Is there any support for if/else conditions?

Posted on
Thu May 26, 2016 9:33 pm
cutmoney offline
Posts: 35
Joined: Dec 22, 2011

Is there any support for if/else conditions?

I've used Indigo Pro for many years and have never found there to be a good way to perform if/else functionality. Is there some way that I'm missing? For instance, I'd like a trigger to execute if a condition is met but, if that condition fails, execute an alternate set of commands (or another trigger). In my most recent situation where this would be useful I have a KPL which I would like to execute a particular scene based on the current state of the lights. So, for instance, if my exterior lights are at their normal state (dim) pushing a button on the KPL would brighten all of my exterior lights to 100%. However, upon pushing the same button, if the lights are in their full bright state, I would like to execute the scene that would return them to their dim state. This would also be based on whether my ExteriorLights variable is set to true.

This would be very simple to achieve with an if/else condition. If exterior lights are dim, then brighten to 100, else execute dim scene. Make sense? Is there any way that I'm missing (without some ridiculous work around with a timer or something)?

Posted on
Fri May 27, 2016 2:11 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Is there any support for if/else conditions?

I've got various triggers like this, but the only way to do it at present is either have lots of triggers for the different permutations or write a python script to do what you want to do (which is how I have mine). I'm hoping indigo 7 will have a GUI support for this.

Computer says no.

Posted on
Fri May 27, 2016 6:21 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Is there any support for if/else conditions?

Durosity is right about the only ways to do this is with multiple triggers or a custom script. But I don't think it's really all that hard to do. For a non-programmer, multiple triggers is the easiest way.

You need one trigger for each possible if/else condition. For your exterior lights example, that's only two triggers. Both trigger on the same event (KPL button press), but they use different condition tests. No timers needed.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri May 27, 2016 6:28 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Is there any support for if/else conditions?

(Pst.. I'm always right! Just ask my wife!)

Also I'll post a example Python script when I get home to show how to do it if it helps!

Computer says no.

Posted on
Fri May 27, 2016 9:23 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Is there any support for if/else conditions?

Conditions defined in the Conditions tab are inherently boolean - so if you just want an else to what you currently have then it's 2 triggers - one with the positive condition and one with the negative.

If, however, you have multiple branches of conditions, then adding an "else" wouldn't help anyway. Just say'n... :wink:

While adding "else" to the current trigger/schedule UI flow is on our list, it's significantly lower in priority than many other things.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri May 27, 2016 9:59 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Is there any support for if/else conditions?

jay (support) wrote:
While adding "else" to the current trigger/schedule UI flow is on our list, it's significantly lower in priority than many other things.


You just made my weekend Jay. I've been delaying on putting in lots of triggers and actions like that but feared indigo 7 may obsolete them. Off I go to cheese off the wife for the next few weeks when my python scripts don't work as expected...

Computer says no.

Posted on
Fri May 27, 2016 12:47 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Is there any support for if/else conditions?

My Scene Toggle plugin sounds like it will do what you want with those lights. If you want to try using that I would set it up like this:

  1. Set your light to it's full brightness of 100%
  2. Create a new Scene Toggle device
  3. Include your device in the device list
  4. Snapshot the current scene
  5. Dim the light to your desired brightness (say 25%)
  6. Set the button to toggle the Scene Toggle device
  7. When you press the button the scene turns On to 100%, when you press it again to turn it off it goes back to the pre-scene state of 25%

Now this assumes that your light is always at 25% or 100% and never off. Since the Scene Toggle is an On/Off/Toggle device you can actually include one Scene Toggle device in the scene of another Scene Toggle device. In that scenario the Off/25% would be a device and the 25%/On would be another, but without more information about when and why it gets turned off it would be hard for me to say exactly how to set it all up.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Sun May 29, 2016 9:19 am
SHKnapp offline
Posts: 33
Joined: May 05, 2009

Re: Is there any support for if/else conditions?

+1 for else

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest