Get node-red-contrib-persist to restore chart

@DeanC Thank you for your persist nodes! I have read through the documentation many times and tried a number of different configurations to get one of my UI charts to restore after a reboot/refresh, but so far to no avail. I have verified that the file is getting written to the correct directory on my Pi, and that this file is appropriately updating with the same data that is going directly into my chart (both chart and persist-in wired to the same message). However unable to restore. I assumed to use the persist-in wired directly to the chart and a few other configurations...Can you help a NOOB please?

Can you add a debug node to a 'persist output' node (that has exactly the same name as the corresponding 'persist input' node) and click inject on the 'persist output' node.
Is the stored data retrieved in the debug panel?

Paul, I have done that and when triggering the persist-out there is no message output to the debug. Both node configurations shown below:

persistin

persistout

Here is some of the data stored in the referenced file:

{"Temp Chart Persist":{"topic":"Outside_Temp","payload":[{"series":["Outside_Temp"],"data":[[{"x":1608416023345,"y":78.6},{"x":1608416023724,"y":78.53},{"x":1608416053730,"y":78.53},{"x":1608416083724,"y":78.46},{"x":1608416113725,"y":78.49},{"x":1608416143728,"y":78.46},{"x":1608416173728,"y":78.55},{"x":1608416203725,"y":78.58},{"x":1608416233735,"y":78.66},{"x":1608416263727,"y":78.67},{"x":1608416293727,"y":78.82},{"x":1608416323728,"y":78.84},{"x":1608416353727,"y":78.94}]],"labels":[""]}],"qos":1,"retain":false,"_topic":"Outside_Temp","_msgid":"1461e3b7.dba17c"}}

They don't have the same name.
Temp Chart Persist
Temp persist in

1 Like

May I ask if there is a way to limit the data stored by this persist node? As I have it on the output of the chart...and that chart is set to limit the X-axis to nnn-days or nnnn-datapoints, will the file being written to by persist inherit these limits? May concern (may be unfounded) is that this storage file grows infinitely.

The persist node will only save the latest data saved by the 'persist input' node, so everytime the chart is redrawn, the saved data will be overwritten with the latest data emitted by the ui_chart.

Please read the node readme.

"The last message wins"
Only the last message received within the storing interval is considered, all other previous messages are discarded. If no message is received within the storing interval, the next incoming message will immediately trigger a store procedure. Setting a large storing interval will reduce filesystem writes but will increase the risk of data loss. Additionally, the buffer is also stored when Node-RED is shutdown

Thank you for the quick reply...I read that but apparently did not fully grasp. I will thus assume that since the persist node is on the output of my chart and the chart is configured to only display xxx duration of data, then the data store will reflect accordingly.

Yes, that's correct.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.