Author |
|
jeremybe Newbie
Joined: March 15 2007
Online Status: Offline Posts: 39
|
Posted: April 06 2007 at 13:57 | IP Logged
|
|
|
Hi-
Can someone give me some guidance on writing an If then statement for a macro- I'm looking for a statement that would let me check the status of 3 insteon devices, if these 3 devices are off a variable is set to off, otherwise the variable is set to on
Thanks for the help!
I'm still on a quest for my perfect KPL solution...
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: April 06 2007 at 16:17 | IP Logged
|
|
|
This will return "Off" or "On"...
if( ph_getinsteonstat( s1 )=1 and ph_getinsteonstat( s2 )=1 and ph_getinsteonstat( s3 )=1, "Off", "On")
Where s1, s2, and s3 are your device ID's.
|
Back to Top |
|
|
jeremybe Newbie
Joined: March 15 2007
Online Status: Offline Posts: 39
|
Posted: April 09 2007 at 12:04 | IP Logged
|
|
|
TonyNo wrote:
This will return "Off" or "On"...
if( ph_getinsteonstat( s1 )=1 and ph_getinsteonstat( s2 )=1 and ph_getinsteonstat( s3 )=1, "Off", "On")
Where s1, s2, and s3 are your device ID's. |
|
|
Tony, thanks - How do I actually get that on/off into a variable??? I'm looking for logic that will say if device x or device y or device z is on then set status=on else status=off - I'm then looking to trigger a PLC group change based on that status...
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: April 09 2007 at 12:26 | IP Logged
|
|
|
Assuming your Global Variable (GV) is STATUS, just put this in your macro...
Set Global | STATUS | if( ph_getinsteonstat( s1 )=1 and ph_getinsteonstat( s2 )=1 and ph_getinsteonstat( s3 )=1, "Off", "On")
You would then just create a trigger that fires when your GV changes to send your group command. I'll detail this tonight, if necessary.
Edited by TonyNo - April 09 2007 at 12:36
|
Back to Top |
|
|
jeremybe Newbie
Joined: March 15 2007
Online Status: Offline Posts: 39
|
Posted: April 16 2007 at 19:26 | IP Logged
|
|
|
Tony I've been trying to do this, but I'm not getting it right...
I did the following in triggers:
ID: SomeLightOn
Action Type:Raw Formula
Action:Set Global({LIGHT_STATUS} if( ph_getinsteonstat( "BSMNT-MEDIA ROOM" )=1 and ph_getinsteonstat( "BSMNTT-STAIRS-UP" )=1 and ph_getinsteonstat( "BSMNT-OVERHEAD" )=1, "1", "0"))
Action Syle:Queued
Status:Active
Trigger Type:Insteon Change
Trigger ID: PLC
Trigger ID number:253 (I want my PLC group to trigger this)
Trigger Value:ANY
So I obviously did something wrong - If you could help me out with this and teh PLC trigger I'd appreciate it - I'm struggling ut trying..
TonyNo wrote:
Assuming your Global Variable (GV) is STATUS, just put this in your macro...
Set Global | STATUS | if( ph_getinsteonstat( s1 )=1 and ph_getinsteonstat( s2 )=1 and ph_getinsteonstat( s3 )=1, "Off", "On")
You would then just create a trigger that fires when your GV changes to send your group command. I'll detail this tonight, if necessary. |
|
|
|
Back to Top |
|
|