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.
Our goal is to combine the data from two (or more) related devices into the same Wialon unit for easy processing and more comprehensive reports.
Traditional dataflow: HTTP stream to “flespi gateway” devices in Wialon
Normally, the HTTP stream to “flespi gateway” uses the ident message parameter as an identifier mask for Wialon:
Using plugins to combine two flespi devices into a single Wialon unit
With the flespi plugin, you can add a custom field (in the example above it’s “Unique ID”) to each device that can be used as an identifier mask for Wialon. Setting this field to a common value for a group of devices allows combining messages from different devices into one Wialon unit.
The following how-to guide assumes that two different devices are already connected to flespi. And the goal is to make them report into a single Wialon unit.
Step 1. Create a custom plugin
- Navigate to Telematics hub -> Plugins -> “+” to add a new plugin
- Give the plugin a meaningful name and pick the "item-fields" plugin type
- Add a field of the string type and give it a name (above we decided to name it unique_id).
Step 2. Add plugin to devices
- Open each flespi device you want to combine into a single Wialon unit.
- Navigate to the Plugins tab.
- Add the plugin created in the previous step into each device.
- Type a common value into the plugin’s Unique ID field for each device.
Step 3. Create an HTTP stream from flespi to Wialon and add both devices to it
- Create a stream to Wialon.
- Use the %unique_id% as the identifiers mask.
- Go to the Devices tab in the stream settings and assign both devices to the stream.
Step 4. Create an “aggregating unit” in Wialon.
- Create a new unit in Wialon.
- Set the device type to “flespi gateway”.
- Specify the same Unique ID that you used in the respective plugin field.
Step 5. Check messages for the new unit
When you open the Messages pane, you should see messages from different flespi devices:
A careful reader might notice that there is no problem in joining not only two but any number of flespi devices into one Wialon unit.
If you need to send configurational commands to devices connected to Wialon via a flespi stream, you can use the ident in the custom plugin field. Thus it will work only with one device in the group.