RaZberry With Home Assistant
I’ve been using Home Assistant on a Raspberry Pi 3 for years now, and over time I’ve had my share of configuration gotchas that I’ve since forgotten. The hardest task was getting my RaZberry Z-Wave HAT running smoothly. The other day, the SD card on the Pi became corrupt and because I’d not been keeping backups of the card like the idiot I am (thankfully I’d been backing up the .homeassistant directory, so I didn’t need to reconfigure anything!) I needed to reinstall Home Assistant from scratch, which was productive in the long run because I’d been putting off upgrading to the latest version for some time now. I used the experience to document the gotchas that I encountered and I’m pleased to say that most of it was really simple and just worked. I followed the instructions on the Home Assistant website, but copied my old
.homeassistant directory over and ran
hass --script check_config (which checks and installs dependencies) before first boot, and everything seemed fine… except that darn z-wave!
So here’s how I installed the RaZberry HAT on a Raspberry Pi 3B running Home Assistant.
The Pi 3 has built-in Bluetooth, and this will conflict with the serial interface that the RaZberry uses. To disable Bluetooth and enable the UART interface needed for the RaZberry to function, open
/boot/config.txt and add the following lines at the bottom
For some bizzare reason, the serial device that the RaZberry uses is configured to the group
tty but with write-only access by this group. Home Assistant runs in
tty, and can therefore only write to the z-wave network, not read from it. Worse, the permissions are set somewhere underneath the OS, so changing the permissions will only be effective until a reboot. Thankfully there is a workaround…
sudo systemctl mask serial-getty@ttyAMA0.service
This will reconfigure the serial interface for
/dev/ttyAMA0 to be in the group
dialout, but with read and write access. Home Assistant is also in group
dialout, so doing this, and then rebooting the Pi, will solve this problem.
Once I’d completed both these steps, the z-wave network sprang into life and it all works just as it did before. Now to remove a load of nasty hacks I wrote for the old version that are no longer necessary due to the improved integrations of the new version!