Trigger.to_<x> to input_number, climate entity template?

Hi everybody,

I am using Eurotronic thermostats with zigbee2mqtt; unfortunately, sometimes they don’t accept hvac_mode: off. You could turn them off manually (by setting current_heating_setpoint to 5 degrees), but if you change hvac_mode, nothing will happen.

So unfortunately I cannot use the blueprint that will turn off heat for a room when the corresponding window has been opened (and vice versa).

Instead, I thought I’d “just” do this whenever a window opens:

  • save current temperature to input_number
  • keep hvac_mode: auto
  • set temperature to 5

and when the window gets shut again

  • set temperature to the value of that input_number

Below is the workaround I use for my office. However, I thought perhaps it’d be possible to use a template for this, so that the trigger could be each binary_sensor.<room>_fenster_contact. Then “extract” the room (which will always be the first thing after binary_sensor. and apply it to the input_number (which currently is just initials per room, but I’d change it to input_number.helper_<room>_fensterauftemp). Finally, set climate.<room>_heizung to 5, and vice versa when the window gets shut again.

I could just write two automations per room, as these will not change (so it’d be a one-time thing to work on), but I prefer to keep things as universal as possible.

Thank you in advance for your ideas :slight_smile:

input_number:
  helper_az_fensterauftemp:
    name: "Vor Öffnung AZ"
    min: 5
    max: 30
    step: 0.5

automation:
  - alias: "Heizung AZ Auf"
    trigger:
      - platform: state
        entity_id: binary_sensor.arbeitszimmer_fenster_contact
        to: "on"
    action:
      - service: input_number.set_value
        entity_id: input_number.helper_az_fensterauftemp
        data_template:
          value: "{{ state_attr('climate.arbeitszimmer_heizung' ,'current_temperature') | float }}"
      - service: climate.set_temperature
        data:
          temperature: 5
          entity_id: climate.arbeitszimmer_heizung
  - alias: "Heizung AZ Zu"
    trigger:
      - platform: state
        entity_id: binary_sensor.arbeitszimmer_fenster_contact
        to: "off"
    action:
      - service: climate.set_temperature
        data:
          temperature: "{{ states('input_number.helper_az_fensterauftemp') | float }}"
          entity_id: climate.arbeitszimmer_heizung