Home assistant is an incredible automation platform designed to run on pretty much any platform and runs seamlessly on a Raspberry Pi 3. It can integrate with all hundreds of 'off the shelf' home devices and has open APIs, giving you the option to even create your own devices for it to interact with. The home assistant website contains some excellent instructions for installing and configuring it here.
The picture on the left, shows our office Raspberry Pi plugged into the network.
The wire at the bottom of the image isn't part of this project but is a simple temperature/humidity sensor. The white dongle plugged into the left of the Pi, is a Z-wave controller.
The key home assistant features that we set up were z-wave and MQTT.
Z-Wave Door Sensor?
Z-Wave is a wireless protocol designed for the internet of things. It is a fast and reliable way to connect devices to each other. There are a few technologies which aim to achieve the same goal as z-wave (Zigbee, RF, X10), but we found this to be the most reliable and has a vast range of devices available for it.
To use z-wave with home assistant we purchased the Aeon Z-Stick Gen 5 and set this using the instructions here. Once this was set up, we could begin adding devices to it; most notably this door sensor. The door sensor was paired with the dongle by pressing the pair buttons and they soon enough showed up in the home assistant dashboard. The sensor runs on two AAA batteries and sleeps for most of the time so that it will last around a year before the batteries need to be changed.
The door sensor is designed to detect whether a door is open or closed, however, the toilet doors in our London office are often closed while locked or unlocked. They are operated by a lever latch, so we decided that the best use for the sensor was to tape it to the latch mechanism itself so that the system would detect whether the door was physically locked or not.
Building the Display
The display was built using a NodeMCU and addressable LED's. The following libraries were used to control the lights:
MQTT is a short lightweight messaging protocol, designed for the internet of things and works by implementing a publish and subscribe architecture. Home assistant handles the publishing of updates so that when the door sensor changes state, the update is pushed to the MQTT server on the Pi. The NodeMCU subscribes to these updates and when they are received it updates the corresponding LED's. It all happens instantly; in the blink of an eye.
Using some cable, solder, glue and a photo frame, we were able to mount the lights and insert a printed overlay to create a contemporary finish.
We have started building a web interface and mobile app for tracking various states around the office including the toilet doors, meeting room bookings and staff availability. The end goal is to have a totally connected office which increases productivity.
The end solution...