Schedules¶
In the IOM, all schedules are derived from a common Schedule base class. This base contains all the shared components of schedules.
Schedule Base Class¶
All schedules will inherit properties from the Schedule base class.
Like other high-level objects in Indigo, there are rules for modifying schedules. For Scripters and Plugin Developers:
- To duplicate, delete, and send commands to a schedule, use the command namespace as described below
- To modify an object's definition, get a copy of the schedule, make the necessary changes, then call
mySchedule.replaceSharedPropsOnServer(newPropsDict)(see below).
Class Properties¶
Under construction
| Property | Type | Writable | Description |
|---|---|---|---|
absoluteDate |
datetime.datetime / None | Yes | The absolute date of the next schedule execution with 00:00:00 as the base time. |
absoluteDateTime |
datetime.datetime / None | Yes | The absolute date and time of the next schedule execution. |
absoluteTime |
datetime.datetime / None | Yes | The absolute time of the next schedule execution with 2000-01-01 as the base date. |
autoDelete |
boolean | Yes | true if Indigo should automatically delete this schedule after the next execution, otherwise false. |
configured |
boolean | Yes | true if the schedule has been fully configured, otherwise false. |
dateType |
indigo.kDateType / None | Describes the "type" of date/time options for the schedule. [Absolute / EveryDay / DaysOfWeek / DaysOfMonth] | |
description |
string | Yes | description of the schedule. |
enabled |
boolean | Yes | true if the schedule is enabled, otherwise false (Indigo will not execute the schedule if false). |
folderId |
integer | No | unique ID of the folder this schedule is in. |
globalProps |
dictionary | No | an indigo.Dict() that will contain the props for the schedule. It's generally easier to use the shortcut sharedProps below. |
id |
integer | No | a unique id of the schedule, assigned on creation by IndigoServer. |
name |
string | Yes | the unique name of the schedule - no two schedules can have the same name. |
nextExecution |
datetime.datetime / None | No | The date and time of the schedule's next execution. |
pluginProps |
dictionary | No | pluginProps will return an empty dict because plugins cannot currently create custom schedules. |
randomizeBy |
integer | Yes | the number of minutes (plus or minus) Indigo should use to randomize the execution of the schedule. |
remoteDisplay |
boolean | Yes | true if remote clients should display the schedule, otherwise false (does not affect the Indigo client UI). |
sharedProps |
dictionary | No | an indigo.Dict() containing the name/value pairs that are shared by all plugins. This is the property dictionary that you can edit via the Global Properties plugin, and your plugin may manage properties in this dictionary as well to add metadata to devices that your plugin can use for other purposes. Use sched.replaceSharedPropsOnServer() to update them (as with pluginProps, you should get copy first, update the copy, then set them back to that copy so you don't accidentally remove some other plugin's props). |
sunDelta |
integer | Yes | The number of seconds before (negative) or after (positive) sunrise or sunset when the schedule should be executed (zero if no offset). |
suppressLogging |
boolean | Yes | true if Indigo should skip logging the schedule's execution in the event log, otherwise false. |
timeType |
indigo.kTimeType | Yes | Absolute / Sunrise / Sunset / Countdown depending on the date and time options selected. |
upload |
boolean | Yes | true if IndigoServer should attempt to upload this schedule to the interface. |
Commands (indigo.schedule.*)¶
Delete¶
Delete the specified schedule.
| Command Syntax Examples |
|---|
indigo.schedule.delete(123) |
| Parameters | |||
|---|---|---|---|
| Parameter | Required | Type | Description |
| direct parameter | Yes | integer | id or instance of the schedule to delete |
Duplicate¶
Duplicate the specified schedule regardless of the type. This method returns a copy of the new schedule.
| Command Syntax Examples |
|---|
indigo.schedule.duplicate(123, duplicateName="my duplicate name") |
| Parameters | |||
|---|---|---|---|
| Parameter | Required | Type | Description |
| direct parameter | Yes | integer | id or instance of the schedule to duplicate |
*duplicateName* |
No | string | name for the newly duplicated schedule |
Enable¶
Enables or disables the specified schedule.
| Command Syntax Examples |
|---|
indigo.schedule.enable(123, value=True, delay=0, duration=0) |
| Parameters | |||
|---|---|---|---|
| Parameter | Required | Type | Description |
| direct parameter | Yes | integer | id or instance of the schedule to enable/disable |
*value* |
Yes | bool | set to True to enable the schedule, False to disable the control |
*delay* |
No | int | the number of seconds to wait before executing the command |
*duration* |
No | int | the number of seconds to wait before reverting the executed command |
Execute¶
Execute the specified schedule.
| Command Syntax Examples |
| --- |
| python
indigo.schedule.execute(123, ignoreConditions=False, schedule_data=None) |
| Parameters | |||
|---|---|---|---|
| Parameter | Required | Type | Description |
| direct parameter | Yes | integer | id or instance of the schedule to execute |
*ignoreConditions* |
No | bool | True will execute the schedule regardless of the conditions set within the schedule, False will honor them |
*schedule_data* |
No | object | an *indigo.Dict* to be passed to the schedule before it is executed |
A note on schedule_data - Indigo will automatically add a source key to your dictionary to represent where the action execution came from:
- "server" if it's something generated from the server itself (schedule execution, built-in trigger, etc.)
- "python" if it's something that comes through IPH that doesn't already have a source attached (scripts, plugins)
- "api-http" if it came from the HTTP API and there wasn't already an included "source"
- "api-websocket" if it came from the websocket API and there wasn't already an included "source"
However, if you include a source key in your schedule_data, we will not overwrite it, we'll just pass through whatever your value is.
For example, if you
my_dict = indigo.Dict()
my_dict["foo"] = "bar"
indigo.schedule.execute(324976872, schedule_data=my_dict)
{"event-indigo-id": 324976872, "event-type": "Schedule", "foo": "bar", "source": "python", "timestamp": "1970-01-01T09:09:40"}
Get Dependencies¶
Get the dependencies of the specified schedule. Returns an **indigo.Dict** object that contains the schedule's dependencies. Will return an empty **indigo.Dict** object if the schedule has no dependencies.
| Command Syntax Examples |
| --- |
| python
indigo.schedule.getDependencies(123) |
| Parameters | |||
|---|---|---|---|
| Parameter | Required | Type | Description |
| direct parameter | Yes | integer | id or instance of the schedule |
Move to Folder¶
Move the specified schedule to the designated folder.
| Command Syntax Examples |
| --- |
| python
indigo.schedule.moveToFolder(123, value=) |
| Parameters | ||||
|---|---|---|---|---|
| Parameter | Required | Type | Description | |
| direct parameter | Yes | integer | id or instance of the schedule | |
| value | Yes | int | string | id or instance of the schedule |
Remove Delayed Actions¶
Remove any outstanding delayed actions from the specified schedule.
| Command Syntax Examples |
| --- |
| python
indigo.schedule.removeDelayedActions(123) |
| Parameters | |||
|---|---|---|---|
| Parameter | Required | Type | Description |
| direct parameter | Yes | integer | id or instance of the schedule |