How to apply flespi to historical data?

Manually posting messages into a flespi device.

Flespi streams, plugins, and calculators are designed to work on real-time data, not process historical accumulated data. This means that plugins, calculators, and streams will only operate the data that arrived AFTER they were created and set up.

However, sometimes you want to overcome this restriction and there’s a way to do so in flespi.

You can manually re-post the desired messages using the following POST method:

https://flespi.io/docs/#/gw/devices/post_devices_dev_selector_messages

In the data section click on the "{}" icon to paste the entire message as JSON:

apibox edit json button

 Then click the green arrow button to execute request or copy the CURL and execute it from Terminal:

flespi device post message

Re-registering messages via GUI

Select the messages you want to re-register in the Toolbox Messages pane, right-click, and pick Re-register messages from the context menu:

re-register messages

Real vs manual message

Important! The manually registered message is different from the message received from the device:

  • It has a ‘rest.timestamp’ parameter

  • It DOESN'T have ‘server.timestamp’ and ‘channel.id’ parameters

flespi device logs manual messages

Note that you can ingest custom parameters into JSON and post them in the message (e.g. ‘driver.id’ parameter on the screenshot above).

Processing specifics

  • If the manual message falls into the existing interval that is within the calculator update_period, the interval will be recalculated.

  • If the manual message has the same timestamp as the existing message in the device storage, the message in storage will be overwritten, so no duplicates occur.

***

By manually posting a message into the flespi device, you make it a fully valid participant of the processing pipeline, which means that all relevant plugins, calculators, and streams will take it into account and will be applied properly.


See also
Using a plugin to detect if the position is inside a specified list of geofences and add status to the device message.
Using plugins to resolve information about Wi-Fi nodes into location data with the help of Google Wi-Fi Geolocation API.