Rhasspy Assistant Tips n Tricks

HermesLedControl for Rhasspy Assistant.

HermesLedControl

← Main page

Official repository

HLC setup for Rhasspy

Installation of HLC is rather simple and documented here

Installation

wget https://gist.githubusercontent.com/Psychokiller1888/a9826f92c5a3c5d03f34d182fda1ce4c/raw/cbb53252dd55dc4e9f5f6064a493f0981cf133fb/hlc_download.sh
sudo chmod +x hlc_download.sh
sudo ./hlc_download.sh

Before starting it, we will have to configure service file for Rhasspy.

The important command line parameters are:

--engine
--pathToConfig

Edit the service file and change ExecStart line as follow:

Adapt HLC version number, your profile path (en instead of fr ?) and your hardware if needed

sudo nano /etc/systemd/system/hermesledcontrol.service
ExecStart=/home/pi/hermesLedControl_v2.0.3/venv/bin/python3 main.py --engine=rhasspy --pathToConfig=/home/pi/.config/rhasspy/profiles/fr/profile.json --hardware=respeaker2 --pattern=kiboost

Then reload daemon and sart it:

sudo systemctl daemon-reload
sudo systemctl start hermesledcontrol

ReSpeaker button

HLC allow to map some function on button pressed.

Example toggling rhasspy wakeword:
from subprocess import call

	def __init__(self, controller):
		super(KiboostLedPattern, self).__init__(controller)
		self.host = '192.168.0.140'
		self.muted = False

	def idle(self, *args): #continuous blue breathing
		if self._debug: print('---idle---')
		self.off()

		middleLed = int(self._numLeds/2)
		if self.muted:
			self._controller.setLed(middleLed, 85, 0, 0, 100)
		else:
			self._controller.setLed(middleLed, 0, 85, 0, 100)
		self._controller.show()

	def onButton1(self, *args):
		if self._debug: print('##_onButton1')
		#mute hotword detection:
		self._animation.clear()
		self.off()
		if self.muted:
			self.muted = False
			call('sudo curl -d "on" http://%s:12101/api/listen-for-wake'%self.host, shell=True)
		else:
			self.muted = True
			call('sudo curl -d "off" http://%s:12101/api/listen-for-wake'%self.host, shell=True)
		self.off()
		self._controller.idle()

Pressing the button will toggle wakeword service, and set self.muted variable accordingly so idle LEDS will show three leds breathing or only the middle one if muted.

Turn LEDs on/off

HLC have topics to turn LEDs on and off. Just run this command on the master Rhasspy:

mosquitto_pub -p 1883 -t 'hermes/leds/toggleOn' -m '{"siteId" : "salle"}'
mosquitto_pub -p 1883 -t 'hermes/leds/toggleOff' -m '{"siteId" : "salle"}'

Tips

If you install several Rhasspy with a master and satellites, keep in mind that each device should have its MQTT host setting to the master IP.

debug

Start the service: sudo systemctl start hermesledcontrol
Stop the service: sudo systemctl stop hermesledcontrol
Restart the service: sudo systemctl restart hermesledcontrol
Show service log: journalctl -u hermesledcontrol.service