How to stream intervals?

Forwarding intervals generated by the flespi analytics engine into your solution.

Sometimes you don’t need to stream the individual messages from your device(s) but want to stream aggregated data generated by the calculators

For example, you want to know when and where a vehicle left a specific zone (geofence). You will have a calculator created for this purpose that will look like this:

flespi calculator configuration geofence

and

flespi calculator config counter

Then you will have your device assigned to this calculator. Now you are ready to consume intervals (once they are generated, of course).

Below are the possible ways to arrange this with flespi.

[Option 1] Subscribe to the proper MQTT topic 

The most obvious way is to subscribe to the proper topic in the MQTT client. For example, with the case above, you want to subscribe to flespi/state/gw/calcs/{id}/devices/+/last to get the last generated interval from the calculator. The result will look like 

mqtt board interval topic result

Note that in the case with geofence ins/outs events you may also want to use the flespi/state/gw/calcs/{id}/devices/+/activated,deactivated topic to get the specific moments in time when crossing the geofence border occurs.

Find more flespi topics in our comprehensive MQTT topics list.

[Option 2] Stream data from an MQTT channel

If it’s not convenient for you to consume intervals directly via MQTT, you can do it via an HTTP stream to your platform. Here’s what you should do.

1. Create an MQTT channel that will connect to the flespi MQTT broker. Specify the topic with the desired intervals.

flespi mqtt channel configuration

2. Create an HTTP stream and configure it to forward data to your server.

flespi http stream configuration

3. Assign the MQTT channel to the stream:

flespi http stream assign channel

4. Now as the new intervals get generated, they will be forwarded to the target platform via the stream.

flespi http stream intervals


See also
Using advanced intervals aggregation capabilities to solve non-trivial tasks with flespi calculators.
Adding information about BLE beacons, DTC codes or visited geofences to the calculator's interval JSON?