How to monitor geofence status and add it into the message?

Using a plugin to detect if the position is inside a specified list of geofences and add status to the device message.

The "msg-geofence" plugin type is used to detect if the position from a given device message is inside a specified list of geofences and add parameters with the status (true/false) and the geofence name to the device message. The plugin adds the name of the first hit geofence into the parameter. The plugin.geofence.status parameter is set to "true" if any geofence is hit, otherwise it will carry "false"

Click on the "+" button in the Telematics Hub -> Plugins section to create a new plugin:

flespi panel telematics hub plugins

Let's define a new plugin to monitor geofence status:

flespi create geofence plugin

Note: you can add up to 1024 geofences into the plugin. If you need to check more than that, just create more “msg-geofences” plugins and assign them all to the device(s). If you use several plugins with geofences, you can add "$plugin.geofence.status==false" into their validate_message parameter to prevent overwriting - once some geofence in a given plugin is hit, other geofence plugins will not be checked.

Then we need to assign this plugin to the right devices. Go to the Plugins tab for the required device and click the "+" button:

assign geofence plugin to device

And then you should be able to see the geofence name and status fields in the new device messages. Go to the Logs & Messages tab for the given device to check:

check messages with geofence status data


Change log

Subscribe to the geofence plugin change log to stay in sync with any updates.

More plugin types

Find a comprehensive list of available plugin types here.

See also
Using plugins to replicate device messages.