Add the "inactive" interval selector and specify the desired value of the inactivity threshold to instruct the flespi analytics engine to catch "gaps" in messages (caused by loss of GPRS connection or GPS visibility) that exceed the specified value:
Use the "activated" event (flespi/interval/gw/calcs/+/devices/+/activated topic) to catch the occurrence of the inactivity event.
Also, you can subscribe to the "flespi/state/gw/calcs/+/devices/+/last" topic and analyze the state of the counter of the "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.
If you need to get access to historical data about all situations when devices fail to go online within the expected interval via the analytics API.
Explore more capabilities of the flespi analytics engine filtering the KB by the “analytics” tag.