Azure / azure-iot-arduino

Azure IoT library for the Arduino
Other
167 stars 96 forks source link

unable to find any example to send twin back to cloud #98

Closed tariqmatech closed 4 years ago

tariqmatech commented 4 years ago

I am able to receive device twin to arduino, but not sure how to send back the reported properties.

i see there is a function Esp32MQTTClient_ReportState which I believe is to send the state back, but not sure how the object would look like. I tried sending following but the reported property of device twin in azure is still empty.

{
"Reported": {
"Property1": "value1",
"Property2": "value2"
}
}
joecoolish commented 4 years ago

I've been working with this source. I haven't gotten it working, but I believe this is how you do it.

https://github.com/Azure/azure-iot-sdk-c/blob/7a426159c1187715934a793e3e0b84bf955ea2a4/iothub_client/samples/iothub_client_device_twin_and_methods_sample/iothub_client_device_twin_and_methods_sample.c

jbobotek commented 4 years ago

Note that there is not currently an Arduino adapted sample for this feature, but if your plan is to adapt that sample, I would probably drop as much of that sample as you need into the current esp Arduino example and see what other files you need to add from the main C SDK.