Accessing Schedules in python scripts?

Posted on
Sun Sep 22, 2013 10:02 am
autolog offline
Posts: 3991
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Accessing Schedules in python scripts?

I would like to be able to access information about schedules in a script.

I note from the documentation that it says: "Schedule class FIXME not yet implemented".

I am not sure if that refers to the documentation or Schedule Class?

Basically, I want to tell if a schedule is active e.g. the heating has been scheduled on.

Is this possible?

Posted on
Sun Sep 22, 2013 12:01 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Accessing Schedules in python scripts?

The schedule object model isn't 100% complete yet, but most of the basics are there. You can tell if a schedule is currently enabled like this (same format as with triggers):

Code: Select all
indigo.schedules[SOME_SCHEDULE_ID_OR_NAME].enabled

Image

Posted on
Sun Sep 22, 2013 12:43 pm
autolog offline
Posts: 3991
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Accessing Schedules in python scripts?

matt (support) wrote:
The schedule object model isn't 100% complete yet, but most of the basics are there. You can tell if a schedule is currently enabled like this (same format as with triggers):

Code: Select all
indigo.schedules[SOME_SCHEDULE_ID_OR_NAME].enabled

I actually want to determine when in a day a schedule is activating.
I have radiators that have a morning on, morning off, evening on and evening off time set by 4 separate schedules. The schedule times can vary by radiator (depends on room location). I want to pick up on the 4 times the schedule activates. Also, possibly in the future (if needed) I might want to extend the number of 'on'/'off' sessions in a day but two is enough for me at the moment.

I want to emulate a 'Boost' and 'Advance' button on a central heating time switch. This is where 'Advance' will advance to the next program and 'Boost' turns the radiator on for a fixed period (typically an hour). To do the 'Advance' processing I need to compare the current time to the Schedule to determine whether to turn the heating 'on' or 'off'. Likewise with 'Boost', I need to make sure that I don't switch the heating 'off' at the end of the 'Boost' period if the heating should be on because of the schedule.

I can probably achieve this by setting variable switches in a schedule action but querying the schedule would be more elegant. :)

Posted on
Sun Sep 22, 2013 12:53 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Accessing Schedules in python scripts?

Look at the following 2 attributes:

Code: Select all
schedule = indigo.schedules[SOME_SCHEDULE_ID_OR_NAME]
schedule.absoluteTime   # Ignore year/date/month fields and just use hour/min/secs.
schedule.nextExecution  # Complete time for next execution (use year/month/day/hour/min/secs)

Image

Posted on
Sun Sep 22, 2013 1:11 pm
autolog offline
Posts: 3991
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Accessing Schedules in python scripts?

matt (support) wrote:
Look at the following 2 attributes:

Code: Select all
schedule = indigo.schedules[SOME_SCHEDULE_ID_OR_NAME]
schedule.absoluteTime   # Ignore year/date/month fields and just use hour/min/secs.
schedule.nextExecution  # Complete time for next execution (use year/month/day/hour/min/secs)

Thanks - I will look at this tomorrow :D

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 21 guests