How to combine messages from several flespi devices into a single one

Using flespi plugins to pack together the data coming from two or more related devices.

There are many cases when data from different devices must be analyzed under the same business logic. For example:

  • The truck and the trailer both have trackers installed. The positioning and CAN-bus data from the truck must be analyzed together with sensor values from a trailer in a single report.
  • The vehicle and the driver. The data from the vehicle tracker must be analyzed along with the data from the driver’s personal tracker or soft-tracker app.
  • The vehicle and the emergency beacon tracker. Security companies hide an additional beacon-tracker inside the car to catch its position if the intruder disables the main tracker.
  • The vehicle and the satellite communication tracker. Satellite communication is expensive, while cellular is cheap. By making a pair, you can transfer telemetry data from a usual GPS tracker via Iridium satellite communication network.

Our goal is to combine the data from two (or more) related devices into the single device for easy processing and more comprehensive reports. You can achieve this with ‘msg-copy’ plugin which enables you to automatically re-post device messages in real time to another device. You can easily copy selected messages only, combine device messages, merge multiple devices into one, and even create a 'device shadow' in a separate account.

How to use

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

Name the plugin and check 'enabled' to activate it. 

The ‘Include parameters’ field requires at least one parameter that will be copied to another device (wildcards and comma-separated lists are supported). Leave this field unchecked (*) to copy all parameters automatically. 

The ‘Exclude parameters’ field is optional and follows the same syntax. 

Note: this plugin requires a flespi token to operate (you can click on a ‘hand’ icon to select one from the list of available tokens). This token should have access to the device to which messages will be copied. To simplify configuration you may use standard token. If you want token access fine-tuning you should provide access to messages submodule with POST method of the corresponding paired device.

Same as other this plugin supports validation in the ‘validate_message’ field if you want it to apply (copy) to a subset of messages only.

Now we need to assign this plugin to the right devices. Go to the Devices tab for the required device and click the ‘+’ button for a list of available plugins. 

Each device assigned to this plugin also requires an associated device ID to specify where messages will be copied.

Once the plugin is applied to the device it copies messages into the target device storage conforming to the ‘validate_message’ expression. As the messages are re-posted via REST they will be highlighted in blue.

Processed, rejected, and skipped messages are counted and reported in the plugin log for diagnostics.

Done

Tip: You can analyze the traffic for any troubleshooting: right-click on a message in the plugin’s Logs, choose View traffic, and switch view mode from Hex to Text in the right-most.

Change log

Subscribe to the msg-copy 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