Device events
Field paths are relative to one object in the message array. [] means an array item: for example, services[].rid is the rid of each service. Fields under value are shown as value.name, value.color_arr[].x, and so on.
Device added
Topic
res/device/add
Example message
json
[
{
"ext_button": [],
"ext_light": [],
"ext_sync": {},
"has_new": 0,
"id": "10E48D35-0ABD-47EB-BA4B-C150D68C4B23",
"join_status": 1,
"name": "Bar Lamp",
"new_version": "",
"online": 1,
"product": {
"cat1_id": 2,
"cat1_name": "Light",
"cat2_id": 205,
"cat2_name": "RGB CW Light",
"cat3_id": 20504,
"cat3_name": "Bar Lamp",
"hardware_version": "6",
"manufacturer": "Bweetech",
"model": "915005988001",
"software_version": "",
"zigbee_version": "4.11.11_50"
},
"services": [
{
"rid": "8BAD2C8A-38BE-41CB-A4D3-563B5C7E9C03",
"rtype": "light"
}
],
"type": "device"
}
]Fields
| Field | Type | Description |
|---|---|---|
id | string | Device UUID. |
type | string | Always device. |
name | string | Device name |
join_status | integer | 1: the device has been added. |
online | integer | 1 when the device is first added successfully. |
has_new | integer | 1 if a firmware update is available; otherwise 0. |
new_version | string | Available firmware version. |
product | object | Product details. See DeviceDetail. |
services | object[] | Services |
services[].rid | string | Resource UUID |
services[].rtype | string | Resource type |
ext_light | object[] | Light state. See LightDetail. |
ext_sync | object | Sync device state. See SyncDetail. |
ext_button | object[] | Button state. |
Event details
- The gateway sends this event once the device has joined the network and
join_statusis set to1.
Device deleted
Topic
res/device/remove
Example message
json
[
{
"id": "10E48D35-0ABD-47EB-BA4B-C150D68C4B23",
"type": "device"
}
]Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique device ID. |
type | string | Always device. |
Event details
- Sent when a device is deleted or its
join_statuschanges to0.
Device updated
Topic
res/device/update
Example message
json
[
{
"id": "10E48D35-0ABD-47EB-BA4B-C150D68C4B23",
"value": {
"name": "吧灯01"
}
}
]Fields
| Field | Type | Description |
|---|---|---|
id | string | Device ID. |
value | object | Fields changed by this event. |
Fields in value
| Field | Type | Description |
|---|---|---|
value.name | string | Device name |
value.room_id | string | Room UUID. |
Event details
- Sent when the device's properties change. The
valueobject contains only the changed fields. - Apply the fields in
valueto your local state. Fields absent from the message have not changed.