Alert on communication loss

Is there a way to trigger a workflow alert or make a change in a dashboard color if communication is lost for more than a defined time?

Hi David,

The easiest way to trigger an alert on a workflow if a device is inactive and continuously sending state would be to use the Device Inactivity Node, and then use either an email, sms, etc. to alert people that need to be alerted. If it is not continuously reporting state then I would use a Device On Connect Trigger and Device On Disconnect Trigger. Each time one of these triggers occurs I would insert a row into a data table. I would then have a 3rd trigger of a Timer Trigger that will fire as frequently as you would like to check to see if the device has disconnected and if so what is the difference between now and the last disconnect time.

As far as the dashboard goes, assuming that you know the time of the last time the device communicated to Losant, you can use an Indicator Block on the dashboard. You can then add a condition that would be {{subtract (formatDate undefined β€˜x’) time}} > 5000 such that the formatData undefined β€˜x’ resolves to the current time now, and subtracts the variable time, which is the last time the device reported. The result of the difference will be in milliseconds. Then you can add make the block a different color and add some kind of warning label to it.

Hope that helps.
Erin

1 Like

Hi Erin
Thanks for this. I’ll try the workflow. Sorry for the naive question, but for the Dashboard do I have to explicitly define β€˜x’? {{(formatDate undefined β€˜x’)}} does not resolve into a value when I try to display it in an indicator block, while {{time}} does. Thanks

I believe it’s the extra (). This {{formatDate undefined 'x'}} should be resolving to the time in milliseconds. If you wanted to display the current time in a human readable format you can do {{formatDate undefined}}. The parentheses are required when wrapping {{formatDate undefined 'x'}} into a subtract helper, like {{subtract (formatDate undefined β€˜x’) time}}.

Thanks,
Erin

Erin. Perfect - thanks so much David