Home automation from nothing to done: Part 3

This is one of a serie of 7 posts about home automation from nothing to done. Each of them marks a milestone in the project and none of them should be too long to comfortably read in the metro when commuting.

In this post I’ll write how to make your heating smarter. In case you didn’t read the first two parts, please take into account that I’m using Home assistant as my home automation software. I have it running on a Raspberry Pi 3, but if you just want to try it out and don’t want to commit buying a device you can install it on your desktop or laptop. I strongly recommend using their docker image in this case since it’s the fastest and less intrusive way to try it out.

At the end of this post we’ll be able to:

  • control our heating through home assistant
  • control our heating with the Homematic web interface
  • control our heating with the physical thermostats

In my opinion it’s important to have multiple fallbacks to make sure that everybody (not only us, but also guests for instance) can interact with our smart home even if they don’t have access to our software or mobile apps.

Smart thermostats

As for all the other appliances, there are a number of smart thermostats you can buy. During my investigation I read about Honeywell, Devolo, Homematic and Elgato. Nest was obviously very high in the list too, but the cost was quite higher than the other ones and I didn’t have a pre-existing centralized setup I could control with it. Remember that as in every other post, my choices are also dictated by the fact that I didn’t want to tear down walls and existing appliances. Your mileage may vary.

Smart thermostats DIY installation Home Assistant support Extensible Price
Honeywell 45€/thermostat + 90€ Hub
Devolo 50€/thermostat + 150€ hub
Homematic 48€/thermostat + 50€ Hub
Elgato ? 62€/thermostat
Nest 270€/hub

I have reasons to believe all of the above are good brands and can work perfectly fine for your smart home setup. Nonetheless, I decided to go with Homematic for a couple of reasons:

  1. Their thermostats can work without hub. This means I could try them and set them up even without an automation integration.
  2. Homematic offers a couple more of nice appliances like window and door sensors that I already planned to buy and wire to the thermostats.
  3. Home Assistant integration was clearly working as I could see from the forums.
  4. Last but not least, the cost was not prohibitive (this is completely subjective, though).

So I ended up buying 4 of these thermostats (and eventually the hub, in order to wire everything to Home Assistant).

a picture of the thermostat

Setting up the thermostats

Since the thermostats can work perfectly fine without the hub, and given that I actually purchased them about one month before I purchased the hub, I set up each one of them with different schedules straight from the devices themselves. For instance, the living room one doesn’t heat in the morning because nobody is there, while the bathroom and bedroom turn on quite early in order for the rooms to be warm when we wake up. All the heatings turn on in the afternoon and they turn off at different times (the bedroom is the last one) in the evening. Of course this schedule only applies from September through March.

Keep in mind that I could perform the same setup through Home Assistant automations (that will be explained in better detail in one of the following posts), but I decided not to rely on Home Assistant for the heating system since it’s a quite critical part of the living experience (especially in winter, where here in Berlin the temperature can easily go below 0° C) and I want everything to work even if the Home Assistant setup is temporarily broken (or if an update to the software broke the homematic integration for any reason). The more stable Home Assistant becomes, maybe after a 1.0 release, the more I can think of migrating the schedule to it (for instance, in March I had to manually change the schedule of all thermostats not to turn on anymore. In September I’ll have to undo this. With Home Assistant automations I wouldn’t have to worry anymore, and I could actually dynamically change the schedules depending on the temperatures).

One more thing to note is that if you want to set more than 6 different intervals for any given day of the week, you may have to either use the homematic hub or Home Assistant automations since the thermostats only support up to 6 intervals a day.

For example the following:

  • 00:00 to 06:00 -> off
  • 06:00 to 09:00 -> on
  • 09:00 to 16:30 -> off
  • 16:30 to 23:00 -> on
  • 23:00 to 00:00 -> off

are already 5 intervals. So you might need to keep this in mind if you don’t plan on buying an Hub initially. Also, Home Assistant only integrates with the Homematic Hub and not with the independent thermostats.

Setting up the Homematic hub

A picture of the hub

Once I bought the hub I decided not to reset all the schedules on every thermostat and re-configure them on the hub, so the only thing I did was pair them one by one. This way they would have been accessible through Home Assistant too. I also set a manual IP address for the hub through the router DHCP menu. I recommend this approach since Home Assistant requires the IP address of the hub and auto discovery is not currently supported.

Don’t forget to navigate to Settings -> Devices and give a name to each thermostat because this is the name we will use when configuring them in Home Assistant.

Wiring the hub to Home Assistant

In order for Home Assistant to know about all the Homematic devices that are paired to the hub, we have to add a new entry in the configuration.yaml file:

      resolvenames: json 
      username: [USERNAME]
      password: [PASSWORD]

I found the json name resolution worked quite reliably in my experience. To use it, you have to create a user through the hub web interface. You can navigate to Settings -> User management and you should see an interface similar to the one in the following picture:

user management

Add a new user, set username and password and use these credentials in the above configuration. I recommend not to grant administration privileges since it’s not needed and prevents the component from doing weird/unexpected things in the future.

Controlling the thermostats through Home Assistant

The next time you open the Home Assistant web interface, you may see a Homematic card that doesn’t really do a lot. Don’t worry, this is normal (even though I admit a bit counter-intuitive).

To find your thermostats, you can go to the States screen reachable at http://[YOUR_HOME_ASSISTANT_IP]:8123/dev-state and look for climate. You should see all the thermostats you paired to the Homematic hub.

climate devices

As you can see the thermostats even have a built-in temperature sensor This allows us to build smart automations in the future, for instance to adjust the settings according to the room temperature.

Now we can create a group to collect all the thermostats entities together and make them available for us to control through the Home Assistant web interface.

Let’s create a new file named groups.yaml in the same directory as the configuration.yaml file, and let’s paste our group:

  name: Heating
  icon: mdi:gauge
    - climate.[YOUR_THERMOSTAT_NAME]

To include this new file in the configuration, we have to add a new line to it:

group: !include groups.yaml

This instructs the configuration file to also include the content of groups.yaml when configuring the groups.

After you restart Home Assistant, you should be able to see the thermostats as in the following image:

climate component

Clicking on one of the entities you can set the temperature, the operation mode (auto/manual) and see the history of its state.

climate detail

You can also perform the same operations through services, something we will see when adding scripts and automations to our Home Assistant setup.

With this post we were able to configure smart thermostats with Home assistant and are now able to control them through its web interface (also from our mobile phone).

With the next post I’ll write about how to setup scenes and scripts, which together with automations are going to form the essential part of our home automation setup. Keep reading!