The "msg-geofence" plugin type is used to detect if the position for a given device message is inside a at least one of geofence configured in plugin configuration. In that case it will add to the message parameters with the status (true/false) and the geofence names to the device message.
There are two operating modes for plugin - single geofence detection or multiple. You pick operating mode by setting hit_type option.
In single operation mode the plugin adds the name of the first hit geofence into the plugin.geofence.name parameter. The plugin.geofence.status parameter is set to "true" if any geofence is hit, otherwise it will carry "false".
In multiple operation mode the plugin will store into plugin.geofence.name parameter array with names of geofences the device was according to the position information in the message.
For both plugin.geofence.name and plugin.geofence.status you can pick other parameter names that plugin will output by setting name_param and status_param configuration options.
How to use
Click on the "+" button in the Telematics Hub -> Plugins section to create a new plugin:
Let's define a new plugin to monitor geofence status:
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:
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:
Done.
If you perform geofences detection with plugin and analyze intervals data (e.g. vehicle trips) with calculators you can use a counter of type="parameter", method="distinct" with parameter="plugin.geofence.name" to add to the interval array with names of all visited geofences during that interval (e.g. trip). This automatically will work for both single and multiple geofences detection modes.
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.