Schedules Enable Status

Posted on
Tue Jun 13, 2023 11:57 am
Mark offline
User avatar
Posts: 263
Joined: Apr 21, 2005
Location: California

Schedules Enable Status

I can enable and disable an Indigo Schedule, either manually via the Indigo client interface (each has its own checkmark), or by using an Action Group (Type: Enable Schedule).

Is there a way to read the enabled status (the checkmark) of an Indigo Schedule via Python?

Thx!

Posted on
Tue Jun 13, 2023 1:18 pm
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Schedules Enable Status

Code: Select all
t = indigo.triggers[ID_OF_TRIGGER]
t.enabled  # boolean indicating if its enabled or not


See the IOM Doc section on Triggers.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jun 13, 2023 3:27 pm
Mark offline
User avatar
Posts: 263
Joined: Apr 21, 2005
Location: California

Re: Schedules Enable Status

Thanks Jay! And for the quick reply!!

Posted on
Tue Jun 13, 2023 3:53 pm
Mark offline
User avatar
Posts: 263
Joined: Apr 21, 2005
Location: California

Re: Schedules Enable Status

Yay! Got what I needed working. I was actually after the check mark for a Schedule, not a Trigger, but I just needed to use "indigo.schedules" in place of "indigo.triggers":

Code: Select all
(str(indigo.schedules[ID_OF_TRIGGER].enabled) == "True")


I struggle with the IOM Doc, so I appreciate the help.

I sometimes find it more reliable to translate booleans into booleans, so to speak, by converting them to strings and then testing for "true" or "false". Not sure why. Anywho, in this case, it needed to be "True" not lower case "true".

I think the case is why using booleans directly sometimes trips me up. Maybe something to do with how Indigo stores booleans in variables. In variables, they seem to need to be lower case. In the IOM they tend to be title case? Something like that.

Posted on
Tue Jun 13, 2023 4:58 pm
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Schedules Enable Status

It should be True without the quotes, that’s the built-in Boolean value. Then there’s no need to convert to a string (which is less efficient).

All values stored in indigo.variable objects are strings (this is a legacy issue). Use:

Code: Select all
indigo.variables[12345].getValue(bool)


to return a real python Boolean value.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jun 13, 2023 5:09 pm
Mark offline
User avatar
Posts: 263
Joined: Apr 21, 2005
Location: California

Re: Schedules Enable Status

Great tip, thank you!

Posted on
Tue Jun 13, 2023 6:28 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Schedules Enable Status

Typo in code warning!

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

Posted on
Tue Jun 13, 2023 7:15 pm
Mark offline
User avatar
Posts: 263
Joined: Apr 21, 2005
Location: California

Re: Schedules Enable Status

What do you mean? What don't you gat about it? :wink:

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 6 guests