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.

ELSE examples?

Featured Replies

Posted

I see a little "else" stuff here and there... and I feel like I'm really missing some program functions by not knowing how to use it right.

 

It seems when I see it it's used something like "if control of a device turns ON then..." and the else is... uh... any other type of control? of that device? It confuses me.

 

Can someone point me to examples where it's making the program work or work better?

Hey Gregory -

 

ELSE will run when something in the IF statement is specifically not true. For example this program:

 

If
       IR '1' is Pressed
   And IR '2' is not Pressed

Then
       Set Scene 'TheaterMain' On

Else
       Set Scene 'TheaterMain' Off

 

The THEN statement will run if the program is TRUE (IR 1 is pressed), and the ELSE statement will run if the program becomes FALSE (IR 2 is pressed).

If
       IR '1' is Held
   And IR '1' is not Released

Then
       Set 'Lamp' Fade Up

Else
       Set 'Lamp' Fade Stop

  • Author
ELSE will run when something in the IF statement is specifically not true.

 

okay... I gotta chew on that for a bit. Effectively, it makes for two cases to run things if I can figure out how to use it right.

 

Thanks!

  • 2 weeks later...

Edit: I made an incorrect statement and didn't want to confuse anyone, so I'm removing this message (original message show in next post below)

If I understand, the only time an "ELSE" would run is if another program called its "Run (If)". Otherwise, if the program triggers on its own, the "IF" conditions were already true and the "ELSE" would not run.

 

Not exactly. A program is evaluated every time any of the Conditions in the program change. If the conditions are met the Then clause is executed, otherwise the Else actions are performed.

 

In jrabin's program example anytime IR '1' changes the program is evaluated.

 

Rand

Oops.

 

Add Schedules to the reason a program runs, not only Conditions.

 

Rand

A program is evaluated every time any of the Conditions in the program change. If the conditions are met the Then clause is executed, otherwise the Else actions are performed.

Thanks Rand - Maybe you can help me understand why this doesn't work. I would expect the light to dim to 35% after 1 minute UNLESS I turn it off or dim it at the switch. Then I'd expect it to stay at whatever level I set it to.

 

Turning it off does what I'd expect, it turns off and stays off. But if I dim the light, the program continues to Run and stays "True", then dims to 35% after the 1 minute is up.

 

If
       Control 'Front: Lights' is not switched Dim
   And Control 'Front: Lights' is not switched Off
   And Control 'Front: Lights' is not switched Fast Off

Then
       Set 'Front: Lights' On
       Wait  1 minute 
       Set 'Front: Lights' 35%

Else
  - No Actions - (To add one, press 'Action')

Actually, I was doing some testing on this trigger, and I can't get this program to trigger either. I tried dimming up, dimming down, dimming from full-On, brightening from full-Off... Maybe there's a bug?

 

If
       Control 'Front: Lights' is switched Dim

Then
       Set 'Kitchen: Light' On

Else
  - No Actions - (To add one, press 'Action')

Actually, I was doing some testing on this trigger, and I can't get this program to trigger either. I tried dimming up, dimming down, dimming from full-On, brightening from full-Off... Maybe there's a bug?

 

If
       Control 'Front: Lights' is switched Dim

Then
       Set 'Kitchen: Light' On

Else
  - No Actions - (To add one, press 'Action')

Hi CJ,

 

Instead of switched Dim, try using switched Fade Down.

Instead of switched Dim, try using switched Fade Down.

Thanks Darrell, that trigger worked great.

What do the "If control x is switched bright/dim" triggers do?

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.