How to set up notifications about device message parameters change?

The guide on how to set up a calculator to receive live customizable MQTT messages when device parameters change according to a complex condition.

Consider the following task: you need to receive a live customizable notification when some of the device parameters change according to a complex condition. E.g. get MQTT message with vehicle position about engine status change based on engine.ignition.status parameter. In this article we consider how to achieve this using the flespi analytics engine in three basic steps:

  1. Create a calculator
  2. Assign an appropriate device to the calculator
  3. Subscribe to the calculator’s special topic

We assume that we already have a registered device getting a constant message inflow with engine.ignition.status and position parameters.

Step 1. Create a calculator

One may find calculators in the Telematics Hub section of the flespi panel. Pay attention to the following details:

  •  messages source must be “device messages” (calculator can also accept data from other calculators)

  • selector’s type is a boolean expression “engine.ignition.status”. You should also check the merge_unknown checkbox so that messages without engine.ignition.status parameter do not cause the interval to end.

  • add a counter of “parameter” type. We don’t need to do any calculation here — just use the plain latitude and longitude values.

Step 2. Assign a device to the calculator

To assign a device to the calculator go to the device’s CALCS tab, click on ‘+’ sign and select the appropriate calculator. New calculator card will appear.

Step 3. Get notification message

The calculator will automatically analyze the incoming messages and generate the message according to calculator settings to the topics flespi/interval/gw/calcs/{calculator-id}/devices/{device-id}/created.


See also
Adding information about BLE beacons, DTC codes or visited geofences to the calculator's interval JSON?
Using plugins to resolve the coordinates of GSM base stations and Wi-Fi networks into position coordinates using Unwired Labs API.