简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM