none
Decode uploaded sensor data from base64 into readable string using an Azure tool and storing it into a blob RRS feed

  • Question

  • I am currently getting sensor data uploaded from a ST Micro SensorTile sensor and it is stored in a file of many JSON objects in this format:

    {"EnqueuedTimeUtc":"2019-06-24T19:53:37.7780000Z","Properties":{},"SystemProperties":{"connectionDeviceId":"test-tile-box","connectionAuthMethod":"{\"scope\":\"device\",\"type\":\"sas\",\"issuer\":\"iothub\",\"acceptingIpFilterRule\":null}","connectionDeviceGenerationId":"636967479491360563","enqueuedTime":"2019-06-24T19:53:37.7780000Z"},"Body":"eyJpZCI6InRlc3QtdGlsZS1ib3giLCJ0cyI6IjIwMTktMDYtMjRUMTU6NTM6MzcuMTg2LTA0MDAiLCJneXJvc2NvcGUiOnsiWCI6LTMyNTIuMywiWSI6LTIxNDkuOCwiWiI6Mjc1My4xfX0="}

    The body contains the information important to the sensor. After decoding, the body contains the JSON object I am most interested in.

    What options do I have in azure to decode this string and store it in a blob storage or other form of storage. For example, there is gyroscope data of x, y, and z in the body of the message and I would like to store this in a logical way in an azure database.

    Any information would help.

    Thanks

    Tuesday, June 25, 2019 5:17 PM

Answers

All replies

  • Hi Joey,

    I would use message routing on Azure IoT Hub -> Azure Function (to decode the message) -> Azure Blob Storage in the end.

    Please also check Azure IoT Reference Architecture.

    Hope it helps! Thanks.

    Thursday, June 27, 2019 10:37 AM
    Moderator
  • I have Azure IoT Hub configured to send all messages to blob, in JSON format. It's working. As above, the {body:xxxx} of the message that contains the actual IoT telemetry is encoded.  The rest of the message is in normal JSON format, human readable.  

    Confused.. What good is sending encoded/binary string data to Blob?  I thought by choosing JSON instead of AVRO, I'd have a full human readable file, complete w/ all the IoT telemetry for viewing in tools like PowerBI or Excel.

    What am I doing wrong? Thanks.

    Monday, October 7, 2019 12:21 AM
  • Hi Eric,

    I don't think you are doing anything wrong. It will depend on case by case. We can look at your solution on another issue if you be so kind to open it.

    Thanks!

    Tuesday, October 8, 2019 1:59 PM
    Moderator
  • Thanks Antonio.  No need to open another issue.  I'm able to consume IoT Hub messages via tools like Azure Streaming Analysis & decode/direct to locations as needed.  My question was purely theoretical, with a bit of feedback: If you give users the choice to route data to a blob-source using JSON, the expectation is that the full message, inclusive of the telemetry (body) is text-readable. 
    Tuesday, October 8, 2019 2:20 PM