Hi all. There are two automations controlling one switch. If in the first automation the temperature is out of range, the switch is turned on. But if the humidity is normal, then the humidity automation turns off this switch. And vice versa. How to make it so that if the service of the first automation worked, then the service of the second automation stopped working?
- alias: auto_cold
trigger:
- platform: homeassistant
event: start
- platform: state
entity_id:
- sensor.average_sensor_temp
action:
service: >-
{% set hi = states('input_number.temp_on_cold') | float %}
{% set low = states('input_number.temp_off_cold') | float %}
{% set temp = states('sensor.average_sensor_temp') | float %}
{% if temp > hi and states('switch.vent_out') == 'off' %}
switch.turn_on
{% elif temp < low %}
switch.turn_off
{% endif %}
entity_id: switch.vent_out
- alias: auto_dehumid
trigger:
- platform: homeassistant
event: start
- platform: state
entity_id:
- sensor.average_sensor_humid
action:
service: >-
{% set hi = states('input_number.humid_on_dehumid') | float %}
{% set low = states('input_number.humid_off_dehumid') | float %}
{% set humid = states('sensor.average_sensor_humid') | float %}
{% if humid > hi and states('switch.vent_out') == 'off' %}
switch.turn_on
{% elif humid < low %}
switch.turn_off
{% endif %}
entity_id: switch.vent_out