How to add static parameters into the message?

Using plugins to add new fields into the device messages.

The "item-fields" plugin type is used to add static fields to the designated devices and/or to add to the received messages custom parameters associated with the device. On top of this it is possible to reference these fields and their values in REST API selectors.

This is the most convenient way to enrich messages from devices with additional per-device data such as VIN number, vehicle plate number, driver name, customer ID or any custom data you would like to add into message from device.

With plugin you define fields schema and when plugin is assigned to device for each device you configure the data - actual values for these fields.

How to use

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 for devices that will add a customer_id field that is a positive integer and a required field:

add new plugin add message field type

Note: by default, the plugin fields will be added and stored in the message and telemetry (edit the "store" setting to change that behavior).

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 plugin to flespi device

And then you should be able to see the new field in the new device messages. Go to the Logs & Messages tab for the given device to check. As you can see each message now contain new "customer_id" parameter with the value you specified in device to plugin assignment:

field added to message in logs

Done.

Independently of the "store" configuration option value, you may now reference plugin fields values to address a specific device in REST API calls, for example GET /gw/devices/plugins.fields.customer_id=12345/messages to fetch its messages. 

Similar functionality you may achieve with device metadata however item-fields plugin gives you simpler configuration, stricter field values control and built-in UI in flespi panel to edit field values.

Change log

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

More plugin types

Find a comprehensive list of available plugins types here.


See also
How to add data generated by calculators to device messages
Using a plugin to convert value with a stepwise linear function