Push Device Status

2022-07-13
No Rating

Device State Publish

Device states refers to the states of all hardware of the drone, which will be published to the server through DJI Pilot 2 and the airport, and this information is included in the property of the thing model.

According to the data characteristics of the property, we divide it into two categories: state category and fixed frequency category. The devices are published to the cloud by the following 2 topics.

  • thing/product/{pid}/state state category. The device will publish in case of states changes.
  • thing/product/{pid}/osd fixed frequency category. The device will publish regularly at 0.5 HZ.

See its thing model file for a list of specific device properties.

Topic Message

Devices publish data using different topics according to their data characteristics. However, the format of the message body data published by the device is consistent.

  • thing/product/{pid}/state

    • After the device is powered on, all state properties are published. It will be published only once.

    • When an property changes, the changed property is published once.

    • The server needs to subscribe to the topic (thing/product/{pid}/state) to get the changed properties in the state.

  • thing/product/{pid}/osd

    • The properties of the fixed frequency will be published by fixed frequency when the device is online.
    • All the properties of the fixed frequency will be included in each published message.

Field description

ParameterRequiredtypeDescription
tidYesstring
bidYesstring
timestampYesint
gatewayYesstring
dataYesobject

Example of data format

{
    "bid":"00000000-0000-0000-0000-000000000000",
    "data":{
        "43-0-0":{
            "gimbal_pitch":0,
            "gimbal_roll":0,
            "gimbal_yaw":-103.7,
            "measure_target_altitude":100,
            "measure_target_distance":1256.800049,
            "measure_target_error_state":1,
            "measure_target_latitude":21.99849,
            "measure_target_longitude":112.987933,
            "payload_index":"43-0-0",
            "version":1
        },
        "attitude_head":0,
        "attitude_pitch":-0.5,
        "attitude_roll":-0.1,
        "battery":{
            "batteries":[
                {
                    "capacity_percent":90,
                    "firmware_version":"01.02.05.31",
                    "index":0,
                    "loop_times":131,
                    "sn":"xxxx",
                    "sub_type":0,
                    "temperature":23.1,
                    "type":0,
                    "voltage":49032
                }
            ],
            "capacity_percent":45,
            "landing_power":5,
            "remain_flight_time":0,
            "return_home_power":10
        },
        "elevation":0,
        "firmware_version":"04.00.0014",
        "gear":1,
        "height":100.020332,
        "home_distance":0,
        "horizontal_speed":0,
        "latitude":22,
        "longitude":113,
        "mode_code":0,
        "position_state":{
            "gps_number":15,
            "is_fixed":0,
            "quality":5,
            "rtk_number":0
        },
        "total_flight_distance":0,
        "total_flight_time":0,
        "vertical_speed":0,
        "wind_direction":0,
        "wind_speed":0
    },
    "tid":"00000000-0000-0000-0000-000000000000",
    "timestamp":1643268212187,
    "gateway":"xxxxx"
}