No connection to Azure IoT, delayed intermediaries - azure

Consider a device placed in no GSM area, i.e. underground or in a pipe or similar. Those devices needs to be updated, checked, enabled/disabled via smartphones of workers passing by. Does Azure IoT support some kind of solution to this? Meaning a smartphone would store a command to a device or to Azure IoT till it reaches connection to Web.

Related

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.

Mobile app to iot communication in azure iot hub

I want to implement the following system.
There are users and each user will have an IoT device. The user should be able to do the following:
Login with their email and password.
Control the IoT device in real time (the user will perform some operation on the IoT device and the result will be displayed instantly on the app).
See the state of IoT device in real time. If something changes on the IoT device it should reflect on the app in real time.
I was wondering if this is doable using azure IoT Hub. I came across an architecture where the device is connected to IoT hub and the app is connected to signalR. The messages from IoT device will go to IoT Hub which will update the app using signalR.
But is there any way we can not have additional component like signalR? Can IoT device and mobile app be connected directly to azure IoT hub and exchange data between them without an entity in between other than IoT hub?
Connecting mobile app to IoT hub seems like an option but I did not find any way to implement email and password based authentication to allow users to connect to IoT hub.
Any help in this regard is appreciated.
You could absolutely go without SignalR. You can use the IoT Hub Service SDK to send C2D messages to your device from your phone, and also listen to the device telemetry with the same SDK.
However, it would probably be a better idea to have some restrictions on what you can do with that SDK. If the user first has to log in, I take it that they don't get access to every device in your application? Using some kind of role-based access might be preferable, you would build an API for that, which then uses the Service SDK to give you the data.
Also, even though you could listen to the device data directly from your phone, that means that if you have bad reception/wifi, data might not be received. You might want to consider storing it somewhere? I don't know the details about your application, but if you would then want to listen to events from that storage and send it to your app... SignalR might not be the worst idea.
"See the state of IoT device in real time. If something changes on the IoT device it should reflect on the app in real time."
For this EventGrid integration (https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-event-grid ) would help. For realtime telemetry as Matthijs said SignalR would be a better choice.If you are fine with some delay (say 10 sec) then Azure Time Series Insights can also be used.

Azure Iot Hub: Revoke device session

I am currently looking for a way to revoke the device session of a device that is connected to the Azure Iot Hub.
For example, when a device connects using a certificate and the certificate expires, the device can still send and receive data while it has a valid token.
Our case is if a device overloads our IoT Hub for whatever reason, we would like to be able to revoke the connection immediately.
We want to be able to revoke such token in order to immediately disconnect a certain device.
Is it even possible to do so? If not, are there workarounds for that?
You can disable a device to connect to the IoT Hub. I just tried this with a simulated device (using the .NET SDK) that was actively sending data. After I turned the switch to Disabled, the connection broke off after a few seconds. This was using the device key, not certificates but I would assume this might work as well.
There is no such as the REST API in the Azure IoT Hub to disconnect connected device. However the following workarounds can help it:
Based on the MQTT Device protocol, only one device with the same ID can be connected to the Azure IoT Hub, so connecting the same device (simulated the same ID) will automatically disconnect a connected one. This workaround doesn't require any change in the device code. You can test it using a tools such as MQTTBox, MQTT.fx, etc.
This workaround is based on invoking a device method to perform closing a device from the device side. You can create a job for Azure IoT Hub background process to "invoke device method". Note, that this workaround needs to built this feature into the device code.
Also, using a notification event on the twin desired property change received by device side can be used for your workaround to perform a closing or re-connecting connection with an Azure IoT Hub.
Edit:
Like #silent answered, changing the state Enable to Disable, the device is going automatically disconnect from the Azure IoT Hub. You can use a REST API to change this status.
I do recommend to built in the device some retrying policy for re-connecting a device to the Azure IoT Hub based on the disconnecting reason such as connection lost, user disconnected, etc.

Minimum requirements Azure IoT Hub

Does someone know the bare minimum required for a device to connect to the Azure IoT Hub and to send and receive messages (in terms of memory usage, processing power etc.). Or is this really case-specific?
I couldn't find a conclusive answer on the web. Does someone have experience with this?
Many thanks!
Does someone know the bare minimum required for a device to connect to
the Azure IoT Hub and to send and receive messages (in terms of memory
usage, processing power etc.).
As #juunas pointed out, it is hard to say precisely.
But you can check from the following two aspects(I assume you mean devices that communicate directly with Azure IoT Hub):
Using Azure IoT SDKs, the device needs to be capable of establishing an IP connection, support TLS, have at least 64KB of RAM ...
Using REST api, the device can connect to the Azure IoT Hub and to send and receive messages directly over the Internet from any application that can send an HTTPS request and receive an HTTPS response.
There's nothing like system/set-up requirements for Azure IoT Hub so there's no specific document from Microsoft talking about this topic. Depending on your target application you can pick the device, as all descent embedded devices can act as IoT device for Azure.
You can take a look at Azure Certified IoT device catalogue and find out whether particular device is listed under that.
MS has published 2 Whitepapers on this. You may find this useful
Evaluating Your IOT Security
The right secure hardware for your IoT deployment

Microsoft Azure to embedded device communcation

I have a question about an Azure IoT project based on Windows Azure. In short; it's an embedded application (ARM based device, running on a custom RTOS) who's sending device information to Windows Azure using the recently announced Serverbus Event Hub. It's using the HTTS endpoint of the Event Hub to send it's information to. So for so good.
But now I want to "talk" to the device from the cloud. Basically, I have a website running on Azure, and I want to send commands to that device (which is not 100% of the time connected, as it's an on-the-field device). What's the best way to do this? What technologies can I use?
Do I need to use Sockets, TCP connections, long-polling HTTP requests, ..? The big 'thing' is that the device is running a custom RTOS, so there are no libraries or whatsoever available..
Thanks! :)
You can think about AMQPS and Azure Service Bus Topics/Subscriptions. Create a subscription with a filter (e.g. by device name or ID) for each device and send annotated messages to the topic.
Count of subscriptions limited by 2000 for 1 topic.

Resources