WolfMQTT JSON IoT Explorer

SnackMahana 21 Reputation points
2021-12-20T21:42:17.683+00:00

Hello, I am developing a sensor using WolfMQTT on pic32mz chip. I want to modify my publish JSON message to contain information in the 'header' segment -- specifically "Product" and "MessageType". Currently, the data hardcoded is applied to the body. Is there a way where I can format the data to be included in the header?

Hardcode message:

    #define APP_MQTT_COMM_MSG           "{\"Product\":\"Comm\",\"MessageType\":\"Message\",\"Header\":{\"CMD\":\"FORWARD\",\"UID\":\"002409020C00090E\",\"GW_UID\":\"002409020C00090E\"},\"Body\":{\"OCB_UID\":\"002409020D000013\",\"IOT_SEQ\":2,\"OCB_SEQ\":2,\"OCB_RSSI\":84,\"OCB_LQI\":255,\"DATA\":\"D0D1C4AED7086A1C71E2523156FAF1CAC442497DC4F4940846F4485007EE0A805A9E60D7E4B1CCF96294C3A3BB47\"}}"  

159094-image.png

Azure Internet of Things
0 comments No comments
{count} votes

Accepted answer
  1. Roman Kiss 2,246 Reputation points
    2021-12-21T08:48:23.987+00:00

    Hi,

    there is no way to make a telemetry data transformation in the Azure IoT Hub (something like we have it in the Azure IoT Central) and only the message enrichments is supported in the Azure IoT Hub.
    You have to do it outside of the IoT Hub, for instance: Azure function, Azure Stream Analytics job, etc.

    Another way is to add some values into the message properties using the publisher topic (at the device side), see in the following example:

    devices/mydevice1/messages/events/$.ct=application%2Fjson&$.ce=utf-8&Product=Comm&MessageType=Message  
    

    Thanks
    Roman

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.