Message format

The following two types of messages are currently supported:

  • Event notification message Refers to the event message of the device, such as: unbind/bind the device, device online and offline, etc.
Event Type Description
gateway_bind Bind gateway
subdevice_bind Bind subdevice
gateway_unbind Unbind gateway
unbind_sub_gw Unbind subdevice
gateway_online Gateway online
gateway_offline Gateway offline
subdevice_online Subdevice online
subdevice_offline Subdevice offline
dev_name_change Modify device name
dev_position_assign Modify device position
resource_alias_changed Modify device attribute name
linkage_created Create automation
scene_created Create scene
event_created Create multiple-conditions
linkage_deleted Delete automation
scene_deleted Delete scene
event_deleted Delete multiple-conditions
  • Device Attribute Message

    Refers to the state change or operation triggered by the device or linkage during use. Such as: socket switch, load power, power consumption, etc.

Note: Event notification messages will all be pushed to third-party servers, and attribute messages will be pushed according to the subscription mode selected by the user.

  • Device Control Failure Message

    When the control device fails, the failure reason will be returned according to the actual situation of the device, including the trigger source, trigger time, error code, etc., so as to quickly locate the cause of the failure.

Format Description

Event notification message

  • General format
Name Type Is it required Description
openId String Yes Authorized user's unique identifier
time String Yes The timestamp when the message was generated, in milliseconds
eventType String Yes Event message notification type
msgId String Yes Message unique identification id
data Object Yes Specific message content
data.time Object Yes The time stamp of the specific message, in milliseconds

Gateway binding notification message

  • Parameter Description
Name Type Is it required Description
time Object Yes The time stamp of the specific message, in milliseconds
model String Yes subject model
did String Yes Device id
bindKey String No Random code bound when the device is added
subDids Array(String) No Subdevice info list
  • Demo:
{
    "msgId":"5657a659abeb42da8dc32e910405b5c8",
    "openId":"5657a659abeb42da10405b5c8",
    "time":"1561621051609",
    "eventType":"gateway_bind",
    "data":{
        "bindKey":"709b1AXaXdETHPEx",
        "subDids":[
            "lumi1.7811dc93a344",
            "lumi1.7811dc93a344"
        ],
        "time":"1619489743705",
        "model":"lumi.gateway.iragl01",
        "did":"lumi1.7811dc93a344"
    }
}

Sub-device binding notification message

  • Parameter Description:
Name Type Is it required Description
model String Yes Subject model
did String Yes Device id
time Object Yes The time stamp of the specific message, in milliseconds
parentDid String Yes Gateway device id
  • Demo:
{
    "msgId":"5657a659abeb42da8dc32e910405b5c8",
    "openId":"5657a659abeb42da10405b5c8",
    "time":"1561621051609",
    "eventType":"subdevice_bind",
    "data":{
        "parentDid":"lumi1.xxx",
        "model":"lumi.plug.v1",
        "did":"lumi1.7811dc93a344",
        "time":"1619489743705"
    }
}

Gateway unbinding notification message

  • Parameter Description:
Name Type Is it required Description
did String Yes Device id
subDids Array(String) No Subdevice info list
time String Yes The time stamp of the specific message, in milliseconds
cause int Yes Reasons for unbinding, 2-gateway operation, 3-cloud operation, 4-gateway reset to the factory, 5-cloud reset gateway
  • Demo:
{
    "msgId":"5657a659abeb42da8dc32e910405b5c8",
    "openId":"5657a659abeb42da10405b5c8",
    "time":"1561621051609",
    "eventType":"gateway_unbind",
    "data":{
        "did":"lumi1.xxx",
        "time":"1619489743705",
        "cause":2,
        "subDids":[
            "lumi1.7811dc93a344",
            "lumi1.7811dc93a344"
        ]
    }
}

Sub-device unbinding notification message

  • Parameter Description:
Name Type Is it required Description
did String Yes Device id
parentDid String Yes Gateway device id
cause int Yes Reason for unbinding, 12-Cloud triggers sub-device unbinding, 13-gateway triggers sub-device unbinding, 17-sub-device replacement and unbinding
time String Yes The time stamp of the specific message, in milliseconds
  • Demo:
{
    "msgId":"5657a659abeb42da8dc32e910405b5c8",
    "openId":"5657a659abeb42da10405b5c8",
    "time":"1561621051609",
    "eventType":"unbind_sub_gw",
    "data":{
        "did":"lumi1.xxx",
        "time":"1619489743705",
        "cause":12,
        "parentDid":"lumi1.7811dc93a344"
    }
}

Gateway online notification message

  • Parameter Description:
Name Type Is it required Description
did String Yes Device id
subDids Array(String) No Subdevice info list
time String Yes The time stamp of the specific message, in milliseconds
  • Demo:
{
    "msgId":"5657a659abeb42da8dc32e910405b5c8",
    "openId":"5657a659abeb42da10405b5c8",
    "time":"1561621051609",
    "eventType":"gateway_online",
    "data":{
        "did":"lumi1.xxx",
        "time":"1619489743705",
        "subDids":[
            "lumi1.7811dc93a344",
            "lumi1.7811dc93a344"
        ]
    }
}

Gateway offline notification message

  • Parameter Description:
Name Type Is it required Description
did String Yes Device id
subDids Array(String) No Subdevice info list
time String Yes The time stamp of the specific message, in milliseconds
  • Demo:
{
    "msgId":"5657a659abeb42da8dc32e910405b5c8",
    "openId":"5657a659abeb42da10405b5c8",
    "time":"1561621051609",
    "eventType":"gateway_offline",
    "data":{
        "did":"lumi1.xxx",
        "time":"1619489743705",
        "subDids":[
            "lumi1.7811dc91a344",
            "lumi1.7811dc93a344"
        ]
    }
}

Sub-device online notification message

  • Parameter Description:
Name Type Is it required Description
did String Yes Device id
cause int Yes Online reason, 11-sub device heartbeat goes online 16-sub device is bound online
time String Yes The time stamp of the specific message, in milliseconds
  • Demo:
{
    "msgId":"5657a659abeb42da8dc32e910405b5c8",
    "openId":"5657a659abeb42da10405b5c8",
    "time":"1561621051609",
    "eventType":"subdevice_online",
    "data":{
        "did":"lumi1.xxx",
        "cause":11,
        "time":"1619489743705"
    }
}

Sub-device offline notification message

  • Parameter Description:
Name Type Is it required Description
did String Yes Device id
cause int Yes Offline reason, 12-sub device is offline without heartbeat, 15-sub device is unbound offline,
time String Yes The time stamp of the specific message, in milliseconds
  • Demo:
{
    "msgId":"5657a659abeb42da8dc32e910405b5c8",
    "openId":"5657a659abeb42da10405b5c8",
    "time":"1561621051609",
    "eventType":"subdevice_offline",
    "data":{
        "did":"lumi1.xxx",
        "cause":12,
        "time":"1619489743705"
    }
}

Modify device name notification message

  • Parameter Description:
Name Type Is it required Description
parentDid String Yes Gateway id
positionId String Yes Position id
model String Yes Subject model
time String Yes The time stamp of the specific message, in milliseconds
deviceName String Yes Device name
did String Yes Device id
  • Demo:
{
    "data":{
        "parentDid":"",
        "positionId":"real2.718491383196524544",
        "model":"lumi.camera.gwpagl01",
        "time":"1628309134211",
        "deviceName":"Camera Hub G3",
        "did":"lumi1.54ef44263144"
    },
    "openId":"openId",
    "msgId":"AC10C8E1000E18B4AAC2217E6F86C7F5",
    "eventType":"dev_name_change",
    "time":"1628500244165"
}

Modify device position notification message

  • Parameter Description:
Name Type Is it required Description
positionName String Yes Position name
positionId String Yes Position id
dids Array(String) Yes Device id array
time String Yes The time stamp of the specific message, in milliseconds
  • Demo:
{
    "data":{
        "positionName":"默认房间",
        "positionId":"real2.587738122830217216",
        "dids":[
            "lumi1.6490c17ac50e"
        ],
        "time":"1628308523160"
    },
    "openId":"openId",
    "msgId":"AC10C8E1000E18B4AAC221751C9CA113",
    "eventType":"dev_position_assign",
    "time":"1628499826376"
}

Modify device attribute name notification message

  • Parameter Description:
Name Type Is it required Description
changeValues Array(Object) Yes Modify value array
did String Yes Device id
time String Yes The time stamp of the specific message, in milliseconds

changeValues description:

Name Type Is it required Description
resourceId String Yes Resource id
name String Yes Updated name
  • Demo:
{
    "data":{
        "changeValues":[
            {
                "resourceId":"4.1.85",
                "name":"Plug"
            }
        ],
        "time":"1628492027819",
        "did":"lumi.158d00044b219c"
    },
    "openId":"openId",
    "msgId":"AC10C8C7000E18B4AAC22C652BABB392",
    "eventType":"resource_alias_changed",
    "time":"1628499314047"
}

Create automation notification messages

  • Parameter Description:
Name Type Is it required Description
model String Yes Subject model
time String Yes The time stamp of the specific message, in milliseconds
linkageId String Yes Linkage id
  • Demo:
{
    "msgId":"5657a659abeb42da8dc32e910405b5c8",
    "openId":"5657a659abeb42da10405b5c8",
    "time":"1561621051609",
    "eventType":"linkage_created",
    "data":{
        "model":"xxx",
        "linkageId":"L.7811dc93a344",
        "time":"1619489743705"
    }
}

Create scene notification message

  • Parameter Description:
Name Type Is it required Description
model String Yes Subject model
time String Yes The time stamp of the specific message, in milliseconds
sceneId String Yes Scene id
  • Demo:
{
    "msgId":"5657a659abeb42da8dc32e910405b5c8",
    "openId":"5657a659abeb42da10405b5c8",
    "time":"1561621051609",
    "eventType":"scene_created",
    "data":{
        "model":"xxx",
        "sceneId":"AL.7811dc93a344",
        "time":"1619489743705"
    }
}

Create multiple-conditions notification message

  • Parameter Description:
Name Type Is it required Description
model String Yes Subject model
time String Yes The time stamp of the specific message, in milliseconds
eventId String Yes Multiple-conditions id
  • Demo:
{
    "msgId":"5657a659abeb42da8dc32e910405b5c8",
    "openId":"5657a659abeb42da10405b5c8",
    "time":"1561621051609",
    "eventType":"event_created",
    "extra":{
        "model":"xxx",
        "eventId":"CL.7811dc93a344",
        "time":"1619489743705"
    }
}

Delete automation notification messages

  • Parameter Description:
Name Type Is it required Description
linkageIds Array(String) Yes Linkage id
time String Yes The time stamp of the specific message, in milliseconds
  • Demo:
{
    "msgId":"5657a659abeb42da8dc32e910405b5c8",
    "openId":"5657a659abeb42da10405b5c8",
    "time":"1561621051609",
    "eventType":"linkage_deleted",
    "data":{
        "linkageIds":[
            "L.7811dc93a345",
            "L.7811dc93a344"
        ],
        "time":"1619489743705"
    }
}

Delete scene notification messages

  • Parameter Description:
Name Type Is it required Description
sceneIds Array(String) Yes Scene id
time String Yes The time stamp of the specific message, in milliseconds
  • Demo:
{
    "msgId":"5657a659abeb42da8dc32e910405b5c8",
    "openId":"5657a659abeb42da10405b5c8",
    "time":"1561621051609",
    "eventType":"scene_deleted",
    "data":{
        "sceneIds":[
            "AL.7811dc93a345",
            "AL.7811dc93a344"
        ],
        "time":"1619489743705"
    }
}

Delete multiple-conditions notification messages

  • Parameter Description:
Name Type Is it required Description
eventIds Array(String) Yes Multiple-conditions id
time String Yes The time stamp of the specific message, in milliseconds
  • Demo:
{
    "msgId":"5657a659abeb42da8dc32e910405b5c8",
    "openId":"5657a659abeb42da10405b5c8",
    "time":"1561621051609",
    "eventType":"event_deleted",
    "data":{
        "eventIds":[
            "CL.7811dc93a345",
            "CL.7811dc93a344"
        ],
        "time":"1619489743705"
    }
}

Device Attribute message

Mainly refers to the state change or operation data generated during the use of device and related linkage objects, such as: socket switch, load power, power consumption, etc.

  • Message format
Name Type Is it required Description
openId String Yes Authorized user's unique identifier
time String Yes The time stamp of the specific message, in milliseconds
msgId String Yes Message unique identification id
msgType String Yes Message type, resource_report
data Array(Object) Yes Message content
data.subjectId String Yes Object id, such as: device id or scene id or linkage id
data.resourceId String Yes The attribute id of the object, such as the on-off state of the socket
data.value String Yes The value to which the attribute of the object is changed
data.time String Yes The property change timestamp of the object, in milliseconds
data.statusCode int Yes The status change result, success or failure, see the description of "Trigger result" below for details
data.triggerSource Object No Message trigger reason
data.attach String No When the user uses User-defined subscription mode, the parameters passed through the "subscribe resource" interface will be returned as it is when the message is generated.
data.triggerSource.type int No Message trigger type, see the description of "Trigger Type" below for details
data.triggerSource.time String No The trigger time of the cause of the message change, in seconds
data.triggerSource.id String No The trigger object id that caused the message change, such as the linkage id
  • Demo:
{
    "msgId":"5657a659abeb42da8dc32e910405b5c8",
    "openId":"5657a659abeb42da10405b5c8",
    "time":"1561621051609",
    "msgType":"resource_report",
    "data":[
        {
            "subjectId":"lumi1.xxx",
            "resourceId":"3.1.85",
            "value":"1",
            "time":"1561621051609",
            "statusCode":0,
            "triggerSource":{
                "type":1,
                "time":"1561621050",
                "id":"AL.xxxx"
            }
        }
    ]
}

Device Control Failure Message

When the control device fails, the failure reason will be returned according to the actual situation of the device, including the trigger source, trigger time, error code, etc., so as to quickly locate the cause of the failure.

  • Message format
Name Type Is it required Description
openId String Yes Authorized user's unique identifier
time String Yes The time stamp of the specific message, in milliseconds
msgId String Yes Message unique identification id
eventType String Yes Message type, control_fail
data Array(Object) Yes Message content
data.time String Yes The property change timestamp of the object, in milliseconds
data.subjectId String Yes Object id, such as: device id or scene id or linkage id
data.resourceId String Yes The attribute id of the object, such as the on-off state of the socket
data.value String Yes The value to which the attribute of the object is changed
data.statusCode int Yes The status failure result, see the description of "Trigger result" below for details
data.triggerSource Object No Message trigger reason
data.triggerSource.type int No Message trigger type, see the description of "Trigger Type" below for details
data.triggerSource.time String No The trigger time of the cause of the message change, in seconds
  • Demo:
{
    "data":{
        "resourceId":"4.1.85",
        "time":"1639455380200",
        "triggerSource":{
            "time":"1639453278",
            "type":21
        },
        "value":"",
        "subjectId":"lumi.158d0004112308",
        "statusCode":4
    },
    "openId":"289738515206846977290753",
    "msgId":"AC10C81E000F18B4AAC6F480C",
    "eventType":"control_fail",
    "time":"1639453292001"
}
  • Trigger result
Id Description
0 Success
1 Some delayed actions were not executed
2 The command sent by the gateway to the sub-device has timed out and was not successfully executed
3 Do not receive the control command by the gateway
4 No response from zigbee
5 Insufficient memory resources of the gateway prevent the issue of control commands
6 Delayed action creation timer failed, unable to achieve the function of delayed execution
7 Too many control commands and busy response
8 The sub-device is in a power-off state
9 The communication between the gateway and the sub-device is very unstable
10 Successfully executed, the old command is overwritten by the new command
20 Successful execution
51 LAN cross-gateway control failed
100 Timeout
602 The device is offline
612 The link between the cloud and the gateway is interrupted
  • Trigger Type
Id Description
0 Unknown
1 Device button control
2 Remote control
3 LAN command control
4 Cloud remote command control
5 Gateway localization linkage control
6 Cloud linkage control
7 LAN linkage control
8 Homekit control
9 System itself
10 Triggered by the device itself
11 Cloud scene
12 Gateway localization scene
13 LAN scene
14 Cloud subexecution
21 Controlled by developer platfrom API
22 Triggered by devices from third-party cloud
26 Controlled by Aqara IOT Solution Platform
33 Heartbeat
34 Third-party voice control
Copyright © 2023 Lumi United Technology Co., Ltd. all right reserved,powered by GitbookFile Modify: 2024-09-27 21:51:47

results matching ""

    No results matching ""