The "msg-expression" plugin type is used to add a new message parameter with the value calculated in the specified expression.
Click on the "+" button in the Telematics Hub -> Plugins section to create a new plugin:
Let's define a new plugin that will calculate the current speed in mph and add it to the speed.mph message parameter:
Then we need to assign this plugin to the right devices. Go to the Plugins tab for the required device and click the "+" button:
And then you should be able to see the new calculated field in the new device messages. Go to the Logs & Messages tab for the given device to check:
Done.
Advanced note: replacing existing parameters
If you specify the name of the existing message parameter (e.g. position.altitude) as the plugin field name, the respective original message parameter will be replaced by the value from the plugin:
Case: how to detect value change
A frequent need is to detect whether a specific parameter has changed compared to its previous value. To achieve that, you can create an msg-expression plugin that checks if a particular parameter (or set of parameters) has changed "param1 != #param1" and then adds the parameter "changed = true". After that, you can use a validate message expression "changed == true" in the item configuration.
Change log
Subscribe to the expressions plugin change log to stay in sync with any updates.
More plugin types
Find a comprehensive list of available plugin types here.