This config is set to have the device execute commands on schedules.
Required Attribute:
schedulable
schedulable{
"name": "schedulable",
"value": { "4": ["OnOff"], "1": ["OnOff"], "2": ["OnOff"], "3": ["OnOff"] }
}Where the key of the attribute value is iotDev, and the value is the Command support config: Scheduler
Device Model Example
{
"1": {
"type": "SWITCH",
"traits": ["OnOff"],
"disabled": false,
"attrs": [
{ "name": "intermittent" , "value": true },
{ "name": "timeStepRange", "value": {"max": 86400, "min": 0.1, "step": 0.1} }
]
},
"2": {
"type": "SWITCH",
"traits": ["OnOff", "CircuitDetector"],
"disabled": false,
"attrs": [
{ "name": "intermittent" , "value": true },
{ "name": "detectDirection", "value": ["OpenToClose", "CloseToOpen"] },
{ "name": "timeStepRange" , "value": {"max": 86400, "min": 0.1, "step": 0.1} }
]
},
"3": {
"type": "SWITCH",
"traits": ["OnOff", "CircuitDetector"],
"disabled": false,
"attrs": [
{ "name": "intermittent" , "value": true },
{ "name": "detectDirection", "value": ["OpenToClose", "CloseToOpen"] },
{ "name": "timeStepRange" , "value": {"max": 86400, "min": 0.1, "step": 0.1} }
]
},
"4": {
"type": "SWITCH",
"traits": ["OnOff", "CircuitDetector"],
"disabled": false,
"attrs": [
{ "name": "intermittent" , "value": true },
{ "name": "detectDirection", "value": ["OpenToClose", "CloseToOpen"] },
{ "name": "timeStepRange" , "value": {"max": 86400, "min": 0.1, "step": 0.1} }
]
},
"Ultron Device": {
"type": "ULTRON",
"traits": ["UltronCommand", "ReportState", "UltronConfig", "RadioGroups"],
"disabled": false,
"attrs": [
{"name": "rebootTime", "value": 20},
{"name": "fwUpgradeTime", "value": 60},
{"name": "iotConfigurableIntervals", "value": true},
{
"name": "schedulable", /* index of attribute array: 3 */
"value": {
"1": ["OnOff"],
"2": ["OnOff"],
"3": ["OnOff"],
"4": ["OnOff"]
}
},
{"name": "schedulableVersion", "value": 1},
{"name": "periodicity", "value": true},
{"value": true, "name": "aperiodicity"},
{ "name": "arbitraryRadioGroupDevices", "value": ["1", "2", "3", "4"] },
{
"name": "supportDefaultActions",
"value": {
"1": { "cmdNames": ["OnOff"], "situations": ["power", "network"] },
"2": { "cmdNames": ["OnOff"], "situations": ["power", "network"] },
"3": { "cmdNames": ["OnOff"], "situations": ["power", "network"] },
"4": { "cmdNames": ["OnOff"], "situations": ["power", "network"] }
}
}
]
}
}
For example, there are 4 ports (iotDevs) named "1", "2", "3", "4"
And all 4 ports support Scheduler defined in Ultron Device.Attrs[3].name = "schedulable", "value" = { "1": ["OnOff"], "2": ["OnOff"], "3": ["OnOff"], "4": ["OnOff"] }
Config Item Attributes
Array of Object:
| Field Name | Type | Note |
|---|---|---|
taskId | Integer | For identification. |
name | String | Which port is applied to. |
iot | String | Required Which port is applied to. |
firstShot | Integer | First execution timestamp. |
interval | Integer | Scheduling Interval, repeating until validBefore. |
validBefore | Integer | Omitted if false. |
disabled | Integer | Omitted if false. |
cmd | Object | Which command to execute when times match. |
Example
{
"config": "Scheduler",
"items": [
{
"taskId": 0,
"iot": "1",
"firstShot": 1727857200, // 2024-10-02T08:20:00+UTC
"interval": null, /* which means this scheduler execute only once */
"cmd": { "command": "OnOff", "params": {"on": true} }
},
{
"taskId": 0,
"iot": "1",
"firstShot": 1727864400, // 2024-10-02T10:20:00+UTC
"cmd": { "command": "OnOff", "params": {"on": false} }
}
]
}
API Example: /usr/v5/SetDeviceConfigs
{
"sn": "UT3M10-ESXXXXX",
"configs": [
{
"config": "Scheduler",
"items": [
{
"taskId": 0,
"iot": "1",
"firstShot": 1727857200,
"interval": null,
"cmd": { "command": "OnOff", "params": {"on": true} }
},
{
"taskId": 0,
"iot": "1",
"firstShot": 1727864400,
"cmd": { "command": "OnOff", "params": {"on": false} }
}
]
}
]
}