Skip to content

Instantly share code, notes, and snippets.

@zsawyer
Last active April 21, 2023 15:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zsawyer/eb7fa11c1be851ea20623f47344f91c7 to your computer and use it in GitHub Desktop.
Save zsawyer/eb7fa11c1be851ea20623f47344f91c7 to your computer and use it in GitHub Desktop.
Raspberry PI 4 Model B HASS + Rhasspy

!!!THIS GUIDE IS WORK IN PROGRESS!!!

hardware used:

  1. Raspberry Pi 4 Model B
  2. 32 GB SD card
  3. bluetooth speaker/microphone

downloads:

  1. raspian full: "Raspberry Pi OS with desktop and recommended software" https://www.raspberrypi.org/software/operating-systems/
    1. this is buster debian; if you are in the future using bullseye you might want to look into using podman
  2. rpi-imager https://www.raspberrypi.org/software/

instruction:

  1. flash image to SD card using rpi-imager
  2. insert SD card into Raspberry Pi
  3. boot into raspberry pi os -> setup language/locale and allow updating

install docker ref

  1. execute in a terminal:
sudo apt update && sudo apt upgrade -y
curl -sSL https://get.docker.com | sh
sudo usermod -a -G docker $USER
sudo reboot
docker run hello-world
  1. run in a terminal
PATH_TO_YOUR_CONFIG=$HOME/.config/hass/config
sudo mkdir -p $PATH_TO_YOUR_CONFIG
sudo chown pi:docker $PATH_TO_YOUR_CONFIG
chmod 770 $PATH_TO_YOUR_CONFIG
docker run --init -d \
  --name homeassistant \
  --restart=unless-stopped \
  -v /etc/localtime:/etc/localtime:ro \
  -v $PATH_TO_YOUR_CONFIG:/config \
  --network=host \
  homeassistant/raspberrypi4-homeassistant:stable
  1. install the files
docker exec -it homeassistant bash
bash-5.0# wget -q -O - https://hacs.xyz/install | bash -
  1. restart HASS
  2. add the HACS Integration

Install HASS Addons

  1. add the following lines to $PATH_TO_YOUR_CONFIG/configuration.yaml (/var/docker/hass/config/configuration.yaml)
### Custom Add-ons 

## for integration with Rhasspy

# Add-on: HTTP (https://www.home-assistant.io/integrations/http/)
http:

# Add-on: Home Assistant API (https://www.home-assistant.io/integrations/api/)
api:

# Add-on: Intent Script (https://www.home-assistant.io/integrations/intent_script/)
intent_script:
  GetTemperature:  # Intent type
    speech:
      text: We have {{ states.sensor.temperature }} degrees
    action:
      service: notify.notify
      data:
        message: Temperature polled.
  1. restart hass

Hint: While you are waiting for the Rhasspy downloads is a good time to do this.

  1. start by going to http://raspberrypi:8123/ or http://localhost:8123/
  1. download latest version of rhasspy https://github.com/rhasspy/rhasspy/releases/
  2. install the local package
sudo apt-get install /home/pi/Downloads/rhasspy_2.5.9_armhf.deb
  1. start the server
rhasspy --profile en

registering rhasspy on startup

  1. copy
cp -p /home/pi/.config/rhasspy/profiles/en/supervisord.conf /home/pi/rhasspy.conf
  1. start editing in the file (use nano or vi instead if you are on console)
sudo mousepad /home/pi/rhasspy.conf
  1. edit the top of the file like so:
[supervisord]
nodaemon=false
user=pi
logfile=/home/pi/.config/rhasspy/profiles/en/supervisord.log
pidfile=/home/pi/.config/rhasspy/profiles/en/supervisord.pid
  1. start editing in the file (use nano or vi instead if you are on console
sudo mousepad /etc/supervisor/supervisord.conf
  1. edit the buttom of the file like so:
[include]
files = /etc/supervisor/conf.d/*.conf /home/pi/rhasspy.conf
  1. start by going to http://raspberrypi:12101/ or http://localhost:12101/
  1. install dependencies
sudo apt -y install nodejs build-essential make g++ graphicsmagick unzip
sudo apt -y install pulseaudio libpulse-dev libcanberra-dev libatlas-base-dev sound-theme-freedesktop
sudo apt-get install gettext 
  1. download sources
cd ~/Downloads
curl https://github.com/stanford-oval/almond-server/archive/master.zip -O -J -L
mkdir ~/opt
unzip almond-server-master.zip -d ~/opt/
mv ~/opt/almond-server-master ~/opt/almond-server
  1. install

    1. optional: upgrade npm
    npm i npm@latest -g
    
    1. install almond-server as normal user (sudo/root install causes problems) Note: Warnings are expected!
    cd ~/opt/almond-server/
    npm install
    
    1. expected sample warnings

    warning: this statement may fall through

    warning: cast between incompatible function types from

    note: in expansion of macro

    warning: catching polymorphic type

    1. expected sample errors

    node-pre-gyp ERR! Tried to download(403): https://snowboy-release-node.s3-us-west-2.amazonaws.com/snowboy/v1.3.1/Release/snowboy-v1.3.1-node-v64-linux-arm.tar.gz node-pre-gyp ERR! Pre-built binaries not found for snowboy@1.3.1 and node@10.24.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)

    1. check for exit status:

    node bin/postinstall || exit 0 ... added 758 packages from 607 contributors in 1327.268s

  2. start Almond server locally

cd ~/opt/almond-server/
npm start

connecting the bluetooth speaker

  1. run in a terminal
sudo apt install bluetooth pi-bluetooth bluez blueman
sudo apt install pavucontrol
  1. follow gui based instructions ref
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment