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

Config data and price data in the same flow #23

Closed eirektg closed 2 years ago

eirektg commented 2 years ago

When using dynamic config as part of the logic, you need to first send the config message as an individual message to the Power Saver node before you send the price data to the same Power saver node. This have some negative impacts:

  1. The Power-saver node will output two different sets of messages, one for each of the incoming messages (config data and price data) . And these two outputs could be different.
  2. The need for two individual messages makes building the logic more difficult

My suggestion is that it should be possible to put the config data in msg.config. By doing that it will be way easier to use dynamic config without building additional logic.

When msg.config and msg.payload is loaded with data and hits the Power Saver node, the Power Saver node should first apply the msg.config, before applying the msg.payload. By doing this, the Power Saver node will only output one result, and this result will be correct.

Example of how the flow could look like with this feature Power Saver Config

ottopaulsen commented 2 years ago

This should be possible in version 3.2.0. Please try.