Rhasspy offline voice assistant toolkit

Seems we need to install libasound2-plugins inside Rhasspy docker container. Thereafter it’s possible to set “pulse: PulseAudio Sound Server” as the Output Device and Output works as before!

This did not work for me.

Did you install libasound2-plugins inside container?

In my case looks like:

2 Likes

Oh, I didn’t see the “pulse” option in the “aplay” in Rhasspy the first time. Now I can see it.
Thanks you so much, the microphone is working again!

@synesthesiam could you add libasound2-plugins to the build of docker container? Seems it is necessary for latest hass.io

Is there a way to get 2.5 version? I would like to experiment with it - the githib only has until 2.4.19

It is not yet available as addon, but you can use a prerelease version.

Here is how:

1 Like

Hi,

I am trying to get started with Rhasspy but I am not getting either the speaker/mic to work, my setup is the following:


Raspberry Pi4 
Jabra SPEAK 410 USB
HassOS 3.2
Hassio 0.108.1
Rhasspy Hassio AddOn  2.4.19

When I go into SSH terminal and do ha hardware info I get the following for audio and input

audio:
  "0":
    devices:
    - chan_id: "0"
      chan_type: digital audio playback
    - chan_id: "0"
      chan_type: digital audio capture
    name: USB-Audio - Jabra SPEAK 410 USB
    type: USB

input:
- Jabra SPEAK 410 USB
- Jabra SPEAK 410 USB Consumer Control

Then In the hassio configuration I have

Config

user_dir: /share/rhasspy/profiles
profile: en
ssl: false
certfile: fullchain.pem
keyfile: privkey.pem
asoundrc: ''

Audio

Input -> Jabra Speak 410 USB Mono
Output -> Jabra Speak 410 USB Analog Stereo

I then went into the web interface, downloaded the english profile and click Train.

But when I go to speech and try to speak a sentence (hello world) I get the following in the logs

DEBUG:APlayAudioPlayer:['aplay', '-q']
ALSA lib dlmisc.c:254:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_pulse.so
aplay: main:788: audio open error: No such device or address
ERROR:APlayAudioPlayer:on_receive
Traceback (most recent call last):
  File "/usr/share/rhasspy/rhasspy/actor.py", line 175, in on_receive
    self._state_method(message, sender)
  File "/usr/share/rhasspy/rhasspy/audio_player.py", line 70, in in_started
    self.play_data(message.wav_data)
  File "/usr/share/rhasspy/rhasspy/audio_player.py", line 102, in play_data
    subprocess.run(aplay_cmd, input=wav_data, check=True)
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['aplay', '-q']' returned non-zero exit status 1.

When going to the console and doing aplay -L I get:

null
    Discard all samples (playback) or generate zero samples (capture)
default
    Default ALSA Output (Home Assistant PulseAudio Sound Server)

Then in the advanced tab I have the following

{
    "microphone": {
        "arecord": {
            "device": "null"
        },
        "system": "arecord"
    }
}

I also try playing around with

asoundrc , including the following in the Config section without luck either


  pcm.!default { type hw card 0 }
  ctl.!default { type hw card 0 }

I am really lost at this point, any help is greatly appreciated

Thanks
Claudio

Try to install libasound2-plugins inside rhasspy docker container. Rhasspy offline voice assistant toolkit

Thanks @nordeep!

By doing apt install --yes libasound2-plugins in the container it started working, however each time I restart the Rhasppy hassio addon I loose the libasound2-plugins installation and the settings stored for the speaker and mic.

How can I make the Rhasppy hassio addon install the libasound2-plugins each time it restarts ?

Thanks!

There are two options: 1. You can create local clone of the Rhasppy hassio addon and add libasound2-plugins package to container. 2. Ask @synesthesiam to add libasound2-plugins package to the official build :slightly_smiling_face:

1 Like

Are there no android apps that can send voice over MQTT ?
The only one i can find was Snips and it worked out of the box, but it isnt available anymore.

We all have old android / ios phones lying around, it would be nice to use them as voice clients / satellites.

I am using 2 old phones as home assistant dashboards, 1 upstairs and one in the living room, it would be nice if they can listen to voice commands.

Well, not exactly the solution you require, but for the usual 2 -3 words control - you could use the conversation compoents in HA. You can then use the TTS to Rhasspy for Voice Feedback

Hi @synesthesiam , can you add libasound2-plugins package to the official build of the Hassio addon ? It is the only way I could make my Jabra 410 USB Mic/Speaker to work with it and each time the container is restarted I have to reinstall it again.

Thanks,
Claudio

well I just gave up and installed 2.5 pre. It doesn’t have this problem. But there is a small structure change to the JSON which is sent back to HA, you will need to incorporate that. Other than that, looks pretty good. I faced voice recognition delays in RPI3B, but in RPI4 even with HA and all those Add-ons running, it is fast!

Hello,

First thank you very much for this great opportunity to have private and offline voice controlled HA! I know that we are now on the edge of 2.5 release, but I am having some issues with Rhasspy Hassio add-on 2.4.19. which maybe could be still present in next release.

My Hassio runs in docker on Intel NUC, with Rhasspy 2.4.19 installed and configured as a Server:

profile - en
[MQTT] - DISABLED
[Intent Handling] - hass
[Wake Word] - DISABLED
[Voice Detection] - DISABLED
[Speech to Text] - kaldi / Pocketsphinx
[Intent Recognition] - conversation
[Text to Speech] - DISABLED
[Microphone] - DISABLED
[Sounds] - DISABLED

My Raspberry Pi 3B runs Rhaspy in docker (synesthesiam/rhasspy-server:latest ) configured as client (with Respeaker Mic Array 2.0 - 1 channel firmware):

profile - en
[MQTT] - DISABLED
[Intent Handling] - hass
[Wake Word] - porcupine
[Voice Detection] - webrtcvad
[Speech to Text] - remote
[Intent Recognition] - conversation
[Text to Speech] - flite
[Microphone] - arecord
[Sounds] - aplay

As you can see my intention is to use my Client to wake up and capture stream and then use my Rhasspy Server to do heavy STT and forward text to HA conversation for intent recognition and handling (by Almond). I was able to make my Client work with Respeaker Mic Array, at least i records and play audio via Rhasspy web console clearly and without issues. I was also able to make whole solution it work end to end with Pocketsphinx as STT on Server and Almond handling HA.

My observed issues:

1. Rhasspy Hassio add-on doesn’t follow SSL config directive:

user_dir: /share/rhasspy/profiles
profile: en
ssl: true
certfile: server.crt
keyfile: server.key
asoundrc: ''

But even that both crt/key files exists (and are referenced from other add-on in the same way/path) Rhasspy is starting only in http mode:

DEBUG:__main__:Namespace(host='0.0.0.0', log_level='DEBUG', port=12101, profile='en', set=[], ssl=None, system_profiles='/usr/share/rhasspy/profiles', user_profiles='/share/rhasspy

2. Pocketsphinx STT has very low confidence/many mistakes

For me is is like < 0.01 in open transcription mode. I do not know what I am doing wrong, but even audio recording is clear and although I am not native speaker I have decent accent, I am not able to force Rhasspy to understand me. :slight_smile: Therefore I tried to switch to kaldi (on the Server, as it takes ages to process STT with kaldi on Raspberry Pi Client). Any hints? Or is it such low confidence and many mistakes normal with Pocketsphinx in open transcription mode?

3. Kaldi is not compatible with this profile

my Server Rhaspy in web console under Speach recognition says:

Do speech recognition with kaldi on this device

Not compatible with this profile

Is it not possible to use kaldi with Server configuration? Why is it ‘not compatible’?

EDIT: Seems that this problem is related to problem 5. Web configuration mechanism has probably some bug and when some config changes are made (only via web interface) it mess the content of configs. I was able to get rid of this error starting fresh Docker, then kaldi was available again.

4. Kaldi Train fails

When I edited profile.json to force use kaldi for STT on my server, I was able after restart to download missing kaldi profile files successfully. But I am getting error when trying to train kaldi:

Training failed: <Task: kaldi_train>: TaskError Command error: ‘[‘bash’, ‘profiles/en/model/train.sh’, ‘/opt/kaldi’, ‘profiles/en/model’, ‘/share/rhasspy/profiles/en/dictionary.txt’, ‘/share/rhasspy/profiles/en/language_model.txt’]’ returned 127

I use default settings for kaldi in profiles.json:


    "speech_to_text": {
        "system": "kaldi",
        "command": {
            "program": "$RHASSPY_BASE_DIR/bin/mock-commands/speech2text.sh"
        },
        "dictionary_casing": "",
        "g2p_model": "g2p.fst",
        "kaldi": {
            "base_dictionary": "base_dictionary.txt",
            "compatible": false,
            "custom_words": "custom_words.txt",
            "dictionary": "dictionary.txt",
            "kaldi_dir": "/opt/kaldi",
            "language_model": "language_model.txt",
            "model_dir": "model",
            "phoneme_examples": "phoneme_examples.txt",
            "phoneme_map": "espeak_phonemes.txt",
            "unknown_words": "unknown_words.txt"
        },
        "pocketsphinx": {
            "min_confidence": 0.5
        },
        "sentences_text": "sentences.txt"
    },

In the log:

[INFO:1018668] quart.serving: 192.168.1.99:33868 GET /api/problems 1.1 200 390 2070
[DEBUG:1018667] InboxActor:  -> stopped
[INFO:1018616] quart.serving: 192.168.1.99:33868 POST /api/train 1.1 500 246 235495
[ERROR:1018612] __main__: Training failed: <Task: kaldi_train>: TaskError
Command error: '['bash', 'profiles/en/model/train.sh', '/opt/kaldi', 'profiles/en/model', '/share/rhasspy/profiles/en/dictionary.txt', '/share/rhasspy/profiles/en/language_model.txt']' returned 127
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/quart/app.py", line 1471, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/usr/local/lib/python3.6/dist-packages/quart/app.py", line 1519, in dispatch_request
    return await handler(**request_.view_args)
  File "app.py", line 640, in api_train
    raise Exception(f"Training failed: {result.reason}")
Exception: Training failed: <Task: kaldi_train>: TaskError
Command error: '['bash', 'profiles/en/model/train.sh', '/opt/kaldi', 'profiles/en/model', '/share/rhasspy/profiles/en/dictionary.txt', '/share/rhasspy/profiles/en/language_model.txt']' returned 127

[DEBUG:1018612] InboxActor:  -> stopped
[DEBUG:1018611] DialogueManager: training_sentences -> ready
[DEBUG:1018391] rhasspynlu.ini_jsgf: Loaded ini file
[DEBUG:1018390] train: Parsing ini file(s): ['/usr/share/rhasspy/profiles/en/sentences.ini']
[INFO:1018389] quart.serving: 192.168.1.99:33870 GET /api/unknown-words 1.1 200 2 1278
[DEBUG:1018383] DialogueManager: ready -> training_sentences
[INFO:1018382] __main__: Starting training

I assume this is maybe because of different paths in Docker under Hassio? Please see difference in all bash script ‘train.sh’ passed arguments:

‘profiles/en/model’
‘/share/rhasspy/profiles/en/dictionary.txt’
‘/share/rhasspy/profiles/en/language_model.txt’

Maybe the first argument should be ‘/share/rhasspy/profiles/en/model’ instead?

EDIT: same as my edit in 4. - Seems that this problem is related to problem 5. Web configuration mechanism has probably some bug and when some config changes are made (only via web interface) it mess the content of configs. I was able to get rid of this error starting fresh Docker, then kaldi was available again.

Thank you for any help or hint. :slight_smile:

Kind regards
litin

Additional finding:

5. Rhasspy on Docker (i.e. nor Hassio add-on but original synesthesiam/rhasspy-server:latest) doesn’t save profile.json

I do run Rhaspy as Client on Docker on Rapsberry Pi using this:

docker run -p 12101:12101
–restart unless-stopped
–name rhasspy
-v “/home/pi/rhasspy/profiles:/profiles”
–device /dev/snd:/dev/snd
synesthesiam/rhasspy-server:latest
–user-profiles /profiles
–profile en

so under my /home/pi/rhasspy/profiles I have:

pi@speakerliving:~/rhasspy/profiles $ ls -ltr
total 4
drwxr-xr-x 5 root root 4096 dub 17 21:14 en

pi@speakerliving:~/rhasspy/profiles/en $ ls -all
total 43444
drwxr-xr-x 5 root root 4096 dub 17 21:14 .
drwxr-xr-x 3 pi pi 4096 dub 17 11:44 …
drwxr-xr-x 2 root root 4096 led 15 2015 acoustic_model
-rw-r–r-- 1 root root 3240168 bře 18 2019 base_dictionary.txt
drwxr-xr-x 2 root root 4096 dub 17 11:50 download
-rw-r–r-- 1 root root 41213581 bře 18 2019 g2p.fst
-rw-rw-r-- 1 root root 13 lis 24 15:43 kaldi_custom_words.txt
drwxr-xr-x 2 root root 4096 dub 17 20:22 porcupine
-rw-rw-rw- 1 root root 2890 dub 17 21:04 profile.json

When I edit configuration using web console, I can find in the log something like:

[INFO:1456010] quart.serving: 192.168.1.99:49690 POST /api/profile 1.1 200 42 4215359
[DEBUG:1455999] main: Wrote profile to /profiles/en/profile.json
[INFO:1448624] quart.serving: 192.168.1.99:49666 GET /api/events/log 1.1 101 - 143332848
[INFO:1448619] quart.serving: 192.168.1.99:49624 GET /api/events/log 1.1 101 - 281722993
[INFO:1448612] quart.serving: 192.168.1.99:49690 GET /api/microphones 1.1 200 1062 136978
[DEBUG:1448595] InboxActor: → stopped

If I restart Rhasspy from console I can see that changes values are present in at web page. But no changes are made to /home/pi/rhasspy/profiles/en/profile.json. (it stays same) So if I restart docker/host Rasberry Pi all previously made changes are lost!

The profile directory /home/pi/rhasspy/profiles/en/ seems to be writeable by Rhasspy Docker without problem as when downloading files for different components from web console Rhasspy has no problem to save them there.

Also it is interesting, that if I modify /home/pi/rhasspy/profiles/en/profile.json manually (to make configuration persistent between host restarts), when I restart Rhasspy from web console no changes made in profile.json are taken. But when I restart Docker or host Raspberry then configuration from profile.json is loaded into Rhassby! this is really strange… :-o

6. when repeating often Rhaaspy remote STT command HTTP error 400 is returned by server to client

Server log:

INFO:quart.serving:192.168.1.89:58994 POST /api/speech-to-text 1.1 200 3 736073
[2020-04-17 20:46:17,478] 192.168.1.89:58994 POST /api/speech-to-text 1.1 200 3 736073
DEBUG:KaldiDecoder:[‘bash’, ‘/share/rhasspy/profiles/en/kaldi/model/decode.sh’, ‘/opt/kaldi’, ‘/share/rhasspy/profiles/en/kaldi/model’, ‘/share/rhasspy/profiles/en/kaldi/model/base_graph’, ‘/tmp/tmp633q8bf6.wav’]
[2020-04-17 20:48:20,896] 192.168.1.99:38200 GET /api/events/log 1.1 101 - 112201509
INFO:quart.serving:192.168.1.99:38200 GET /api/events/log 1.1 101 - 112201509
ERROR:quart.serving:Error in ASGI Framework
Traceback (most recent call last):
[2020-04-17 20:48:20,902] Error in ASGI Framework
Traceback (most recent call last):
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 91, in handle_asgi_app
await asgi_instance(self.asgi_receive, self.asgi_send)
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 106, in call
await _cancel_tasks(pending)
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 189, in _cancel_tasks
raise task.exception()
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 157, in handle_websocket
‘code’: 1000,
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 149, in asgi_send
await self.asend(CloseConnection(code=int(message[“code”])))
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asyncio/wsproto.py”, line 93, in asend
self.write(self.connection.send(event))
File “/usr/local/lib/python3.6/dist-packages/wsproto/init.py”, line 64, in send
data += self.connection.send(event)
File “/usr/local/lib/python3.6/dist-packages/wsproto/connection.py”, line 101, in send
“Connection cannot be closed in state %s” % self.state
wsproto.utilities.LocalProtocolError: Connection cannot be closed in state ConnectionState.CLOSED
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 91, in handle_asgi_app
await asgi_instance(self.asgi_receive, self.asgi_send)
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 106, in call
await _cancel_tasks(pending)
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 189, in _cancel_tasks
raise task.exception()
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 157, in handle_websocket
‘code’: 1000,
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 149, in asgi_send
await self.asend(CloseConnection(code=int(message[“code”])))
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asyncio/wsproto.py”, line 93, in asend
self.write(self.connection.send(event))
File “/usr/local/lib/python3.6/dist-packages/wsproto/init.py”, line 64, in send
data += self.connection.send(event)
File “/usr/local/lib/python3.6/dist-packages/wsproto/connection.py”, line 101, in send
“Connection cannot be closed in state %s” % self.state
wsproto.utilities.LocalProtocolError: Connection cannot be closed in state ConnectionState.CLOSED
DEBUG:KaldiDecoder:turn off kitchen light
DEBUG:InboxActor: → stopped
[2020-04-17 20:48:21,994] 192.168.1.89:59000 POST /api/speech-to-text 1.1 200 22 1119511
INFO:quart.serving:192.168.1.89:59000 POST /api/speech-to-text 1.1 200 22 1119511
DEBUG:KaldiDecoder:[‘bash’, ‘/share/rhasspy/profiles/en/kaldi/model/decode.sh’, ‘/opt/kaldi’, ‘/share/rhasspy/profiles/en/kaldi/model’, ‘/share/rhasspy/profiles/en/kaldi/model/base_graph’, ‘/tmp/tmpytf8400q.wav’]
DEBUG:KaldiDecoder:turn off
DEBUG:InboxActor: → stopped
INFO:quart.serving:192.168.1.89:59004 POST /api/speech-to-text 1.1 200 8 980771
[2020-04-17 20:48:40,478] 192.168.1.89:59004 POST /api/speech-to-text 1.1 200 8 980771
DEBUG:KaldiDecoder:[‘bash’, ‘/share/rhasspy/profiles/en/kaldi/model/decode.sh’, ‘/opt/kaldi’, ‘/share/rhasspy/profiles/en/kaldi/model’, ‘/share/rhasspy/profiles/en/kaldi/model/base_graph’, ‘/tmp/tmp1uazylhr.wav’]
DEBUG:KaldiDecoder:turn off bedroom night

Client log:

[DEBUG:1957453] InboxActor: → stopped
[INFO:1957398] quart.serving: 192.168.1.99:51502 GET /api/profile 1.1 200 6907 49278
[ERROR:1957389] main: not enough values to unpack (expected 2, got 1)
Traceback (most recent call last):
File “/usr/local/lib/python3.6/dist-packages/quart/app.py”, line 1471, in full_dispatch_request
result = await self.dispatch_request(request_context)
File “/usr/local/lib/python3.6/dist-packages/quart/app.py”, line 1519, in dispatch_request
return await handler(**request_.view_args)
File “app.py”, line 871, in api_unknown_words
word, pronunciation = re.split(r"+", line, maxsplit=1)
ValueError: not enough values to unpack (expected 2, got 1)
[INFO:1957373] quart.serving: 192.168.1.99:51512 GET /api/profile 1.1 200 9463 103873
[INFO:1957368] quart.serving: 192.168.1.99:51506 GET /api/phonemes 1.1 200 1526 125323
[INFO:1957344] quart.serving: 192.168.1.99:51500 GET /api/profiles 1.1 200 144 126916
[DEBUG:1957287] main: Loading phoneme examples from /usr/share/rhasspy/profiles/en/phoneme_examples.txt
[INFO:1957273] quart.serving: 192.168.1.99:51504 GET /api/events/log 1.1 101 - 173146
[ERROR:1957262] asyncio: Task exception was never retrieved
future: <Task finished coro=<WebsocketMixin.handle_websocket() done, defined at /usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py:60> exception=LocalProtocolError(‘Connection cannot be closed in state ConnectionState.CLOSED’,)>
Traceback (most recent call last):
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 91, in handle_asgi_app
await asgi_instance(self.asgi_receive, self.asgi_send)
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 106, in call
await _cancel_tasks(pending)
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 189, in _cancel_tasks
raise task.exception()
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 157, in handle_websocket
‘code’: 1000,
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 149, in asgi_send
await self.asend(CloseConnection(code=int(message[“code”])))
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asyncio/wsproto.py”, line 93, in asend
self.write(self.connection.send(event))
File “/usr/local/lib/python3.6/dist-packages/wsproto/init.py”, line 64, in send
data += self.connection.send(event)
File “/usr/local/lib/python3.6/dist-packages/wsproto/connection.py”, line 101, in send
“Connection cannot be closed in state %s” % self.state
wsproto.utilities.LocalProtocolError: Connection cannot be closed in state ConnectionState.CLOSED

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 78, in handle_websocket
await self.handle_asgi_app(event)
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 99, in handle_asgi_app
await self.asend(CloseConnection(code=CloseReason.ABNORMAL_CLOSURE))
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asyncio/wsproto.py”, line 93, in asend
self.write(self.connection.send(event))
File “/usr/local/lib/python3.6/dist-packages/wsproto/init.py”, line 64, in send
data += self.connection.send(event)
File “/usr/local/lib/python3.6/dist-packages/wsproto/connection.py”, line 101, in send
“Connection cannot be closed in state %s” % self.state
wsproto.utilities.LocalProtocolError: Connection cannot be closed in state ConnectionState.CLOSED
[ERROR:1957258] asyncio: Task exception was never retrieved
future: <Task finished coro=<WebsocketMixin.handle_websocket() done, defined at /usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py:60> exception=LocalProtocolError(‘Connection cannot be closed in state ConnectionState.CLOSED’,)>
Traceback (most recent call last):
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 91, in handle_asgi_app
await asgi_instance(self.asgi_receive, self.asgi_send)
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 106, in call
await _cancel_tasks(pending)
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 189, in _cancel_tasks
raise task.exception()
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 157, in handle_websocket
‘code’: 1000,
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 149, in asgi_send
await self.asend(CloseConnection(code=int(message[“code”])))
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asyncio/wsproto.py”, line 93, in asend
self.write(self.connection.send(event))
File “/usr/local/lib/python3.6/dist-packages/wsproto/init.py”, line 64, in send
data += self.connection.send(event)
File “/usr/local/lib/python3.6/dist-packages/wsproto/connection.py”, line 101, in send
“Connection cannot be closed in state %s” % self.state
wsproto.utilities.LocalProtocolError: Connection cannot be closed in state ConnectionState.CLOSED

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 78, in handle_websocket
await self.handle_asgi_app(event)
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 99, in handle_asgi_app
await self.asend(CloseConnection(code=CloseReason.ABNORMAL_CLOSURE))
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asyncio/wsproto.py”, line 93, in asend
self.write(self.connection.send(event))
File “/usr/local/lib/python3.6/dist-packages/wsproto/init.py”, line 64, in send
data += self.connection.send(event)
File “/usr/local/lib/python3.6/dist-packages/wsproto/connection.py”, line 101, in send
“Connection cannot be closed in state %s” % self.state
wsproto.utilities.LocalProtocolError: Connection cannot be closed in state ConnectionState.CLOSED
[ERROR:1957255] asyncio: Task exception was never retrieved
future: <Task finished coro=<WebsocketMixin.handle_websocket() done, defined at /usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py:60> exception=LocalProtocolError(‘Connection cannot be closed in state ConnectionState.CLOSED’,)>
Traceback (most recent call last):
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 91, in handle_asgi_app
await asgi_instance(self.asgi_receive, self.asgi_send)
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 106, in call
await _cancel_tasks(pending)
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 189, in _cancel_tasks
raise task.exception()
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 157, in handle_websocket
‘code’: 1000,
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 149, in asgi_send
await self.asend(CloseConnection(code=int(message[“code”])))
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asyncio/wsproto.py”, line 93, in asend
self.write(self.connection.send(event))
File “/usr/local/lib/python3.6/dist-packages/wsproto/init.py”, line 64, in send
data += self.connection.send(event)
File “/usr/local/lib/python3.6/dist-packages/wsproto/connection.py”, line 101, in send
“Connection cannot be closed in state %s” % self.state
wsproto.utilities.LocalProtocolError: Connection cannot be closed in state ConnectionState.CLOSED

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 78, in handle_websocket
await self.handle_asgi_app(event)
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 99, in handle_asgi_app
await self.asend(CloseConnection(code=CloseReason.ABNORMAL_CLOSURE))
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asyncio/wsproto.py”, line 93, in asend
self.write(self.connection.send(event))
File “/usr/local/lib/python3.6/dist-packages/wsproto/init.py”, line 64, in send
data += self.connection.send(event)
File “/usr/local/lib/python3.6/dist-packages/wsproto/connection.py”, line 101, in send
“Connection cannot be closed in state %s” % self.state
wsproto.utilities.LocalProtocolError: Connection cannot be closed in state ConnectionState.CLOSED
[ERROR:1957251] asyncio: Task exception was never retrieved
future: <Task finished coro=<WebsocketMixin.handle_websocket() done, defined at /usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py:60> exception=LocalProtocolError(‘Connection cannot be closed in state ConnectionState.CLOSED’,)>
Traceback (most recent call last):
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 91, in handle_asgi_app
await asgi_instance(self.asgi_receive, self.asgi_send)
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 106, in call
await _cancel_tasks(pending)
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 189, in _cancel_tasks
raise task.exception()
File “/usr/local/lib/python3.6/dist-packages/quart/asgi.py”, line 157, in handle_websocket
‘code’: 1000,
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 149, in asgi_send
await self.asend(CloseConnection(code=int(message[“code”])))
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asyncio/wsproto.py”, line 93, in asend
self.write(self.connection.send(event))
File “/usr/local/lib/python3.6/dist-packages/wsproto/init.py”, line 64, in send
data += self.connection.send(event)
File “/usr/local/lib/python3.6/dist-packages/wsproto/connection.py”, line 101, in send
“Connection cannot be closed in state %s” % self.state
wsproto.utilities.LocalProtocolError: Connection cannot be closed in state ConnectionState.CLOSED

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 78, in handle_websocket
await self.handle_asgi_app(event)
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asgi/wsproto.py”, line 99, in handle_asgi_app
await self.asend(CloseConnection(code=CloseReason.ABNORMAL_CLOSURE))
File “/usr/local/lib/python3.6/dist-packages/hypercorn/asyncio/wsproto.py”, line 93, in asend
self.write(self.connection.send(event))
File “/usr/local/lib/python3.6/dist-packages/wsproto/init.py”, line 64, in send
data += self.connection.send(event)
File “/usr/local/lib/python3.6/dist-packages/wsproto/connection.py”, line 101, in send
“Connection cannot be closed in state %s” % self.state
wsproto.utilities.LocalProtocolError: Connection cannot be closed in state ConnectionState.CLOSED
[INFO:1957240] quart.serving: 192.168.1.99:51502 GET /api/slots 1.1 200 2 43580
[INFO:1957194] quart.serving: 192.168.1.99:51500 GET /api/sentences 1.1 200 581 16090

Kind regards
litin

I updated both rhasspy and hassio to the latest version (hassio 0.108.6 + rhasspy add-on 2.4.20) and I cannot start rhasspy now. The log says:

Traceback (most recent call last):
  File "app.py", line 17, in <module>
    import attr
ModuleNotFoundError: No module named 'attr'

I use raspbian + hass.io in docker with rhasspy add-on.
Anyone know how to fix this?
I have tried rebuilding and removing both the add-on and files in located in /share/rhasspy/ but nothing seems to work. Tried reinstalling the rhasspy add-on several times but it’s not working

My system:

Hello,

I can confirm this problem - after upgrade hassio 0.108.6 + rhasspy add-on 2.4.20 (do not know which caused issue) I am getting same error.

I do also run Rhasspy 2.4.20 Docker image on my clients now (i.e. just Rhasspy Docker, not Hassio addon) and it could be started OK. However, it could not download Porcupine required files (i did cleared my profile before deploying new Docker image). I do get pop-up window after restarting Rhasspy but no files are downloaded. Pressing ‘Download now’ button triggers immediately popup that files where downloaded while no file download action is being triggered - no files are saved in porcupine directory in the selected profile. Seem to be bug related to this change in Rhasspy 2.4.20:

  • Don’t error out on missing porcupine files

“missing”:
“/profiles/en/porcupine/libpv_porcupine.so”:
0: “wake.system”
1: “porcupine”

“/profiles/en/porcupine/porcupine.ppn”:
0: “wake.system”
1: “porcupine”

“/profiles/en/porcupine/porcupine_params.pv”:
0: “wake.system”
1: “porcupine”

Hopefully synesthesiam is arround to help? :slight_smile:

Thank you.
litin

1 Like

I’ve fixed the ModuleNotFoundError. Changes are merged and a new docker image is built by the maintainer

1 Like