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

Code:

alias: Heizung Switch Zeitplan
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.heizung_wc_zeitplan
      - input_boolean.heizung_eingang_zeitplan
      - ...
    id: ZeitplanOFF
    to: "off"
  - platform: state
    entity_id:
      - input_boolean.heizung_wc_zeitplan
      - input_boolean.heizung_eingang_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 }}"
      temp: |
        {% if scheduler_state %}
          {{ eco_temp }}
        {% else %}
          {{ comfort_temp }}
        {% endif %}
  - choose:
      - conditions:
          - condition: trigger
            id: ZeitplanOFF
        sequence:
          - if:
              - "{{ not scheduler_state }}"
            then:
              - service: input_number.set_value
                data_template:
                  value: "{{ device_temp }}"
                target:
                  entity_id: "{{ comfort }}"
      - conditions:
          - condition: trigger
            id: ZeitplanON
        sequence:
          - service: climate.set_temperature
            data:
              hvac_mode: heat
              temperature: "{{ temp }}"
            target:
              entity_id: "{{ device }}"
mode: parallel
max: 20