Hi all, can you help me to solve the problem in automation?
So the idea is: if the AC is in fan_only no automation trigger. If the AC is in other states and window ( or windows ) are open ( o will be open) the automation should turn off the specific AC.
Here my automation:
alias: Villa-Force_to_Stop_Air_Cond_if_Window_Open
description: ''
trigger:
- platform: state
entity_id:
- binary_sensor.window1
- binary_sensor.window2
- binary_sensor.window3
- binary_sensor.window4
- binary_sensor.window5_1
- binary_sensor.window5_2
to: 'on'
- platform: state
entity_id:
- climate.1
- climate.2
- climate.3
- climate.4
- climate.5
condition:
- condition: state
entity_id: input_boolean.interlock_air_cond_villa
state: 'on'
action:
- service: climate.turn_off
target:
entity_id >-
{% if is_state('binary_sensor.window1', 'on') and not
is_state('climate.1', 'fan_only') %} climate.1
{% endif %}
- service: climate.turn_off
target:
entity_id >-
{% if is_state('binary_sensor.window2', 'on') and not
is_state('climate.2', 'fan_only') %}
climate.2
{% endif %}
- service: climate.turn_off
target:
entity_id >-
{% if is_state('binary_sensor.window3', 'on') and not
is_state('climate.3', 'fan_only') %}
climate.3
{% endif %}
- service: climate.turn_off
target:
entity_id >-
{% if is_state('binary_sensor.window4', 'on') and not
is_state('climate.4', 'fan_only') %}
climate.4
{% endif %}
- service: climate.turn_off
target:
entity_id >-
{% if is_state('binary_sensor.window5_1', 'on') or
is_state('binary_sensor.window5_2', 'on') and not
is_state('climate.5', 'fan_only') %}
climate.5
{% endif %}
mode: single
initial_state: true
________
what i noticed is that only the first climate1 seems to work. while sometimes the 2nd or 3rd or 4th or 5th also works ....
maybe there is a smarter way to write the code?
Thanks for your help / suggestion