Smart Home 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.

Device ATTRIBUTES

Devices with this trait may report the following attributes as part of the SYNC operation. To learn more about handling SYNC intents, see Intent fulfillment.

Attributes Type Description
commandOnlyOnOff Boolean

(Default: false)

Indicates if the device can only controlled through commands, and cannot be queried for state information.

queryOnlyOnOff Boolean

(Default: false)

Indicates if the device can only be queried for state information, and cannot be controlled through commands.

Examples

Device that supports on/off command and reporting states.

{
  "commandOnlyOnOff": false,
  "queryOnlyOnOff": false
}

Device that only supports on/off commands.

{
  "commandOnlyOnOff": true,
  "queryOnlyOnOff": false
}

Device (typically sensor) that only supports reporting on/off state.

{
  "queryOnlyOnOff": true,
  "commandOnlyOnOff": false
}

Device STATES

Devices with this trait may report the following states as part of the QUERY operation. To learn more about handling QUERY intents, see Intent fulfillment.

States Type Description
on Boolean

Whether a device with an on/off switch is on or off.

Examples

Is the device on?

{
  "on": true
}

Is the device off?

{
  "on": false
}

Device COMMANDS

Devices with this trait may respond to the following commands as part of the EXECUTE operation. To learn more about handling EXECUTE intents, see Intent fulfillment.

action.devices.commands.OnOff

Turn the device on or off.

Parameters

Parameters Type Description
on Boolean

Required.

Whether to turn the device on or off.

Examples

Turn the device on.

{
  "command": "action.devices.commands.OnOff",
  "params": {
    "on": true
  }
}

Turn the device off.

{
  "command": "action.devices.commands.OnOff",
  "params": {
    "on": false
  }
}

Device ERRORS

See the full list of errors and exceptions.