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 are various ways to do so in flespi: via REST API, in the dashboard, or with the help of a dedicated tool.
Re-register messages via GUI
This method is great for quickly updating a single or several consecutively received messages. Select the ones required in the Toolbox Messages pane, right-click, and pick 'Re-register messages' from the context menu.
Updated messages will be colored in blue.
Re-register messages via REST API
You can manually repost the desired messages using the following POST method.
First, copy a message by right-clicking on the Messages pane, then select 'Copy message'
Now proceed to the POST /devices/{dev-selector}/messages.
In the data section, click on the '{}' icon to paste the entire message as JSON. The imported message will appear on the right, with the 'object' fields populated. Then click the green arrow button to execute the request or copy the CURL and execute it from Terminal.
The result box will display the number of messages sent successfully and any errors encountered.
Using Re-register messages tool
If you need to re-register a big array of messages it might be a good option to use the Re-register messages tool on the main menu in your dashboard.
A window will appear on the right allowing you to select source and destination: Channel/Device <> Device/Stream. Specify the time interval, provide the required ID, and hit the Get messages button.
Actual and re-registered messages
Any re-registered message is different from the message natively received from the device:
It has a ‘rest.timestamp’ parameter,
It doesn't have ‘server.timestamp’ and ‘channel.id’ parameters
Note that besides ingesting custom parameters into JSON and posting them in the message you can:
- erase specific parameters in your message with the msg-erase plugin,
- copy selected messages to another device to duplicate or even merge devices with the msg-copy plugin,
- restore specific parameters from the stored message with the same timestamp with the msg-merge plugin.
Processing re-registered messages
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 to the flespi device, you make it a fully valid participant in the processing pipeline, which means that all relevant plugins, calculators, and streams will be considered and applied properly.