ottopaulsen / node-red-contrib-power-saver

A Node-RED node to saver money by turning off when the power is most expensive
Other
71 stars 17 forks source link

Improve the Capacity part of grid tariff example #148

Closed havardhellvik closed 1 year ago

havardhellvik commented 1 year ago

Added a constant (DELAY_TIME_MS_ALLOWED) that allows the live records to have some delay (default to 3 seconds) to ensure that the entire flow is triggered by the live data collection. Useful if the live data collection is based on a time-trigger of 1 minute. The flow is dependent on having at least two live records in its internal buffer - and the flow will stop if the data gets too old (older than one minute). A status is added to the Collect estimate for hour node to visualize this.

As the time left for the current hour is reaching zero, the timeleftsec variable will explode some of the calculations. To avoid this, a new constant is added, MIN_TIMELEFT (default to 3 minutes), which will ensure that the calculations flattens when there is only 3 minutes left of the hour. This is to be able to better visualize that estimates in trends.