Step By Step - albertmon/smarthome GitHub Wiki
Smarthome Step By Step
Step 1: Make sure you have the hardware
Depending on your needs you must have
- A computer
For the computer we selected the Raspberry 4 (see here) with- memory: 4Gb or 8 Gb (preferred with Rhasspy),
- power adapter: 3A or 5A (with more than 1 transceiver or touch display),
- MicroSDHC memory card 32Gb or larger (if you want to copy your music library for use with Kodi: No network traffic)
- Touch Display: Optional for easy manual control of Domoticz
- Hardware to communicate with sensors and switches:
Depending on your switches and sensors:- RFXCOM-XL (or other) Transceiver 433.92 Mhz
- Zigbee Dongle. We chose CC2531, but other hardware is now recommended for Zigbee2MQTT (see here)
- RTL-SDR Dongle.
- Only when using Rhasspy or other voice communication:
- (USB) Speaker and microphone (we use Jabra Speak 410, but other can be used)
- Remote controlled switches, sensors etc. 433Mhz or Zigbee. You can buy them almost everywhere.
Make sure your controller device can communicate with your sensors and switches.
Step 2: Install your Raspberry Pi
Install your Raspberry Pi (RPi) with the distribution including desktop (you can use this on your touch-screen)
Follow the instructions on the official RaspberryPi website: https://www.raspberrypi.org/documentation/computers/getting-started.html
(Or use my quick setup)
Connect all your devices (Zigbee, RFX, Microphone, Speaker etc)
Reboot
Connect to your RPi for the first time
- Find the IP of your new RPi. See how-to-find-your-ip-address on raspberrypi.org
- Install KiTTY or PuTTY or other ssh client on your PC, Mac or Workstation
- Optional: Install VNC-client
Login into your RPi by starting your ssh-client and connect to your RPi You will be prompted:
login as: pi
[email protected]'s password:
Linux raspberrypi 5.10.17-v7+ #1414 SMP Fri Apr 30 13:18:35 BST 2021 armv7l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri May 7 16:07:34 2021
SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.
pi@raspberrypi:~ $
Step 3: Configure your RPi
First we modify some default settings. All these changes can be made with raspi-config.
At the prompt enter:
sudo raspi-config
and adjust the following settings:
- System Options > Password
CHANGE THE PASSWORD (default: raspberrypi) AND DO NOT FORGET IT - System Options > Hostname
Change the hostname (default: raspberrypi) to (e.g.)smart-pi
. Use only letters, digits or '-'
I advise you to change the hostname. You can use this name in your browser and you do not have to remember the IP-number. This IP-number can be changed by the router (when you use dhcp, the default)
Example: If you chosesmart-pi
as hostname, you can usehttp://smart-pi.local:8080
to connect to Domoticz, orhttp://smart-pi.local:12101
to connect to Rhasspy
- Interface Options > VNC
Enable VNC (Optional) - Localisation Options > Locale Set your Language (You can add your locale. I recommend to keep it the default (english))
- Localisation Options > Timezone Set your Timezone
- Finish and Reboot
Connect and Login again (with your new password!)
On the RPi get the smarthome software from github: First check if git is installed:
git --version
When this command returns an error execute:
sudo apt-get install git
Step 4: Install the software
You have to perform the next tasks:
-
Decide what you want and need:
- Decide where you want the software installed
I suggest a directory in your Home directory with a simple name e.g.smart
, ordomo
- Do you want to install Domoticz?
- Do you use a Zigbee transceiver?
- Do you use an RFX or RFLink transceiver?
- Do you use an RTL-SDR Dongle?
For this dongle there are two ways to get the received data into Domoticz
- Directly into Domoticz.
WARNING: This method is not possible when Domoticz is running in a (standard) Docker container!!
If you want to use this method, Domoticz must be installed manually. For more info check the Domoticz website: (https://www.domoticz.com/wiki/Main_Page) - Using the
run_rtl_to_domoticz
script (see github and read the README).
This script runs a python script that listens continuously for data and sends it to Domoticz (at the moment only Bresser 5 in 1 is implemented). If you downloaded the repository you can find it in the directorydomo
- Directly into Domoticz.
- Do you want to install Rhasspy?
- If so, what language do you want
- What is your sound device?
- Decide where you want the software installed
-
Setup your hardware
To install your SDR dongle look here -
Set up the necessary software
-
Install the smarthome software.
The smarthome software contains tools and for the installation of Domoticz and Rhasspy.
You also get configuration files and additional software for Rhasspy to get it working (in English and Nederlands)
We install the git repostory in the home directorycd ~
git clone https://github.com/albertmon/smarthome.git
Create a directory where the files must come. You can choose any name you want. I will name it
domo
in my commands.mkdir ~/domo
cd ~/domo
Now you can run scripts to install and configure the necessary software
-
Check your system and update/upgrade and install necessary packages
Run the script that checks the necessary packages or adds them to your pi (docker, python pip etc.)~/smarthome/scripts/system-setup
Now run the script that will install everyting using docker-compose
It will also create a tool in $HOME/bin calleddoco
(I am lazy and did not want to type docker-compose everytime).dc
is a very old UNIX program and I did not want to hide it, so I settled for doco. For some functions you get a shorthand (e.g. dcup to rebuild an start all containers, rundoco --list
for a list of shortcuts)The script will want to know several configuration variables (and give reasonable default suggestions)
~/smarthome/scripts/software-setup
-
If all went well, you can now start your Home automation system with:
dcup
Note: The first time you start will take a lot of time. Docker will download images (large preconfigured files). The next time you use dcup the downloaded images will be on your memory card.
Note: If dcup
returns: -bash: dcup: command not found
(or something like this) you must logout and login again on your pi
All systems are running (enter dctop or dcps to check) but no lamps will be switched and no voice control is possible
You will have to tell the computer about your lamps and other things and learn the computer to understand you when you speak and learn to talk back.
Step 5: Configure the software
Configure Domoticz
If you do not use Domoticz you can skip this part
When you have followed the Step-By-Step Guide so far, Domoticz is running.
You can use the use your browser to read the Domoticz Configuration page in the Domoticz wiki
You can connect to Domoticz on your pi using the url:
http://<ip or hostname of your pi>:8080
Where you must fill in the correct ip or hostname of your pi.
Note: If you configure Zigbee2MQTT in Domoticz, be sure to replace localhost by the hostname/Ip-number of your RPi
Configure Rhasspy
Now you can configure Rhasspy.
You can access your Rhasspy with the url:
http://<ip or hostname of your pi>:12101
Where you must fill in the correct ip or hostname of your pi.
If you changed the Rhasspy port you have to change 12101 by that port number
Rhasspy has a good manual and it is good to read the Tutorials. You can read the documentation by clicking the last icon on the icon bar on the left.
Software to handle intents is located in the smarthome repository.
You can use this by copying it to the rhasspy profile directory:
(cd to directory
domo
)sudo cp -rp ~/smarthome/rhasspy/* volumes/rhasspy/profiles/nl/
After copying, you can configure Rhasspy to use this software by changing the Intent Handling settings:
Intent Handling : Local Command
Program : /profiles/nl/handler/intenthandler.py
Do NOT forget to save the settings and restart Rhasspy
- When adding hardware you must restart the containers (
dcrestart
) or the pi (sudo reboot
) - When the system does not seem to work you can check by calling
dctop
.
You should see many lines with process info for every subsystem - For more info about the smarthome intenthandler goto Tutorial Smarthome