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 →

Basic Node-Red Flows for Automating Lighting with Home Assistant

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.

Continue reading →

Favorite ESP8266 Internet of Things Projects

So many good uses for these chips, here are a few I’ve made and some I still intend to.

  1. ESP Easy – by far the easiest way to connect a bunch of cheap sensors to an esp8266. I have about 6 of these doing various things.
  2. Bed Occupancy Sensor – FSR sensor for pressure and a simple automation to determine bed occupancy
  3. WiFi Candle Using multiple WS2812 addressable LEDs to create a simple lamp that flickers like a candle.
  4. Notification Flag – Raise a flag based on a simple condition. Would be nice to combine in tandem with…
  5. Mailbox Sensor – Notify when mailbox is opened.
  6. DIY Milight Hub – I’ve been using this and it works great. Control as many cheap Chinese RGB bulbs as you want.
  7. Simple Water Alarm – If water shorts the wires, it wakes a sleeping esp8266 and sounds the alarm
  8. Door/Window Monitor – Along the same lines, a simple magnetic switch monitors the status of a window or door.
  9. Smart Power Strip – Retrofitting a power strip with 2 banks of controllable outlets, using 3D printed parts.
  10. Weather Station Display – Another super cool 3D printed project that plugs in and displays info on a small screen.

My favorite form factor of the esp8266 is the Wemos D1 Mini. Tiny, all the inputs you need, and there are many premade ‘shields’ for it so you can stack components.

 

The Open Source Smart Home: Getting Started with Home Assistant & Node-Red

Home Assistant is one of the most interesting open source projects I’ve ever come across. It interfaces with any device, platform, or service you can think of and allows you to perform actions based on the data you monitor. It has a great community and is under extremely active development. With a little creativity almost anything is possible with Home Assistant, and best of all it’s private and totally under your control.

After using Hass to control my smart home for the last year, I started to hit the limitations of it’s YAML-based configuration. Any automation that was even moderately complicated  required a lot of pieces spread out through the configuration files (see the sprawling “Creating an Alarm Clock” thread on the HA forums for an example). Doing simple things like if-then or a  loop required awkward workarounds. As my automations (and ambitions) increased in complexity, so did the time I spent  trying to figure out what was going on.

That’s when I discovered Node-Red, a visual programming tool developed by IBM. Node-Red is the perfect complement to Home Assistant, allowing for very complicated logic to be constructed visually through a simple “flow” interface. It integrates seamlessly with Home Assistant. Let’s set it up.

Continue reading →

Presence Detection Part 1: Home Assistant & Bayesian Probability

One of the most useful things to track for home automation is whether anyone is home or not. If you want the lights to turn off when no one is home, the vacuum robot to run when you’re at work, or the heat to come on before you arrive home on a cold night you need to reliably be able to tell if the house is occupied.

How can we track the state of something that is not directly observable? We can’t plug ourselves directly into the internet (…yet). After trying several approaches to monitoring presence, I’ve come up with a method that is very near 100% reliable.

Continue reading →