For a long time Home Assistant users have had the option to create virtual thermostats using the climate
integration. This integration acts like a regular thermostat because it checks the current temperature and turns on the heater or A/C to maintain a preset room temperature.
This can be particularly useful if you do not have a physical thermostat installed and want to make a dumb heater smarter.
Setting up the thermostat component
climate:
- platform: generic_thermostat
name: Lounge Heater
heater: switch.lounge_heater
target_sensor: sensor.lounge_temperature
min_temp: 18
max_temp: 25
target_temp: 20
min_cycle_duration: 300
cold_tolerance: 18
hot_tolerance: 22
The min_cycle_duration
setting defines the minimum amount of time for each heating cycle. This stops the heater from turning on at 19.9 degrees for a few seconds to heat the room and then turning off again once the target_temp at 20.1 degrees. It would otherwise create an annoying cycle of heater on/heater off.
The cold_tolerance
setting determines how far below 20 degrees the room temperature is allowed to drop before the heater is switched on.
hot_tolerance
does the opposite. It will turn off the heater once the room has been heated to 22 degrees. (but only if the heater has already been running for 5 minutes according to min_cycle_duration
)
The full documentation can be found here
Automating thermostat interactions
Turning on the thermostat when I am home
Now that we have created a virtual thermostat we are able to control it using the Home Assistant website. Ideally, we should try to automate away any manual interaction. One thing I find myself doing is to turn on the thermostat when I come home from work. This can be done easily using the automation below.
automation:
trigger:
platform: state
entity_id: device_tracker.daniel
to: 'home'
action:
- service: climate.turn_on
entity_id: climate.lounge_heater
Turning off climate control when nobody is home
automation:
trigger:
platform: state
entity_id: device_tracker.daniel
to: 'away'
action:
- service: climate.turn_off
entity_id: climate.lounge_heater
Want to receive free smart home tips and tricks in your inbox?
Sign up to receive free tips and tricks that will help you build your home automation system.
Conclusion
This what I love about home automation, being able to define virtual appliances like a thermostat and automating away some tedious interactions that would otherwise need to be done manually. Let me know in the comments if you can think of any additional use cases and useful automations relating to climate control or thermostats!
Photo by Dan LeFebvre on Unsplash