Devices commands
hub.devices.list
Connection type: UI
Permissions: DEVICES: READ/VIEW
Provides a list of registered devices on the hub.
Note: this request doesn't take a gateway id, so it returns devices for ALL gateways.
request:
no params
response:
Field | Type | Required | Description |
---|---|---|---|
_id | string | + | An id of the device |
parentDeviceId | string | + | An id of the parent device. Empty in case of main device |
category | string | + | A device category |
subcategory | string | + | A device subcategory |
deviceTypeId | string | + | A device type id, generated from manufacturer info |
gatewayId | string | + | An id of a gateway this device belongs to |
name | string | + | A device name |
type | string | + | A device type |
batteryPowered | bool | + | Is device battery powered |
reachable | bool | + | Is device reachable |
armed | bool | - | is device armed by house mode |
roomId | string | + | An id of a room this device is assigned to |
persistent | bool | - | Is device persistent. Persistent device can't be removed by force removing. False by default. |
info | object | - | Some additional information for this device |
serviceNotification | bool | + | Special mark for forwarding all changes with this device and items to different Cloud services. Default value: false. |
security | string | + | Security level how the device is connected. Possible options: no , low , middle , high . |
ready | bool | + | Ready status of device. true value means device is ready to any changes. false value means device is busy. |
status | string | + | Possible options: idle , broken . idle - device is in normal mode, broken - device has invalid data. |
Examples
Get information about registered devices on the hub.
request:
{
"method": "hub.devices.list",
"id": "_ID_",
"params": {}
}
response:
{
"api": "1.0",
"error": null,
"id": "<request_id>",
"result": {
"devices": [
{
"_id": "5cf0dc8c7f000068d223e889",
"batteryPowered": false,
"category": "switch",
"deviceTypeId": "634_257_10",
"gatewayId": "5ca480227f00004c03de3f1f",
"info": {},
"name": "Smart Plug",
"parentDeviceId": "",
"reachable": true,
"armed": false,
"serviceNotification": false,
"roomId": "",
"subcategory": "interior_plugin",
"type": "device",
"security": "no",
"status": "idle"
}
]
}
}
hub.device.name.set
Connection type: UI
Permissions: DEVICES: WRITE/EDIT
Renames device.
request:
Field | Description |
---|---|
_id | device id |
name | new device's name |
response:
empty result
broadcasts:
Broadcasts | Description |
---|---|
hub.device.updated | informs about device state changed |
Examples
request:
{
"method": "hub.device.name.set",
"id": "_ID_",
"params": {
"_id": "5cf0dc8c7f000068d223e889",
"name": "<new device name>"
}
}
response:
{
"api": "1.0",
"error": null,
"id": "_ID_",
"result": {}
}
errors:
Code | Message | Data |
---|---|---|
-32600 | Bad request, name is empty | rpc.params.empty.name |
-32600 | Bad request, name does not exist | rpc.params.notfound.name |
hub.device.room.set
Connection type: UI
Permissions: DEVICES: WRITE/EDIT
Place device.
request:
Field | Description |
---|---|
_id | Id of target device |
roomId | Id of target room |
response:
empty result
broadcasts:
Broadcasts | Description |
---|---|
hub.device.updated | informs about device state changed |
Examples
request:
{
"method": "hub.device.room.set",
"id": "_ID_",
"params": {
"_id" : "_OBJECT_ID_",
"roomId": "_OBJECT_ID_"
}
}
response:
{
"api": "1.0",
"error": null,
"id": "_ID_",
"result": {}
}
errors:
Code | Message | Data |
---|---|---|
-32500 | Placing subdevice is forbidden | ezlo.device.forbidden.place.subdevice |
-32500 | No device found! | ezlo.device.notfound |
-32500 | Room not found | nma.room.notfound |
-32602 | Wrong field of object | rpc.params.wrong_field |
hub.device.armed.set
Connection type: UI
Permissions: DEVICES: WRITE/EDIT
Place device.
request:
Field | Description |
---|---|
_id | Id of target device |
armed | "Armed" status of device |
response:
empty result
broadcasts:
Broadcasts | Description |
---|---|
hub.device.updated | informs about device state changed |
Examples
request:
{
"method": "hub.device.armed.set",
"id": "_ID_",
"params": {
"_id" : "_OBJECT_ID_",
"armed": true,
}
}
response:
{
"api": "1.0",
"error": null,
"id": "_ID_",
"result": {}
}
errors:
Code | Message | Data |
---|---|---|
-32602 | Wrong field of object | rpc.params.wrong_field |
hub.device.status.check
Connection type: UI
Permissions: DEVICES: READ/VIEW
Check state of device(reachable or unreachable now)
request:
Field | Description |
---|---|
_id | Device id |
response:
empty result
broadcasts:
Broadcasts | Description |
---|---|
hub.device.updated | informs about device state changed |
Examples
request:
{
"method": "hub.device.status.check",
"id": "_AUTO_113852_",
"params": {
"_id": "__DEVICE_ID__"
}
}
response:
{
"api": "1.0",
"error": null,
"id": "_AUTO_113852",
"result": {}
}
hub.device.force_remove
Connection type: UI
Permissions: DEVICES: WRITE/EDIT
Remove device from Controller despite the consequences. 'forceDeviceRemoveCommand' script from plugin config will be called in lua.
request:
Field | Description |
---|---|
_id | Id of target device |
response:
empty result
broadcasts:
Broadcasts | Description |
---|---|
hub.device.removed | informs about device was removed |
hub.item.removed | informs about item was removed |
Examples
request:
{
"method": "hub.device.force_remove",
"id": "_ID_",
"params": {
"_id" : "_OBJECT_ID_"
}
}
response:
{
"api": "1.0",
"error": null,
"id": "_ID_",
"result": {}
}
errors:
Code | Message | Data |
---|---|---|
-32500 | No device found! | ezlo.device.notfound |
-32500 | Device is persistent | ezlo.device.persistent |