I installed Rhasspy last WE, i didn’t want to use docker because of potential problems with sound device so i installed everything thanks to venv. Here is how i did it.
Disclaimer : it is certainly not be the only or best but since it works for me, it might be useful to others.
Disclaimer 2 : i did not invent anything, you can find all these steps in the official documentation of each project but all in one place is not so bad
Requirements :
- Raspberri Pi
- Debian buster installed
- Respeaker hat
- speaker connected to the Respeaker Hat
Update you Pi
sudo apt update && sudo apt upgrade
Disable inboard audio to avoid conflicts
sudo nano /boot/config.txt
find this line and change its value to off
dtparam=audio=off
install seeds drivers
sudo apt install git
git clone https://github.com/respeaker/seeed-voicecard.git
cd seeed-voicecard
sudo ./install.sh
sudo reboot
test audio record/playback
beware : this command should produce an awful echo sound, this is what is expected
arecord -f cd -Dhw:0 | aplay -Dhw:0
install Home Assistant
sudo apt-get install python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev
sudo useradd -rm homeassistant -G dialout,gpio,i2c
cd /srv
sudo mkdir homeassistant
sudo chown homeassistant:homeassistant homeassistant
sudo -u homeassistant -H -s
cd /srv/homeassistant
python3 -m venv .
source bin/activate
you should have switched to venv, now install Home Assistant
python3 -m pip install wheel
pip3 install homeassistant
exit the venv
exit
and now create the service file
sudo nano -w /etc/systemd/system/home-assistant@homeassistant.service
with this content
[Unit]
Description=Home Assistant
After=network-online.target
[Service]
Type=simple
User=%i
ExecStart=/srv/homeassistant/bin/hass -c "/home/%i/.homeassistant"
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
enable and start Home Assistant Service
sudo systemctl --system daemon-reload
sudo systemctl enable home-assistant@homeassistant
sudo systemctl start home-assistant@homeassistant
now Rhasspy
cd
git clone https://github.com/synesthesiam/rhasspy.git
cd rhasspy/
./download-dependencies.sh
./create-venv.sh
create rhasspy service
sudo nano -w /etc/systemd/system/rhasspy@pi.service
with this content
[Unit]
Description=Rhasspy
After=network-online.target
[Service]
Type=simple
ExecStart=/home/pi/rhasspy/run-venv.sh --profile fr
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
enable and start the service
sudo systemctl --system daemon-reload
sudo systemctl enable rhasspy@pi
sudo systemctl start rhasspy@pi
[optional] install PicoTTS
there are missing packages on Buster so we need to install them manually
wget http://archive.raspberrypi.org/debian/pool/main/s/svox/libttspico-utils_1.0+git20130326-3+rpi1_armhf.deb
wget http://archive.raspberrypi.org/debian/pool/main/s/svox/libttspico0_1.0+git20130326-3+rpi1_armhf.deb
sudo apt install ./libttspico0_1.0+git20130326-3+rpi1_armhf.deb ./libttspico-utils_1.0+git20130326-3+rpi1_armhf.deb
[optional] install Snips wakeword - we don’t need/want all Snips platform
sudo bash -c 'echo "deb https://raspbian.snips.ai/stretch stable main" > /etc/apt/sources.list.d/snips.list'
sudo apt-key adv --fetch-keys https://raspbian.snips.ai/531DD1A7B702B14D.pub
sudo apt update
sudo apt install mosquitto mosquitto-clients snips-satellite snips-hotword-model-heysnipsv4
and now my config file
wake > system > hermes is for Snips wakeword only
{
"handle": {
"system": "hass"
},
"home_assistant": {
"access_token": "xxxx",
"url": "http://localhost:8123"
},
"microphone": {
"arecord": {
"device": "capture"
},
"system": "arecord"
},
"mqtt": {
"enabled": true,
"publish_intents": false
},
"sounds": {
"recorded": "/home/pi/rhasspy/etc/wav/beep_lo.wav",
"wake": "/home/pi/rhasspy/etc/wav/beep_hi.wav"
},
"text_to_speech": {
"picotts": {
"language": "fr-FR"
},
"system": "picotts"
},
"wake": {
"system": "hermes"
}
}
One more thing
Resppeaker 2 has a built-in button, why not using it to trigger voice recognition without Wakeword?
Needs Hermes wake system
install requirments
sudo pip3 install rpi.gpio paho-mqtt
create file
sudo nano button.py
with this content
import RPi.GPIO as GPIO
import time
import paho.mqtt.client as mqtt
BUTTON = 17
GPIO.setmode(GPIO.BCM)
GPIO.setup(BUTTON, GPIO.IN)
client = mqtt.Client("rhasspy")
client.connect("localhost")
while True:
state = GPIO.input(BUTTON)
if not state:
# someone has pushed the button, publish to MQTT
client.publish("hermes/hotword/default/detected",'{"siteId": "default"}')
while not state:
state = GPIO.input(BUTTON)
time.sleep(0.1) # Pause
time.sleep(0.1) # Pause
now create a service file as usual
sudo nano /etc/systemd/system/button@pi.service
[Unit]
Description=Button
After=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/python3 /home/pi/button.py
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
enable and restart the service
sudo systemctl --system daemon-reload
sudo systemctl enable button@pi
sudo systemctl start button@pi
Merry Christmas