Backing into home automation

MQTT

Whilst implementing a little project one of the possibilities was to use a MQTT Broker. In the final go around I did not use the MQTT broker. But since I now had a running MQTT broker on the RaspberryPi I wondered what, if anything, that would be good for. About every web search indicated that it was used in home automation.

Flashback

Way back in the 1970s and 80s I fitted out my house with a number of X-10 devices, original ones labeled BSR and later ones typically Radio Shack or Leviton (the Leviton were far more reliable). So I guess I am not a total newbie with home automation. However that house was sold in the early 1990s and I’ve not paid any attention to the field in over 25 years.

What Is Home Automation?

It seems that there are two big areas that people think of when “home automation” is mentioned:

  • Remote control of lights and equipment
  • Alarm systems

Most of the hype seems to be about voice control but all the advertising seems to be for using it as just another remote control input. “Alexa, turn on the living room lights”, etc.

My take on home automation is a little different: There should be no fancy touch control screens or voice commands needed. Everything should just happen when it should and not when it shouldn’t. That end goal will need significant computer learning (AI) to achieve but in the meantime some things can be implemented by running sequences that are triggered from available sensors.

The real test of a system would be to see if a visitor, with no instruction, was able to “run” things, that is have the house react in a proper way for someone who has not been trained to operate the system.

Finding an excuse a project

With a relatively under used Raspberry Pi available I decided to look around for something that could improve our day to day household experience. The initial project is actually something that could be done with no computers at all. But using components designed for automation made the project simpler and cheaper to implement.

Our master bath is located diagonally opposite in our house from our hot water heater. The previous owner had a plumber install a return line and a circulation pump and then, to save energy, put a timer on the pump power to limit the time is was on to times when it was likely that instant hot water would be desired.

It dawned on me a while back that the shower lights were on a separate switch and that if the circulation pump ran when the shower lights were on we’d solved the problem of a long wait for hot water. I surveyed the situation and figured out that only real way to run a cable between the shower light switch and the pump power outlet was through the crawl space under the house. But to do that a hole would be need to be drilled through a poured concrete foundation wall. More than I wanted to deal with myself and our quest for electrical contractors willing to do it for a reasonable price was not successful either.

But with a light switch that could send its on/off status and a remove on/off device for the pump, maybe it would be cheaper to “automate” this rather than hard wire it.

This is a trivial example of how I think home automation ought to work:

  • The system reliably detects a situation
  • The system adapts/adjusts various household items to make it nicer for the occupants.

And another excuse project

While researching the various options available it dawned on me that we had another slight irritation that could be addressed: If we don’t remember to turn on the front porch light when we anticipate returning after dark it is hard to see to put the key in lock. I guess one could go full in and get remote control lock but that is a step too far for me. In the mean time if the porch light could turn on for a few minutes when we arrive home after dark it would be great.

A motion detector is not desired for that as I only want the lights to come on for us. So “house owner presence detection” rather than movement or heat detection is needed. For security, if I feel the need for a video camera at that location it can certainly be one that has night vision capabilities.

To implement this simple automation we need something that:

  • Knows if it is light or dark out
  • Reliably detects if we have been away and have now just returned.

It turns out that these are pretty easy nowadays. And, as usual, I’ve gone a bit overboard. The local home center has some compatible switches and sensors but does not have all the bits needed to do what I want. So basically the time consuming part is waiting for delivery of on-line ordered bits and pieces.

Summary

I guess I should go into more detail, but I’ll just mention the general way I’ve done the above:

  • Decided to go with Home Assistant installed on the Raspberry Pi. It seems to have a myriad of add-ons to allow it to communicate and control devices using the most of the currently deployed home automation protocols.
  • Decided to use Z-Wave based remote control sensors and switches.
  • Am using Node-RED to create automation scripts.
  • Am using a Home Assistant component that can pull the list of devices on my network to determine, based on cellphones connected to WiFi, if we are home.
  • Everything is setup to be locally managed: I’d rather not have the system require the Internet to work and I’d rather not be sharing the status of my house with a third party.