4

Context: I am sending temp/humidity data from an NCD.io sensor through a gateway device to Azure, where it is being stored in the IoT Hub, somewhere.

enter image description here

Problem: Where is this data? I can access it through the device twin & also see it being sent via the Azure CLI, but the data logged in the IoT Hub only conveys information about the gateway message itself, not the actual data. The screenshot is a chart of messages received to date; I can go step deeper and glean insights about the messages but nothing about the sensor data.

enter image description here

Can this information only be accessed via another service? Is there no way to view data in the Hub?

Looking for clarification, tips/tricks. Thanks!!

Andras M.
  • 43
  • 4

2 Answers2

1

Azure IoT Hub doesn't act as Telemetry database for querying the data. Indeed it's storing the data for the specified time defined in the retention policy but you don't have a direct access to it from the portal. To get the data you can do the following -

  1. Create a Message Route on the Device Telemetry Messages that will route your messages to an external storage. https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-d2c
  2. Create an Azure Function with IoT Hub trigger that will get the messages and then you can programmatically route them. https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-iot-trigger?tabs=csharp
  3. Use tools like Device Explorer - https://docs.microsoft.com/en-us/azure/iot-pnp/howto-use-iot-explorer
  4. Use the EventProcessorHost library to get the data https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-event-processor-host
shachar
  • 234
  • 1
  • 2
0

Here are a couple of articles that may explain it for you.

https://docs.microsoft.com/en-us/previous-versions/azure/iot-accelerators/iot-accelerators-remote-monitoring-sample-walkthrough

https://azure.microsoft.com/en-us/blog/route-iot-device-messages-to-azure-storage-with-azure-iot-hub/

From the first link. Basically seems to me that by default the data is kept in CosmoDB. That makes sense to me as it would be the perfect place as I believe I read CosmoDB guarantees single digit latency and it is massive and designed for such things.

Apparently, there is some abstraction that lets you access it through the Storage Adaptor Micro Service. So I think that is why you can assess it through the Device Twin.

The second link speaks about being able to save the data to custom endpoints like blob storage. I suppose if you want access to the data to download it is possible.

I am not an expert but interested. Hope this helps. If someone gets a different interpretation of the Microsoft links I am interested.