Roman Posted December 3, 2012 Posted December 3, 2012 Seems the below code works great with regards to the "THEN" condition however what I am hoping to do is run the "ELSE" program . $Accent_Lighting is only = to 1 between Sunset and 11pm, then at 11pm the value changes to 0 so my understanding is then the ELSE statement should run yet it does not?? What am I missing???? If $Accent_Lighting is 1 Then Set 'Front Door Hall Light Frt' On Set 'Bedroom Hallway Upr' On Set 'Family Room Staircase Light L' On Wait 1 minute Set 'Bedroom Hallway Upr' Off Wait 2 minutes Set 'Front Door Hall Light Frt' Off Set 'Family Room Staircase Light L' Off Else Set 'Front Door Hall Light Frt' 55% Set 'Bedroom Hallway Upr' 40% Wait 2 minutes Set 'Front Door Hall Light Frt' Off Wait 1 minute Set 'Bedroom Hallway Lwr' Off
LeeG Posted December 3, 2012 Posted December 3, 2012 Is the Program in a Folder? Is the Variable a State or Integer?
Roman Posted December 3, 2012 Author Posted December 3, 2012 Is the Program in a Folder? Is the Variable a State or Integer? Yes the program is in a Folder called Courtesy lights. $Accent_Lighting is a variable that is checked that I programmed into the Variable tab. Just noticed that my variable is an INTEGER. What is the difference between Integer and State?
TJF1960 Posted December 3, 2012 Posted December 3, 2012 Under the Variable tab are 2 more tabs. The first tab is Integer, the 2nd tab is State. In order for your program to run either the Then or Else the variable has to be a State variable, which should be contained in the State variable tab.
LeeG Posted December 3, 2012 Posted December 3, 2012 As TJF1960 has already noted the Variable must be a State variable for a change in value to trigger program execution. It means the posted Program was never triggered, Then or Else clause. There is a forum Category dedicated to Variables which has some good information on how Variables work. Also be sure the Folder condition is still True when the State variable changes to 0. Otherwise the Program will not be triggered even when using a State variable.
Roman Posted December 3, 2012 Author Posted December 3, 2012 Thanks got some reading to do.. From what I read if I change the variable from Integer to State looks like this will solve my problem. For all worked fine for the Then, just never triggered the else.. Thanks
Roman Posted December 3, 2012 Author Posted December 3, 2012 Changed variable to "STATE" now even with the STATE of $Accent_Lighting_State = 0 now it runs the THEN program vs the ELSE program?? Confused??? If $Accent_Lighting_State is 1 Then Set 'Front Door Hall Light Frt' On Set 'Bedroom Hallway Upr' On Set 'Family Room Staircase Light L' On Wait 1 minute Set 'Bedroom Hallway Upr' Off Wait 2 minutes Set 'Front Door Hall Light Frt' Off Set 'Family Room Staircase Light L' Off Else Set 'Front Door Hall Light Frt' 55% Set 'Bedroom Hallway Upr' 40% Wait 2 minutes Set 'Front Door Hall Light Frt' Off Wait 1 minute Set 'Bedroom Hallway Lwr' Off
LeeG Posted December 3, 2012 Posted December 3, 2012 That will not happen if all things are correct. Be sure there was a Save on the Variable screen and Save Changes was done on Program Details screen. Keep in mind that like Status, variables have to change value for a Program to trigger, regardless of which clause will execute. Change the variable value to 2 or 3 and see what happens. Look at the Last Run Time on the Programs Summary tab to insure Program is actually being triggered.
Recommended Posts