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

[error][ps-strategy-lowest-price] Dynamic command reset doesn't seem to remove price-information #41

Closed arild-flatland closed 2 years ago

arild-flatland commented 2 years ago

Created a sequence with prices (today and tomorrow) from Tibber and a ps-strategy-lowest-price node (ver 3.4.1). This was done in the afternoon so I got prices for 48 hours. Set the node to pick the 5 cheapest hours between 14:00 and 06:00 and that worked perfectly. Then I wondered what would happen after midnight. After midnight I added a trigger and a change node to send the 'reset' command to the ps-strategy-lowest-price node and expected the node to delete all historical data, including the prices for yesterday. I got two status messages from ps-strategy-lowest-price node: "Resetting node context by command" and "No price data". However, when fetching prices right after midnight I get only 24 hours of prices from Tibber, but the hours-array inside the ps-strategy-lowest-price still contains 48 hours. When repeating this process in the afternoon, both reset and get prices from Tibber (now also for the next day), the ps-strategy-lowest-price node contains 72 hours of price information. To me this looks like the reset command does not delete the price information in the ps-strategy-lowest price node.

ottopaulsen commented 2 years ago

Thank you for reporting this issue, and for a very good bug description. There was a bug in the reset-command so not all history was deleted. It should be fixed in version 3.4.2. Please verify and report back.

arild-flatland commented 2 years ago

Thank you so much for your very quick response and for providing a fix. Unfortunately, I'm not able to download the new version 3.4.2. From the "Manage Palette" menu, I search for the power saver node, and it still says version 3.4.1. I have tried to restart NodeRed and I have also restarted my rPi, but unfortunately still only version 3.4.1 is available. Do you have any tricks up the sleeve for getting access to the newest version on git?

ottopaulsen commented 2 years ago

Sorry, forgot to publish. Try now.

arild-flatland commented 2 years ago

Tested again with version 3.4.2 right after midnight. Now everything works as expected. When sending the 'reset' command and then feeding the ps-strategy-lowest-price node with the 24 hours of prices from Tibber, the size of the hours array in ps-strategy-lowest-price node is also 24. In addition the schedule array is cleaned up accordingly. Great job, thanks for the fix and have a nice week end!