Simple Thermostat Automation with Home Assistant

Simple Thermostat Automation with Home Assistant

Introduction

The heating season in Poland is ongoing. Automating room temperature can significantly reduce costs. Here, I will present a simple setup that utilizes just two devices.

What will You learn?

  • Create a new Home Assistant automation
  • Execute a specific action based on a trigger
  • Monitor automation executions

What devices to use?

I began building my home automation with basic devices, including the Aqara temperature sensor and the Avatto TRV6 thermostat. I recently purchased both on AliExpress at a fair price. Please check out the linked articles if you would like to learn more about them and their installation.

Setting up heat automation

Open Home Assistant homepage and navigate to Settings -> Automation.

Since this is a simple automation, I will create two procedures: one for turning on the heating and another for switching it off.

Let’s start with the first one. Click Create automation button, and then Create New Automation.

Add a trigger. In my case, it’s Aqara sensor, placed in the living area.

When the temperature stays below 21 degrees Celsius for at least 10 minutes, the automation will be triggered.

Next up, you can add an optional condition for example time is between. Personally I don’t want to heat the living room in the night, because I’m in bedroom. So here I’ve added another condition if current time is between 6am and 10pm.

Last step for this automation is to set what actually needs to be done, so turning on the heating. I chose the correct thermostat and set its mode to `heat`.

That’s it for now.  Click Save and you will be asked to give that automation a name.

If you prefer YAML code, I’m sharing it below:

alias: Living Room Radiator Daily
description: Heat when below 21degrees between 6 and 22
trigger:
  - type: temperature
    platform: device
    device_id: 9a40ade37c2b29a15e93c3a687521361
    entity_id: 7d8b003e895fcb140feb0535e63daf7b
    domain: sensor
    below: 21
    for:
      hours: 0
      minutes: 10
      seconds: 0
condition:
  - condition: time
    after: "06:00:00"
    before: "22:00:00"
action:
  - device_id: dbd3dc4af8c1a68b75a9b23532abdebf
    domain: climate
    entity_id: 3fa5058913a0b77ee1d623acedd43848
    type: set_hvac_mode
    hvac_mode: heat
mode: single

Turning off the heating

In the same manner as previously create a new automation.

I will also check the current room temperature, but this time, the condition is that the temperature must be above 21 degrees Celsius.

And the actual action to be executed:

Same as previously I’m sharing the YAML:

alias: Living Room Radiator Daily
description: Heat when below 21degrees between 6 and 22
trigger:
  - type: temperature
    platform: device
    device_id: 9a40ade37c2b29a15e93c3a687521361
    entity_id: 7d8b003e895fcb140feb0535e63daf7b
    domain: sensor
    below: 21
    for:
      hours: 0
      minutes: 10
      seconds: 0
condition:
  - condition: time
    after: "06:00:00"
    before: "22:00:00"
action:
  - device_id: dbd3dc4af8c1a68b75a9b23532abdebf
    domain: climate
    entity_id: 3fa5058913a0b77ee1d623acedd43848
    type: set_hvac_mode
    hvac_mode: heat
mode: single

And that’s it! Your simple heating management should be up and running. 

Monitoring automation execution

You can check whether your automation is working as expected using two methods.

The first, and in my opinion the most useful, is to view the Logbook. You can access it from main navigation panel on the left hand side.

In the screenshot, you can clearly see exactly when the heating was turned on and when it was turned off.

Another option, especially useful when debugging is to check Traces. Traces are accessible from automation menu. There you can check every step and parameters used.

If you found this article helpful, consider buying me a coffee. This helps me continue writing these articles for you!

Buy Me A Coffee

Conclusion

In this article I showed you how to set up a simple automation in Home Assistant. With this automation, you will be able to manage the heating in your home. It serves as a baseline, so if you need something more tailored to your needs, please experiment and share your results!