Controlling climate from input select

Tags: #<Tag:0x00007f77f8f5b000> #<Tag:0x00007f77f8f5af38>

I like to minimalize my climate ui and made a setup with a custom slider (for setting temperature) and an input select element (for selecting presets) grouped together with a lovelance custom fold-entity-row. See example below:

Schermafdruk%20van%202019-08-18%2017-07-54

From the input select element, I want to set the climate preset, but one of the options will be ‘off’ which also changes the hvac mode to off. This is my automation so far:

- id: '825223522' 
  alias: Toon                              
  initial_state: true
  hide_entity: false
  trigger:
  - platform: state
    entity_id:
    - input_select.toon_preset
  action:
  - service: climate.set_hvac_mode
    entity_id: climate.toon_thermostaat
    data_template:
      hvac_mode: >
        {% if is_state("input_select.toon_preset", "Uit") %}
          'off'
        {% else %}
          'heat'
        {% endif %}
  - service: climate.set_preset_mode
    entity_id: climate.toon_thermostaat
    data_template:
      preset_mode: >
        {% if is_state("input_select.toon_preset", "Thuis") %}
          'home'
        {% elif is_state("input_select.toon_preset", "Comfort") %}
          'comfort'
        {% elif is_state("input_select.toon_preset", "Slapen") %}
          'sleep'
        {% else %}
          'away'
        {% endif %}

When I test the data templates by pasting them in the dev / template section in HA they will give the desired result. However, it wouldn’t set the climate object. When I try to set the climate object with a non template value It works like that:

  - service: climate.set_preset_mode
    entity_id: climate.toon_thermostaat
    data_template:
      preset_mode: 'sleep'

What am I doing wrong?

Remove the quotes around the mode names…

- id: '825223522' 
  alias: Toon                              
  initial_state: true
  hide_entity: false
  trigger:
  - platform: state
    entity_id:
    - input_select.toon_preset
  action:
  - service: climate.set_hvac_mode
    entity_id: climate.toon_thermostaat
    data_template:
      hvac_mode: >
        {% if is_state("input_select.toon_preset", "Uit") %}
          off
        {% else %}
          heat
        {% endif %}
  - service: climate.set_preset_mode
    entity_id: climate.toon_thermostaat
    data_template:
      preset_mode: >
        {% if is_state("input_select.toon_preset", "Thuis") %}
          home
        {% elif is_state("input_select.toon_preset", "Comfort") %}
          comfort
        {% elif is_state("input_select.toon_preset", "Slapen") %}
          sleep
        {% else %}
          away
        {% endif %}

How simple… and it works! Tank you very much

1 Like

Hi,
I’ve been much trying to do the same with my honnywell eco-home thermostats and failed. Would you be so kind to post your configuration.yaml and the working code in automation? and I assume your entity is “climate.toon_thermostaat” right?
Thanks

sorry, havenot seen your message in time. Do you still need something?