Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: IF Then Statement Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
jeremybe
Newbie
Newbie


Joined: March 15 2007
Online Status: Offline
Posts: 39
Posted: April 06 2007 at 13:57 | IP Logged Quote jeremybe

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 View jeremybe's Profile Search for other posts by jeremybe
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: April 06 2007 at 16:17 | IP Logged Quote TonyNo

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 View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
jeremybe
Newbie
Newbie


Joined: March 15 2007
Online Status: Offline
Posts: 39
Posted: April 09 2007 at 12:04 | IP Logged Quote jeremybe

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 View jeremybe's Profile Search for other posts by jeremybe
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: April 09 2007 at 12:26 | IP Logged Quote TonyNo

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 View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
jeremybe
Newbie
Newbie


Joined: March 15 2007
Online Status: Offline
Posts: 39
Posted: April 16 2007 at 19:26 | IP Logged Quote jeremybe

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 View jeremybe's Profile Search for other posts by jeremybe
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum