Automatically translate this page?

How to detect connection problems or check device state validity with calculators?

Using flespi analytics to detect GSM connectivity loss, GPS visibility loss, or other state change.

A counter in flespi analytics can determine its value based on the “active”-ness of the unfinished interval. If the “active” parameter for the interval is “true”, the counter will also equal to “true”; otherwise, it will be “false”. 

This dependency can help create notification triggers for the situations when a parameter state change occurs within the specified time, e.g. device goes offline (loses GPRS connection) or misses position data (loses GPS visibility).

You can use a non-zero max_inactive property of an interval selector to automatically trigger active interval recalculation upon timeout expiration if no messages have been received within the specified time and set interval active state to “false”.

create flespi calculator with max_inactive

To catch the “active” state change in realtime, subscribe via MQTT to the topic "flespi/state/gw/calcs/+/devices/+/active". Receiving a NULL message in this topic means that the interval for this device is no more active (i.e. timed out) and therefore the connection was lost or the GPS signal was lost.

check active interval state in mqtt board

By controlling for this parameter you can easily check fleet accessibility and get timely notifications about abnormal patterns. 

Alternatively, you can subscribe to "flespi/state/gw/calcs/+/devices/+/last" topic and analyze the state of the counter of "active" type — this way you will always have a message with the last valid device state. To catch invalid or unwanted state controlling for "active=false" value.

It is also beneficial that you get access to historical data about all situations when devices fail to go online within the expected interval via analytics API


Explore more capabilities of the flespi analytics engine filtering the KB by “analytics” tag.

See also
Configuring your device to send data to the flespi platform.
A comprehensive guide on the key concepts and principles of the flespi analytics engine.