How to differentiate the data in IoT Central coming from multiple similar sensors(Philips hue bulbs) to a gateway device connected to IoT Central - azure

We have a Gateway device which is registered in IoT central application. This gateway device is connected to multiple similar Sensor devices such as Philips hue bulbs via ZigBee.
We are sending telemetry from sensors to IoT central via simple JSON
{"mac":"<mac address>","illumination":"200","bulb_status":"1"}
In IoT Central, we have registered our Gateway device as the IoT device with a device template which has telemetry properties related to Philips bulb and other sensors as well.
Now the challenge we are facing is, how to differentiate the data that is being sent by Philips bulb in room1 and Philips bulb in room2 in the IoT central as we have only 1 device registered in IoT Central.
The JSON has similar properties for both the bulbs and the telemetry values in IoT Central are being replaced by whichever device sends the last message.
Please provide me with the correct scalable approach for this kind of scenario.
Note: Consider our gateway device can't run IoT Edge runtime as of now. So we can't use it as Edge device.

There are two ways to tackle this. The first would be to program your gateway device to supply an identity to each of your bulbs. This means all your lamps will become a separate device in IoT Central (and you will be charged for them). Your gateway device will need to have the connection details for all of the devices it is sending telemetry for.
A second (not so pretty) way is to add a telemetry point to your interface for each lamp. So instead of brightness you would have lamp1_brightness and lamp2_brightness. I'm only including this in my answer because it is feasible and will result in seeing dashboard per lamp in IoT Central. It does not scale well either.
Eventually Azure IoT Edge will support Identy Translation, which can solve this and other questions

I have put up an E2E example of Nano BLE devices with data captured via a Central Gateway based on a Raspberry Pi using the Azure IoT Python SDK. This example is "in-progress", but I think you might find two files useful...
Main Project
https://github.com/Larouex/IoTCRaspberryPiProtocolTranslationGateway
BLE Project
https://github.com/Larouex/IoTCNanoBLESense33
File you might want to check out...
scandevices.py
https://github.com/Larouex/IoTCRaspberryPiProtocolTranslationGateway/blob/master/scandevices.py
This script uses BLEScan to find the BLE devices matching a naming pattern and writes them to a configuration file.
provisiondevices.py
https://github.com/Larouex/IoTCRaspberryPiProtocolTranslationGateway/blob/master/provisiondevices.py
This script and associated class use the Azure IoT SDK for Devices to read the devices in the configuration file and provision them in Azure IoT Central. The current code does a transparent approach and uses the identity of the BLE Device to provision and looks like a real device in Iot Central.
Over the next couple weeks I will continue to add the other scenarios like Opaque and Protocol Translation (which looks like the scenario you are interested in).
You may want to consider your differentiations of the Hues by modeling the locations and separate the telemetry values (versus plotting mac addresses), but you will hit some brittleness in versioning as you add or try to delete bulbs.
I recommend identify translation and associate each bulb with a model. Use the Device Groups for aggregate views. Then device properties because useful for location, etc.

Related

Azure Digital Twins <---> The Things Network (2 way communication)

I am working on a project that requires two-way communication between Azure Digital twins and the Things Network. Right now I am able to connect my AZDT to the TTN via an IoT HUB to update the twin with "read variables" for example I have a CO2 sensor that sends data via the IoT HUB instance to the AZDT.
However I am not sure how to do the communication the other way around, when I send a signal to a "write" variable, and this message is carried over to the device, for example I have a smart plug that can be turned off via the AZDT.
anyone could give me some ideas? or support on that?
thanks
did you check out the TTI IoT Hub integration documentation page?
There is a section that explains Desired Properties for updating values between The Things Stack and IoT Hub
https://www.thethingsindustries.com/docs/integrations/cloud-integrations/azure-iot-hub/device-twin/#desired-properties
To generate a downlink you need to update the shadow of the device and save it, which will schedule a downlink for the device on The Things Stack.
To trigger this from the twin itself, you need to update the Digital Twin state that contains the property of the device in question
I would take a look at additional docs from MSFT on this
e.g.,
Updating device twin in IoT Hub: https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-device-twins
Updating Digital Twin: https://learn.microsoft.com/en-us/azure/digital-twins/how-to-manage-twin#update-a-digital-twin
Hope this helps

Azure IoT-Hub Device Twin with Azure Digital Twin using DTDL: are they complements or alternatives? How?

There is some confusion between two aspects of Azure IoT-Hub. I see here that Azure Digital Twins (with DTDL) simplify device state management (reported, desired properties) when compared to Azure IoT-Hub Device Twins. However, I see here that they appear to be separate but linkable entities.
So the question: Can Azure Digital Twins (and DTDL) be seen/used as REPLACEMENTS for Azure IoT-Hub Device Twins. How? If not, why not, since having two separate Twins appears overly complex?
Note that we use the IoT-Edge and leverage its offline features of reported and desired properties in the Iot-Hub Device Twins.
Thanks!
Short answer: No
Longer and arguably more friendly answer: To leverage the Device Twins in IoT Hub, you need Device Twins in IoT Hub, but you can link it to your Digital Twin in Azure Digital Twins (ADT). If you want to include your Device Twin properties in ADT, you need to route your Device Twin messages to a Function that will make the translation to ADT. In this subsection of the docs, you can see the differences in notation.
If you want to let ADT 'drive' your Device Twin, you need to subscribe to ADT change notifications, consume them in another Function and apply the changes in the Device Twin in IoT Hub. This is currently all custom work, you can base some of the work on the link you provided in your question.
With regards to your question about complexity: it might seem a little complex to set up ADT as your single source of configuration, but when it's done, you have your config in one place. In practice, I'm not seeing this happen a lot.
Important to note
To make things a little more confusing, the first link you provided mentioned Digital Twins and Device Twins as if they're two different things, while in fact, it's three. You have the Device Twin in IoT Hub, the Digital Twin in IoT Plug and Play context and a Digital Twin within Azure Digital Twins. It's important to understand the differences between the three, as ADT is a separate system, but PnP Digital Twins and Device Twins are accessible through your IoT Hub.

How to transfer > 8K sensitive binary information to Azure IoT Device

How can an IoT device which connects to an IoT Hub using the Azure IoT Hub SDK retrieve larger amounts of sensitive data which is part of the device configuration?
I know i can use Device Twins as configuration documents per Device, but those are limited to 8K in total.
I need larger amounts of data in binary format to be transfered to the device when i a device - for example - gets reset to factory defaults or somehow loses it's local storage as part of a hardware fault.
I was thinking about using a D2C method triggering a request which results in a series of C2D or direct method calls to the requesting device transmitting the information in question (basically mimiking request/response behavior). However this feels like a workaround.
My other thought was about transmitting urls to a storage account as part of the device twin properties allowing the device to download the binary information using the Storage SDK, however given the sensitive nature of the information downloaded i can't directly expose this information to the internet using a public accessible container in Azure Storage.
So my last thought was to access a REST API which controls access to the information. However my concern is, that i break out of the secure communication channel, the IoT Hub SDK provides with it's build in communication methods and i have to secure the communication between device and the REST API using some kind of rotating secret anyway which could expose other risks along with a complicated custom implementation.
What is the suggested way of providing access to this kind of device-specific data for Azure IoT Clients?
I do recommend to use a new feature (still in the preview) of the Azure IoT Hub such as a Device Streams.
You can test this new preview feature using my updated tool Azure IoT Hub Tester (see Appendix A2)

I am trying to understand how to choose number of Azure IOT Hubs in a scenario where I have variety of devices sending variety of data

I am trying to understand on do I need to choose individual IOT HUB based on device category.
For Example I have devices sending GPS info.
Devices send stock info
Devices sending quality info.
Devices sending security info.
Devices sending fire safety info.
Each of the above category devices send versatile data in versatile format. In this scenario is it a best option to configure multiple IOT hubs or one IOT hub is suffice.
Thanks in Advance....
As the IoT Hub is totally agnostic to the actual data that you are sending, you would not need to have separate IoT Hubs per use case. You can still connect all the devices to one IoT Hub and then route the telemetry data, for example based on on device properties, to different downstream processing steps.
You might still want to use multiple IoT Hubs but mainly then for either scaling reasons or for geographical distribution.

Best method to send data to Microsoft Azure IoT central from multiple devices

I am looking for advice as to the best way to send data from multiple devices to IoT central.
To explain, I will be deploying 3-6 IoT connected microprocessors that will send data from multiple attached sensors to IoT central.
I will be doing this at just one location at first but eventually will be deploying these sensor networks at multiple locations. Each of these locations will need to have a personalized dashboard to view their sensor network data.
I am looking for any advice as to the best method to send this data to IoT central.
Thank you for the help.
Azure IoT Central recently released Device bridge which is an open-source solution that can be used to connect Sigfox, Particle, The Things Network, and other clouds to your Azure IoT Central app. You can access the open source solution from Github.

Resources