Hello everybody,

I've got a question regarding storing Data in node-red.
I have a Wallbox with an endpoint that delivers the amount of energy in kWh used. Every day this amount grows.
I already thought about storing the "yesterday" value in a global and substract it from "today" to receive the amount used "today". That would deliver me the amount used on every day, which I want to display. When I do that every day I'd have a nice chart of the amount used from day to day and can also add the values up to see the amount for each month.

Unfortunately I am not sure how to store the date in node-red for this feature. As far as I know I have only standard varialbes that I can use - no arrays or anything like that. Or am I able to create an array , maybe a JSON? and store it to a standard global variable? I would need to parse it afterwards to inject it to the chart everytime.

I am not quite sure if this would be possible in node-red. Any recommendations?

Thx for any hints.

Best regards

Yes you can store an array of objects in the context storage and parse it for chart input.

You can also feed live data into your chart and the chart will output an array of historical data inputted.

There are numerous posts on how to parse data for the chart node, have a go and come back with more question if you need more help.

1 Like

Yeah, it seems that works. Nice.
I stored the data in an object with dates as keys and energy amount as values.
the Object itself gets stored in a global to be recoverable.

Now I'll try to push that into the chart in a nice way...

1 Like