OnOff Trait Schema

action.devices.traits.OnOff - The basic on and off functionality for any device that has binary on and off, including plugs and switches as well as many future devices. Note that thermostats have an expanded "mode" setting, which is a multiway switch that includes on and off, but thermostats generally will not have this trait.

Device COMMANDS

Command Parameters/Definition
action.devices.commands.OnOff on Boolean. Required. Whether to turn the device on or off.

Sample EXECUTE Request

This example shows how to turn one light on.
Request
{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "inputs": [{
    "intent": "action.devices.EXECUTE",
    "payload": {
      "commands": [{
        "devices": [{
          "id": "123",
          "customData": {
            "fooValue": 74,
            "barValue": true,
            "bazValue": "sheepdip"
          }
        }, {
          "id": "456",
          "customData": {
            "fooValue": 36,
            "barValue": false,
            "bazValue": "moarsheep"
          }
        }],
        "execution": [{
          "command": "action.devices.commands.OnOff",
          "params": {
            "on": true
          }
        }]
      }]
    }
  }]
}