Skip to main content

Heizung Absenkung Fenster

 

 

 

alias: Heizung Fenster Absenkung
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.fenster_wc_open_close
      - binary_sensor.fenster_buero_open_close
      - ...
    id: FensterAUF
    to: "on"
  - platform: state
    entity_id:
      - binary_sensor.fenster_wc_open_close
      - binary_sensor.fenster_buero_open_close
      - ...
    id: FensterGESCHLOSSEN
    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 }}"
  - choose:
      - conditions:
          - condition: trigger
            id: FensterAUF
        sequence:
          - if:
              - "{{ scheduler_state }}"
            then:
              - service: climate.set_temperature
                data:
                  temperature: "5"
                target:
                  entity_id: "{{ device }}"
            else:
              - 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: FensterGESCHLOSSEN
        sequence:
          - if:
              - "{{ 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