Hey guys,
I’m trying to control the heater (turn on and off) if the temperature is below 18C or above 22C and if someone is at home.
Any help? Thank you
#Climate
- action:
- data:
service_template: >
{% if is_state('sensor.ulisses', 'home') or is_state('sensor.daniela', 'home') %}
{% if states('sensor.pws_temp_c' | float) < 18 %}
- turn_on:
service: switch.turn_on
data:
entity_id: switch.heater_switch
{% elif states('sensor.pws_temp_c' | float) > 22 %}
- turn_off:
service: switch.turn_off
data:
entity_id: switch.heater_switch
{% else %}
- turn_on:
service: switch.turn_on
data:
entity_id: switch.heater_switch
{% endif %}
{% else %}
- turn_off:
service: switch.turn_off
data:
entity_id: switch.heater_switch
{% endif %}
alias: 'Climate'
trigger:
- above: '22'
entity_id: sensor.pws_temp_c
platform: numeric_state
- below: '18'
entity_id: sensor.pws_temp_c
platform: numeric_state