As my Home Assistant setup has become increasingly complex, I’ve started to see the limitations of the Raspberry Pi platform. Graphs are slow, and the history and logbook are basically unusable to me. Everything works, but I’d like to be able to use these things with a lot more data and still have everything be snappy in the frontend. My other home server needs have grown as well, so I decided to get an Intel NUC and migrate all of my current servers to either Docker containers or virtual machines with Proxmox.
Setting up a smart home can be a costly affair, if every device needed an expensive proprietary smart switch you would spend quite a bit of money. With a very tiny amount of soldering and some custom firmware, the Sonoff Basic model can be turned into a locally controlled MQTT enabled WiFi smart switch for about $7 each. These tiny little esp8266 based boards can be spliced into a power cord to add WiFi control to anything.
I have about a dozen of these and they work great. Because of how cheap they are, I have started adding them to some ridiculous devices. Today’s DIY WiFi retrofit: my coffee mug warmer.
I want my mug warmer to come on automatically when I enter my office in the morning, but only if I’ve made coffee already. But first, I need to flash some new firmware onto my Sonoff.
I am in the habit of going on cooking sprees while listening to music… loudly. I only share one wall with a neighbor here in the loft, and that neighbor is very tolerant. On a Sunday afternoon, with multiple dishes going at a time, my most used smart home feature is “Alexa, set a meatball timer for 25 minutes”. Having Alexa keep track of all my timers is really helpful when my hands are full. The problem is that I rarely hear the timer, and have burned a few things not paying attention.
Using IFTTT, Node-Red, and Home Assistant I can blink the lights in the room when the Alexa timer goes off – even if I wander off to a different room.
Privacy is important in the smart home, and one of the primary reasons to use Home Assistant is because it is totally under control of the user, on your own network. Since writing these posts, setting up encryption with Hass & Node-Red has been the number one question I’ve been asked about my setup. So after being lazy and just leaving my software behind a VPN and firewall, I finally git around to setting up SSL support for both Home Assistant and Node-Red.
Read below for a guide to securing your smart home with Let’s Encrypt.
- dashboard – Create an entirely custom, live dashboard. Amazing!
- statistics – Some useful statistical functions, based on Simple Statistics
- state-machine – Manage a state machine with your own parameters
- actionflows – This one seems extremely promising. Package flows as reusable functions that can be looped, prioritized, and benchmarked.
I think making a dashboard is my next project, which I will certainly document here on the blog.
I am wondering if state-machine could be used to manage the state of a finicky IR controlled fan I have. I was never able to find a way to do this in Home Assistant accurately. Since Node-Red can do more complicated logic, it could monitor my fan related sensors and output in the format for the MQTT Fan component. Interesting!
In my last post about using Node-Red to make automations with Home Assistant, I showed some very simple flows for turning lights on and off. While it is important to get used to the Node-Red way of doing things and it’s interface, none of the examples in my post are very compelling. All of that can easily be accomplished in Home Assistant already, so what makes Node-Red so awesome?
Let’s examine some of Node-Red’s features a little closer to get a better idea of what’s going on, how we can use that to create dynamic automations with Home Assistant, and an example of an alarm clock radio flow that uses some advanced logic nodes.
As someone who cycles to work most days, I keep a pretty close eye on the weather. One thing I like to know is which way the wind is blowing – a strong headwind means I should maybe opt for the road bike, not the cruiser. Home Assistant has a ton of weather platforms – and the Dark Sky one that I prefer tracks wind direction. The only problem is it returns the direction in degrees, which is meaningless to me.
See below for a template sensor that will convert degrees to a human-readable cardinal direction.
Living in an urban city without a garden, I have been exercising my green thumb by accumulating more and more houseplants. I have them tucked away in every light-filled corner, hanging from every rafter in my tall ceilings. Which is a problem, because I have to get a ladder out to water most of them!
Using some cheap plant soil sensors and a simple Python script, I will have Home Assistant check all of my plants and make a list of which need my attention. Then when more than a few need to be watered, I can be notified or have the voice assistant give me an update.
You know what’s great about motion sensors? They are very, very cheap to build yourself. All it takes is an esp8266 module like the Wemos D1 Mini, some PIR sensors, and the ESP Easy firmware and you can have a bunch up and running in a few minutes. I haven’t DIYed a battery powered one yet, but there are plenty of great Z-Wave ones available.
Once you have a couple of motion sensors in your smart home, you can have Home Assistant track the last place it saw motion. This is a useful bit of info – useful as a condition for your automations, or as an input for a bayesian binary sensor. See below for YAML to create a meta-motion sensor with a history.
Smart light bulbs are probably the first thing everyone getting into home automation buys. It is easy to see the applications for them – have the lights come on at night, turn off when you’re home, etc. It’s very satisfying to have the lights react to the day and your activities, and my goal with automating lighting has always been to not have to think about it, for it to work in the background.
In my initial post about Home Assistant and Node-Red, I explained the initial hoops you have to jump through to get both pieces of software up and running and talking to each other. Now we will start using them together in some very simple flows to control lighting, to get a better understanding of how Node-Red works, and to start to delve into this powerful tool.