Add device id via payload converter for Azure IoT Central Device Bridge

For the integration with Azure IoT Central Device Bridge, the http integration needs to send payloads in the form of :

{
    "device": {
        "deviceId": "my-cloud-device"
    },
    "measurements": {
        "temp": 20.31,
        "pressure": 50,
        "humidity": 8.5,
        "ledColor": "blue"
    }
}

I am somewhat successful in using the ttn built-in payload decoder en converter, but I cannot seem to figure out how to get the deviceId.

Does anyone have any idea on how to access the ttn properties of the device that sent the payload in the payload converter?

2 Likes

Hi, @KimVdd:
I have been trying out the Azure IoT Central Device Bridge and with the help of a few people there solved some of my issues related to the deviceId; you may want to check if your code contains some of the problems I was having, and possibly you might just reinstall the Bridge from scratch. For some reason my bridge was pulling the Device EUI (hardware_serial), not the deviceId (both of which are in the metadata). If you look into their code on lib/engine.js, “measurements” is used to extract the payload.

Once you see your payload decoder in TTN working (mine outputs the following):

{
  "battVolt": 4.1839599609375,
  "measure": 9731.4453125,
  "state": 0
}

and the Azure IoT Central Device Bridge installed, you can setup the http integration on TTN using the “Get function URL” from the Azure IotC dashboad under the function “IoTCIntegration”. After I had my variable issues worked out, and the templates created, it started working smoothly.

Hopefully that helps a little.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.