Skip to main content

Heizung An- / Aus

Wenn der Status eines Switches wechselt wird das Thermostat an- oder ausgeschaltet.

Beim Wechsel nach Aus innerhalb des Komfort Zeitplanes  wird die aktuelle Temperatur in die Komfort Temperatur Entität geschrieben.

Alle nötigen Stati und Entitäten werden im Variablen Block gesetzt, damit bleibt die Sequence schön kurz.

2023.02.19: Überprüfung ob Fenster geschlossen sind bevor die Komfort Temperatur gespeichert wird

Code:

alias: Heizung An / Aus
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.heizung_buero_on_off
      - input_boolean.heizung_wc_on_off
      - input_boolean.heizung_eingang_on_off
      - input_boolean.heizung_flur_on_off
      - input_boolean.heizung_werkstatt_on_off
      - input_boolean.heizung_ez_on_off
      - input_boolean.heizung_wz_on_off
      - input_boolean.heizung_sz_on_off
      - input_boolean.heizung_gruen_on_off
      - input_boolean.heizung_rosa_on_off
      - input_boolean.heizung_lydi_on_off
      - input_boolean.heizung_carrera_on_off
      - input_boolean.heizung_wcdg_on_off
      - input_boolean.heizung_studio_on_off
    id: HeizungAN
    to: "on"
  - platform: state
    entity_id:
      - input_boolean.heizung_buero_on_off
      - input_boolean.heizung_wc_on_off
      - input_boolean.heizung_eingang_on_off
      - input_boolean.heizung_flur_on_off
      - input_boolean.heizung_buero_on_off
      - input_boolean.heizung_werkstatt_on_off
      - input_boolean.heizung_ez_on_off
      - input_boolean.heizung_wz_on_off
      - input_boolean.heizung_sz_on_off
      - input_boolean.heizung_gruen_on_off
      - input_boolean.heizung_rosa_on_off
      - input_boolean.heizung_lydi_on_off
      - input_boolean.heizung_carrera_on_off
      - input_boolean.heizung_wcdg_on_off
      - input_boolean.heizung_studio_on_off
    id: HeizungAUS
    to: "off"
condition:
  - condition: state
    entity_id: input_boolean.urlaub
    state: "off"
action:
  - variables:
      room: "{{ trigger.entity_id.split('_')[2] }}"
      device: "{{ 'climate.thermostat_' + room }}"
      comfort: "{{ 'input_number.thermostat_' + room + '_comfort' }}"
      eco: "{{ 'input_number.thermostat_' + room + '_eco' }}"
      device_temp: "{{ state_attr( device, 'temperature') }}"
      eco_temp: "{{ states(eco) }}"
      comfort_temp: "{{ states(comfort) }}"
      scheduler: "{{ 'schedule.heizung_' + room + '_eco' }}"
      scheduler_state: "{{ states(scheduler) | bool }}"
      scheduler_switch: "{{ states('input_boolean.heizung_' + room + '_zeitplan') | bool }}"
      window_state: "{{ states('binary_sensor.fenster_' + room + '_open_close') }}"
      store_temp: "{{ device_temp > eco_temp }}"
  - choose:
      - conditions:
          - condition: trigger
            id: HeizungAUS
        sequence:
          - if:
              - condition: template
                value_template: "{{ scheduler_state }}"
            then:
              - service: climate.set_temperature
                data:
                  temperature: "5"
                target:
                  entity_id: "{{ device }}"
            else:
              - if:
                  - condition: template
                    value_template: "{{ scheduler_state }}"
                  - condition: template
                    value_template: "{{ window_state }} == 'off'"
                then:
                  - service: input_number.set_value
                    data_template:
                      value: "{{ device_temp }}"
                    target:
                      entity_id: "{{ comfort }}"
              - service: climate.set_temperature
                data:
                  temperature: "5"
                target:
                  entity_id: "{{ device }}"
      - conditions:
          - condition: trigger
            id: HeizungAN
        sequence:
          - if:
              - condition: template
                value_template: "{{ scheduler_state }}"
            then:
              - service: climate.set_temperature
                data:
                  temperature: "{{ eco_temp }}"
                target:
                  entity_id: "{{ device }}"
            else:
              - service: climate.set_temperature
                data:
                  temperature: "{{ comfort_temp }}"
                target:
                  entity_id: "{{ device }}"
mode: parallel
max: 20