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


Joined: March 15 2007
Online Status: Offline
Posts: 39
Posted: April 28 2007 at 15:54 | IP Logged Quote jeremybe

Hi - I have a trigger that fires when a Global Variable "Light_Status" is changed - This trigger is supposed to update the PLC GROUP "KEYPAD LIGHT B" and turn on/off my KPL light - Using the formula below, whenever this Macro is executed my PLC goes into a loop and winds up hanging - Any ideas?

if("Light_Status" ="Off",ph_insteongroupcu ("KEYPAD LIGHT B","KEYPAD",ioff),ph_insteongroupcu ("KEYPAD LIGHT B","KEYPAD",ion))

Is there any other way to do this? Help would be apprecaited!
Back to Top View jeremybe's Profile Search for other posts by jeremybe
 
twomble
Groupie
Groupie
Avatar

Joined: January 07 2007
Location: United States
Online Status: Offline
Posts: 45
Posted: April 28 2007 at 16:36 | IP Logged Quote twomble

We need to see what the trigger looks like too. My guess is since your updating the KPL light with a PLC group the trigger is firing again causing the loop. To update the light on my KPL's I'm sending a direct command to the KPL's, not by a PLC group.
Back to Top View twomble's Profile Search for other posts by twomble
 
jeremybe
Newbie
Newbie


Joined: March 15 2007
Online Status: Offline
Posts: 39
Posted: April 29 2007 at 14:11 | IP Logged Quote jeremybe

I'm trying to copy what you've done for your KPL status - Your Some Light on - How do you set up a trigger to watch the PLC group for a change? I have the following trigger set up tp launch a macro:

Trigger ID: Somelighton
Action Type: Macro
Action:LIGHTON
Action Style: Immediate
Staus: Active
Trigger Type: Insteon Device Chg
Trigger ID: POWERLINC
Trigger ID Number: 253 (MY PLC GROUP NUMBER)
Trigger Value: ON
Boolean: 1

I thought that the Trigger ID number would be My PLC group, but opviously I'm wrong and the PLC grousp do not show up under the Trigger ID...
Back to Top View jeremybe's Profile Search for other posts by jeremybe
 
twomble
Groupie
Groupie
Avatar

Joined: January 07 2007
Location: United States
Online Status: Offline
Posts: 45
Posted: April 29 2007 at 14:25 | IP Logged Quote twomble

Attached is my SomeLightOn trigger. You will need to change it to match your group number of 253. When this trigger fires it runs a macro that sets the global var LightStatus to On.
2007-04-29_142455_SomeLightOnTrigger.sql.txt
Save the attached file and rename it by removing the .txt at the end of it. Then you can import it in PowerHome and make the changes needed for your config.

Edited by twomble - April 29 2007 at 14:27
Back to Top View twomble's Profile Search for other posts by twomble
 
twomble
Groupie
Groupie
Avatar

Joined: January 07 2007
Location: United States
Online Status: Offline
Posts: 45
Posted: April 29 2007 at 14:31 | IP Logged Quote twomble

This next file is the trigger that watches the global var Light Status and runs the macro that updates the KPL light. Again you will need to save the file and rename it by removing the .txt at the end. Once imported you can make the changes needed for your config.
2007-04-29_143110_WatchLightStatVar.sql.txt
Back to Top View twomble's Profile Search for other posts by twomble
 
jeremybe
Newbie
Newbie


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

Thanks - I imported the triggers - I'm still not sure where I'm supposed to subsitute the PLC group - Also - SO taht I understand, what does "case([TEMP4] when 1,3,4,5 then 1 else 0)" do?

Thanks for your help...
Back to Top View jeremybe's Profile Search for other posts by jeremybe
 
twomble
Groupie
Groupie
Avatar

Joined: January 07 2007
Location: United States
Online Status: Offline
Posts: 45
Posted: April 29 2007 at 17:49 | IP Logged Quote twomble

Honestly, I don't remember the details on the case statement. It has something to do with how the ON command was sent. Such as a Preset dim, brighten command, and so on. I'm sure Dave or someone can explain it in more detail.

Anyway... I have one more trigger to show you and my macros that all the triggers run. This is the trigger that fires when an OFF signal is detected. You will need to change this for your specific lights.

2007-04-29_174908_SomeLightOffTrigger.sql.txt
Back to Top View twomble's Profile Search for other posts by twomble
 
twomble
Groupie
Groupie
Avatar

Joined: January 07 2007
Location: United States
Online Status: Offline
Posts: 45
Posted: April 29 2007 at 17:54 | IP Logged Quote twomble

This is the macro that checks the status of all my lights. I have not upgraded to PowerHome 10 so I'm not yet using the new ph_getinsteonlevelrt function. The order of the devices being checked doesn't really matter, but I did arrange it to first check what I felt were the most likly lights to still be on. The way this "If" statement works it will exit as soon as it finds one of the lights on (no need to keep checking the others once you find one on).

2007-04-29_175347_GetLightStatus.sql.txt
Back to Top View twomble's Profile Search for other posts by twomble
 
twomble
Groupie
Groupie
Avatar

Joined: January 07 2007
Location: United States
Online Status: Offline
Posts: 45
Posted: April 29 2007 at 17:58 | IP Logged Quote twomble

This is the macro that sets the global var Light Status to on.

2007-04-29_175806_SetLightStatus.sql.txt
Back to Top View twomble's Profile Search for other posts by twomble
 
twomble
Groupie
Groupie
Avatar

Joined: January 07 2007
Location: United States
Online Status: Offline
Posts: 45
Posted: April 29 2007 at 17:59 | IP Logged Quote twomble

This is the macro that updates the light on the KPL's.

2007-04-29_175932_UpdateKPLight.sql.txt
Back to Top View twomble's Profile Search for other posts by twomble
 
twomble
Groupie
Groupie
Avatar

Joined: January 07 2007
Location: United States
Online Status: Offline
Posts: 45
Posted: April 29 2007 at 18:04 | IP Logged Quote twomble

That should do it for you. In your configuration you have fewer lights so it should run faster than mine and if you update the code to use the new ph_getinsteonlevelrt function it will be very accurate. The best part about doing it this way is if you ever get "out of sync" simply turning on or off one of the lights will get everything synced up again.

I'm sure some of my code is a bit on the sloppy side and could be improved, but it does work very well the way it is.

Good luck with doing this the "Tim" way...
Back to Top View twomble's Profile Search for other posts by twomble
 
jeremybe
Newbie
Newbie


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

Tim-

I cant thank you enough - Its working perfectly now - I couldn't figure out how to fire a trigger when any on in the PLC group is received - I wound up setting up 3 triggers - 1 for each of the lights in my basement - I tried eveyrthing I coudl think of but I cant see how to determine if there was a change in the PLC groups light status - Once again thank you - My sleepless nights are over :)
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