Making a Smarter Home

Making a Smarter Home

Many years ago I bought some X10 equipment to provide a way of controlling switches from a remote location. I also bought the computer module and had a single automation running to turn the porch light on at dusk and off at 2 am. While this was cool and useful, it wasn’t a smart home. Once I moved, the switches moved with me but the automation was never restored. Since then I have contemplated making my house smarter but I wanted actual automations so I didn’t just complicate my house with new ways to control things. I wasn’t going to settle for turning on the porch light at dusk so until this year my house remained un-smart.

With my new A/C that was installed a couple of years ago I got a wifi thermostat that could be controlled from my phone. One of the features I really liked on this thermostat was the circulate fan mode. Like many homes, my house has hot and cool spots and it would be nice to have the fan minimize this by circulating the air. However I live in the Houston area and circulating air thru the A/C if the system was recently cooling will result in the indoor humidity going up from the air passing through the water saturated evaporated coils. To avoid this unpleasant situation I only want to circulate the air if the heater has been running. Now some of you will point out an easy solution is to only set the thermostat to circulate when I flip to heat mode. Again, thanks to Texas weather there are weeks, even days, where keeping your house a comfortable temperature means you run both heat and cool. Thanks to dual set points the thermostat takes care of the temperature control but it won’t change the fan mode.

My original solution was to write a script to query the thermostat, find out what it was doing and switch the fan mode appropriately. In learning how to programmatically interact with my Lennox thermostat I ran across Home Assistant. Home Assistant is a free, open source home automation system written in Python that can easily run on a Raspberry Pi. Well the price was right, I was learning python and I had a Raspberry Pi that needed a purpose. With all of that going for it I promptly switched gears and started installing and configuring Home Assistant. As a side note, don’t buy a Lennox A/C! Their thermostat is proprietary and the only way to interact with it is to connect it to their cloud service and then interact with the cloud service. There are much better thermostats out there, unfortunately the advanced features of my unit only work with Lennox thermostats. If someone from Lennox happens to read this, please think of your customers and open things up.

Home Assistant has two major install options; HASS.IO which is a custom linux flavor with Home Assistant integrated in, and a standalone service that can be run on any flavor of Linux that has Python 3. I played with both, but HASS.IO had some limitations around custom components so I opted to install the service on Raspbian. Even as an add-on service there are a couple of ways to install it. I chose to install it in a python virtual environment as described here.

Like most home automation systems out there, documentation for Home Assistant is very basic and not as helpful as it could be, but there is a very active forum with lots of helpful people. Home Assistant has native components for talking to a lot of the smart thermostats on the market but Lennox is not one of them. But Jerome had written the custom climate component for HA as well as an API for talking to the thermostat. His code was a bit old by the time I found it and both Home assistant and Lennox had made some breaking changes so I took to rewriting parts of the code to get it working again. Having never worked with Home Assistant I had to read through the documentation and a lot of the source code to figure out how this component was supposed to behave. After much patience and perseverance, I had Home Assistant talking to my thermostat. Yay! I have another way to control my A/C! If you are also blessed with a Lennox Wifi thermostat and want to control it programmatically I have both updates pieces available on GitHub.

Home Assistant is still pretty young and is in active development so breaking changes happen. Before I could learn how to build an automation, one of the updates broke the interaction with the thermostat. After more digging into the HA source code I figured out what was wrong and updated my code to work with the new standards. With that distraction and the amount of time that passed while getting to this point, the need to run the heater had passed and the house had switched to permanent cooling. But never fear, my time spent in the documentation and forums lead me to all sorts of other things I can do with this system. So what should I work on now? Stick with my goal and build an automation that I can’t use for a couple more months or maybe setup LED light strips for lighting and notifications, or build something to find out if the garage door is open. With so many choices I don’t know what will actually come to life next.

Come back again and see where this choose your own adventure takes me.

Jacob

Leave a Reply

Your email address will not be published. Required fields are marked *