Jump to content
View in the app

A better way to browse. Learn more.

Universal Devices Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Cannot get my "ELSE" condition to run

Featured Replies

Posted

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

  • Author
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?

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.

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.

  • Author

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

  • Author

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

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.

Guest
This topic is now closed to further replies.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.