An automation tries to fire every 1 minute, and needs to check the status of input booleans. If any of the inputs are ON, the service switches on a boiler.
If ALL of the inputs are OFF, the boiler switches off.
I got this far: -
alias: Boiler Call for Heat
description: ''
trigger:
- platform: time_pattern
seconds: '60'
condition:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.lr_call_heat
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.kt_call_heat
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.mb_call_heat
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.of_call_heat
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.fb_call_heat
state: 'on'
action:
- service: switch.turn_on
data: {}
entity_id: switch.shelly1_40f52000485c
mode: single
This is the automation to switch on the boiler. I also as above want to switch the boiler off if ALL of the booleans are OFF.
When any of the input_booleans turns on, the automation is triggered and turns on the boiler.
When any of the input_booleans turns off, the automation is triggered and checks if it’s the last input_boolean to turn off and then turns off the boiler.
Let me know if you need help converting your automation to use a State Trigger. It’s far more efficient than polling every minute.
I think that will turn off the boiler the moment any of the input_booleans gets turned off. The OP wants to turn it off after the last input_boolean is turned off (i.e only when all input_booleans are off). The group makes it easy to comply with this requirement.
The other advantage of using a group is that gives you global control over all five input_booleans (i.e. easily turn them all off at once should there ever be a need to do so). The group can also be referenced by other automations in the future. Plus it’s easy to add more input_booleans to it (and all automations that reference it will use the additional input_booleans).
I was trying to point out that having 5 booleans doing this is daft. I realise now that I didn’t put enough sarcasm in my post for this to shine through.
Boolean is set to “on” or “off” basis the set point of TRV, for example, if the measured temperature is less than the setpoint, the boolean is set to “on”. If the temperature is matching the setpoint, the boolean is set to off.
This means that i have a “call for heat” for each TRV (well, each room).
Now, what i am doing is firing an automation every 1 minute to check the status of the booleans, if any of them are on, the boiler fires. If they are all off, the boiler shuts down.
If i placed all booleans in a group, would this still work?
You may have missed the entire point of what I proposed.
I’m suggesting to stop thinking along the lines of polling and use events. In other words, instead of checking for the state of the input_booleans every minute, let their own state-changes control when the switch should be turned on/off.
Analogy is you have assigned someone a task and now ask them every minute if they have finished it. The strategy I offered is to allow that person to report when they are finished.
Yup, but also as I suspected above, this means that you end up with a shed load of automations all on top of each other turning booleans on and off and then those booleans triggering other automations.
Multiple middle players creates many more opportunities for errors to creep in.
Better to trigger directly and reduce the number of middle players. ie whatever circumstances currently turn the booleans on and off should trigger the automation that turns the boiler on or off directly instead. The booleans are highly likely to be redundant in this scenario.
This makes sense and I’ll have a play over the next couple of days. I am new-Ish to HA and have spent my life programming big building management systems which operate differently
How do you mean? Do you want the state to be unchanged (static); for a certain period of time before the trigger occurs or do you simply want to pause for a period of time after it triggers before continuing?