This repository contains the code discussed in the book Control Your Home with Raspberry Pi: Secure, Modular, Open-Source and Self-sufficient, published by Elektor International Media, as well as a list of errors and their corrections and some additional tips and references.
Ever since the Raspberry Pi was introduced, it has been used by enthusiasts to automate their homes. The Raspberry Pi is a powerful computer in a small package, with lots of interfacing options to control various devices.
This book shows you how you can automate your home with a Raspberry Pi. You'll learn how to use various wireless protocols for home automation, such as Bluetooth, 433.92 MHz radio waves, Z-Wave, and Zigbee. Soon you'll automate your home with Python, Node-RED, and Home Assistant, and you'll even be able to speak to your home automation system.
All this is done securely, with a modular system, completely open-source, without relying on third-party services. You're in control of your home, and no one else.
At the end of this book, you can install and configure your Raspberry Pi as a highly flexible home automation gateway for protocols of your choice, and link various services with MQTT to make it your own system. This DIY (do it yourself) approach is a bit more laborious than just installing an off-the-shelf home automation system, but in the process, you can learn a lot, and in the end, you know exactly what's running your house and how to tweak it. This is why you were interested in the Raspberry Pi in the first place, right?
This code, organized by chapter, includes:
mosquittoservice. In practice you copy the services from various Docker Compose files and add them to one Docker Compose file to run your whole home automation stack.
You can download the code on your Raspberry Pi all at once with:
git clone https://github.com/koenvervloesem/raspberry-pi-home-automation.git
You may need to install
sudo apt install git
The code is then downloaded into the directory
raspberry-pi-home-automation, organized by chapter.
If you prefer to download only a specific file, navigate to the file in GitHub's web interface and then click on Raw at the right. Then copy the URL from your web browser's URL bar and paste it after the
wget command, for instance:
Make sure that you're in the right directory first, or move the file to the correct location afterwards.
Just selecting and copying the code from the web interface and pasting it in an editor may also work, but is not recommended. Especially with Python code the whitespace can become mixed up, which results in invalid code.
See the ERRATA document for the list of errors in the book and their corrections.
See the ADDITIONS document for some additional tips and references to interesting projects not mentioned in the book.