Message Structure
AuthRequest
Description
WebSocket authentication request
First-message authentication flow for the Studio self-domain endpoint and LAN Studio environments; not used in production or cloud environments.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: AuthRequest. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | object | Yes | Business parameters. |
data.authType | string | No | Authentication type. Pass token.Fixed value: token. Default: token. |
data.token | string | Yes | Use the format Bearer <Token>, where <Token> is the raw token obtained from Aqara Studio. Do not log or expose this token. |
Example
bearerToken
{
"type": "AuthRequest",
"version": "v1",
"msgId": "10001",
"data": {
"authType": "token",
"token": "<accessToken>",
"clientId": "<clientId>"
}
}
AuthResponse
Description
WebSocket authentication response
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: AuthResponse. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | string or null | Yes | Response data. When no data is returned, it is usually an empty string or null. Default: "". |
code | integer (int32) | Yes | Processing result code. 0 indicates success, and any non-zero value indicates failure. |
message | string or null | Yes | Processing result message. |
Example
success
{
"type": "AuthResponse",
"version": "v1",
"msgId": "10001",
"data": "",
"code": 0,
"message": "Authentication successful. Welcome <username>"
}
PingRequest
Description
Heartbeat request
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: ping. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | string or null | No | Business parameters. Default: null. |
Example
ping
{
"type": "ping",
"version": "v1",
"msgId": "10002",
"data": null
}
PongResponse
Description
Heartbeat response
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: pong. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | string | Yes | Fixed value: pong. |
code | integer (int32) | Yes | Processing result code. 0 indicates success, and any non-zero value indicates failure. |
message | string or null | Yes | Processing result message. |
Example
pong
{
"type": "pong",
"version": "v1",
"msgId": "10002",
"data": "pong",
"code": 0,
"message": "success"
}
SubscribeAllRequest
Description
Subscribe to all or selected devices request
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: SubscribeAllRequest. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | array<string> or null | No | List of device IDs. When null, omitted, or an empty array, this subscribes to all device data within the current permission scope and clears previously established device-level subscriptions. When data is non-empty, the “subscribe all devices” state is cancelled and these device-level subscriptions are appended, but previously appended device-level subscriptions are not automatically cleared.To narrow or replace the device-level subscription scope, first use UnsubscribeAllRequest to remove devices that are no longer needed. To clear all device-data and Trait subscriptions on the current connection, send UnsubscribeAllRequest with an empty data array or omit data; this request does not clear standalone event or object-event subscriptions. If the current account or token permission scope has no accessible devices, the server may return code=0 but no subsequent push messages will be generated. Within the same connection, SubscribeAllRequest overrides and clears Trait subscriptions previously established via SubscribeTraitValueRequest. To switch from all-device or selected-device subscriptions back to Trait-only subscriptions, first send UnsubscribeAllRequest to clear the all-device/device-level subscriptions. Default: null. |
Example
- allDevices
- allDevicesWithEmptyArray
- specifiedDevices
{
"type": "SubscribeAllRequest",
"version": "v1",
"msgId": "1751609244328",
"data": null
}
{
"type": "SubscribeAllRequest",
"version": "v1",
"msgId": "1751609244329",
"data": []
}
{
"type": "SubscribeAllRequest",
"version": "v1",
"msgId": "1751609244328",
"data": [
"deviceId"
]
}
SubscribeAllResponse
Description
Subscribe to all or selected devices response
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: SubscribeAllResponse. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | string or null | Yes | Response data. When no data is returned, it is usually an empty string or null. Default: "". |
code | integer (int32) | Yes | Processing result code. 0 indicates success, and any non-zero value indicates failure. |
message | string or null | Yes | Processing result message. |
UnsubscribeAllRequest
Description
Unsubscribe from all or selected devices request
Clears subscriptions for all or selected device data and also clears Trait subscriptions for the current session. It does not clear standalone event subscriptions or precise object-event subscriptions, and it does not disable the default DEVICE_ADDED and DEVICE_REMOVED events received on authenticated connections.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: UnsubscribeAllRequest. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | array<string> or null | No | List of device IDs. Empty or null means unsubscribe from all device-data and Trait subscriptions. If the current connection is subscribed to all devices, unsubscribing by specific device IDs has no effect; an empty value must be passed to cancel all device-data subscriptions. Within the same connection, UnsubscribeAllRequest also clears Trait subscriptions previously established via SubscribeTraitValueRequest. Unsubscribing specific devices only removes device-level subscriptions and does not mean stopping all push messages on the current connection. This request does not clear rules established by SubscribeEventRequest or SubscribeObjectEventRequest, nor does it disable the default DEVICE_ADDED and DEVICE_REMOVED push messages. Default: null. |
UnsubscribeAllResponse
Description
Unsubscribe from all or selected devices response
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: UnsubscribeAllResponse. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | string or null | Yes | Response data. When no data is returned, it is usually an empty string or null. Default: "". |
code | integer (int32) | Yes | Processing result code. 0 indicates success, and any non-zero value indicates failure. |
message | string or null | Yes | Processing result message. |
SubscribeTraitValueRequest
Description
Subscribe to specified Trait values request
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: SubscribeTraitValueRequest. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | array<object> | Yes | List of Traits to subscribe to. A non-empty array is recommended; omitting data causes parsing to fail. In the current implementation, an empty array or empty traitCodes may still return a success response, but no effective TraitValueUpdate subscription will be created. |
data[].deviceId | string | Yes | Device ID. |
data[].endpointId | integer (int32) | Yes | Endpoint ID. |
data[].functionCode | string | Yes | Function code. |
data[].traitCodes | array<string> | Yes | List of Trait feature point codes. A non-empty array is recommended; an empty array does not create or cancel any specific Trait subscriptions, although the current implementation may still return a success response. |
Example
subscribeTrait
{
"type": "SubscribeTraitValueRequest",
"version": "v1",
"msgId": "get_devices_1751609244328",
"data": [
{
"deviceId": "57190441014857",
"endpointId": 3,
"functionCode": "MediaPlayback",
"traitCodes": [
"TargetPlaybackState"
]
}
]
}
SubscribeTraitValueResponse
Description
Subscribe to specified Trait values response
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: SubscribeTraitValueResponse. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | string or null | Yes | Response data. When no data is returned, it is usually an empty string or null. Default: "". |
code | integer (int32) | Yes | Processing result code. 0 indicates success, and any non-zero value indicates failure. |
message | string or null | Yes | Processing result message. |
TraitValueUpdate
Description
Trait Value Update
After subscribing to all traits of a specified device through SubscribeAllRequest or subscribing to a specified Trait of a specified device through SubscribeTraitValueRequest, when the value of the target Trait changes, Aqara Studio will push this message to you. For information on Aqara's existing Traits and their data types, see Aqara Data Model Tags.
All business notifications now carry studioId/eventId pair; ordinary historical messages allow omission for compatibility with legacy producers. Ordinary request/response messages do not reference this structure. Execution results and the four new scene object events have additional identity constraints.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: TraitValueUpdate. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | array<object> | Yes | Push payload data. |
data[].deviceId | string | Yes | Device ID. |
data[].endpointId | integer (int32) | Yes | Endpoint ID. |
data[].functionCode | string | Yes | Function code. |
data[].traitCode | string | Yes | Trait feature point code. |
data[].value | any | No | Trait feature point value. The actual type is determined by the specific feature point definition. |
data[].time | integer (int64) | Yes | Report timestamp in milliseconds. |
eventId | string | No | An opaque string for this logical notification. It must contain at least one non-whitespace character. Store and compare it as-is without relying on its format. It remains unchanged across channels and HTTP retries. Consecutive notifications with the same content use different values. Minimum length: 1. Pattern: \S. |
studioId | string | No | The official Studio identity that publishes the notification. It must contain at least one non-whitespace character. It is not a gateway identity or an authentication credential. Minimum length: 1. Pattern: \S. |
code | integer (int32) | Yes | Processing result code. 0 indicates success, and any non-zero value indicates failure. |
message | string or null | Yes | Processing result message. |
eventId and studioId must appear together.
Example
- Device Online Status Changed
- Playback State Changed
- Device Name Updated
{
"type": "TraitValueUpdate",
"eventId": "449fd6f6-c52c-4488-a3a2-000000000001",
"studioId": "studio-example",
"version": "v1",
"msgId": "10810",
"data": [
{
"deviceId": "57190441014857",
"endpointId": 0,
"functionCode": "BasicInformation",
"traitCode": "Reachable",
"value": true,
"time": 1794637886352
}
],
"code": 0,
"message": ""
}
{
"type": "TraitValueUpdate",
"eventId": "449fd6f6-c52c-4488-a3a2-000000000002",
"studioId": "studio-example",
"version": "v1",
"msgId": "10811",
"data": [
{
"deviceId": "57190441014857",
"endpointId": 3,
"functionCode": "MediaPlayback",
"traitCode": "TargetPlaybackState",
"value": "0",
"time": 1754469720110
}
],
"code": 0,
"message": ""
}
{
"type": "TraitValueUpdate",
"eventId": "449fd6f6-c52c-4488-a3a2-000000000003",
"studioId": "studio-example",
"version": "v1",
"msgId": "10812",
"data": [
{
"deviceId": "device-1",
"endpointId": 0,
"functionCode": "EndpointLabel",
"traitCode": "EndpointName",
"value": "Living Room Light",
"time": 1789113600000
}
],
"code": 0,
"message": ""
}
UnsubscribeTraitValueRequest
Description
Unsubscribe from specified Trait values request
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: UnsubscribeTraitValueRequest. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | array<object> | No | List of Traits to unsubscribe from. A non-empty array is recommended. Omitting data, passing an empty array, or using empty traitCodes will not cancel any Trait subscriptions, although the current implementation may still return a success response. Default: []. |
data[].deviceId | string | Yes | Device ID. |
data[].endpointId | integer (int32) | Yes | Endpoint ID. |
data[].functionCode | string | Yes | Function code. |
data[].traitCodes | array<string> | Yes | List of Trait feature point codes. A non-empty array is recommended; an empty array does not create or cancel any specific Trait subscriptions, although the current implementation may still return a success response. |
UnsubscribeTraitValueResponse
Description
Unsubscribe from specified Trait values response
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: UnsubscribeTraitValueResponse. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | string or null | Yes | Response data. When no data is returned, it is usually an empty string or null. Default: "". |
code | integer (int32) | Yes | Processing result code. 0 indicates success, and any non-zero value indicates failure. |
message | string or null | Yes | Processing result message. |
SubscribeEventRequest
Description
Subscribe Alarm Request
Send after authentication. data must be a non-empty array of event types. Ordinary clients use ALARM. The subscription applies to the current session only, and repeated requests are idempotent. This does not affect device, Trait, or object event subscriptions.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: SubscribeEventRequest. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | array<string> | Yes | Use ALARM for alarms; do not accept empty arrays, wildcards, or object ID filters. Minimum items: 1. Fixed item value: ALARM. |
Example
subscribeAlarmRequest
{
"type": "SubscribeEventRequest",
"version": "v1",
"msgId": "alarm-subscribe-1",
"data": [
"ALARM"
]
}
SubscribeEventResponse
Description
Subscribe Alarm Response
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: SubscribeEventResponse. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | string or null | Yes | Response data. When no data is returned, it is usually an empty string or null. Default: "". |
code | integer (int32) | Yes | Processing result code. 0 indicates success, and any non-zero value indicates failure. |
message | string or null | Yes | Processing result message. |
Example
subscribeAlarmResponse
{
"type": "SubscribeEventResponse",
"version": "v1",
"msgId": "alarm-subscribe-1",
"data": "",
"code": 0,
"message": "success"
}
AlarmEvent
Description
Raw Alarm Push
Delivered only to sessions that explicitly subscribe to ALARM. SubscribeAllRequest and object event subscriptions do not enable this implicitly. Alarms are independent of App notification-bar pushes. Delivery is not limited to OFF_NORMAL; consume the sourceState actually published by the alarm source. Only real-time pushes are supported, and historical alarms are not redelivered. Re-subscribe after disconnection. msgId is for tracing only and is not a globally unique event ID.
WebSocket and HTTP shared raw alarm-push payload. WebSocket explicitly subscribes to ALARM to receive, and HTTP enables alarms according to configuration; does not use the app notification payload.
All business notifications now carry studioId/eventId pair; ordinary historical messages allow omission for compatibility with legacy producers. Ordinary request/response messages do not reference this structure. Execution results and the four new scene object events have additional identity constraints.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: AlarmEvent. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | object | Yes | Push payload data. |
data.uuid | string | Yes | Alarm record ID. Subsequent events for the same alarm record may reuse this value; it is not a unique event ID for each state change. |
data.deviceName | string | Yes | Display name of the device. |
data.deviceId | string | Yes | Device ID. May be an empty string when the device cannot be resolved. |
data.devicePointName | string | Yes | Display name of the alarm point. |
data.alarmClass | string | Yes | Display name of the alarm class. |
data.alarmRuleName | string | Yes | Display name of the alarm rule. May fall back to the point name. |
data.alarmText | string | Yes | Alarm display text. |
data.alarmValue | string | Yes | Formatted alarm value as a string. |
data.sourceState | string | Yes | Standard status of the alarm source, including NORMAL (normal), OFF_NORMAL (triggered), FAULT (fault), and ALERT (alert). Values are provided based on the actual alarm event and do not imply that every status or acknowledgment action produces a separate push. Receivers should remain compatible with future added values. |
data.alarmTime | integer (int64) | Yes | Unix millisecond timestamp. |
data.localized | object | Yes | Provides text by language tag. Some languages may be absent when localized text generation fails; in that case, the top-level text uses the system default language or an available fallback language. Minimum properties: 1. |
data.localized.*.devicePointName | string | Yes | Display name of the alarm point. |
data.localized.*.alarmText | string | Yes | Alarm display text. |
data.localized.*.alarmValue | string | Yes | Alarm value. |
data.localized.*.sourceStateText | string | Yes | Alarm source state display text. |
eventId | string | No | An opaque string for this logical notification. It must contain at least one non-whitespace character. Store and compare it as-is without relying on its format. It remains unchanged across channels and HTTP retries. Consecutive notifications with the same content use different values. Minimum length: 1. Pattern: \S. |
studioId | string | No | The official Studio identity that publishes the notification. It must contain at least one non-whitespace character. It is not a gateway identity or an authentication credential. Minimum length: 1. Pattern: \S. |
code | integer (int32) | Yes | Processing result code. 0 indicates success, and any non-zero value indicates failure. |
message | string or null | Yes | Processing result message. |
eventId and studioId must appear together.
Example
alarmTriggered
{
"version": "v1",
"msgId": "alarm-notify-alarm-1",
"type": "AlarmEvent",
"data": {
"uuid": "alarm-1",
"deviceName": "Smoke sensor",
"deviceId": "device-1",
"devicePointName": "Smoke concentration",
"alarmClass": "Critical",
"alarmRuleName": "Smoke rule",
"alarmText": "Smoke detected",
"alarmValue": "On",
"sourceState": "OFF_NORMAL",
"alarmTime": 1793577600000,
"localized": {
"zh-CN": {
"devicePointName": "烟雾浓度",
"alarmText": "检测到烟雾",
"alarmValue": "开启",
"sourceStateText": "触发"
},
"en-US": {
"devicePointName": "Smoke concentration",
"alarmText": "Smoke detected",
"alarmValue": "On",
"sourceStateText": "Triggered"
}
}
},
"code": 0,
"message": "success"
}
UnsubscribeEventRequest
Description
Unsubscribe Alarm Request
Send after authentication. data must be a non-empty array of event types. Ordinary clients use ALARM. The subscription applies to the current session only, and repeated requests are idempotent. This does not affect device, Trait, or object event subscriptions.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: UnsubscribeEventRequest. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | array<string> | Yes | Use ALARM for alarms; do not accept empty arrays, wildcards, or object ID filters. Minimum items: 1. Fixed item value: ALARM. |
Example
unsubscribeAlarmRequest
{
"type": "UnsubscribeEventRequest",
"version": "v1",
"msgId": "alarm-unsubscribe-1",
"data": [
"ALARM"
]
}
UnsubscribeEventResponse
Description
Unsubscribe Alarm Response
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: UnsubscribeEventResponse. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | string or null | Yes | Response data. When no data is returned, it is usually an empty string or null. Default: "". |
code | integer (int32) | Yes | Processing result code. 0 indicates success, and any non-zero value indicates failure. |
message | string or null | Yes | Processing result message. |
Example
unsubscribeAlarmResponse
{
"type": "UnsubscribeEventResponse",
"version": "v1",
"msgId": "alarm-unsubscribe-1",
"data": "",
"code": 0,
"message": "success"
}
SubscribeObjectEventRequest
Description
Subscribe to space, device-space relationship, and automation object events
Incrementally adds object-event subscriptions for the current WebSocket session; duplicate subscriptions are idempotent.
When objectIds is omitted, null, or an empty array, subscribe to all currently accessible objects under the specified eventTypes; when non-empty, subscribe only to the specified objects.
Subsequent subscription requests are merged with existing rules and do not overwrite previously specified object rules. Subscribing to all objects replaces the existing ID list for the same event type.
Apps may use all-object subscriptions to maintain a complete list; screen devices and third-party services typically subscribe to specified objects according to their business scope.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: SubscribeObjectEventRequest. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | array<object> | Yes | Must contain 1 to 100 subscription items. Requests are merged incrementally by session, and duplicate subscriptions are idempotent. SPACE_ADDED, AUTOMATION_ADDED, and SCENE_ADDED only allow the all-objects semantic for objectIds. Minimum items: 1. Maximum items: 100. |
data[].eventTypes | array<string> | Yes | Minimum items: 1. Items must be unique. Allowed item values
|
data[].objectIds | array<string> or null | No | List of object IDs. Fill in device, space, automation, or scene IDs according to the event types. When subscribing, omitted, null, or empty objectIds means all objects within the current permission scope; when non-empty, only the specified objects are matched. When unsubscribing, omitted, null, or empty objectIds means clearing all rules for the corresponding eventTypes; when non-empty, only the specified objects are removed. Within the same WebSocket session, at most 1000 distinct objectIds may be cumulatively subscribed under each eventType. When objectIds is non-empty, the eventTypes in the same item must belong to the same public ID family (device, space, automation/scene); SPACE_ADDED, AUTOMATION_ADDED, and SCENE_ADDED support only the all-objects semantic. Maximum items: 1000. Items must be unique. Minimum item length: 1. |
Example
- subscribeAllPreciseObjectEvents
- subscribeSelectedObjects
{
"type": "SubscribeObjectEventRequest",
"version": "v1",
"msgId": "object-subscribe-1",
"data": [
{
"eventTypes": [
"SPACE_ADDED",
"SPACE_REMOVED",
"SPACE_UPDATED",
"AUTOMATION_ADDED",
"AUTOMATION_REMOVED",
"AUTOMATION_UPDATED",
"AUTOMATION_SPACE_UPDATED",
"DEVICE_SPACE_UPDATED"
],
"objectIds": []
}
]
}
{
"type": "SubscribeObjectEventRequest",
"version": "v1",
"msgId": "object-subscribe-2",
"data": [
{
"eventTypes": [
"DEVICE_SPACE_UPDATED"
],
"objectIds": [
"device-1",
"device-2"
]
},
{
"eventTypes": [
"AUTOMATION_REMOVED",
"AUTOMATION_UPDATED",
"AUTOMATION_SPACE_UPDATED"
],
"objectIds": [
"automation-1"
]
}
]
}
SubscribeObjectEventResponse
Description
Object-event subscription response
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: SubscribeObjectEventResponse. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | string or null | Yes | Response data. When no data is returned, it is usually an empty string or null. Default: "". |
code | integer (int32) | Yes | Processing result code. 0 indicates success, and any non-zero value indicates failure. |
message | string or null | Yes | Processing result message. |
ObjectEvent
Description
Object event push
Device add/remove events are pushed by default; changes to spaces, automations, standalone scenes, and space relationships are delivered according to precise object subscriptions. Current 19 object event types are provided with examples.
DEVICE_ADDED and DEVICE_REMOVED are pushed by default after an authenticated connection is established.
DEVICE_SPACE_UPDATED, the three SPACE_* changes, the four AUTOMATION_* changes, the four SCENE_* changes, and AUTOMATION_EXECUTION_RESULT and SCENE_EXECUTION_RESULT are delivered only to SubscribeObjectEventRequest sessions that match the eventType, objectId, and current permissions.
DEVICE_ENDPOINT_* and DEVICE_TRAIT_PARAMETER_UPDATE continue to follow the existing device-data subscriptions.
Independent scenes are managed through /scenes, and change notifications use four SCENE_* event families, still using AUTOMATION_* for automation. Trustworthiness is determined by the server. No separate event is provided for count changes. Creating or deleting an automation sends only the corresponding lifecycle snapshot and does not additionally send a space-relationship event. For an existing object, AUTOMATION_SPACE_UPDATED is sent only when its space relationship changes. If both the content and the relationship change at the same time, both types of events may be received.
Independent scenes use SCENE_ADDED/REMOVED/UPDATED/SPACE_UPDATED, no longer sending AUTOMATION_*; the sceneId still uses the auto_ prefix. Old automation manual entries still belong to automation. Scene definition comparison excludes space, and space and definition changes in the same batch generate two different eventId notifications.
The manualTriggers field in an automation snapshot contains triggerNodeId and triggerName. Adding, deleting, or renaming a manual trigger entry returns the full list through AUTOMATION_UPDATED. Replace the cache with the full list, and clear previous entries when the array is empty. No additional event subscription type is required.
msgId is used only for trace correlation. New business notifications are idempotent by studioId + eventId; old object changes without a common identity are idempotently handled based on object state, and should not be deduplicated solely by objectId, eventType, or time.
The new AUTOMATION_EXECUTION_RESULT and SCENE_EXECUTION_RESULT events notify per effective action record, for automations and scenes respectively. They are not completion events for an entire execution. Both Studio and Gateway are covered. A native optimization is notified once per native call. An unconfirmed result is unknown and is not expanded into per-device successes.
The two new events and the four independent scene changes must carry the common-layer studioId and eventId. The same notification identity is kept across channels and HTTP retries. The action results can be trimmed according to the receiver's permissions. They are idempotent by studioId + eventId. executionId only correlates an execution and is explicitly null when unavailable. A new subscription may receive records that the shared queue has not yet delivered. Historical replay is not provided.
All business notifications now carry studioId/eventId pair; ordinary historical messages allow omission for compatibility with legacy producers. Ordinary request/response messages do not reference this structure. Execution results and the four new scene object events have additional identity constraints.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: objectEvent. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | object | Yes | Generic data for objectEvent. The currently known values are listed under eventType, but the receiving side should treat it as an extensible string. When HTTP ALL_SUPPORTED is selected, Studio may, after an upgrade, send events and data structures that are not listed in older versions of the documentation. |
data.eventType | string | Yes | Extensible object event type; see KnownPushObjectEventType for currently known values. Minimum length: 1. |
data.objectId | string | Yes | Object ID; by event type, device, space, automation, or scene ID. The scene value still uses auto_<nodeID> and cannot be classified by the ID prefix. |
data.time | integer (int64) | Yes | Event timestamp in milliseconds. |
data.data | object or null | No | The concrete structure is determined by eventType. The current structures are described by PushObjectEventDeviceData, PushObjectEventTraitParameterData, DeviceSpaceUpdateEventData, SpaceEventData, AutomationPushSnapshot, AutomationSpaceUpdateEventData, ScenePushSnapshot, SceneSpaceUpdateEventData and ExecutionResultData.Future new structures may be added on the push side; PreciseObjectEventType in subscription requests remains a strict enum in the current version. |
eventId | string | No | An opaque string for this logical notification. It must contain at least one non-whitespace character. Store and compare it as-is without relying on its format. It remains unchanged across channels and HTTP retries. Consecutive notifications with the same content use different values. Minimum length: 1. Pattern: \S. |
studioId | string | No | The official Studio identity that publishes the notification. It must contain at least one non-whitespace character. It is not a gateway identity or an authentication credential. Minimum length: 1. Pattern: \S. |
code | integer (int32) | Yes | Processing result code. 0 indicates success, and any non-zero value indicates failure. |
message | string or null | Yes | Processing result message. |
eventId and studioId must appear together.
eventId: UUID of this logical notification. It remains unchanged across channels and HTTP retries.
studioId: The Studio official identity for publishing the notification, not the executing gateway ID.
Minimum length: 1.
When data.eventType is AUTOMATION_EXECUTION_RESULT, SCENE_EXECUTION_RESULT, SCENE_ADDED, SCENE_REMOVED, SCENE_UPDATED, SCENE_SPACE_UPDATED, eventId, studioId are required.
Example
- Scene Added
- Scene Removed
- Scene Updated
- Scene's Space Updated
- Device Added
- Device's Space Updated
- Automation Updated
- Automation's Space Unassigned
- Device Removed
- Device Endpoint Added
- Device Endpoint Removed
- Device Trait Parameter Update
- Space Added
- Space Removed
- Space Updated
- Automation Added
- Automation Removed
- Automation Space Assigned
- Device Space Unassigned
- Scene Action Result
- Automation Native Invocation Unknown
{
"type": "objectEvent",
"version": "v1",
"msgId": "trace-scene_added",
"eventId": "449fd6f6-c52c-4488-a3a2-000000000020",
"studioId": "studio-example",
"code": 0,
"message": "success",
"data": {
"eventType": "SCENE_ADDED",
"objectId": "auto_scene001",
"time": 1793836800123,
"data": {
"objectId": "auto_scene001",
"name": "Movie scene",
"createTime": 1793836800000,
"spaces": []
}
}
}
{
"type": "objectEvent",
"version": "v1",
"msgId": "trace-scene_removed",
"eventId": "449fd6f6-c52c-4488-a3a2-000000000021",
"studioId": "studio-example",
"code": 0,
"message": "success",
"data": {
"eventType": "SCENE_REMOVED",
"objectId": "auto_scene001",
"time": 1793836800123,
"data": {
"objectId": "auto_scene001",
"name": "Movie scene",
"createTime": 1793836800000,
"spaces": []
}
}
}
{
"type": "objectEvent",
"version": "v1",
"msgId": "trace-scene_updated",
"eventId": "449fd6f6-c52c-4488-a3a2-000000000022",
"studioId": "studio-example",
"code": 0,
"message": "success",
"data": {
"eventType": "SCENE_UPDATED",
"objectId": "auto_scene001",
"time": 1793836800123,
"data": {
"objectId": "auto_scene001",
"name": "Movie scene",
"createTime": 1793836800000,
"spaces": []
}
}
}
{
"type": "objectEvent",
"version": "v1",
"msgId": "trace-scene_space_updated",
"eventId": "449fd6f6-c52c-4488-a3a2-000000000023",
"studioId": "studio-example",
"code": 0,
"message": "success",
"data": {
"eventType": "SCENE_SPACE_UPDATED",
"objectId": "auto_scene001",
"time": 1793836800123,
"data": {
"objectId": "auto_scene001",
"oldSpaceIds": [
"space-old"
],
"spaces": [
{
"spaceId": "space-new",
"name": "会议室",
"parentSpaceId": null
}
]
}
}
}
{
"type": "objectEvent",
"eventId": "449fd6f6-c52c-4488-a3a2-000000000004",
"studioId": "studio-example",
"version": "v1",
"msgId": "2",
"data": {
"eventType": "DEVICE_ADDED",
"objectId": "14d3b91",
"time": 1754469720110,
"data": {
"deviceId": "14d3b91",
"name": "",
"deviceTypesList": [
"Light"
],
"endpointIds": [
0,
2,
3
],
"time": 1754469720110
}
},
"code": 0,
"message": "success"
}
{
"type": "objectEvent",
"eventId": "449fd6f6-c52c-4488-a3a2-000000000005",
"studioId": "studio-example",
"version": "v1",
"msgId": "object-event-1",
"data": {
"eventType": "DEVICE_SPACE_UPDATED",
"objectId": "device-1",
"time": 1789113600000,
"data": {
"deviceId": "device-1",
"oldSpaceId": "space-1",
"space": {
"spaceId": "space-2",
"name": "Bedroom",
"spatialMarking": "room",
"parentSpaceId": "home-1"
}
}
},
"code": 0,
"message": "success"
}
{
"type": "objectEvent",
"eventId": "449fd6f6-c52c-4488-a3a2-000000000006",
"studioId": "studio-example",
"version": "v1",
"msgId": "object-event-2",
"data": {
"eventType": "AUTOMATION_UPDATED",
"objectId": "automation-1",
"time": 1789113600000,
"data": {
"automationId": "automation-1",
"definitionType": "SCRIPT_JSON",
"name": "Home mode",
"enabled": true,
"createTime": 1789000000000,
"manualTriggers": [
{
"triggerNodeId": "trigger-1",
"triggerName": "Enable home mode"
}
]
}
},
"code": 0,
"message": "success"
}
{
"type": "objectEvent",
"eventId": "449fd6f6-c52c-4488-a3a2-000000000007",
"studioId": "studio-example",
"version": "v1",
"msgId": "object-event-3",
"data": {
"eventType": "AUTOMATION_SPACE_UPDATED",
"objectId": "automation-1",
"time": 1789113600000,
"data": {
"automationId": "automation-1",
"oldSpaceId": "space-2",
"oldSpaceIds": [
"space-2",
"space-3"
],
"spaces": []
}
},
"code": 0,
"message": "success"
}
{
"type": "objectEvent",
"eventId": "449fd6f6-c52c-4488-a3a2-000000000008",
"studioId": "studio-example",
"version": "v1",
"msgId": "example-device_removed",
"data": {
"eventType": "DEVICE_REMOVED",
"objectId": "device-1",
"time": 1793577600000,
"data": {
"deviceId": "device-1",
"name": "Living room light",
"deviceTypesList": [
"Light"
],
"endpointIds": [
0,
2
],
"time": 1793577600000
}
},
"code": 0,
"message": "success"
}
{
"type": "objectEvent",
"eventId": "449fd6f6-c52c-4488-a3a2-000000000009",
"studioId": "studio-example",
"version": "v1",
"msgId": "example-device_endpoint_added",
"data": {
"eventType": "DEVICE_ENDPOINT_ADDED",
"objectId": "device-1",
"time": 1793577600000,
"data": {
"deviceId": "device-1",
"name": "Living room light",
"deviceTypesList": [
"Light"
],
"endpointIds": [
0,
2,
3
],
"time": 1793577600000
}
},
"code": 0,
"message": "success"
}
{
"type": "objectEvent",
"eventId": "449fd6f6-c52c-4488-a3a2-00000000000a",
"studioId": "studio-example",
"version": "v1",
"msgId": "example-device_endpoint_removed",
"data": {
"eventType": "DEVICE_ENDPOINT_REMOVED",
"objectId": "device-1",
"time": 1793577600000,
"data": {
"deviceId": "device-1",
"name": "Living room light",
"deviceTypesList": [
"Light"
],
"endpointIds": [
0,
2
],
"time": 1793577600000
}
},
"code": 0,
"message": "success"
}
{
"type": "objectEvent",
"eventId": "449fd6f6-c52c-4488-a3a2-00000000000b",
"studioId": "studio-example",
"version": "v1",
"msgId": "example-device_trait_parameter_update",
"data": {
"eventType": "DEVICE_TRAIT_PARAMETER_UPDATE",
"objectId": "device-1",
"time": 1793577600000,
"data": {
"deviceId": "device-1",
"endpointId": 2,
"functionCode": "LevelControl",
"traitCode": "CurrentLevel",
"oldValue": {
"endpointId": 2,
"functionCode": "LevelControl",
"traitCode": "CurrentLevel",
"min": 1,
"max": 100,
"step": 1,
"unit": "%"
},
"newValue": {
"endpointId": 2,
"functionCode": "LevelControl",
"traitCode": "CurrentLevel",
"min": 1,
"max": 100,
"step": 2,
"unit": "%"
}
}
},
"code": 0,
"message": "success"
}
{
"type": "objectEvent",
"eventId": "449fd6f6-c52c-4488-a3a2-00000000000c",
"studioId": "studio-example",
"version": "v1",
"msgId": "example-space_added",
"data": {
"eventType": "SPACE_ADDED",
"objectId": "space-2",
"time": 1793577600000,
"data": {
"spaceId": "space-2",
"name": "Bedroom",
"spatialMarking": "room",
"parentSpaceId": "home-1"
}
},
"code": 0,
"message": "success"
}
{
"type": "objectEvent",
"eventId": "449fd6f6-c52c-4488-a3a2-00000000000d",
"studioId": "studio-example",
"version": "v1",
"msgId": "example-space_removed",
"data": {
"eventType": "SPACE_REMOVED",
"objectId": "space-2",
"time": 1793577600000,
"data": {
"spaceId": "space-2",
"name": "Bedroom",
"spatialMarking": "room",
"parentSpaceId": "home-1"
}
},
"code": 0,
"message": "success"
}
{
"type": "objectEvent",
"eventId": "449fd6f6-c52c-4488-a3a2-00000000000e",
"studioId": "studio-example",
"version": "v1",
"msgId": "example-space_updated",
"data": {
"eventType": "SPACE_UPDATED",
"objectId": "space-2",
"time": 1793577600000,
"data": {
"spaceId": "space-2",
"name": "Master bedroom",
"spatialMarking": "room",
"parentSpaceId": "home-1"
}
},
"code": 0,
"message": "success"
}
{
"type": "objectEvent",
"eventId": "449fd6f6-c52c-4488-a3a2-00000000000f",
"studioId": "studio-example",
"version": "v1",
"msgId": "example-automation_added",
"data": {
"eventType": "AUTOMATION_ADDED",
"objectId": "automation-1",
"time": 1793577600000,
"data": {
"automationId": "automation-1",
"definitionType": "WHEN_IF_THEN",
"name": "Home mode",
"enabled": true,
"createTime": 1793491200000,
"manualTriggers": []
}
},
"code": 0,
"message": "success"
}
{
"type": "objectEvent",
"eventId": "449fd6f6-c52c-4488-a3a2-000000000010",
"studioId": "studio-example",
"version": "v1",
"msgId": "example-automation_removed",
"data": {
"eventType": "AUTOMATION_REMOVED",
"objectId": "automation-1",
"time": 1793577600000,
"data": {
"automationId": "automation-1",
"definitionType": "WHEN_IF_THEN",
"name": "Home mode",
"enabled": true,
"createTime": 1793491200000,
"manualTriggers": []
}
},
"code": 0,
"message": "success"
}
{
"type": "objectEvent",
"eventId": "449fd6f6-c52c-4488-a3a2-000000000011",
"studioId": "studio-example",
"version": "v1",
"msgId": "example-automation_space_updated",
"data": {
"eventType": "AUTOMATION_SPACE_UPDATED",
"objectId": "automation-1",
"time": 1793577600000,
"data": {
"automationId": "automation-1",
"oldSpaceId": null,
"space": {
"spaceId": "space-2",
"name": "Bedroom",
"spatialMarking": "room",
"parentSpaceId": "home-1"
},
"oldSpaceIds": [],
"spaces": [
{
"spaceId": "space-2",
"name": "Bedroom",
"spatialMarking": "room",
"parentSpaceId": "home-1"
}
]
}
},
"code": 0,
"message": "success"
}
{
"type": "objectEvent",
"eventId": "449fd6f6-c52c-4488-a3a2-000000000012",
"studioId": "studio-example",
"version": "v1",
"msgId": "example-device_space_updated",
"data": {
"eventType": "DEVICE_SPACE_UPDATED",
"objectId": "device-1",
"time": 1793577600000,
"data": {
"deviceId": "device-1",
"oldSpaceId": "space-2",
"space": null
}
},
"code": 0,
"message": "success"
}
{
"type": "objectEvent",
"version": "v1",
"msgId": "trace-example",
"eventId": "449fd6f6-c52c-4488-a3a2-828db5f9ab6e",
"studioId": "studio-example",
"code": 0,
"message": "success",
"data": {
"eventType": "SCENE_EXECUTION_RESULT",
"objectId": "auto_scene001",
"time": 1793664000123,
"data": {
"objectId": "auto_scene001",
"name": "Home scene",
"executionId": "opaque-run-example",
"triggeredAt": 1793664000000,
"actionOccurredAt": null,
"executeMode": "Gateway",
"resultCode": 0,
"actionKind": "device_write",
"actionTarget": {
"type": "device",
"id": "device-example",
"name": "Living room light",
"resourceId": "4.1.85",
"resourceName": "开关"
},
"triggerSource": {
"sourceType": 60,
"triggerSubjectId": null,
"triggerSubjectName": null,
"triggerResourceId": null,
"triggerResourceName": null
},
"spaces": [
{
"spaceId": "space-example",
"name": "Living room",
"parentSpaceId": null
}
]
}
}
}
{
"type": "objectEvent",
"version": "v1",
"msgId": "trace-native-example",
"eventId": "6f913a2c-9484-42d5-bfa9-00b0b1fd23ee",
"studioId": "studio-example",
"code": 0,
"message": "success",
"data": {
"eventType": "AUTOMATION_EXECUTION_RESULT",
"objectId": "auto_automation001",
"time": 1793664000123,
"data": {
"objectId": "auto_automation001",
"name": "Away automation",
"executionId": "opaque-run-example",
"triggeredAt": 1793664000000,
"actionOccurredAt": null,
"executeMode": "Studio",
"resultCode": 2,
"actionKind": "native_scene_recall",
"actionTarget": null,
"triggerSource": {
"sourceType": 51,
"triggerSubjectId": null,
"triggerSubjectName": null,
"triggerResourceId": null,
"triggerResourceName": null
},
"spaces": []
}
}
}
UnsubscribeObjectEventRequest
Description
Unsubscribe from space, device-space relationship, and automation object events
Removes specified object rules or clears specified event types for the current WebSocket session.
When objectIds is non-empty, only the specified objects are removed; when omitted, null, or an empty array, all object rules for the corresponding eventTypes are cleared.
All-object subscriptions do not support excluding selected objects. To switch from all objects to specified objects, first clear the event type and then send a new specified-object subscription.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: UnsubscribeObjectEventRequest. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | array<object> | Yes | Must contain 1 to 100 unsubscribe items; an empty array is a parameter error and does not mean unsubscribing from all event types. When objectIds is omitted, null, or an empty array, all object rules under the corresponding eventTypes for the current session are removed; when non-empty, only the specified objects are removed. Minimum items: 1. Maximum items: 100. |
data[].eventTypes | array<string> | Yes | Minimum items: 1. Items must be unique. Allowed item values
|
data[].objectIds | array<string> or null | No | List of object IDs. Fill in device, space, automation, or scene IDs according to the event types. When subscribing, omitted, null, or empty objectIds means all objects within the current permission scope; when non-empty, only the specified objects are matched. When unsubscribing, omitted, null, or empty objectIds means clearing all rules for the corresponding eventTypes; when non-empty, only the specified objects are removed. Within the same WebSocket session, at most 1000 distinct objectIds may be cumulatively subscribed under each eventType. When objectIds is non-empty, the eventTypes in the same item must belong to the same public ID family (device, space, automation/scene); SPACE_ADDED, AUTOMATION_ADDED, and SCENE_ADDED support only the all-objects semantic. Maximum items: 1000. Items must be unique. Minimum item length: 1. |
Example
- unsubscribeSelectedObject
- clearEventType
{
"type": "UnsubscribeObjectEventRequest",
"version": "v1",
"msgId": "object-unsubscribe-1",
"data": [
{
"eventTypes": [
"AUTOMATION_UPDATED"
],
"objectIds": [
"automation-1"
]
}
]
}
{
"type": "UnsubscribeObjectEventRequest",
"version": "v1",
"msgId": "object-unsubscribe-2",
"data": [
{
"eventTypes": [
"AUTOMATION_UPDATED"
],
"objectIds": []
}
]
}
UnsubscribeObjectEventResponse
Description
Object-event unsubscription response
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: UnsubscribeObjectEventResponse. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | string or null | Yes | Response data. When no data is returned, it is usually an empty string or null. Default: "". |
code | integer (int32) | Yes | Processing result code. 0 indicates success, and any non-zero value indicates failure. |
message | string or null | Yes | Processing result message. |
CommandReport
Description
Gateway command execution result
Sent with v1 device-level or full-device subscriptions, preserving the original gateway result without indicating that the device physical action has been completed.
All business notifications now carry studioId/eventId pair; ordinary historical messages allow omission for compatibility with legacy producers. Ordinary request/response messages do not reference this structure. Execution results and the four new scene object events have additional identity constraints.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: CommandReport. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | A non-empty identifier used by the request. It should remain unique at least among unfinished requests on the current connection. Normal responses correlate with the same msgId, while msgIds on server push messages are used only for link tracing, do not correspond to subscription request msgIds, and are not guaranteed to be globally unique. Minimum length: 1. Maximum length: 64. |
data | object | Yes | Push payload data. |
data.deviceId | string | Yes | Minimum length: 1. |
data.sequence | integer | Yes | Minimum: 1. |
data.timestamp | integer | Yes | Studio recorded time Minimum: 0. |
data.did | string | Yes | Minimum length: 1. |
data.reportTime | integer or null | Yes | Gateway original report time |
data.source | string or null | Yes | — |
data.data | object | Yes | Additional properties are allowed. |
data.content | object | Yes | Additional properties are allowed. |
eventId | string | No | An opaque string for this logical notification. It must contain at least one non-whitespace character. Store and compare it as-is without relying on its format. It remains unchanged across channels and HTTP retries. Consecutive notifications with the same content use different values. Minimum length: 1. Pattern: \S. |
studioId | string | No | The official Studio identity that publishes the notification. It must contain at least one non-whitespace character. It is not a gateway identity or an authentication credential. Minimum length: 1. Pattern: \S. |
code | integer (int32) | Yes | Processing result code. 0 indicates success, and any non-zero value indicates failure. |
message | string or null | Yes | Processing result message. |
eventId and studioId must appear together.
Example
command_report
{
"type": "CommandReport",
"version": "v1",
"msgId": "report-example",
"studioId": "studio-example",
"eventId": "449fd6f6-c52c-4488-a3a2-828db5f9ab6e",
"code": 0,
"message": "success",
"data": {
"deviceId": "device-1",
"sequence": 1,
"timestamp": 1793577600000,
"did": "gateway-device-example",
"reportTime": null,
"source": null,
"data": {
"2.148.33050.0": "0"
},
"content": {
"0": 0,
"2": 2
}
}
}
ErrorMessage
Description
Error response
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Fixed value: ErrorMessage. |
version | string | Yes | Fixed value: v1. |
msgId | string | Yes | Returns the original request msgId when it can be correlated; the server may return UNKNOWN or an empty string when it cannot correlate the original request. Minimum length: 0. Maximum length: 64. |
data | string or null | No | Error responses typically do not carry business data. |
code | integer (int32) | Yes | Processing result code. Any non-zero value indicates failure; clients are discouraged from relying on specific error codes for fixed business logic decisions. |
message | string or null | Yes | Error message. |
Example
missingMsgId
{
"type": "ErrorMessage",
"version": "v1",
"msgId": "",
"data": null,
"code": 400,
"message": "Missing msgId"
}