Possible to use an ELSE type statement in Schedule?

Posted on
Mon Apr 24, 2017 6:34 am
petematheson offline
Posts: 741
Joined: Sep 14, 2014
Location: Southampton, UK

Possible to use an ELSE type statement in Schedule?

I currently have a number of scheduled running to do various checks on the house.

The one I'm configuring now is checking if a room is in use, by checking if any of the lights are on, or a Harmony Activity is running, or the sonos is playing etc..
Currently I'm having to double up on all of my rules.

The first rule checks if ANY of the following devices are on.. and sets a variable to True (Is this room occupied?)
The second rule checks if ALL of the following devices are off.. and sets that variable to False.

Just thought it would be much simpler if we could use the first rule and just have an ... else set variable to false, rather than duplicating the whole schedule.
It would also mean making future tweaks is easier as I don't have to remember to add a new device into both schedules

Posted on
Mon Apr 24, 2017 9:51 am
jay (support) offline
Site Admin
User avatar
Posts: 15814
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Possible to use an ELSE type statement in Schedule?

It's been requested before. I'd recommend using a single Python script as your action that determines what to do, then executes the appropriate action group (so you only have to edit the actions in one place for true and one place for false).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Apr 24, 2017 12:23 pm
durosity offline
User avatar
Posts: 3817
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Possible to use an ELSE type statement in Schedule?

Yeah that’s how I do it.. more for triggers as I don’t do much scheduling.. but same principle. An example if it helps:

Code: Select all
dev = indigo.devices[964639587] # "Bedroom 2 - Master Switch"
if dev.states["command"] == "Mood 5":
   indigo.dimmer.brighten(828126709, by=50) # TURN UP SIDE LAMP
elif dev.states["command"] == "Mood 4":
   indigo.device.turnOff(828126709) # TURN OFF SIDE LAMP
elif dev.states["command"] == "Mood 3":
   indigo.actionGroup.execute(1206849764) # TURNS ON ELECTRIC BLANKET 30 MINS
elif dev.states["command"] == "Mood 2":
   indigo.device.toggle(1815938212) # TOGGLES ROLLER BLIND
elif dev.states["command"] == "Mood 1":
   indigo.device.toggle(1498113616) # TOGGLES VENETIAN BLIND
elif dev.states["command"] == "Group off":
   indigo.actionGroup.execute(453752047) # TURNS ALL LIGHTS OFF


On a side note.. matt & jay… it’d be AWESOME if you can make a GUI function for this.. it’s a right pain having to update all my little scripts every time I need to replace a device for whatever reason. It’s not a particularly common issue but when it does happen it usually takes me weeks to notice when there’s something I’ve not updated.

Computer says no.

Posted on
Mon Apr 24, 2017 1:50 pm
jay (support) offline
Site Admin
User avatar
Posts: 15814
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Possible to use an ELSE type statement in Schedule?

When you replace a device you should just edit the existing device rather than creating a new one and deleting the old one - that way it keeps the same ID and none of your scripts break... ;)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Apr 24, 2017 2:00 pm
durosity offline
User avatar
Posts: 3817
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Possible to use an ELSE type statement in Schedule?

Hehe yeah it's sometimes not as simple as that though.. multifunction Z-Wave devices where I've removed a temp sensor and it won't resync without it for example.

Computer says no.

Posted on
Mon Apr 24, 2017 2:34 pm
jay (support) offline
Site Admin
User avatar
Posts: 15814
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Possible to use an ELSE type statement in Schedule?

Yeah, that's a problem. And it's on the list to look into, but it's not exactly easy... ;)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest