On_off
devices.capabilities.on_off
Remote device on/off (similar to pressing the power button on the device or its remote control). This is a basic capability for most devices.
Common voice commands
Most devices use separate turn on and turn off commands. Voice commands depend on the device type and are given in the description of the applicable types.
Yasmina, turn on the light.
Yasmina, put the kettle on.
Description of capability
The structure is used in the response to the Information about user devices operation.
Capability parameters
Parameter | Type | Description | Required |
---|---|---|---|
type | String | Type of capability. | Yes |
retrievable | Boolean | If it's possible to request the state of this device capability. Acceptable values:
| No |
reportable | Boolean | Indicates that the notification service reports the capability state change. Acceptable values:
| No |
parameters | Object | The parameters object. | No |
parameters object | |||
split | Boolean | This parameter is used with retrievable:false and shows that the provider uses different commands to turn on and off the device. On the Yango Play app home screen, the turn-on settings will be shown for all supported devices. Acceptable values:
| No |
Parameter | Type | Description | Required |
---|---|---|---|
type | String | Type of capability. | Yes |
retrievable | Boolean | If it's possible to request the state of this device capability. Acceptable values:
| No |
reportable | Boolean | Indicates that the notification service reports the capability state change. Acceptable values:
| No |
parameters | Object | The parameters object. | No |
parameters object | |||
split | Boolean | This parameter is used with retrievable:false and shows that the provider uses different commands to turn on and off the device. On the Yango Play app home screen, the turn-on settings will be shown for all supported devices. Acceptable values:
| No |
Example of use
Yango Smart Home requests the details of user devices from the provider. In response, the provider sends information that the user has a socket with remote turn-on and turn-off.
curl -i -X GET 'https://example.com/v1.0/user/devices' \ -H 'Authorization: Bearer 123qwe456a...' \ -H 'X-Request-Id: ff36a3cc-ec...'
Copied to clipboard
HTTP/1.1 200 OK { "request_id": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "user_id": "user-001", "devices": [ { "id": "socket-001-xda", "name": "socket", "description": "xda smart socket", "room": "bedroom", "type": "devices.types.socket", "custom_data": { "api_location": "rus" }, "capabilities": [ { "type": "devices.capabilities.on_off", "retrievable": false, "reportable": false, "parameters": { "split": false } } ], "device_info": { "manufacturer": "Provider-01", "model": "xda 1", "hw_version": "1.2", "sw_version": "5.4" } } ] } }
Copied to clipboard
Current capability state
The structure is used in the response to the Information about the states of user devices operation and in the request body of the Notification about device state change operation.
Capability parameters
Parameter | Type | Description | Required |
---|---|---|---|
type | String | Type of capability. | Yes |
state | Object | Capability state parameters. | Yes |
state object | |||
instance | String | Function name for this capability. Acceptable values:
| Yes |
value | Boolean | Function value for this capability. Acceptable values:
| Yes |
Parameter | Type | Description | Required |
---|---|---|---|
type | String | Type of capability. | Yes |
state | Object | Capability state parameters. | Yes |
state object | |||
instance | String | Function name for this capability. Acceptable values:
| Yes |
value | Boolean | Function value for this capability. Acceptable values:
| Yes |
Example of use
Yango Smart Home requests the provider to change the state of the user device. The provider responds with the state of the user device.
curl -i -X POST 'https://example.com/v1.0/user/devices/query' \ -H 'Authorization: Bearer 123qwe456a...' \ -H 'X-Request-Id: ff36a3cc-ec...' \ -H 'Content-Type: application/json' \ -d '{ "devices": [ { "id": "socket-001-xda", "custom_data": { "api_location": "rus" } } ] }'
Copied to clipboard
HTTP/1.1 200 OK { "request_id": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "devices": [ { "id": "socket-001-xda", "capabilities": [ { "type": "devices.capabilities.on_off", "state": { "instance": "on", "value": true } } ] } ] } }
Copied to clipboard
Change the state of the device capability
The structure is used in the response to the Change device state operation.
Capability parameters
Parameter | Type | Description | Required |
---|---|---|---|
type | String | Type of capability. | Yes |
state | Object | An object that describes the result of changing the state of the capability. | Yes |
state object | |||
instance | String | Function name for this capability. Acceptable values:
| Yes |
action_result | Object | Result of changing the state of the device capability. | No |
action_result object | |||
status | String | Status of the device capability state change. Acceptable values:
| Yes |
error_code | String | An error code from the list of errors. If status:"ERROR" , the parameter is required. | No |
error_message | String | Extended human-readable description of a possible error. It is displayed only in the Testing section of the developer console. | No |
Parameter | Type | Description | Required |
---|---|---|---|
type | String | Type of capability. | Yes |
state | Object | An object that describes the result of changing the state of the capability. | Yes |
state object | |||
instance | String | Function name for this capability. Acceptable values:
| Yes |
action_result | Object | Result of changing the state of the device capability. | No |
action_result object | |||
status | String | Status of the device capability state change. Acceptable values:
| Yes |
error_code | String | An error code from the list of errors. If status:"ERROR" , the parameter is required. | No |
error_message | String | Extended human-readable description of a possible error. It is displayed only in the Testing section of the developer console. | No |
Example of use
Yango Smart Home requests the provider to change the state of the user's devices. The provider responds with the result of user device state change.
curl -i -X POST 'https://example.com/v1.0/user/devices/action' \ -H 'Authorization: Bearer 123qwe456a...' \ -H 'X-Request-Id: ff36a3cc-ec...' \ -H 'Content-Type: application/json' \ -d '{ "payload": { "devices": [ { "id": "socket-001-xda", "custom_data": { "api_location": "rus" }, "capabilities": [ { "type": "devices.capabilities.on_off", "state": { "instance": "on", "value": false } } ] } ] } }'
Copied to clipboard
HTTP/1.1 200 OK { "request_id": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "devices": [ { "id": "socket-001-xda", "capabilities": [ { "type": "devices.capabilities.on_off", "state": { "instance": "on", "action_result": { "status": "DONE" } } } ] } ] } }
Copied to clipboard