I’m refactoring my old template code to the new syntax, in the process I thought I would then combine duplicate template: blocks into one…but it then gives a TON of errors trying to reload.
Anyone able to tell why this might be?
Specifically I tried to remove the line:
template:
- trigger:
to just
- trigger:
which I assumed would go with the previous template block. But then I get LOADS of errors all over the place in the logfile.
Working code, with duplicate template:
input_boolean:
# This will be a "fan on" to keep the fan running 24x7
downstairs_hvac_fan_on_manual_hold:
name: Downstairs HVAC Fan On Manual Hold
icon: hass:fan
template:
- sensor:
- default_entity_id: sensor.downstairs_hvac_fan_status
name: "Downstairs HVAC Fan Status"
#entity_id: sensor.time
state: >-
{{ state_attr('climate.downstairs_thermostat','fan_state').split(' ').0 }}
- name: Downstairs HVAC Fan Mode Preference
icon: hass:fan
state: >-
{% set fan_on = is_state('group.downstairs_hvac_fan_on_conditions','on') %}
{% set fan_circ = is_state('group.downstairs_hvac_fan_circ_conditions','on') %}
{% set fan_force_auto = is_state('group.downstairs_hvac_fan_force_auto_conditions','on') %}
{% if fan_on and (not fan_force_auto) %}
Low
{% elif fan_circ and (not fan_force_auto) %}
Circulation
{% else %}
Auto low
{% endif %}
- binary_sensor:
- default_entity_id: binary_sensor.downstairs_hvac_fan_idle_cycle
name: "Downstairs HVAC Fan Idle Cycle"
delay_on: '04:00:00'
delay_off: >
{{ 0 if is_state('binary_sensor.downstairs_hvac_fan_idle_cycle','unknown') else '02:00:00' }}
state: >-
{{ is_state('sensor.downstairs_hvac_fan_status','Idle') and
is_state('binary_sensor.downstairs_hvac_fan_idle_cycle','off') }}
- default_entity_id: binary_sensor.downstairs_hvac_fan_manual_on
name: "Downstairs HVAC Fan Manual On"
delay_on: '00:01:00'
delay_off: >
{{ 0 if is_state('binary_sensor.downstairs_hvac_fan_manual_on','unknown') else '01:00:00' }}
state: >-
{{ state_attr('climate.downstairs_thermostat','fan_mode') == 'Low' and
is_state('group.downstairs_hvac_fan_on_conditions','off') }}
- default_entity_id: binary_sensor.main_floor_high_temp_difference
name: "Main Floor High Temp Difference"
delay_on: >
{{ 0 if is_state('binary_sensor.main_floor_high_temp_difference','unknown') else '00:05:00' }}
delay_off: >
{{ 0 if is_state('binary_sensor.main_floor_high_temp_difference','unknown') else '00:10:00' }}
state: >-
{{ (states('sensor.main_floor_max_temperature')|float(-999) - states('sensor.main_floor_min_temperature')|float(999)) > 4 }}
- default_entity_id: binary_sensor.basement_rooms_high_temp_difference
name: "Basement Rooms High Temp Difference"
delay_on: >
{{ 0 if is_state('binary_sensor.basement_rooms_high_temp_difference','unknown') else '00:05:00' }}
delay_off: >
{{ 0 if is_state('binary_sensor.basement_rooms_high_temp_difference','unknown') else '00:10:00' }}
state: >-
{{ (states('sensor.basement_rooms_max_temperature')|float(-999) - states('sensor.basement_rooms_min_temperature')|float(999)) > 3 }}
- default_entity_id: binary_sensor.basement_main_floor_high_temp_difference
name: "Basement Main Floor High Temp Difference"
delay_on: >
{{ 0 if is_state('binary_sensor.basement_main_floor_high_temp_difference','unknown') else '00:05:00' }}
delay_off: >
{{ 0 if is_state('binary_sensor.basement_main_floor_high_temp_difference','unknown') else '00:10:00' }}
state: >-
{{ states('sensor.main_floor_average_temperature')|float('NAN') != 'NAN' and states('sensor.basement_rooms_average_temperature')|float('NAN') != 'NAN' and
(states('sensor.main_floor_average_temperature')|float(0) - states('sensor.basement_rooms_average_temperature')|float(0)) | abs > 3 }}
- default_entity_id: binary_sensor.downstairs_set_temp_near_outside_temp
name: "Downstairs Set Temp Near Outside Temp"
delay_on: >
{{ 0 if is_state('binary_sensor.downstairs_set_temp_near_outside_temp','unknown') else '00:05:00' }}
delay_off: >
{{ 0 if is_state('binary_sensor.downstairs_set_temp_near_outside_temp','unknown') else '00:10:00' }}
state: >-
{{ states('sensor.outside_rear_sensor_age')|int(9999) < 1800 and
(states('sensor.outside_rear_temperature')|float(999) - states('sensor.downstairs_hvac_set_temp_cooling')|float(-999)) < 5 and
(states('sensor.outside_rear_temperature')|float(-999) - states('sensor.downstairs_hvac_set_temp_heating')|float(999)) > -5 }}
- default_entity_id: binary_sensor.downstairs_can_do_passive_cooling
name: "Downstairs Can Do Passive Cooling"
delay_on: >
{{ 0 if is_state('binary_sensor.downstairs_can_do_passive_cooling','unknown') else '00:05:00' }}
delay_off: >
{{ 0 if is_state('binary_sensor.downstairs_can_do_passive_cooling','unknown') else '00:10:00' }}
state: >-
{{ states('sensor.outside_rear_sensor_age')|int(9999) < 1800 and
states('sensor.outside_rear_temperature')|float(999) < states('sensor.main_floor_average_temperature')|float(-999) and
states('sensor.main_floor_average_temperature')|float(-999) > ((states('sensor.downstairs_hvac_set_temp_heating')|float(999) + (states('sensor.downstairs_hvac_set_temp_cooling')|float(999)*2))/3) }}
- default_entity_id: binary_sensor.downstairs_can_do_passive_heating
name: "Downstairs Can Do Passive Heating"
delay_on: >
{{ 0 if is_state('binary_sensor.downstairs_can_do_passive_heating','unknown') else '00:05:00' }}
delay_off: >
{{ 0 if is_state('binary_sensor.downstairs_can_do_passive_heating','unknown') else '00:10:00' }}
state: >-
{{ states('sensor.outside_rear_sensor_age')|int(9999) < 1800 and
states('sensor.outside_rear_temperature')|float(-999) > states('sensor.main_floor_average_temperature')|float(999) and
states('sensor.main_floor_average_temperature')|float(999) < (((states('sensor.downstairs_hvac_set_temp_heating')|float(-999)*2) + states('sensor.downstairs_hvac_set_temp_cooling')|float(-999))/3) }}
- default_entity_id: binary_sensor.downstairs_door_open_recently
name: "Downstairs Door Open Recently"
delay_on: >
{{ 0 if is_state('binary_sensor.downstairs_door_open_recently','unknown') else '00:00:10' }}
delay_off: >
{{ 0 if is_state('binary_sensor.downstairs_door_open_recently','unknown') else '00:30:00' }}
state: >-
{{ is_state('binary_sensor.back_door','on') or
is_state('binary_sensor.front_door','on') or
is_state('binary_sensor.basement_door','on') }}
- default_entity_id: binary_sensor.downstairs_humidifier_run_fan
name: "Downstairs Humidifier Run Fan"
delay_on: '00:15:00'
delay_off: >
{{ 0 if is_state('binary_sensor.downstairs_humidifier_run_fan','unknown') else '00:00:30' }}
state: >-
{{ is_state('binary_sensor.downstairs_hvac_humidifier_running','on') and
states('sensor.indoor_projected_night_humidity') | float(999) < 50.0 and
states('sensor.outdoor_humidity_coming_inside') | float(999) < 60.0 and
states('sensor.downstairs_hvac_zone_average_humidity') | float(999) < 45.0 and
states('sensor.downstairs_hvac_zone_max_humidity') | float(999) < 48.0 }}
- default_entity_id: binary_sensor.downstairs_dehumidifier_run_fan
name: "Downstairs Dehumidifier Run Fan"
# delay_on: '00:00:00'
delay_off: >
{{ 0 if is_state('binary_sensor.downstairs_dehumidifier_run_fan','unknown') else '00:10:00' }}
state: >-
{{ is_state('binary_sensor.basement_dehumidifier_running','on') and
states('sensor.downstairs_hvac_zone_max_humidity') | float(999) > 50.0 }}
- default_entity_id: binary_sensor.downstairs_bathroom_exhaust_fan_on
name: "Downstairs Bathroom Exhaust Fan On"
delay_on: >
{{ 0 if is_state('binary_sensor.downstairs_bathroom_exhaust_fan_on','unknown') else '00:01:00' }}
delay_off: >
{{ 0 if is_state('binary_sensor.downstairs_bathroom_exhaust_fan_on','unknown') else '00:05:00' }}
state: >-
{{ is_state('switch.basement_bath_exhaust_fan','on') }}
- default_entity_id: binary_sensor.downstairs_hvac_fan_tou_peak_auto
name: "Downstairs HVAC Fan TOU Peak Auto"
value_template: >-
{{ is_state('binary_sensor.dominion_power_tou_peak','on') and is_state('input_boolean.downstairs_hvac_severe_weather_mode','off') }}
template:
- trigger:
- platform: state
id: "cooling"
entity_id: sensor.downstairs_hvac_status
to: 'cooling'
- platform: state
id: "cooling_idle"
entity_id: sensor.downstairs_hvac_status
from: 'cooling'
to: 'idle'
for: '00:05:00'
- platform: homeassistant
id: "ha_start"
event: start
binary_sensor:
- name: "Downstairs HVAC Cooling Idle Fan Delay"
state: >-
{% if trigger.id == "cooling" %}
True
{% else %}
False
{% endif %}
group:
downstairs_hvac_fan_on_conditions:
name: "Downstairs HVAC Fan On Conditions"
entities:
- binary_sensor.main_floor_high_temp_difference
- binary_sensor.basement_rooms_high_temp_difference
- binary_sensor.basement_main_floor_high_temp_difference
#- binary_sensor.downstairs_can_do_passive_cooling
#- binary_sensor.downstairs_can_do_passive_heating
- binary_sensor.downstairs_hvac_fan_manual_on
#- binary_sensor.downstairs_door_open_recently
- binary_sensor.downstairs_humidifier_run_fan
- binary_sensor.downstairs_dehumidifier_run_fan
- binary_sensor.downstairs_bathroom_exhaust_fan_on
- input_boolean.downstairs_hvac_fan_on_manual_hold
- input_boolean.downstairs_hvac_severe_weather_mode
downstairs_hvac_fan_circ_conditions:
name: "Downstairs HVAC Fan Circ Conditions"
entities:
- binary_sensor.downstairs_hvac_fan_idle_cycle
#- binary_sensor.downstairs_set_temp_near_outside_temp
downstairs_hvac_fan_force_auto_conditions:
name: "Downstairs HVAC Fan Force Auto Conditions"
entities:
- binary_sensor.downstairs_hvac_cooling_idle_fan_delay
- binary_sensor.downstairs_hvac_fan_tou_peak_auto
automation:
- alias: "Downstairs HVAC Set Fan Mode"
trigger:
- platform: state
entity_id: sensor.downstairs_hvac_fan_mode_preference
for: '00:00:05'
- platform: state
entity_id: climate.downstairs_thermostat
to: 'heat_cool'
for: '00:00:05'
condition:
- condition: state
entity_id: climate.downstairs_thermostat
state: 'heat_cool'
action:
- service: climate.set_fan_mode
data:
entity_id: climate.downstairs_thermostat
fan_mode: "{{ states('sensor.downstairs_hvac_fan_mode_preference') }}"
- alias: "Downstairs HVAC Set Fan Off"
trigger:
- platform: state
entity_id: climate.downstairs_thermostat
to: 'off'
action:
- service: climate.set_fan_mode
data:
entity_id: climate.downstairs_thermostat
fan_mode: "Auto low"
# - alias: "Downstairs Thermostat Fan Cycle On"
# trigger:
# - platform: state
# entity_id: group.downstairs_hvac_fan_on_conditions
# to: 'on'
# - platform: state
# entity_id: climate.downstairs_thermostat
# to: 'heat_cool'
# - platform: state
# entity_id: sensor.downstairs_hvac_daily_cycle
# - platform: state
# entity_id: sensor.downstairs_hvac_status
# from: 'cooling'
# to: 'idle'
# for: '00:05:00'
# condition:
# - condition: state
# entity_id: group.downstairs_hvac_fan_on_conditions
# state: 'on'
# - condition: state
# entity_id: climate.downstairs_thermostat
# state: 'heat_cool'
# action:
# - service: climate.set_fan_mode
# data:
# entity_id: climate.downstairs_thermostat
# fan_mode: "Low"
#
# - alias: "Downstairs Thermostat Fan Cycle Circ"
# trigger:
# - platform: state
# entity_id: group.downstairs_hvac_fan_on_conditions
# to: 'off'
# - platform: state
# entity_id: group.downstairs_hvac_fan_circ_conditions
# to: 'on'
# - platform: state
# entity_id: sensor.downstairs_hvac_fan_status
# to: 'Running'
# for:
# hours: 1
# - platform: state
# entity_id: climate.downstairs_thermostat
# to: 'heat_cool'
# - platform: state
# entity_id: sensor.downstairs_hvac_daily_cycle
# - platform: state
# entity_id: sensor.downstairs_hvac_status
# from: 'cooling'
# to: 'idle'
# for: '00:10:00'
# condition:
# - condition: state
# entity_id: group.downstairs_hvac_fan_on_conditions
# state: 'off'
# - condition: state
# entity_id: group.downstairs_hvac_fan_circ_conditions
# state: 'on'
# - condition: state
# entity_id: climate.downstairs_thermostat
# state: 'heat_cool'
# action:
# - service: climate.set_fan_mode
# data:
# entity_id: climate.downstairs_thermostat
# fan_mode: "Circulation"
#
# - alias: "Downstairs Thermostat Fan Cycle Off"
# trigger:
# - platform: state
# entity_id: group.downstairs_hvac_fan_on_conditions
# to: 'off'
# - platform: state
# entity_id: group.downstairs_hvac_fan_circ_conditions
# to: 'off'
# - platform: state
# entity_id: sensor.downstairs_hvac_fan_status
# to: 'Running'
# for:
# hours: 1
# - platform: state
# entity_id: climate.downstairs_thermostat
# to: 'heat_cool'
# - platform: state
# entity_id: sensor.downstairs_hvac_daily_cycle
# - platform: state
# entity_id: sensor.downstairs_hvac_status
# from: 'cooling'
# to: 'idle'
# condition:
# - condition: or
# conditions:
# - condition: template
# value_template: '{{ trigger.from_state.state == "cooling" and trigger.to_state.state == "idle" }}'
# - condition: and
# conditions:
# - condition: state
# entity_id: group.downstairs_hvac_fan_on_conditions
# state: 'off'
# - condition: state
# entity_id: group.downstairs_hvac_fan_circ_conditions
# state: 'off'
# - condition: state
# entity_id: climate.downstairs_thermostat
# state: 'heat_cool'
# action:
# - service: climate.set_fan_mode
# data:
# entity_id: climate.downstairs_thermostat
# fan_mode: "Auto low"

