The Cheapest WiFi Smart Switch: Flashing the Sonoff Basic

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.

Continue reading →

Location Aware Notification Lights with Node-Red and IFTTT

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.

Continue reading →

Let's Encrypt

Setting Up Let’s Encrypt with Node-Red & Home Assistant

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.

Continue reading →

More Nodes for Home Automation: state-machine, actionflows, dashboard, statistics

I’m keeping a running list of useful nodes I’ve found for home automation. Here’s a couple of more I came across recently in the Node-Red library.

  • 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!

Morning Radio

Going Further with Home Automations in Node-Red

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.

Continue reading →

Useful Sensor: Cardinal Wind Direction for Home Assistant

At a glance – gustier than usual this morning.

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.

Continue reading →


Self Hosting: Setting up a Personal Wiki with DokuWiki

One of the most useful things I self host on my server is a personal wiki. I use it for note taking on projects, a journal, a beer homebrew log, storing recipes, config files, and for archiving web pages or documents. It is a great alternative to Evernote or OneNote if you want to keep your information out of the corporate cloud.

There are many wikis out there but I prefer the low-overhead DokuWiki, which is easy to install and uses flat plaintext files to store your wiki pages so it’s easy to set up anywhere and backup your data. DokuWiki as a default install is very basic and can be extended to do almost anything with a few plugins. Read below for some of my recommendations for making the most of your wiki and some example use cases.

Continue reading →

Useful Sensor: Bayesian Sleep Detection in Home Assistant

Sleep is not something I can directly observe in my smart home (at least not until I build that DIY bed sensor). It would be nice to know though – then the alarm could be set, doors locked, thermostat set, music volume slowly dimmed, and internet bandwidth reprioritized automatically when it’s time for bed. We spend a lot of time sleeping in our homes, so it makes sense to be able to detect it.

Using Home Assistant’s Bayesian binary sensor it’s possible to guess pretty accurately when everyone’s tucked away. See below for example YAML and explanation.

Continue reading →

Home Assistant: Making My Plants Talk with IoT Sensors and a Python Script

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.

Continue reading →

Useful Sensor: Motion Last Seen & Meta Motion Sensor

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.

Continue reading →