Skip to main content

Heizung Switch Zeitplan

Per Switch kann der Zeitplan aktiviert oder deaktiviert werden. Dabei wird die dann korrekte Temperatur gesendet.

Zeitplan AUS bedeutet Komfort Temperatur

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

Code:

alias: Heizung Switch Zeitplan
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.heizung_wc_zeitplan
      - input_boolean.heizung_eingang_zeitplan
      - input_boolean.heizung_flur_zeitplan
      - input_boolean.heizung_buero_zeitplan
      - input_boolean.heizung_werkstatt_zeitplan
      - input_boolean.heizung_ez_zeitplan
      - input_boolean.heizung_wz_zeitplan
      - input_boolean.heizung_sz_zeitplan
      - input_boolean.heizung_gruen_zeitplan
      - input_boolean.heizung_rosa_zeitplan
      - input_boolean.heizung_lydi_zeitplan
      - input_boolean.heizung_kinderbad_zeitplan
      - input_boolean.heizung_carrera_zeitplan
      - input_boolean.heizung_wcdg_zeitplan
      - input_boolean.heizung_studio_zeitplan
    id: ZeitplanOFF
    to: "off"
  - platform: state
    entity_id:
      - input_boolean.heizung_wc_zeitplan
      - input_boolean.heizung_eingang_zeitplan
      - input_boolean.heizung_flur_zeitplan
      - input_boolean.heizung_buero_zeitplan
      - input_boolean.heizung_werkstatt_zeitplan
      - input_boolean.heizung_ez_zeitplan
      - input_boolean.heizung_wz_zeitplan
      - input_boolean.heizung_sz_zeitplan
      - input_boolean.heizung_gruen_zeitplan
      - input_boolean.heizung_rosa_zeitplan
      - input_boolean.heizung_lydi_zeitplan
      - input_boolean.heizung_kinderbad_zeitplan
      - input_boolean.heizung_carrera_zeitplan
      - input_boolean.heizung_wcdg_zeitplan
      - input_boolean.heizung_studio_zeitplan
    id: ZeitplanON
    to: "on"
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 | bool }}"
      temp: |
        {% if scheduler_state %}
          {{ eco_temp }}
        {% else %}
          {{ comfort_temp }}
        {% endif %}
  - choose:
      - conditions:
          - condition: trigger
            id: ZeitplanOFF
        sequence:
          - if:
              - condition: template
                value_template: "{{ not scheduler_state }}"
            then:
              - 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 }}"
      - conditions:
          - condition: trigger
            id: ZeitplanON
        sequence:
          - service: script.turn_on
            data:
              variables:
                room: "{{ room }}"
                temp: "{{ temp }}"
            target:
              entity_id: script.heizung_set_temperature
mode: parallel
max: 20