AND funtion on multiple triggers, or a work-around for it?

Hi,

I want to create an automation to switch off the heating furnace (switch.verwarming_brander) when ALL of the radiators (also switches because they all have a solenoid valve) are OFF

I can’t use the triggers because then it will switch off when 1 of the radiators switches off, it should wait untill the LAST one switches off

The multiple triggers use “OR” function, but I need “AND”

It should only switch off the heater when the last radiator switches off.

How should I do this ?

I already have an automation for switching ON the burner, but that’s easy because there does need the “OR” function on the triggers : If any radiator switches on, the burner should switch on … easy peasy … but for switching OFF … ???

I thought of putting all the radiators as trigger going from “on” to “off” and then adding all the radiators again as condition being “off” … but I think that would create a problem on the last one, because at the moment of the trigger the condition is still “on”, so it won’t pass the condition at that moment … but because of it switching off there won’t be any other trigger to turn the furnace off … hmmmmmm

Greetings
Pascal
Belgium

No there won’t be an issue.
Do as you said, all being triggers and all being condition and it will work.

1 Like

I’ll try …

Create a group containing all the radiator switches. Use the group in a State Trigger because the group will report off only when all radiators are off.

1 Like

You can use a group. A group’s value is “on” as long as one entity within the group is “on”, and turns “off” only when all the entities are “off”.

trigger:
  - platform: state
    entity_id: group.all_radiators
    to: "off"
1 Like

I think this simple automation should do the trick.

alias: example
trigger:
- platform: state
  entity_id: group.radiators
action:
- service: 'switch.turn_{{ trigger.to_state.state }}'
  target:
    entity_id: switch.boiler
1 Like

edit: all of the other posts have covered it, my post is essentially superfluous. :slight_smile: I especially like 123’s idea.

This is easy. Just put all radiators as a trigger and all radiators as a condition. It will only fire once the last one goes off.
like this: (bad syntax as I am doing this by hand)

trigger:
- entity: heater.heater1
  to_state: off
- entity: heater.heater2
  to_state: off
conditions:
- entity: heater.heater1
  state: off
- entity: heater.heater2
  state: off

I made the group and it works !

thanks a lot for the help !

Glad to hear using a group solved the problem.

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic is resolved. This helps other users find answers to similar questions.

For more information, refer to guideline 21 in the FAQ.