Different priorites for toggling devices on or off

Hi, I'm trying to achieve something that I think should be pretty common, but haven't found how to implement it without resorting to custom coding, and I'd rather not reinvent the wheel if possible. I've tried searching for it, but haven't found anything.

I control a water heater with my Node Red instance. In order to save in electricity costs, I don't want it being turned on 24/7, so I would like to toggle it on or off depending on different factors. Some of them:

  1. It should be always on at some hours (when electricity is cheap) and off at others
  2. If total instant home power exceeds some treshold, it should be turned off no matter the time
  3. My home has solar panels, so even if we're not on cheap electricity hours, water heater should be turned on if there's enough sun
  4. Manual control should also be possible

Those are a lot of different calculations, each of them end concluding if water heater should be on or off. Problem is not all of them will reach to the same conclusion (perhaps water heater should be off according to time of day, but sun is up and other node concludes it should instead be on). Managing each condition independently only leads to very fast switching between on and off due to automations "fighting" between them, so I would love some way of coordinating all conditions, taking into account different rule priorities, reaching a final, stable decision about if water heater should be on or off at a specific moment, considering everything.

Is there a standard/contrib node that lets me manage this kind of scenarios? Let's say all automations feeding it with a message including intended device state (on/off), priority and perhaps time to live, and it managing conflicts and calculating the end result.

Thanks in advance!

Welcome to the forum @jesjimher

If you determine the answers to points 1 to 4 above, then you can use (for example) node-red-contrib-boolean-logic-ultimate to combine the conditions into the final answer.

1 Like

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