HermesLedControl

Hi,

After discussion with his author, the Snips Led Control has been renamed Hermes Led Control :hugs:

We have turn it agnostic and it now works with Rhasspy !

You can install it : https://github.com/project-alice-assistant/HermesLedControl/wiki/Installation-&-update

Nothing to edit just follow installer options:

  • Choose Rhasspy engine
  • If your rhasspy isn’t en, set pathToConfig to /home/pi/.config/rhasspy/profiles/fr/profile.json for example
  • Finish installation (choose respeaker option etc)
    Then it should comes setup as a service and running !

Now all we need is full support of hermes topics by Rhasspy:
MQTT published hermes topics

Many thanks to @Psycho, the author of HermesLedControl. Worked with him last year on this tool, always of great support :beers:

:wink:

14 Likes

Really great news !!!
Thank to both of you, great work ! :+1: :clap:

1 Like

I was using it before 
 Great news thanks a lot psycho and kiboOst

1 Like

How would you install this on a fresh raspian lite install on a satellite pi with the main rhasspy service in a docker container in a vm on a server in a rack in another room

What prevent you from connecting with ssh and install it ?

For me, complete inexperience with MQTT as well as no idea how to do much on a Pi. :crazy_face: I think I need an MQTT broker set up for this to work but I don’t know how to get that going. My attempt had Rhasspy logging that it was trying to connect every 5 seconds but NoneType seemed to be a problem (I don’t have the logs because I undid what I could) and there were no LED lights. A step-by-step tutorial (from “lights that represent Rhasspy actions would be cool” to “wow that’s amazing!”) would be quite helpful!

You need mqtt and rhasspy configured to use it

Install mosquito:

sudo apt update
sudo apt install -y mosquitto mosquitto-clients

Enable the service:

sudo systemctl enable mosquitto.service
sudo systemctl start mosquitto

Then enable MQTT in rhasspy settings with the IP of rhasspy device (localhost may not work with docker container)

Anyway, we have to wait for Rhasspy to publish every Hermes topics so HLC works as advertised.
Here is an old video with snips : https://www.youtube.com/watch?v=kcHWm15i-Gc

Also, @synesthesiam actually with snips I use the respeaker button to shutdown wakeword detection. So snips can still handle tts command, but when there is a lot of people in house this avoid false/positive causing false intent and such.

I guess this PR https://github.com/synesthesiam/rhasspy/pull/143 would help to set wakeword detection on/off over http and mqtt ?

So this is installed in the rhasspy docker container or on the satellite with the respeaker.

Thanks! I had done all but the last line. This still didn’t work with MQTT set up as above, MQTT enabled in Rhasspy and the IP address of the Pi itself (running Rhasspy in docker) with Rhasspy settings saved and restarted. I tried restarting the different parts in different orders but nothing ever lit up. I did get the reconnecting every 5 seconds message because of a NoneType problem but I think restarting Rhasspy solved that issue (restarting something did solve that issue). Still no lights, though. I’m probably doing something silly so please don’t waste your time trying to figure it out but thanks for your help with MQTT!

Here is a start for HermesLedControl with Rhasspy doc:

@synesthesiam

Please have a look at the button part. Actually with snips we can toggle wakeword detection like this:

call('sudo systemctl stop snips-hotword.service', shell=True)

Should this be possible with full-serviced next rhasspy ? Something like this ?

call('sudo systemctl stop rhasspy-wake-snowboy-hermes.service', shell=True)

Also, here are HLC MQTT topics it subscribe to:

https://github.com/project-alice-assistant/HermesLedControl/wiki/MQTT-Topics

Just to be sure we can get all same exact topics so it is perfectly supported.

:kissing:

Actually I don’t like the idea of starting or stopping a service just to start or stop listening to a wake word. The rhasspy-wake-snowboy-hermes service should always be running and just toggle its listening state as a reaction on a hermes/hotword/toggleOn or hermes/hotword/toggleOff message on MQTT or the resulting REST API call. Doesn’t HermesLedControl send these MQTT messages as a reaction on the button?

1 Like

You define whatever you want on button pressed. As this is an external script it needs a bash command, but I’m ok with you and yes it could be a simple:
call(‘mosquitto_pub -p 1883 -t ‘hermes/hotword/toggleOff’ -m ‘{“siteId” : mySatellite}’’, shell=True) command.

1 Like

Hi,
At first: I’m a newby and don’t know, if I’m in the right place here.

My working environment:
I’m using Rhasspy (with German profile) on an Raspi 3B with Respeaker 4 Mic Hat, which works fine.
I also installed Hermes LED Control on this Raspi, but the Respeaker-LEDs will not light up, when speaking the hotword, or some sentences.

I also get the Rhasspy-intents on another Raspi, which run’s a SmartHome-Software called ioBroker
ioBroker can combine the hardware (sensors, actors) of many different manufacturers.
It also contains a mqtt-Broker.
In the topics of this mqtt-Broker I can see the intents from Rhasspy and can react to them (for example switching lights).
I also can see the the hermes topics

Now my problem/question:
Why doesn’t the ReSpeaker LED-ring does’nt light up, when speaking hotword, or some sentences?

After I installed Hermes Led Control, I got the related topics in ioBroker.
For example “mqtt.0.hermes.asr.startListening”, “mqtt.0.hermes.asr.stopListening”, mqtt.0.hermes.asr.textCaptured, mqtt.0.hermes.leds.onCall, “mqtt.0.hermes.intent.lamps”, and so on.

Now, when i’m speaking to Rhasspy, only the topics “mqtt.0.hermes.asr.textCaptured” and the hermes-intent-topics will change as aspected.
But no reaction in the topics “mqtt.0._hermes.hotword”, "mqtt.0.hermes.asr.startListening, “mqtt.0.hermes.asr.stopListening”, or the other “mqtt.0.hermes.leds”-topics.

IMy thought was, that in this topics I will get some paylod from Hermes Led Control?
Maybe I’m totally wrong with this assumption?
Anyway, should the led ring react even without these topics?

Sorry for the stupid questions, but any help is welcome

I guess you have to connect HLC mqtt to your rpi handling intent, the mqtt host/master.

By default, HLC with engine rhasspy read your profile to get the mqtt settings ip and siteId. If this ip in your settings isn’t pointing to your master, you can force HLC to use whatever you want with for example --mqttServer

Here is the list of arguments: https://github.com/project-alice-assistant/HermesLedControl/wiki/Arguments-customization

OK, thanks for your explanation.
The HLC-Topics are created on my correct mqtt-broker.

Maybe I should alter my question more precisely:
Should something happen inside these topics, wenn HLC is active?
If not, what must be sent (for example) with the topic " mqtt.0.hermes.leds.onMessage" that sometings happen with the LED-ring?

Nothing have to be sent to have the led on when service starts.
HLC doesn’t send anything on mqtt, it just listen on some topics to give a visual feedback.

Here are all the topics used by HLC, and the full documentation: https://github.com/project-alice-assistant/HermesLedControl/wiki/MQTT-Topics

Maybe you could try debug mode. Never had too, leds just lights on when starting the service: https://github.com/project-alice-assistant/HermesLedControl/wiki/Run-in-debug-mode

And once more, actual version of rhasspy doesn’t publish every hermes topics so it doesn’t work actually. Just get the led on, I get the wakeword detected animation, but after that nothing, it stay in this state until I restart the service.

So, pretty unusable with actual rhasspy, but having it set on the rpi, it should begin to work without doing anything when we update to rhasspy version with all hermes topics.

OK, thanks again.
That completely answers my question.
I will wait for a rhasspy-version with the hermes-topics.

Hi,

Is HermesLedControl working on an docker install of rhasspy ?

I got this error after the installation of HLC

Jun 11 18:23:57 raspberrypi systemd[1]: Started Hermes Led Control.
Jun 11 18:23:58 raspberrypi python3[1293]: Starting Hermes Led Control v. 2.0.6
Jun 11 18:23:58 raspberrypi python3[1293]: Initializing HermesLedControl
Jun 11 18:23:58 raspberrypi python3[1293]: Initializing Rhasspy settings
Jun 11 18:23:58 raspberrypi python3[1293]: Loading configurations
Jun 11 18:23:58 raspberrypi python3[1293]: Error loading configurations: 'mqtt'
Jun 11 18:23:58 raspberrypi systemd[1]: hermesledcontrol.service: Succeeded.
Jun 11 18:24:01 raspberrypi systemd[1]: Started Session c2 of user pi.
Jun 11 18:24:03 raspberrypi systemd[1]: hermesledcontrol.service: Service RestartSec=5s expired, scheduling restart.
Jun 11 18:24:03 raspberrypi systemd[1]: hermesledcontrol.service: Scheduled restart job, restart counter is at 18.
Jun 11 18:24:03 raspberrypi systemd[1]: Stopped Hermes Led Control.

Did we have to install mosquito or something else ?

Yes, it is running

Yes, you have to install a mqtt broker (e.g. mosquitto) in order to get access to the intents

Ok thanks for your response i’ll try that :heart:

Si the internal mqtt can’t be use for this

I’m not quite sure. But with a separate mqtt broker you will be on the safe side, also for any future application. It requires nearly no resources. Just do a simple linux installation since this is the easiest way. Not in docker since configuration is more complicated.

Ok i’will try this, thanks a lot

Edit : It works so nice thanks again !!

You can. You just need to map the ports from your rhasspy docker or , if you are deploying hermes_led_control as a docker container aswell, just link them in a docker compose file for example.
That will expose the internal mqtt broker.

1 Like

Sounds interesting. Do you have an example? Thank you

You can find an example for Node-RED and Rhasspy here. The same method works for linking other containers: they’re all in the same virtual network that Docker Compose creates and they can reach each other by their container name on their exposed ports.

Thank you very much. This information is extremely helpful

Since I could not find a docker image of hermes-led anywhere I made my own and postet it on their github. You can find it here if you are interested.

Daenara

1 Like

Hello,

I would like to know if there is a way to change the idle led status/animation trough MQTT ?
I yould like my automation system (Jeedom) to send various status to rhasspy/hermesLedControl by lighting the led with different patterns.
for example, if a mail was detected in my mail box light in yellow 

in red if my security alarm is activated


Do you know how to do that ?
regards.

For anyone interested to get it running with the rhasspy docker image, the integrated MQTT broker and the HLC installscript, I’m using this docker-compose.yml for Rhasspy:

rhasspy:
  image: "rhasspy/rhasspy"
  container_name: rhasspy
  restart: unless-stopped
  volumes:
    - "$HOME/.config/rhasspy/profiles:/profiles"
    - "/etc/localtime:/etc/localtime:ro"
  ports:
    - "12101:12101"
    - "12183:12183"
  devices:
    - "/dev/snd:/dev/snd"
  command: --user-profiles /profiles --profile de
  dns: 192.168.0.242

The additional port is what you might mostly be interested in. :wink:

Additionally you need to tell HLC the MQTT target. Unfortunately it’s not possible to specify no config file. So I simply created a profile.json in HLC’s main folder:

{
  "mqtt": {
    "host": "127.0.0.1",
    "port": 12183
  }
}

Normally this configuration is being read from the profile.json of rhasspy. But if you’re using the internal broker there’s no MQTT section being written to the profile.json.

And last but not least this is my adjusted systemd unit file I’m using:

[Unit]
Description=Hermes Led Control

[Service]
WorkingDirectory=/home/pi/hermesLedControl_v2.0.9
ExecStart=/home/pi/hermesLedControl_v2.0.9/venv/bin/python3 main.py --pathToConfig=profile.json --engine=rhasspy --hardware=respeaker2 --pattern=projectalice
Restart=always
RestartSec=5
User=pi

[Install]
WantedBy=multi-user.target

Hope this helps someone. :slight_smile:

5 Likes

Hello,
I made modification inside the code to add a new topic to change idle status dynamically.
For now I’m able to set an animation or pattern for idle Status (and change it) through MQTT.
I also modify the Breath animation to pass it severals colors, and also to add a sleep after all (or one) color breath.

Hello,

Has anyone ever run the Google AIY leds on the Rhasspy installed?

The start configuration of the program: hermesledcontrol.service

ExecStart=/home/pi/hermesLedControl_v2.0.9/venv/bin/python3 main.py --engine=rhasspy
–pathToConfig=/home/pi/.config/rhasspy/profiles/fr/profile.json --hardware=googleAIY --pattern=kiboost

In the jeeRhasspy logs, I see :

[2020-12-07 13:49:19][DEBUG] : [jeerhasspyCmd] <execute> TTS-default.ledOn() | {"background":"0"}
[2020-12-07 13:49:19][DEBUG] : [jeerhasspyCmd] <setLEDs> 1 siteId: default
[2020-12-07 13:49:19][DEBUG] : [RhasspyUtils] <_request> POST | http://192.168.XXX.XXX:12101/api/mqtt/hermes/leds/toggleOn | {"siteId":"default"}
[2020-12-07 13:49:24][DEBUG] : [jeerhasspyCmd] <execute> TTS-default.ledOff() | {"background":"0"}
[2020-12-07 13:49:24][DEBUG] : [jeerhasspyCmd] <setLEDs> 0 siteId: default
[2020-12-07 13:49:24][DEBUG] : [RhasspyUtils] <_request> POST | http://192.168.XXX.XXX:12101/api/mqtt/hermes/leds/toggleOff | {"siteId":"default"}
[2020-12-07 13:51:20][DEBUG] : [jeerhasspyCmd] <execute> TTS-default.ledOn() | {"background":"0"}
[2020-12-07 13:51:20][DEBUG] : [jeerhasspyCmd] <setLEDs> 1 siteId: default
[2020-12-07 13:51:20][DEBUG] : [RhasspyUtils] <_request> POST | http://192.168.XXX.XXX:12101/api/mqtt/hermes/leds/toggleOn | {"siteId":"default"}
[2020-12-07 13:51:25][DEBUG] : [jeerhasspyCmd] <execute> TTS-default.ledOff() | {"background":"0"}

And service Hermesledcontrol logs :

déc. 07 14:47:54 raspberrypi python3[7549]: Starting Hermes Led Control v. 2.0.6
déc. 07 14:47:54 raspberrypi python3[7549]: Initializing HermesLedControl
déc. 07 14:47:54 raspberrypi python3[7549]: Initializing Rhasspy settings
déc. 07 14:47:54 raspberrypi python3[7549]: Loading configurations
déc. 07 14:47:54 raspberrypi python3[7549]: Error loading configurations: 'mqtt'

Any idea for Error loading configurations: ‘mqtt’ ?

This helped me to get it working with my Respeaker 4. The shell script in the wiki did not work on my raspberry pi4 and was not creating the configuration correctly.

I manually created a folder under pi/home/hermesLedControl with a configuration.yml file and the profile.json example that you provided. Added the link to profile.json in the config file:

pathToConfig=‘profile.json’

Opened the 12183 port of the Rhasspy image in docker and those lovely LEDS came into action.

Spent so much time on it this weekend and had almost given up home so thank you!

1 Like

I’ve detailed how I got past this using the post from @Armadillo. Let me know if I can help you further

Thank you, work great

1 Like

I use a Raspberry Pi 4B with a ReSpeaker 4 and “installed” Rhasspy via docker.

After that I installed HermesLedControl.
For some reason the wake word recognition is extremeley bad now and it seems HermesLedControl consumes a lot of CPU.

Has someone else reached better results? If yes, how?

Did you activate the DoA (Detection Of Arrival) function in Hermes Led Control?
It’s very resources greedy and I can imagine it causes the behaviour


Yes, I activated DoA. After disabling DoA, it works. Thank you!

I had some problems. So I post the commands/settings I use:

sudo ./hlc_download.sh
2 (rhasspy)
/home/pi/.config/rhasspy/profiles/de/profile.json (path to assistant config file)
#2 (respeaker4)
#1 (google)
#/home/pi/.config/hermesLedControl (where configuration saved)
#2 (no DoA)
#1 (yes - install respeaker4)

# here the HLC script skiped because of kernel issues. so install it manually again:
git clone https://github.com/respeaker/seeed-voicecard
cd seeed-voicecard
sudo ./install.sh --compat-kernel
sudo reboot

Is there an overview about the difference of the HCL led patterns (google, alexa, 
)?

No idea, but you can easily try them.
In the configuration file you can specify which animation HLC should use, just restart the service and test.

AFAIR on the wiki on the github page there is also a more detailed description of all animations and how you can customize your own!

Hi Guys, I am trying HermesLedControl on my 2 satellite RasPi’s, and have a couple of questions


After a couple of issues (including HLC defaulting to the wrong MQTT port) it is flashing beautifully on the RasPi 3B with reSpeaker 4-mic HAT. :smiley: :heart_eyes:

  1. The wiki on the project-alice github leaves out more than it answers. Should I ask questions and make documentation suggestions by raising github issues, or is there a more appropriate forum than here ?

  2. Unfortunately the RasPi Zero W with Adafruit Voice Bonnet (which I believe is functionally identical to reSpeaker 2-mic HAT) appears to be receiving MQTT messages, but showing messages like “On play finished received but it wasn’t for me”

/etc/systemd/system/hermesledcontrol.service contains

[Unit]
Description=Hermes Led Control

[Service]
WorkingDirectory=/home/don/hermesLedControl_v2.0.15
ExecStart=/home/don/hermesLedControl_v2.0.15/venv/bin/python3 main.py --hermesLedControlConfig=/home/don/.config/hermesLedControl/configuration.yml
Restart=always
RestartSec=5
User=don

[Install]
WantedBy=multi-user.target

/home/don/.config/hermesLedControl/configuration.yml contains:

engine: "rhasspy"
pathToConfig: "/home/don/.config/rhasspy/profiles/en/profile.json"
hardware: "respeaker2Mics"
pattern: "google"
enableDoA: false
debug: True
endFrame: 0 

and the Rhasspy profile is:

{
    "dialogue": {
        "volume": "0.5"
    },
    "handle": {
        "satellite_site_ids": "sat-2",
        "system": "hass"
    },
    "home_assistant": {
        "access_token": "eyJ0eXAiOiJKV1Qi 
 PH_CoQYsJa00b_-sd8",
        "url": "http://192.168.1.98:8123/"
    },
    "intent": {
        "system": "hermes"
    },
    "microphone": {
        "arecord": {
            "device": "plughw:CARD=seeed2micvoicec,DEV=0",
            "siteId": "sat-2",
            "udp_audio_port": "12203"
        },
        "system": "arecord"
    },
    "mqtt": {
        "enabled": "true",
        "host": "192.168.1.98",
        "port": "1883",
        "password": "passwd",
        "site_id": "sat-2",
        "username": "rhasspy"
    },
    "sounds": {
        "aplay": {
            "device": "plughw:CARD=seeed2micvoicec,DEV=0",
            "volume": "0.5"
        },
        "system": "aplay"
    },
    "speech_to_text": {
        "system": "hermes"
    },
    "text_to_speech": {
        "satellite_site_ids": "sat-2",
        "system": "hermes"
    },
    "wake": {
        "porcupine": {
            "udp_audio": "12203"
        },
        "system": "porcupine"
    }
}

On the RasPi Zero (siteId “sat-2”), journalctl -u hermesledcontrol.service gives (with date/time stamps removed for readability) 


[MainThread] - [INFO] - Initializing HermesLedControl
[MainThread] - [INFO] - Initializing Rhasspy settings
[MainThread] - [INFO] - Loading configurations
[MainThread] - [INFO] - Loaded 14 hardware references
[MainThread] - [INFO] - - Mqtt server set to 192.168.1.98
[MainThread] - [INFO] - - Mqtt port set to 1883
[MainThread] - [INFO] - - Mqtt username set to rhasspy
[MainThread] - [INFO] - - Mqtt password set to "hidden"
[MainThread] - [INFO] - - Client id set to sat-2
[MainThread] - [INFO] - - Hardware set to ReSpeaker 2-Mics
[MainThread] - [INFO] - - Using google as pattern with 3 leds
[MainThread] - [INFO] - Initializing leds controller
[MainThread] - [INFO] - Hermes Led Control started
[Thread-4] - [DEBUG] - New animation <bound method GoogleHomeLedPattern.wakeup of <ledPatterns.GoogleLedPat
[Thread-4] - [DEBUG] - Timeout is setting duration from 0 to 120
[Thread-4] - [DEBUG] - New animation <bound method GoogleHomeLedPattern.idle of <ledPatterns.GoogleLedPatte
[Thread-3] - [DEBUG] - On hotword triggered
[Thread-3] - [DEBUG] - New animation <bound method GoogleHomeLedPattern.wakeup of <ledPatterns.GoogleLedPat
[Thread-3] - [DEBUG] - Timeout is setting duration from 0 to 120
[Thread-3] - [DEBUG] - On play finished received but it wasn't for me
[Thread-3] - [DEBUG] - On hotword toggle on triggered

I have tried to simplify the config files by reducing fields duplicated in multiple files.

SiteId is specified in ~/.config/rhasspy/profiles/en/profile.json"; but does “–clientId:” also need to be specified in ~/.config/hermesLedControl/configuration.yml" ?