# Save date depended data regardless of shut downs

**URL:** <https://discourse.nodered.org/t/save-date-depended-data-regardless-of-shut-downs/22503>\
**Category:** General\
**Created:** [2 March 2020 13:59 UTC](https://discourse.nodered.org/t/save-date-depended-data-regardless-of-shut-downs/22503 "2020-03-02T13:59:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dany17](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@dany17](https://discourse.nodered.org/u/dany17)\
**Post date:** [2 March 2020 13:59 UTC](https://discourse.nodered.org/t/save-date-depended-data-regardless-of-shut-downs/22503/1 "2020-03-02T13:59:56Z")

</div>

hello,  
I'm pretty new to Node-Red.  
I'm using a revolution pi and a janitza umg 605 to read energy consumption data of a coffeemaker.  
The revelution pi is not running permanently but is shut down, when the coffeemaker is not in use. This could be several times a day.

I need to find a way to get the total energy consumption data between 00:00:00 and 23:59:59 regardless of shutdowns and store it to a folder with the name of the respective date so i can read out the total energyconsumption of single previous days and compare it.

I get a value of the energy consumption every second and i know how to store context data to my file system. I already created a flow variable witch is stored to my file system every 30 seconds overwriting the previous value.

So what i need is:

- a way to get the current value right before the pi is shut down and store it to another file
- a function, that knows wich date it is and adds all stored "right before shotdown"-values for one day and store it to a file with the name of the date

I hope my question is kind of understandable.  
Thank you for ideas.

Daniel

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [2 March 2020 14:23 UTC](https://discourse.nodered.org/t/save-date-depended-data-regardless-of-shut-downs/22503/2 "2020-03-02T14:23:14Z")

</div>

Why not use a database to store the data (and a timestamp)?  
Plotting graphs & barcharts would then be so much easier.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [2 March 2020 16:04 UTC](https://discourse.nodered.org/t/save-date-depended-data-regardless-of-shut-downs/22503/3 "2020-03-02T16:04:33Z")

</div>

Indeed, InfluxDB is excellent at doing time-based storage and processing.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [1 May 2020 16:04 UTC](https://discourse.nodered.org/t/save-date-depended-data-regardless-of-shut-downs/22503/4 "2020-05-01T16:04:33Z")

</div>

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