Send json via ESP32
kmw0044 opened this issue · 7 comments
Query/Question
I would like to send a json with the Azure Hub ESP32 SDK, but I can't find the right solution to modifiying the getTelemetry method.
Why is this not a Bug or a feature Request?
No new feature and otherwise the sdk works
Setup (please complete the following information if applicable):
- OS: Windows
- IDE: Arduino 1.8
- Version of the Library used 1.1.4
Information Checklist
Please make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
the data gets send to the hub but when I track it with the Device Explorer Twin i dont get a json but this:
temperature, moisture and uv are gloabl float variables
- Query Added
- Setup information Added
Telemetry data is not twin data. You can view telemetry data in the IoT explorer on the telemetry tab.
Hi @kmw0044. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.
Hi @kmw0044, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!
Hi so I got it to send the json correctly (my method was faulty), but now I have the issue that i want to send seperate messages, so for each sensor I need a seperate getTelemtryPayload. How can I integrate taht with sendTelemetry? And do I need seperate arrays for the telemtry payload?
Hello @kmw0044! You could create multiple methods, like getTemperatureTelemetryPayload and getHumidityTelemetryPayload, and then have multiple get_publish_topics and publishes
if (az_result_failed(az_iot_hub_client_telemetry_get_publish_topic(
&client, NULL, telemetry_topic, sizeof(telemetry_topic), NULL)))
{
Serial.println("Failed az_iot_hub_client_telemetry_get_publish_topic");
return;
}
mqtt_client.publish(telemetry_topic, getTelemetryPayload(), false);
within sendTelemetry to send them as separate messages (or you could break that into multiple methods as well if you don't necessarily want them sending at the same time)
Let me know if this helps, or if you have further questions
Hi @kmw0044. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.