Author |
|
BrettP Newbie
Joined: May 18 2009 Location: United States
Online Status: Offline Posts: 6
|
Posted: May 18 2009 at 17:07 | IP Logged
|
|
|
Hello to all.
New to this forum posting, but have been a reader years.
First I will give you some history and then tell what I am trying to accomplish.
Used a few of the software packages out there.
Ran Homeseer, Misterhouse and last was HCA8. I have done trials on many others out there.
So when I began to use Insteon I went with PH.
Love it so far, not to basic and it is as complicated as you make it.
I am beating my head trying to figure out the KPL's.
Status of A-F or A-D(6btn). I have found different ways of getting it but it can not be the only ways of doing it.
example:
Get button 8 from "KP_TV"
if(ph_and(2 ^ (8-1),ph_insteonwithret ("KP_TV", 25, 1 )) = 0, ph_tts('its off'),ph_tts(' its on'))
So what am I missing on making this easier?
I have 11 KPL's and dont want to write a trigger and script for 66 to 88 buttons/groups. NOT FUN!
Can I use a virtual device to monitor the group? no, cause when pushed it does not send out 'group 41 ON'. KPL sends '09.A4.10 group 1 on'.
I know that other software does all this automatic.
Even if there is an easier command to do this.
ph_insteongrouprt('1', 99, 25) or something.
Any direction help would be greatly appreciated.
Brett
__________________ Insteon, X10, ADI, Power-Home, W800RF32/2414u/CM11a, Wireless security sensors
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: May 25 2009 at 16:51 | IP Logged
|
|
|
Brett,
Im trying to better understand what you want to accomplish. In doing so, Im sure I can come up with a fairly painless way to implement.
Later KPL's do respond with the bit status of the buttons with the 0x19,1 command so that part is working. Is your main goal to just display the status of each of your KPL buttons? or are you also trying to control the status of the buttons individually (from within PowerHome)?
If you're just wanting to monitor the status of the buttons, you should be able to do this with virtual Digital Inputs. You could right a timed event that periodically issues the status command above or you could have a trigger that monitors when the button is actually pressed (or remotely controlled) or you could do both.
Let me know a few more details and I can tailor a solution for you.
Dave.
|
Back to Top |
|
|
BrettP Newbie
Joined: May 18 2009 Location: United States
Online Status: Offline Posts: 6
|
Posted: May 25 2009 at 19:13 | IP Logged
|
|
|
Thanks for the response.
I would like to show the status of KPL's.
I was working on a script that would maybe update a GVAR but just started messing with it.
Not a working item yet,, but this is what I have.
Once working I would have all my KPL just checked and updated at the same time. Maybe later break it out to seperate KPL's or something.
if(ph_and(2 ^ (8-1),ph_insteonwithret ("KP_TV", 25, 1 )) = 0, ph_setglobal_s('KP_T8', 'OFF'), ph_setglobal_s('KP_T8', 'ON')) +
if(ph_and(2 ^ (8-1),ph_insteonwithret ("KP_T", 25, 1 )) = 0, ph_setglobal_s('KP_T7', 'OFF'), ph_setglobal_s('KP_T7', 'ON')) +
if(ph_and(2 ^ (6-1),ph_insteonwithret ("KP_Gar", 25, 1 )) = 0, ph_setglobal_s('KP_T6', 'OFF'), ph_setglobal_s('KP_T6', 'ON'))
Edited by BrettP - May 25 2009 at 21:03
__________________ Insteon, X10, ADI, Power-Home, W800RF32/2414u/CM11a, Wireless security sensors
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: May 28 2009 at 14:40 | IP Logged
|
|
|
Brett,
This is fairly easy to do. Below is a single macro that will handle all of your KeypadLincs. The only thing you need to do is to create Digital Input devices for each KPL and each KPL button that you wish to monitor. The reason I recommend digital inputs over global variables is that they display on the Device Status screen and you can easily add a Digital Input change trigger (you could also create the trigger on a global). These digital inputs will be treated as "Virtual" devices within PH. If you'd rather use globals, then it should be easy enough to modify macro line 110 to do so.
If you're going to use the virtual digital inputs, the first thing we should do is setup a virtual controller within PowerHome. In the PowerHome Explorer, navigate to PowerHome|Setup|Controllers and insert a new controller. Set the ID to "VIRT" or "VIRTUAL" and choose a controller type of "PowerHome Virtual". Restart or reinit PH for the controller to become active.
Next create your virtual Digital Inputs. First check that you've got a Digital I/O Type defined. Go to PowerHome|Devices|Digital I/O|Types. If you've never used digitals before, this will probably be blank. Insert a new line, give it a description of "Virtual Device" or similar. The rest of the defaults settings should be fine. Press "F5" to save. Navigate to PowerHome|Devices|Digital I/O|Points. Insert a new digital device for each KPL button whose status you wish to monitor. THIS NEXT PART IS VERY IMPORTANT! In order for the macro below to work, you MUST make the Digital ID the same as the KPL ID with an "_X" appended where X is the button number. So if you have a KPL with an ID of "KP_GAR", you'll create 8 digital inputs with ID's of "KP_GAR_1" thru "KP_GAR_8". Give an appropriate description, set the I/O to "Input", the "Point Type" to the "Virtual Device" you created earlier, and the controller to your VIRT or VIRTUAL controller you created. THIS NEXT PART IS ALSO IMPORTANT! Make sure that the Unit / Point combination is unique. For Virtuals, I would probably make the Unit 999 and the Point a sequential number from then on. Press "F5" to save. If you get a database error saying press OK to lose changes or cancel, then you probably don't have unique Unit / Point combinations. Hit Cancel (so you don't lose your changes) and correct them so they are unique.
With that out of the way, you just need the following macro and have it called via a Timed Event as often as you'd like the button status updated.
Code:
10 Set System [LOCAL2] 1
20 Set System [LOCAL1] ph_sql(0,"select id from insteondevices where typeid in (select typeid from insteontypes where description like '%keypadlinc%')")
30 Label LOOP1
40 Goto Label if(ph_getvar_n(1,2) = 0,"","C1")
50 End Macro
60 Label C1
70 Set System [LOCAL3] ph_getline(ph_getvar_s(1,1),2)
80 Set System [LOCAL4] ph_insteonwithret(ph_getvar_s(1,3),25,2)
90 Set System [LOCAL5] 8
100 Label LOOP2
110 Formula Immediate ph_setdigitalout(ph_getvar_s(1,3) + "_" + ph_getvar_s(1,5),ph_and(2 ^ (ph_getvar_n(1,5) - 1),ph_getvar_n(1,4)))
120 Goto Label if(ph_addtovar(1,5, -1) = 0,"","LOOP2")
130 Wait 1
140 Goto Label "LOOP1"
|
|
|
To save some typing, Ive also exported the macro here: 2009-05-28_144002_kplupdate.txt
Hope this helps,
Dave.
|
Back to Top |
|
|
BrettP Newbie
Joined: May 18 2009 Location: United States
Online Status: Offline Posts: 6
|
Posted: May 28 2009 at 18:59 | IP Logged
|
|
|
Thanks so much Dave.
I noticed two things so far.
" set the I/O to "Input" "
Then you use ph_setdigitalout.
Nothing happens at all when it is set like this.
When I change the I/O to Output it does result in some change. If Btn 1 is on it shows them all on. If Btn1 is off they are all off.
I will look at it a bit later and see why.
Brett
__________________ Insteon, X10, ADI, Power-Home, W800RF32/2414u/CM11a, Wireless security sensors
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: May 28 2009 at 22:31 | IP Logged
|
|
|
BrettP, earlier in the day I created a setup to define a Virtual Digital In using Daves post and it works okay here.
ph_setdigitalout("SENSOR2 ID", 0) turns the device Off
ph_setdigitalout("SENSOR2 ID", 1) turns the device On
in the Device Status display.
I would check each of the items Dave mentioned against what you actually have defined. Maybe a finger check along the way.
You can try executing the ph_setdigitalout command under the Formula Builder and see if you get a ! (something wrong in the command or the definition behind it) or a 0 which indicates success.
__________________ Lee G
|
Back to Top |
|
|
BrettP Newbie
Joined: May 18 2009 Location: United States
Online Status: Offline Posts: 6
|
Posted: May 29 2009 at 11:13 | IP Logged
|
|
|
I had to make some changes to get it to work. But Dave is the man.
Here is what I have done.
(dont have clue how to copy the macro here)
Attached is the export of the macro detail.
2009-05-29_111132_2009-05-28_144002_kplupdate.txt
The main KPL would show xx% on after I check each KPL button. So at the end for now I have it just do getinsteonlevelrt for each KPL.
Let me know if there is a better way of doing it.
__________________ Insteon, X10, ADI, Power-Home, W800RF32/2414u/CM11a, Wireless security sensors
|
Back to Top |
|
|
|
|