Hi everyone,
I have set up an automation for a heater in my parents’ house that turns climate.woonkamer_airco
off if the current temperature has reached the target temperature - 0.5 degrees for longer than 30 minutes.
I’ve been able to achieve this with a template binary_sensor, but I am trying to find a simpler way to do this. It’s such a simple request, but disproportionally difficult to implement. Does anyone know of a simpler method?
I’m hoping to teach my dad, who knows his way around computers, to create basic automations himself. Templating isn’t something that will be easy to teach.
Simpler solutions that did not work
-
Numeric state trigger: Not possible without template sensors. The numeric state trigger only accepts numbers and helpers as
above
andbelow
values. Templates are not supported and there is no way to use a state attribute as one of these values. -
Template trigger: Not possible as
for:
cannot be used with template triggers.
How I solved it
Template binary sensor
- binary_sensor:
- name: Woonkamer airco target reached
state: >
{{ state_attr('climate.woonkamer_airco', 'current_temperature')
| float(0) >= (state_attr('climate.woonkamer_airco', 'temperature') | float(0) - 0.5) }}
availability: "{{ state_attr('climate.woonkamer_airco', 'current_temperature') | is_number }}"
Automation:
alias: Turn woonkamer airco off when target is reached
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.woonkamer_airco_target_reached
for:
hours: 0
minutes: 30
seconds: 0
to: "on"
condition:
- condition: state
entity_id: climate.woonkamer_airco
state: heat
action:
- service: climate.turn_off
data: {}
target:
entity_id: climate.woonkamer_airco
mode: single
It’s not hard to do, but with the complexity that the automation editor and helpers allow for, perhaps I missed an easier way to do this. I really dislike needing to make template sensors for very simply things. It makes everything so messy and harder to understand.