home-assistant / addons

:heavy_plus_sign: Docker add-ons for Home Assistant
https://home-assistant.io/hassio/
Apache License 2.0
1.58k stars 1.52k forks source link

Whisper - satellite: ERROR:asyncio:Task exception was never retrieved #3033

Closed KeithSBB closed 1 year ago

KeithSBB commented 1 year ago

Describe the issue you are experiencing

With a Rhasspy3 satellite having the following configuration.yaml

programs:
  mic:
    arecord:
      command: |
        arecord -q -r 16000 -c 1 -f S16_LE -t raw -
      adapter: |
        mic_adapter_raw.py --rate 16000 --width 2 --channels 1

  wake:
    porcupine1:
      command: |
        .venv/bin/python3 bin/porcupine_stream.py --model "${model}"
      template_args:
        model: "porcupine_raspberry-pi.ppn"

  remote:
    websocket:
      command: |
        script/run "${uri}"
      template_args:
        uri: "ws://homeassistant.home.arpa:10300/pipeline/asr-tts"

satellites:
  default:
    mic:
      name: arecord
    wake:
      name: porcupine1
    remote:
      name: websocket
    snd:
      name: aplay

I get the following error in whisper log when I ask satellite: "porcupine,... what time is it?"

ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-221' coro=<AsyncEventHandler.run() done, defined at /usr/local/lib/python3.9/dist-packages/wyoming/server.py:26> exception=JSONDecodeError('Expecting value: line 1 column 1 (char 0)')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/wyoming/server.py", line 28, in run
    event = await async_read_event(self.reader)
  File "/usr/local/lib/python3.9/dist-packages/wyoming/event.py", line 48, in async_read_event
    event_dict = json.loads(json_line)
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

In addition, I have no idea how to configure the rhasspy3 satellite for the two remote ws ports defined in home assistant for piper and whisper (10200, 10300). How to properly setup the pipeline is not well defined anywhere that I could find. My HA server is headless and I can only use voice assist through a raspberrypi satellite.

What type of installation are you running?

Home Assistant OS

Which operating system are you running on?

Other (e.g., Raspbian/Raspberry Pi OS/Fedora)

Which add-on are you reporting an issue with?

Almond

What is the version of the add-on?

It appears to be the new wyoming protocol (not Almond)

Steps to reproduce the issue

  1. Set-up raspberrypi satellite per Rhasspy3 satellite tutorial
  2. Home assistant running in a VM on Fedora server 38 (on headless HP server HW I7)
  3. Start rhasspy3
  4. Wake word, "Porcupine"
  5. Say anything like, "What time is it"
  6. Refresh and View whisper log ...

System Health information

System Information

version core-2023.5.2
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.10.11
os_name Linux
os_version 6.1.25
arch x86_64
timezone America/Los_Angeles
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.31.0 Stage | running Available Repositories | 1279 Downloaded Repositories | 2
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 10.1 -- | -- update_channel | stable supervisor_version | supervisor-2023.04.1 agent_version | 1.5.1 docker_version | 23.0.3 disk_total | 30.8 GB disk_used | 7.6 GB healthy | true supported | true board | ova supervisor_api | ok version_api | ok installed_addons | Duck DNS (1.15.0), NGINX Home Assistant SSL proxy (3.4.2), File editor (5.6.0), Terminal & SSH (9.7.0), Mosquitto broker (6.2.1), Piper (0.1.2), Whisper (0.1.1)
Dashboards dashboards | 3 -- | -- resources | 0 views | 3 mode | storage
Recorder oldest_recorder_run | April 26, 2023 at 3:44 PM -- | -- current_recorder_run | May 6, 2023 at 6:17 AM estimated_db_size | 113.98 MiB database_engine | sqlite database_version | 3.40.1

Anything in the Supervisor logs that might be useful for us?

No

Anything in the add-on logs that might be useful for us?

Whisper:

ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-221' coro=<AsyncEventHandler.run() done, defined at /usr/local/lib/python3.9/dist-packages/wyoming/server.py:26> exception=JSONDecodeError('Expecting value: line 1 column 1 (char 0)')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/wyoming/server.py", line 28, in run
    event = await async_read_event(self.reader)
  File "/usr/local/lib/python3.9/dist-packages/wyoming/event.py", line 48, in async_read_event
    event_dict = json.loads(json_line)
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Additional information

I know that this is an early release and that satellite configurations may not be fully fleshed out yet. My setup only works with a voice assistant satellite. I've had Genie (almond), Mycroft, rhasspy2 all working before.

When it comes to pipelines, I'm used to Linux pipewire managed by wireplumber which works really well for audio. It lets me configure connections as wires between sources and sinks and seamlessly supports multiple out and multiple in connections. I was hoping that the Wyoming protocol and voice assistant pipelines would work in a similar manner, but so far I don't see anything like a routing table which let's me interconnect the various voice assistant functions.

In wyoming going to have something like what pipewire has in its architecture?

Thanks for all the great work

synesthesiam commented 1 year ago

Thanks for the feedback! I think there have been enough changes in Assist pipelines that this is now broken in Rhasspy 3. I will need to adapt this to fit: https://github.com/synesthesiam/homeassistant-pipeline

synesthesiam commented 1 year ago

@agners Please close, as this is something that needs to be fixed in Rhasspy and not here