2

I want to create a rule to check when my device stops sending messages to IoT Central.

For example, when I have a power outage and my device stops working I want to be able to fire an action: send email, run an Azure Function, etc.

I was thinking of creating a command to send a message to my device and then try to read it back. Then I would create a job to run this command but this doesn't seem to be right way to deal with this.

Is that possible? What should I do?

EDIT I already have some telemetry information being sent from my device to the cloud. If I was able to calculate the time past since the last message, I could create a rule (ex.: When time is greater than X) to fire an action.

  • You can integrate IoT Central with an Azure Stream Analytics and added a job for your business requirements. – Roman Kiss May 21 '19 at 18:48

2 Answers2

2

This Microsoft tutorial deals with your scenario. The telemetry is exported to an event hub and Stream Analytics checks if a device stops sending telemetry.

It seems you can't do this in IoT Central without exporting the data somehow.

Matthijs van der Veer
  • 3,865
  • 2
  • 12
  • 22
0

You can try to create virtual health monitor device in a cloud which will periodically ping your physical devices . For example cloud device x will have telemetry 'HealthDeviceAtHomeA', if you able to reach device A from cloud device X you are sending telemetry HealthDeviceAtHomeA = 100, otherwise HealthDeviceAtHomeA = 0 . Then for device x create a rule that will check average of HealthDeviceAtHomeA for last 5 min and if it less then for example 50 you will alert. This will ensure connectivity and you can define different rules and logic as a number of your devices grows. If you have firewall restrictions then your home device can report its health to virtual health device.

George Trifonov
  • 1,971
  • 17
  • 20
  • George, is it possible to create a rule to verify the average of my telemetry in the last 5 minutes using Azure Iot Central? I know that I can keep firing an Azure Function through a job to do that but I don't think this is best way to do it. – Antonio Vildes Barbosa May 21 '19 at 18:12
  • You can try to create count rule for event X for period Y. Example: define event connected and send this event very 30 seconds. create a count event rule for last 10 minutes and if count fill be less than 10 trigger an action. Please note that rules are firing when there is some data for specified interval, so once it has been fired there will be a point when you will have no data for specified window of time and rule will not be evaluated. I didn't tried it myself but it should work – George Trifonov May 21 '19 at 18:54