Jump to content

Cannot get my "ELSE" condition to run


Roman

Recommended Posts

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

Link to comment
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?

Link to comment

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.

Link to comment

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

Link to comment

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

Link to comment

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.

Link to comment

Archived

This topic is now archived and is closed to further replies.


  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.3k
×
×
  • Create New...