Hello friends,
after having tried around for a long time and not finding a perfect solution for me, I have now built a very well working control for my living room heating. I have two windows in my living room and what was most important to me was that no matter which window is opened or closed, the heating is always turned on and off correctly. In addition, the temperature should be given from the thermostat to Home Assistant when the thermostat is changed manually and the values from Home Assistant to the thermostat, all according to the heating mode. I have now also solved everything about 1 mode from the thermostat, since the thermostat is controlled since some Home Assistant versions by the hvac_mode and a preset_mode. After a long time of trying I decided to use only heating and OFF from the thermostat and to define the Eco and heating mode directly in Home Assistant.
I think there are some solutions that are a bit simpler, because it’s all very complex and there’s no holiday mode. This is not so important to me because I switch the heating on and off manually when I come home from work and go to bed. More important to me was that the heating goes off when I open one or both windows.
Logic:
If one of the two windows is opened, it is checked whether the heating mode is set to Eco or Heating, if this is the case, the heating is switched off and the previous heating mode is written into a template. If one window is now closed and the other is still open, nothing happens. Only when both windows are closed will the system check whether the heating was previously in Eco or heating mode and then set it to the previous mode.
With the Xiaomi switch I can manually choose between the heating mode Eco and Heating. So when I go to bed I press the button and the heating goes into Eco mode. When I come home and press the switch, it goes on. Both, however, only if it was previously in either heating or Eco mode.
Devices:
1x Xiaomi Wireless Switch (for manual switching between eco and heating mode)
2x window sensors
1x Eurotronic Spirit Z-Wave Plus Thermostat
Home Assistant Objects:
2 sliders for the temperature setting of eco and heating mode
1 input selector for the thermostat modes (Off, Eco, Heating)
1 template input selector for the previous thermostat modes with window open
Setting options:
Off, Eco, Heating
Temperature for Eco Mode
Temperature for heating mode
configuration.yaml
input_number:
slider_wzheat:
name: WZHeatSlider
min: 8
max: 28
step: 0.5
unit_of_measurement: '°C'
slider_wzheateco:
name: WZHeatEcoSlider
min: 8
max: 28
step: 0.5
unit_of_measurement: '°C'
input_select:
wzheat_preset:
name: Thermostatmodus
options:
- Aus
- Eco
- Heizen
icon: mdi:radiator
wzheat_preset_template:
name: Thermostatmodus
options:
- Aus
- Eco
- Heizen
sensors.yaml
####################################################################
###### Wohnzimmer Thermostat Sensor ###############################
wz_thermostat_value:
value_template: "{{ states.climate.eurotronic_eur_spiritz_wall_radiator_thermostat_heat.attributes.temperature }}"
wz_thermostat_furnacevalue:
value_template: "{{ states.climate.eurotronic_eur_spiritz_wall_radiator_thermostat_furnace.attributes.temperature }}"
automations.yaml
################################################################################
### Heizung ####################################################################
####################################################################
###### Ändere Werte bei Input Selector ###########################
- alias: WZ Heizung AUS
trigger:
- platform: state
entity_id: input_select.wzheat_preset
to: 'Aus'
action:
- service: climate.set_hvac_mode
data:
entity_id: climate.eurotronic_eur_spiritz_wall_radiator_thermostat_heat
hvac_mode: 'off'
- alias: WZ Heizung ECO
trigger:
- platform: state
entity_id: input_select.wzheat_preset
to: 'Eco'
action:
- service: climate.set_hvac_mode
data:
entity_id: climate.eurotronic_eur_spiritz_wall_radiator_thermostat_heat
hvac_mode: heat
- service: climate.set_temperature
data_template:
entity_id: climate.eurotronic_eur_spiritz_wall_radiator_thermostat_heat
temperature: '{{ states.input_number.slider_wzheateco.state | float }}'
- alias: WZ Heizung AN
trigger:
- platform: state
entity_id: input_select.wzheat_preset
to: 'Heizen'
action:
- service: climate.set_hvac_mode
data:
entity_id: climate.eurotronic_eur_spiritz_wall_radiator_thermostat_heat
hvac_mode: heat
- service: climate.set_temperature
data_template:
entity_id: climate.eurotronic_eur_spiritz_wall_radiator_thermostat_heat
temperature: '{{ states.input_number.slider_wzheat.state | float }}'
####################################################################
###### Ändere Werte bei Slider Änderungen #########################
- alias: Slider Set Heat Eco
hide_entity: true
initial_state: true
trigger:
platform: state
entity_id: input_number.slider_wzheateco
condition:
- condition: state
entity_id: input_select.wzheat_preset
state: 'Eco'
action:
- service: climate.set_temperature
data_template:
entity_id: climate.eurotronic_eur_spiritz_wall_radiator_thermostat_heat
temperature: "{{ states.input_number.slider_wzheateco.state | float }}"
- alias: Slider Set Heat
hide_entity: true
initial_state: true
trigger:
platform: state
entity_id: input_number.slider_wzheat
condition:
- condition: state
entity_id: input_select.wzheat_preset
state: 'Heizen'
action:
- service: climate.set_temperature
data_template:
entity_id: climate.eurotronic_eur_spiritz_wall_radiator_thermostat_heat
temperature: "{{ states.input_number.slider_wzheat.state | float }}"
####################################################################
###### Slider Wert bei manueller Änderung am Thermostat ##########
- alias: Sync WZ Thermostat Value Heat
trigger:
platform: state
entity_id: sensor.wz_thermostat_value
condition:
- condition: state
entity_id: input_select.wzheat_preset
state: 'Heizen'
action:
service: input_number.set_value
data_template:
entity_id: input_number.slider_wzheat
value: "{{ trigger.to_state.state | float }}"
- alias: Sync WZ Thermostat Value Eco
trigger:
platform: state
entity_id: sensor.wz_thermostat_value
condition:
- condition: state
entity_id: input_select.wzheat_preset
state: 'Eco'
action:
service: input_number.set_value
data_template:
entity_id: input_number.slider_wzheateco
value: "{{ trigger.to_state.state | float }}"
####################################################################
###### Heizmodus bei Xiaomi Switch Button Press ##################
- alias: Heizung Wohnzimmer Switch AN
trigger:
platform: event
event_type: xiaomi_aqara.click
event_data:
entity_id: binary_sensor.switch_158d00020fec64
click_type: long_click_press
condition:
- condition: state
entity_id: input_select.wzheat_preset
state: 'Eco'
action:
- service: climate.set_hvac_mode
data:
entity_id: climate.eurotronic_eur_spiritz_wall_radiator_thermostat_heat
hvac_mode: heat
- service: climate.set_temperature
data_template:
entity_id: climate.eurotronic_eur_spiritz_wall_radiator_thermostat_heat
temperature: '{{ states.input_number.slider_wzheat.state | float }}'
- service: input_select.select_option
data_template:
entity_id: input_select.wzheat_preset
option: 'Heizen'
- alias: Heizung Wohnzimmer Switch ECOMODE
trigger:
platform: event
event_type: xiaomi_aqara.click
event_data:
entity_id: binary_sensor.switch_158d00020fec64
click_type: long_click_press
condition:
- condition: state
entity_id: input_select.wzheat_preset
state: 'Heizen'
action:
- service: climate.set_hvac_mode
data:
entity_id: climate.eurotronic_eur_spiritz_wall_radiator_thermostat_heat
hvac_mode: heat
- service: climate.set_temperature
data_template:
entity_id: climate.eurotronic_eur_spiritz_wall_radiator_thermostat_heat
temperature: '{{ states.input_number.slider_wzheateco.state | float }}'
- service: input_select.select_option
data_template:
entity_id: input_select.wzheat_preset
option: 'Eco'
####################################################################
###### Heizmodus bei Fenster offen ###############################
- alias: WZ Heizung AUS FenstAUF1
trigger:
- platform: state
entity_id: binary_sensor.door_window_sensor_158d00016cce4b
to: 'on'
condition:
condition: and
conditions:
- condition: state
entity_id: binary_sensor.door_window_sensor_158d0001a99e12
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: input_select.wzheat_preset
state: 'Heizen'
- condition: state
entity_id: input_select.wzheat_preset
state: 'Eco'
action:
- service: input_select.select_option
data_template:
entity_id: input_select.wzheat_preset_template
option: "{{ states('input_select.wzheat_preset') }}"
- service: input_select.select_option
data_template:
entity_id: input_select.wzheat_preset
option: 'Aus'
- alias: WZ Heizung AUS FenstAUF2
trigger:
- platform: state
entity_id: binary_sensor.door_window_sensor_158d0001a99e12
to: 'on'
condition:
condition: and
conditions:
- condition: state
entity_id: binary_sensor.door_window_sensor_158d00016cce4b
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: input_select.wzheat_preset
state: 'Heizen'
- condition: state
entity_id: input_select.wzheat_preset
state: 'Eco'
action:
- service: input_select.select_option
data_template:
entity_id: input_select.wzheat_preset_template
option: "{{ states('input_select.wzheat_preset') }}"
- service: input_select.select_option
data_template:
entity_id: input_select.wzheat_preset
option: 'Aus'
- alias: Wohnzimmer Heizung EIN bei alle Fenster ZU
trigger:
- platform: state
entity_id: binary_sensor.door_window_sensor_158d00016cce4b, binary_sensor.door_window_sensor_158d0001a99e12
to: "off"
condition:
condition: and
conditions:
- condition: state
entity_id: 'binary_sensor.door_window_sensor_158d00016cce4b'
state: 'off'
- condition: state
entity_id: 'binary_sensor.door_window_sensor_158d0001a99e12'
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: input_select.wzheat_preset_template
state: 'Heizen'
- condition: state
entity_id: input_select.wzheat_preset_template
state: 'Eco'
action:
- service: input_select.select_option
data_template:
entity_id: input_select.wzheat_preset
option: "{{ states('input_select.wzheat_preset_template') }}"
Lovelace UI card
cards:
- entities:
- entity: input_select.wzheat_preset
- entity: input_number.slider_wzheateco
icon: 'mdi:gauge-low'
name: Temperatur Eco
- entity: input_number.slider_wzheat
icon: 'mdi:gauge-full'
name: Temperatur Heizen
show_header_toggle: false
title: Heizung
type: entities
- cards:
- entity: sensor.wz_thermostat_furnacevalue
max: 28
min: 8
name: Ist-Temp.
severity:
green: 22
red: 18
yellow: 20
theme: default
type: gauge
unit: °C
- entity: sensor.wz_thermostat_value
max: 28
min: 8
name: Soll-Temp.
theme: default
type: gauge
unit: °C
type: horizontal-stack
type: vertical-stack
It all works very well, but I would be very happy about suggestions and tips.