Node Red Runtimes

Hi All,

I would like to create a "master time" in Node-Red (if there isn't already built into the program) that basically just counts the total time that the Raspberry Pi its running off is on and Node-Red as a program is running. From there, we want to break off the timer into its individual components and monitor the total runtime of each component and each operating mode. So for example if the master time has been 24 hours running, and our digestion tank has been running for 12 hours, it has been 50% utilized. I have indicators from the PLC showing me when a component is on or off, I just am unsure about the "master time" counter that will be the baseline.

Many thanks

Save the current time when node-red starts up and then you can work out the time on just by subtracting the start time from the current time.

Will this be able to add times as well? Say the Raspberry Pi is shut down and turns back on, can it add that previous runtime to the current one? If so, could you briefly explain how? I am relatively new to Node-Red, particularly the JavaScript aspect.

OK, I don't think that was clear. If you want it to be retained across node-red restarts then the information will have to be saved somewhere. You could save it in a database or in persistent context. Working with context : Node-RED
If you have not heard of saving in the node-red context then presumably you have not already watched this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

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