Heizung An- / Aus
Code:
alias: Heizung An / Aus
description: ""
trigger:
- platform: state
entity_id:
- input_boolean.heizung_buero_on_off
- input_boolean.heizung_wc_on_off
- ...
id: HeizungAN
to: "on"
- platform: state
entity_id:
- input_boolean.heizung_buero_on_off
- input_boolean.heizung_wc_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 }}"
- choose:
- conditions:
- condition: trigger
id: HeizungAUS
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: HeizungAN
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