Hi Nick,
Certainly, I can give some detail. I had two different thoughts in my mind, the format of the body and the ability to add a string to the end of the MQTT topic for Azure IoT Hub, sorry about that.
- The message sent from TTN to Azure IoT Hub has this form:
And as you can see, the Body property is a long Base64 string. Unreadable. I want that Body parameter to be a JSON string, so I can read it directly from the database.
Translated from Base64, the Body property is what is shown below. (I removed sensitive data and replaced with x’s, but this has everything we need for this post)
The frm_payload is sent as Base64 with encoding, I get that, but I want the “decoded_payload” to come through with no decoding needed, which means I want the decoded Body property as shown below to be sent.
{
"end_device_ids": {
"device_id": "eui-24e124743e043333",
"application_ids": {
"application_id": "lorawan-sensors"
},
"dev_eui": "x",
"join_eui": "x",
"dev_addr": "x"
},
"received_at": "2024-04-08T13:29:56.374311155Z",
"uplink_message": {
"session_key_id": "x",
"f_port": 85,
"f_cnt": 18,
"frm_payload": "AXVkBVsBiAFYAmwD",
"decoded_payload": {
"channel2Value": 5,
"channelValue": 1,
"header2Name": 91,
"header2Value": 1,
"headerName": 117,
"headerValue": 100,
"value1": 392,
"value2": 600,
"value3": 876
}
...
}
}
- I am using the Things Network IoT Hub integration: https://www.thethingsindustries.com/docs/integrations/cloud-integrations/azure-iot-hub/ It uses MQTT to send messages to Azure. That’s mostly what this post was about, can I change the MQTT settings of what TTN is sending.
It sounds like I can’t, so you might have answered my question.
Can I make a future feature suggestion somewhere? We should be able to direct which MQTT topics our messages are sent to, that way we can specify the message type.
Thanks for your time!