I have been looking to do some sort of Home Control for a while now, and was prompted to do something after reading some articles on the ESP8266 WiFi capable micro-controller from Espressif Systems. It is an evolving thing as I get new ideas and the time to implement them.
Home Controller
Currently running OpenHAB 3 on a Raspberry Pi 3 which is very low power and runs 24/7. Since building the new FreeNAS server the MySQL database and Grafana have been moved to a Jail therein to minimise SD-card writes on the Raspberry Pi.
The HC runs Node-RED which allows easy graphical configuration of additional logic to support dynamic timing for lights, etc. Also added MQTT to allow communication with remote sensors for temperature, leak monitoring, etc.
In addition to the automatic elements in the HC, status and control can be achieved via the OpenHAB App running on our iPhones / iPads, through the HabPanel interface running on a spare 10″ Lenova tablet (using HabPanel Viewer for Android) and also via Web browsers on our computers.
Lights
It was very important that whatever I did had the maximum WAF (Wife Acceptance Factor) so I did not want to go changing light-switches for remote controlled versions (the lack of a neutral wire in the lighting circuits of our UK home was an issue anyhow). As a result I went for remote controlled lamps instead. I quite liked the Philips Hue system although the lamps are pretty expensive but I found a recommendation for the Innr smart lights which work with the Philips bridge. I bought a Philips Hue Bridge, a Philips remote control switch and several Innr lamps. This bridge easily integrates into the OpenHab environment, and I use some Node-RED flows as well:
- to bring the outside lights (welcome / drive / front door) on at dusk, and off some time (random) around bed time
- to ensure lights come on dim after we have gone to bed, but bright in “waking” dark hours
Alexa
I linked an Echo Dot to the Philips Hue skill and can control lights verbally: “Alexa kitchen on, please” turns the kitchen light on.
Temperature Sensors
I wanted temperature sensors to use ESP8266 but the WiFi connection is power hungry and I found they did not last very long with batteries. So I looked at alternatives.
- Battery Operated #1. I built sensors based on MySensors guides using Arduino micro controllers combined with 2.4 GHz radios which can run off two AA batteries for a substantial period by sleeping much of the time. But I had a lot of difficulties with very limited range, probably due to the Chinese clones I was using, so eventually abandoned that.
- Battery Operated #2. I discovered ESP-NOW (official docs here) on the ESP8266 which avoids the overheads of Ethernet and uses direct connection between ESP8266. Had several temperature sensor nodes running, using the EnigmaIOT protocol, and an ESP8266 based gateway which provides an ESP-NOW interface directly with the sensors, and an MQTT over WiFi interface back to Node-RED and OpenHAB. This proved substantially more successful but eventually dropped as I could not get more than 4 or 5 months out of a pair of AA batteries, particularly on the outside sensor.
- Mains Powered Sensors. Finally ended up using ITEAD SONOFF Basic switches as mains-powered ESP8266 and added DS18B20 temperature sensors. These report over MQTT to Node-RED and OpenHAB. Refer to “Setup SONOFF” page for details of using ESPURNA on these devices.
Other ESP8266 Devices
The other ESP8266 devices are ITEAD SONOFF switches used to control some LED strip lights in the kitchen and dining room, and I was working on adding a digital thermostat connected via MQTT back to OpenHab, but that has been abandoned and replaced by a Nest Thermostat.
Notes / Resources
- Programming environment for Home Control
- TODO: put installation documentation for all elements online
- TODO: link to code for HABpanel display [done for Weather and Lights widgets]
- TODO: add details of Node-RED flows [done for Weather and Lights widgets]