I’ve been struggling for days with automation control for my house ventilation system. I can control 4 fan speeds and recirculation on/off with a relay card on ESPHome. This works great manually.
But the last days I’ve been trying to automate the system to keep inner climate cool by blowing full fan during nights when outsde temperature is low and during day time when outdoor is hot keepin low fan and turning on recirculation. I realized that I can’t make an automation script with both multiple conditions AND multiple actions depending on condition, so I made several automations but I’m struggling with the coonditions in each one of these when trying to use templating and I really need help. When run my automations the always come out as “TRUE” every time regardless of what values the temperature sensors show and I don’t know what I am doing wrong. So I need help with script or maybe how I can debug. The idea is that the automations would trigger once every hour and check the current conditions/temperatures and the set the correct fan-speed actions.
This is how my automations for each actions currently looks like:
- id: '1596296409426'
alias: Climate Control - Cold outside and above 18 inside
description: Normal fan
trigger:
- hours: '1'
platform: time_pattern
condition:
- condition: and
conditions:
- condition: template
value_template: >-
{% if states('sensor.utluft_temp')|int > 18 and states('sensor_utluft_temp')|int < 25 and states('sensor.inluft_temp)|int < states('sensor.utluft_temp')|int %}
true
{%else%}
false
{%endif%}
action:
- data: {}
entity_id: switch.vent_fan2
service: switch.turn_on
- data: {}
entity_id: switch.vent_recirc
service: switch.turn_off
mode: single
- id: '1596304013346'
alias: Climate Control - Colder outside medium FAN
description: Starting to get colder outside, set FAN medium
trigger:
- hours: '1'
platform: time_pattern
condition:
- condition: and
conditions:
- condition: template
value_template: >-
{% if states('sensor.utluft_temp')|int > 20 and states('sensor.utluft_temp')|int < 24 and states('sensor.utluft_temp')|int > states('sensor.inluft_temp')|int %}
true
{%else%}
false
{%endif%}
action:
- data: {}
entity_id: switch.vent_fan3
service: switch.turn_on
- data: {}
entity_id: switch.vent_recirc
service: switch.turn_off
mode: single
- id: '1596304338482'
alias: Climate Control - Very hot inside set FULL FAN
description: Very hot inside but cold outside, set full fan
trigger:
- hours: '1'
platform: time_pattern
condition:
- condition: and
conditions:
- condition: template
value_template: >-
{% if states('sensor.utluft_temp')|int > 25 and states('sensor.inluft_temp')|int < states('sensor.utluft_temp')|int %}
true
{%else%}
false
{%endif%}
action:
- data: {}
entity_id: switch.vent_fan4
service: switch.turn_on
- data: {}
entity_id: switch.vent_recirc
service: switch.turn_off
mode: single
- id: '1596304574084'
alias: Climate Control - Keep cool
description: Colder inside than outside - keep cool inside
trigger:
- hours: '1'
platform: time_pattern
condition:
- condition: and
conditions:
- condition: template
value_template: >-
{% if states('sensor.utluft_temp')|int <= states('sensor.inluft_temp')|int and states('sensor.utluft_temp')|int > 20 %}
true
{%else%}
false
{%endif%}
action:
- data: {}
entity_id: switch.vent_fan1
service: switch.turn_on
- data: {}
entity_id: switch.vent_recirc
service: switch.turn_on
mode: single