Or/Else function

Hi! Forgive me if this already exists, but I’m not finding it. Would it be possible to add an “Or” and “Else” function to the “If” statements? I see the “Equal to” and “Not equal to” functions, but nothing else. Thanks! :slight_smile:

Hi @skimber , yes it doesn’t exist :sweat_smile:
I didn’t add this functionality to keep the “if” line simple.
bur you still can achieve both the “Else” and the “Or” in a relative simple way,

Else - you can just add another if with the reverse statement,

  • if you want to be sure that it won’t do both “if” and “else” (because maybe you are changing a critical value in the first “if” line) you can create a “Boolean” variable and set it at first to “True” and inside the first “if” change if to “False”, so if this variable value remains “True” it means that you should run the else functions.

Or - you can create a Boolean variable and set it to “False”, then you can add multiple “if” lines and inside them set this variable to “True”, so if just one of those “if” lines go through this variable value will be “True”.

And - you can add “if” line inside “if” line and only if both are “true” the inner “if” line functions will run.

I try to keep it simple but functional at the same time so some compromise was needed.


Got it. This is a huge help. Thank you. I had figured out how to do the “And” thing, but couldn’t figure out the other two.

Hi @alonshemer Can you possibly give an example of the Or one? Having trouble wrapping my head around the Booleans. lol

Hi @skimber , Sure!

this automation will display a message if you type 5 or 10 in the user prompt window

Download -
If - Or - Example.json (7.4 KB)

Please let me know if you need a better example.

1 Like

That opened it right up in my mind. I get it now! Thank you!