Page 1 of 1

Schedules Enable Status

PostPosted: Tue Jun 13, 2023 11:57 am
by Mark
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!

Re: Schedules Enable Status

PostPosted: Tue Jun 13, 2023 1:18 pm
by jay (support)
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.

Re: Schedules Enable Status

PostPosted: Tue Jun 13, 2023 3:27 pm
by Mark
Thanks Jay! And for the quick reply!!

Re: Schedules Enable Status

PostPosted: Tue Jun 13, 2023 3:53 pm
by Mark
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.

Re: Schedules Enable Status

PostPosted: Tue Jun 13, 2023 4:58 pm
by jay (support)
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.

Re: Schedules Enable Status

PostPosted: Tue Jun 13, 2023 5:09 pm
by Mark
Great tip, thank you!

Re: Schedules Enable Status

PostPosted: Tue Jun 13, 2023 6:28 pm
by FlyingDiver
Typo in code warning!

Re: Schedules Enable Status

PostPosted: Tue Jun 13, 2023 7:15 pm
by Mark
What do you mean? What don't you gat about it? :wink: