How to script custom parsing logic for message payload?

Using plugins with PVM code to instruct how to parse payload in the device messages.

The "msg-pvm-code" plugin type is used to add PVM code for custom parsing logic.

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 device plugin that will remove the position parameters (as GDPR regulations require) if the private.mode parameter is set to true (boolean value). 

Note, you can add the private.mode parameter to messages using the "item-fields" plugin. Set higher priority to this plugin to ensure the private.mode parameter is already in place before our "msg-pvm-code" applies.

add plugin with pvm code

Translation: if the message contains private.mode parameter and it is set to true, delete the following position.* parameters.

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 with pvm code

And then you should be able to see that position.* parameters are no longer present in the new device messages when the private.mode is true. Go to the Logs & Messages tab for the given device to check:

check that plugin with pvm code applied

Done.

More plugin types

Find a comprehensive list of available plugins types here.


See also
Using plugins to resolve position coordinates into address using Here reverse geocoding API and add it into the device messages.