Float
devices.properties.float
Displaying device property values in numeric format.
Property description
The structure is used in the response to the Information about user devices operation.
Property parameters
Parameter |
Type |
Description |
Required |
type |
String |
Property type. |
Yes |
retrievable |
Boolean |
Whether it's possible to request the state of the device property. Acceptable values:
|
No |
reportable |
Boolean |
Whether the property reports the state change to Yandex Smart Home using the notification service. Acceptable values:
|
No |
parameters |
Object |
|
Yes |
parameters
object
Parameter |
Type |
Description |
Required |
instance |
String |
Function name for the property. You can find the acceptable values in the List of functions section. |
Yes |
unit |
String |
Function value units. You can find the acceptable values in the List of functions section. |
Yes |
Example of use
Yandex Smart Home requests the details of user devices from the provider. The provider responds that the user has a humidifier with a humidity property.
curl -i -X GET 'https://example.com/v1.0/user/devices' \
-H 'Authorization: Bearer 123qwe456a...' \
-H 'X-Request-Id: ff36a3cc-ec...'
HTTP/1.1 200 OK
{
"request_id": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
"payload": {
"user_id": "user-001",
"devices": [{
"id": "humidifier-001-hmdfr",
"name": "увлажнитель",
"description": "умный увлажнитель hmdfr",
"room": "спальня",
"type": "devices.types.humidifier",
"custom_data": {
"api_location": "rus"
},
"capabilities": [{
"type": "devices.capabilities.on_off"
}],
"properties": [{
"type": "devices.properties.float",
"retrievable": true,
"reportable": true,
"parameters": {
"instance": "humidity",
"unit": "unit.percent"
}
}],
"device_info": {
"manufacturer": "Provider-01",
"model": "hmdfr 1",
"hw_version": "1.2",
"sw_version": "5.4"
}
}]
}
}
Current property 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.
Property parameters
Parameter |
Type |
Description |
Required |
type |
String |
Property type. |
Yes |
state |
Object |
Property state parameters. |
Yes |
state
object
Parameter |
Type |
Description |
Required |
instance |
String |
Function name for the property. You can find the acceptable values in the List of functions section. |
Yes |
value |
Float |
Property value for this capability. |
Yes |
Example of use
Yandex Smart Home requests the provider to change the state of the user device. The provider responds that the humidifier's property shows 55% humidity.
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": "humidifier-001-hmdfr",
"custom_data": {
"api_location": "rus"
}
}
]
}'
HTTP/1.1 200 OK
{
"request_id": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
"payload": {
"devices": [{
"id": "humidifier-001-hmdfr",
"properties": [{
"type": "devices.properties.float",
"state": {
"instance": "humidity",
"value": 55
}
}]
}]
}
}
String enclosed in quotation marks, for example: "Hello, world"
.
An array of elements separated by a comma. As array items, you can use standard JSON elements: a string, number, true
, false
, object, or array. Arrays are enclosed in square brackets []
:
"cities": ["Moscow", "Tokyo", "New York"]
Floating-point number with a precision of 6-9 decimal digits.
List of "key": value
pairs separated by commas. The list is enclosed in curly brackets {}
.
{
"name": "John",
"surname": "Smith"
}
Boolean value without quotes: true
or false
.