Copyright ©

Mongoose OS Forum


Connecting ESP32 to Azure IoT hub - twins/shadows reported state

Hi, Im following the example here to connect my esp32 device to azure

Ive added

  "desired": {
    "on": true,   // <-- add this 

into the devices twin

and have everything setup and when I switch the device on it reports the follwing data

"reported": {
      "ota": {
        "fw_version": "1.0",
        "fw_id": "********************",
        "mac": "***********",
        "device_id": "esp32_******",
        "app": "ota-shadow",
        "arch": "esp32",
        "message": "idle",
        "status": 0,
        "is_committed": true,
        "commit_timeout": 0,
        "partition": 0,
        "progress_percent": 0

I also see the sending of the data in the mos console:

mgos_azure_shadow_mq Update: {"ota":{"fw_version": "1.0", "fw_id": "***********-****", "mac": "*************", "device_id": "esp32_********", "app": "ota-shadow", "arch": "esp32[Oct 21 16:34:14.864] "}}
mgos_azure_shadow_mq Update: {"ota":{"message": "idle", "status": 0, "is_committed": true, "commit_timeout": 0, "partition": 0, "progress_percent[Oct 21 16:34:14.879] ": 0}}

The twin doesnt seem to generate the reported state "on": true, and therefore isnt generating a delta "on": true,

Does the cloud provider add the reported state "on": true, when I add the desire state "on": true, or should reported state "on": true be reported by my esp32 device? If the second question is true then this isnt happening

If someone can point out where im going wrong Id be very grateful

Ive done this is AWS and everthing seems OK and when I change the Desired "on": true, it sends that to the device and inturn switches on my LED


Sign In or Register to comment.