Closed electro89 closed 1 year ago
Hi @electro89 This section here in our twin sample should be useful for that scenario:
I tried to get twin data but I got an error
2022/10/24 07:33:36 [INFO] MQTT client connecting.
2022/10/24 07:33:42 [INFO] MQTT client connected (session_present=0).
2022/10/24 07:33:42 [INFO] MQTT client subscribing to '$iothub/methods/POST/#'
2022/10/24 07:33:44 [INFO] MQTT topic subscribed (message id=59839).
2022/10/24 07:33:44 [INFO] MQTT client subscribing to '$iothub/twin/res/#'
2022/10/24 07:33:44 [INFO] MQTT topic subscribed (message id=915).
2022/10/24 07:33:44 [INFO] MQTT client subscribing to '$iothub/twin/PATCH/properties/desired/#'
2022/10/24 07:33:45 [INFO] MQTT topic subscribed (message id=22658).
2022/10/24 07:33:45 [INFO] MQTT client publishing to '$iothub/twin/PATCH/properties/reported/?$rid=0'
2022/10/24 07:33:45 [INFO] Client requesting device twin document from service.
2022/10/24 07:33:45 [INFO] MQTT client publishing to '$iothub/twin/GET/?$rid=1'
2022/10/24 07:33:45 [INFO] MQTT message received.
2022/10/24 07:33:45 [INFO] Properties update request completed (id=0, status=204)
2022/10/24 07:33:45 [INFO] MQTT message received.
2022/10/24 07:33:45 [ERROR] azure_iot_mqtt_client_message_received failed (topic=$iothub/twin/res/200/?$rid=1).
Hmm that topic that's received says 200
which is a success. Is the error from IoT api's or device/mqtt code?
Hi @electro89, wanted to check in on the above question.
@danewalton Even after using get_device_twin_document function it returned error, finally found out where the problem is, at https://github.com/Azure/azure-sdk-for-c-arduino/blob/main/examples/Azure_IoT_Central_ESP32_AzureIoTKit/AzureIoT.cpp#L773 It returns RESULT_ERROR
Hi,
Would it be possible to add a Device Twin example to the ESP32 sdk?
Regards Paul Brink
Hi @PDE-Paul at the moment we are not adding a sample for Device Twin on ESP32 but you can take a look at our existing twin sample.
closing issue
I want to get data from twin at startup of esp32 device from azure IoT central to initialize data . But could not find any example related to this. In the example esp32 chip the variable telemetryFrequencySecs does not get updated from azure IoT central twin property at startup of the device. Is there function to retrieve data from twin property when the user manually wants it ?