Periodicity

This configuration sets up the routine periodicity of a device.

Required Attribute:

schedulable, periodicity

optional attribute: aperiodicity, if true, this device support one-shot capability.

[
  {
    "name": "schedulable",
    "value": true
  },
  {
    "name": "periodicity",
    "value": true
  },
  {
    "name": "aperiodicity",
    "value": true
  }
]

Device Model Example

{
  "Ultron Device": {
    "type": "ULTRON",
    "traits": ["UltronCommand", "ReportState", "UltronConfig"],
    "disabled": false,
    "attrs": [
      {"name": "rebootTime", "value": 20},
      {"name": "fwUpgradeTime", "value": 60},
      {"name": "iotConfigurableIntervals", "value": true},
      {"name": "schedulable", "value": {"Light": ["OnOff"]}},
      {"name": "periodicity", "value": true},
      {"name": "availableDimmingTypes", "value": ["0-10V", "1-10V"]}
    ]
  },
  "Light": {
    "type": "LIGHT",
    "traits": ["OnOff", "Brightness"],
    "disabled": false,
    "attrs": [
      {"name": "queryOnlyOnOff", "value": false},
      {"name": "commandOnlyBrightness", "value": false} ]
  }
}

Config Item Attributes

Field NameTypeNote
startIntegerStart time of the periodicity cycle (Unix timestamp).
tickIntegerDuration of each time unit/tick within the period (e.g., in seconds).
periodIntegerTotal number of ticks in one full periodicity cycle.
devArray[String]Array of device names/IDs this periodicity applies to.
actArray[Object]Array of actions (commands) that can be triggered by events.
eventsArray[Object]Array of event definitions, including their schedule within the period.

Object of act (action)

Field NameTypeNote
cmdsArray[Object]Which cmds are involved in this periodicity.

Object of cmd

Field NameTypeNote
commandStringCommand name. E.g.: "OnOff"
paramsObjectCommand parameters.

Object of events

Field NameTypeNote
idIntegerUnique identifier for this specific event definition within the events array.
disabledBooleanOptional. If true, this event schedule is ignored. Defaults to false if not present.
nameStringA user-defined name or label for this event (e.g., "Morning On", "Evening Off").
oneShotBooleanOptional. If true, the event runs only once based on the schedule. Requires aperiodicitysupport.
scheduleArray[String]Defines when actions occur. Format: "tick1,tick2,...:dev_list:act_index". See example.

Example

{
  "config": "Periodicity",
  "items": {
    "start": 1690905600,
    "tick": 600,
    "period": 1008,
    "dev": ["Light"],
    "act": [
      {
        "cmds": [
          { "command": "OnOff", "params": {"on": true} }
        ]
      },
      {
        "cmds": [
          { "command": "OnOff", "params": {"on": false} }
        ]
      }
    ],
    "events": [
      { "id": 0, "name": "0.0", "schedule": ["45,189,333,765,909:0:0", "105,249,393,825,969:0:1"] }
    ]
  }
}

where

{
  ...
  "schedule": ["45,189,333,765,909:0:0", "105,249,393,825,969:0:1"],
  ...
}
  • Starting from: "start": 1690905600, first executions: 1690905600+45*600 = 1690932600,
  • with dev_list = [0] ("Light")
    • If you want to execute on multiple devices, use comma-separated string to do that. eg: 0,45,90:0,1:0
  • with act_index = 0
 {"cmds": [{ "command": "OnOff", "params": {"on": true} }]}

and so on.

API Example: /usr/v5/SetDeviceConfigs

{
  "sn": "UT2Z07-6JXXXXX",
  "configs": {
    "config": "Periodicity",
    "items": {
      "start": 1690905600,
      "tick": 600,
      "period": 1008,
      "dev": ["Light"],
      "act": [
        {
          "cmds": [
            { "command": "OnOff", "params": {"on": true} }
          ]
        },
        {
          "cmds": [
            { "command": "OnOff", "params": {"on": false} }
          ]
        }
      ],
      "events": [
        { "id": 0, "name": "0.0", "schedule": ["45,189,333,765,909:0:0", "105,249,393,825,969:0:1"] }
      ]
    }
  }
}

{
  "sn": "UT2Z07-6JXXXXX",
  "configs": [
    {
      "config": "Periodicity",
      "items": {
        "start": 1690905600,
        "tick": 600,
        "period": 1008,
        "dev": ["Light"],
        "act": [
          {
            "cmds": [
              { "command": "OnOff", "params": {"on": true} }
            ]
          },
          {
            "cmds": [
              { "command": "OnOff", "params": {"on": false} }
            ]
          }
        ],
        "events": [
          { "id": 0, "name": "0.0", "schedule": ["45,189,333,765,909:0:0", "105,249,393,825,969:0:1"] }
        ]
      }
    }
  ]
}