Updated on 2022-08-11 GMT+08:00

Device Twin Delta

This topic is used to subscribe to device twin delta events. When a device twin changes, the twin properties whose actual values are different from expected values are returned.

Topic

$hw/events/device/{device_id}/twin/update/delta

Parameter

Type

Description

device_id

String

End device ID.

Usage

Use an MQTT client to subscribe to this topic.

Parameter Description

Parameter

Type

Description

event_id

String

Event ID.

timestamp

Int64

Timestamp when the event occurred.

twin

Object

A set of updated device twins. Each twin is in the key-value pair format. The value contains the option flag, the twin metadata contains the value type, the expected status contains the expected value and update time, and the actual status contains the actual value and update time.

delta

Map

Names of twin properties whose actual values are different from expected values, and expected values of these properties.

Example

When an end device is bound to an edge node, the following message is received:

$hw/events/device/{device_id}/twin/update/delta

{
     "event_id":"b9625811-f34f-4252-bee9-98185e7e1ec7",
     "timestamp":1557314742131,
     "twin":{
         "state":{
             "expected":{
                 "value":"running",
                 "metadata":{
                     "timestamp":1557314742122
                 }
             },
             "optional":true,
             "metadata":{
                 "type":"string"
             }
         }
     },
     "delta":{
         "state":"running"
     }
 }