Page 1 of 1

Is there any support for if/else conditions?

PostPosted: Thu May 26, 2016 9:33 pm
by cutmoney
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)?

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

PostPosted: Fri May 27, 2016 2:11 am
by durosity
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.

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

PostPosted: Fri May 27, 2016 6:21 am
by FlyingDiver
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.

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

PostPosted: Fri May 27, 2016 6:28 am
by durosity
(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!

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

PostPosted: Fri May 27, 2016 9:23 am
by jay (support)
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.

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

PostPosted: Fri May 27, 2016 9:59 am
by durosity
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...

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

PostPosted: Fri May 27, 2016 12:47 pm
by Colorado4Wheeler
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.

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

PostPosted: Sun May 29, 2016 9:19 am
by SHKnapp
+1 for else