Author |
|
ficklma1 Groupie
Joined: December 08 2007 Location: United States
Online Status: Offline Posts: 59
|
Posted: December 28 2007 at 18:25 | IP Logged
|
|
|
Hi PH'ers,
First off, I think PH is a great piece of software (about to purchase it) I've run into a slight challenge and need some assistance to make sure it will do what I'm sure it's capable of, just don't know exactly how to.
I have macro with the following if statement that fires after the Insteon Device Chg.
10 formula
if("[LOCAL10]" = "0", ph_run('C:\Program Files\xlobby\XReceive\xsend.exe ~~"command:xlobby:button state set:[LOCAL7]_toggle:Off~~"'))
This works great if the device change happened from PH. The problem is, I'm passing [LOCAL7], which is the correct id if I'm using PH or another SDM program to control the device on/off. However, if I turn the device on from the switch, [LOCAL7] states the PLC id, which does me no good, since I'm passing it as a button id. I've noticed I can use [TEMP5] which is the correct address id of the source switch, I just need to convert it to the id name.
I've tried a few formulas to attempt this lookup - ph_sqlselect, ph_sqlselectinto, etc. to try and retrieve the id name.
sample SQL: select id from insteondevices where address='[TEMP5]'
This SQL works in the SQL window on the web server, of course I have to replace [TEMP5] with the actual id to test this in the SQL window.
Here is a sample macro I'm trying(not verbatim):
10 msgbox
"[LOCAL7]"
20 setsystem
id: [LOCAL7]
if("[LOCAL7]" = "POWERLINC1",ph_sqlselectinto(7,"select id from insteondevices where address='[TEMP5]'"), [LOCAL7])
30 msgbox
"[LOCAL7]"
40 formula
if("[LOCAL10]" = "0", ph_run('C:\Program Files\xlobby\XReceive\xsend.exe ~~"command:xlobby:button state set:[LOCAL7]_toggle:Off~~"'))
Line 10 returns POWERLINC1 (When source switch is used)
Line 20 returns !
Line 30 returns a blank or null
Any help on how to accomplish this would be greatly appreciated.
Thanks.
|
Back to Top |
|
|
cmhardwick Senior Member
Joined: July 08 2006 Location: United States
Online Status: Offline Posts: 290
|
Posted: December 28 2007 at 20:19 | IP Logged
|
|
|
I think this is why I was using [LOCAL8] instead in my macro. This might work better as well instead of [TEMP5].
Worth a try
__________________ Cicero, Enjoying automation!
|
Back to Top |
|
|
ficklma1 Groupie
Joined: December 08 2007 Location: United States
Online Status: Offline Posts: 59
|
Posted: December 28 2007 at 23:54 | IP Logged
|
|
|
Unfortunately that didn't help. Thanks for the suggestion. I'll keep plugging away at it.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: December 30 2007 at 22:14 | IP Logged
|
|
|
ficklma1,
Try using [TEMP10]. This should contain the ID of the device that is changing whether it's controlled locally or via the PowerHome (this is from memory...I'll have to double-check so let me know if this is incorrect).
HTH,
Dave.
|
Back to Top |
|
|
ficklma1 Groupie
Joined: December 08 2007 Location: United States
Online Status: Offline Posts: 59
|
Posted: December 31 2007 at 10:18 | IP Logged
|
|
|
Hi Dave,
I do have a version of this working now, but I'll try that. It would make it a lot simpler.
I do have a very perplexing problem though around this macro and the Insteon Device Chg trigger.
I've added the suggested method [LOCAL9] <> [LOCAL10] and the other necessary settings for this trigger, however it appears there's one scenario that the trigger doesn't fire.
Here's the scenario:
I have two switchlincs master(A) and slave(B) and an additional switchlinc(C) that controls another separate light. I've linked these all to the PLC and I've added these to the links in PH. I've even cross-linked these switches to the PLC. What I'm seeing is that if I hit switch(A) or (B) the trigger fires(all good so far), I can hit switch(A) or (B) again to turn off the light and it will fire as planned(still good). Then if I click switch(C) (not linked to another switch, just the PLC). The Insteon Device Chg doesn't fire. Now, if I just click switch(C) without first clicking switch(A) or (B), then the trigger fires. It appears that if I use switch(A) or (B) at all before using switch(C), then switch(C) doesn't cause the Insteon Device Chg trigger to fire.
Very strange - any ideas? It's driving me nuts!
Thanks.
|
Back to Top |
|
|