Plugins — customize messages for flespi devices

Complement and/or transform your device data to meet the requirements of a third-party platform.

Plugins are used to inject, delete or modify data received by the flespi devices to prepare it for further consumption and use in a variety of cases such as streaming into government-regulated systems, toll roads services, various telematics data aggregators, and the like.

The device plugins can be used to:

  • Store custom information in devices and use it in REST selectors. For example, add your customer id or phone number field to all devices.

  • Publish custom information into device telemetry.

  • Add custom information into JSON message representation that is published into MQTT and streams. Thus your system will be able to receive some special device attributes or operate based on this data. We are using this for implementing a tollbg plugin and stream. Another use case for this is to stream multiple devices under the same identifier.

  • Add custom information into JSON message representation that is stored in the flespi database. This allows you to post-process your own data with flespi analytics — build reports and trigger notifications.

  • Validate data received from the device and retain validated parameters value. If the message doesn't pass validation expression, the plugin won't be applied to the message at all.

  • Delete specified parameters from the received messages.

  • Add custom parsing based on the user-defined parsing scheme written using our special PVM language.

Plugins for devices define the schema of fields, how to validate field values, and what to do with them at different stages of the flespi message pipeline process. The current configuration of devices attached to the plugin can be retrieved via the REST API or by subscribing to flespi/state/gw/plugins/+/devices/+ MQTT topic.

Types of plugins

Below is the list of currently supported plugin types:

Plugin type

Description

item-fields

add static fields to the designated item, some of the fields can be stored as message parameters

msg-expression

add new message parameters as a result of evaluating expressions

msg-erase

remove the listed parameters from the message

msg-pvm-code

execute PVM code to process the message

google-reverse-geocoding

resolve the position address using Google reverse geocoding and add it to the message

nominatim-reverse-geocoding

resolve the position address using Nominatim reverse geocoding (OSM) and add it to the message. Public and private servers supported.

wialon-reverse-geocoding

resolve position address using reverse Gurtam Wialon geocoding and add it to the message

wialon-lbs-geocoding

resolve position coordinates using LBS Wialon geocoding and add them to the message

Plugins priority

If you assign several plugins to a device, you may want to apply them in a specific order. Use the priority parameter in the plugin configuration to arrange the required order. The higher the number in the priority field, the earlier the plugin will apply.

Data validation

Use the validate_message field in the plugin configuration to specify the validation expression that should succeed for the plugin to apply. If no validation expression is specified, the plugin will apply to all messages.

flespi plugin configuration validate message

Timezone

Use the timezone field in the plugin configuration to specify the correct timezone for all time/date-related operations in selectors and counters.

flespi plugin configuration timezone

***

Read a comprehensive article on plugins here.


See also
Using flespi plugins to remove the location data from telemetry messages according to the specified schedule.
Using plugins to resolve the coordinates of GSM base stations into position coordinates using Wialon LBS geocoding and add them into the device messages.