This is one of my first home assistant projects so I would appreciate feedback on it. I need to learn from my mistakes and can only do that if someone is willing to give me some tips. Thanks in advance
We already have “dumb” mechanical thermostats in each room. You turn a wheel to set the temperature you want the underfloor heating to maintain. Behind the thermostat in the living room I have installed a Shelly 1PM switch and wired the output from the thermostat to the input of the switch.
The aim of this automation is as follows.
If there is some one at home, then they should control the heating in the living room using the existing thermostat. If there is no one at home, then the Shelly Switch takes over the control keeping the room above 14°C If the Home Assistant decides to stop working, the thermostat should still work.
This is the flow diagram I developed while thinking about this.
I have a helper that is set “on” when someone is home but “off” when no one is there. That is what decides who does the controlling. If it is “on”, then the automation doesn’t need to do anything as the Shelly deals with things. If it is “off” then the Home Automation needs to keep the temperature at about 14.5°C.
Here is my code:
alias: Wohnzimmer Heizung
description: >-
Wenn jemand zu Hause ist, sollte er die Heizung im Wohnzimmer mit dem
vorhandenen Thermostat regeln. Wenn niemand zu Hause ist, übernimmt der Shelly
Switch die Steuerung und hält die Raumtemperatur über 14 °C.
triggers:
- trigger: state
entity_id:
- switch.thermostat
from: null
to: null
- trigger: numeric_state
entity_id:
- sensor.wetter_wohnzimmer_temperatur
above: 15
- trigger: numeric_state
entity_id:
- sensor.wetter_wohnzimmer_temperatur
below: 14
conditions:
- condition: state
entity_id: input_boolean.someoneathome
state:
- "off"
actions:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.wetter_schlafzimmer_temperatur
above: 14.5
sequence:
- action: switch.turn_off
metadata: {}
data: {}
target:
entity_id: switch.thermostat
- conditions:
- condition: numeric_state
entity_id: sensor.wetter_wohnzimmer_temperatur
below: 14.5
sequence:
- action: switch.turn_on
metadata: {}
data: {}
target:
entity_id: switch.thermostat
mode: single
The automation appears to work as expected but I am very interested to hear what I have forgotten / done wrong.
Thanks - and greetings from the frozen Alps
