Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: How to Trigger based on global variable Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
pingmustard
Newbie
Newbie


Joined: September 13 2010
Online Status: Offline
Posts: 18
Posted: January 06 2013 at 02:29 | IP Logged Quote pingmustard

I'm trying to create some lighting control logic based on global variable state changes.   However, I notice when triggers fire, I can't really condition the trigger on a previous state value. Is there a way to create trigger to capture when a global variable change from value A -> value B (not just any change)?

If a trigger is configured on modification of a global variable GV_SAMPLE, and a condition of "{GV_SAMPLE}=1" is used as the trigger Boolean, does the condition always evaluate BEFORE the global variable GV_SAMPLE is changed?

Back to Top View pingmustard's Profile Search for other posts by pingmustard
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: January 06 2013 at 08:51 | IP Logged Quote TonyNo

I think you would need to add a variable to track the previous state.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: January 06 2013 at 13:31 | IP Logged Quote dhoward

Actually, [TEMP5] contains the new value and [TEMP10]
contains the previous value. So you could use this in
the boolean field to trigger only on specific values.

If you want to trigger ONLY when a GV changes from value
A to value B, then you could use this in the boolean
formula:

ph_getvar_s(2,10) = "A" and ph_getvar_s(2,5) = "B"

Hope this helps,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
pingmustard
Newbie
Newbie


Joined: September 13 2010
Online Status: Offline
Posts: 18
Posted: January 14 2013 at 00:49 | IP Logged Quote pingmustard

That seem to have done the job.

Thanks Dave!
Back to Top View pingmustard's Profile Search for other posts by pingmustard
 

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