synesthesiam / homeassistant-satellite

Streaming audio satellite for Home Assistant
MIT License
186 stars 23 forks source link

aplay device or resource busy with Anker PowerConf S330 #58

Open gensyn opened 11 months ago

gensyn commented 11 months ago

When I first started playing around with the satellite I was using speakers over the audio jack and a USB mic and everything pretty much worked as expected. Now I got an Anker PowerConf S330, which was specifically named by HA to yield great results (not with homeassistant-satellite per se, but still). I can still use the satellite as a voice assistant, but only if I'm not playing audio (e.g. music) at the same time; if I do I get

aplay: main:830: Fehler beim Öffnen des Gerätes: Das Gerät oder die Ressource ist belegt
ERROR:__main__:Unexpected error playing media item: PlayMedia(media='sounds/boop.wav')
Traceback (most recent call last):
  File "/home/pi/homeassistant-satellite/homeassistant_satellite/snd.py", line 67, in play
    snd_proc.stdin.write(chunk)
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/homeassistant-satellite/homeassistant_satellite/__main__.py", line 386, in _playback_thread_entry
    play(item.media)
  File "/home/pi/homeassistant-satellite/homeassistant_satellite/snd.py", line 67, in play
    snd_proc.stdin.write(chunk)
  File "/usr/lib/python3.9/subprocess.py", line 1024, in __exit__
    self.stdin.close()
BrokenPipeError: [Errno 32] Broken pipe
aplay: main:830: Fehler beim Öffnen des Gerätes: Das Gerät oder die Ressource ist belegt
ERROR:__main__:Unexpected error playing media item: PlayMedia(media='http://<redacted>')
Traceback (most recent call last):
  File "/home/pi/homeassistant-satellite/homeassistant_satellite/snd.py", line 67, in play
    snd_proc.stdin.write(chunk)
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/homeassistant-satellite/homeassistant_satellite/__main__.py", line 386, in _playback_thread_entry
    play(item.media)
  File "/home/pi/homeassistant-satellite/homeassistant_satellite/snd.py", line 67, in play
    snd_proc.stdin.write(chunk)
  File "/usr/lib/python3.9/subprocess.py", line 1024, in __exit__
    self.stdin.close()
BrokenPipeError: [Errno 32] Broken pipe

I don't know why today it's in german, used to be english. But it says that the device could not be opened as the device or resource is busy. So it seems with the PowerConf only one process my play audio on the device while the audio jack has no such limitation. I updated the PowerConf firmware but it made no difference. Does anyone else have this problem or is there something I am missing?

vhsdream commented 11 months ago

I use the S330 as well and was not aware of this limitation since right now the pi is solely for testing the wake word. I wonder if this will bring issues if media player functionality is added to the satellite.

gensyn commented 11 months ago

I use the S330 as well and was not aware of this limitation since right now the pi is solely for testing the wake word. I wonder if this will bring issues if media player functionality is added to the satellite.

Other way around for me. I already used the pi as a media_player and now wanted to add the wake word.