/api/play-wav to base with siteId=satellite

Does anyone have this working? I just get a timeout. It does successfully play on the satellite; but appears the server didn’t handle the playFinished?

To satellite:

curl -X POST "http://satellite.lan:12101/api/play-wav?siteId=test" -H "Content-Type: audio/wav" --data-binary @"/Users/foobar/Downloads/alice_wake.wav"
OK

To base:

curl -X POST "http://base.lan:12101/api/play-wav?siteId=test" -H "Content-Type: audio/wav" --data-binary @"/Users/foobar/Downloads/alice_wake.wav"
TimeoutError: 
[ERROR:2022-11-24 14:39:36,593] rhasspyserver_hermes: 
Traceback (most recent call last):
  File "/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/quart/app.py", line 1821, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/quart/app.py", line 1869, in dispatch_request
    return await handler(**request_.view_args)
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__main__.py", line 1135, in api_play_wav
    await asyncio.gather(*aws)
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__init__.py", line 755, in play_wav_data
    handle_finished(), messages(), message_types
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__init__.py", line 995, in publish_wait
    result_awaitable, timeout=timeout_seconds
  File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for
    raise futures.TimeoutError()
concurrent.futures._base.TimeoutError
[DEBUG:2022-11-24 14:39:36,593] rhasspyserver_hermes: Publishing 41 bytes(s) to hermes/asr/toggleOn
[DEBUG:2022-11-24 14:39:36,593] rhasspyserver_hermes: -> AsrToggleOn(site_id='test', reason=<AsrToggleReason.PLAY_AUDIO: 'playAudio'>)
[DEBUG:2022-11-24 14:39:36,592] rhasspyserver_hermes: Publishing 41 bytes(s) to hermes/hotword/toggleOn
[DEBUG:2022-11-24 14:39:36,592] rhasspyserver_hermes: -> HotwordToggleOn(site_id='test', reason=<HotwordToggleReason.PLAY_AUDIO: 'playAudio'>)
[DEBUG:2022-11-24 14:39:06,561] rhasspyserver_hermes: -> AudioPlayBytes(127610 byte(s))
[DEBUG:2022-11-24 14:39:06,561] rhasspyserver_hermes: Publishing 41 bytes(s) to hermes/asr/toggleOff
[DEBUG:2022-11-24 14:39:06,561] rhasspyserver_hermes: -> AsrToggleOff(site_id='test', reason=<AsrToggleReason.PLAY_AUDIO: 'playAudio'>)
[DEBUG:2022-11-24 14:39:06,560] rhasspyserver_hermes: Publishing 41 bytes(s) to hermes/hotword/toggleOff
[DEBUG:2022-11-24 14:39:06,560] rhasspyserver_hermes: -> HotwordToggleOff(site_id='test', reason=<HotwordToggleReason.PLAY_AUDIO: 'playAudio'>)
[DEBUG:2022-11-24 14:39:06,559] rhasspyserver_hermes: Playing 127610 byte(s)
Message 5 received on hermes/asr/toggleOn at 2:41 PM:
{
    "siteId": "test",
    "reason": "playAudio"
}
QoS: 0 - Retain: false
Message 4 received on hermes/hotword/toggleOn at 2:41 PM:
{
    "siteId": "test",
    "reason": "playAudio"
}
QoS: 0 - Retain: false
Message 3 received on hermes/audioServer/test/playFinished at 2:41 PM:
{
    "id": "0505c2a9-9344-47cd-8ab5-9bd618b66cda",
    "sessionId": "0505c2a9-9344-47cd-8ab5-9bd618b66cda"
}
QoS: 0 - Retain: false
Message 2 received on hermes/audioServer/test/playBytes/0505c2a9-9344-47cd-8ab5-9bd618b66cda at 2:41 PM:
b'RIFFr\xf2\x01\x00WAVEfmt \x10\x00\x00....
QoS: 0 - Retain: false
Message 1 received on hermes/asr/toggleOff at 2:41 PM:
{
    "siteId": "test",
    "reason": "playAudio"
}
QoS: 0 - Retain: false
Message 0 received on hermes/hotword/toggleOff at 2:41 PM:
{
    "siteId": "test",
    "reason": "playAudio"
}

Looks like if I am reading the code correctly there is bug in the subscribe:

[DEBUG:2022-11-24 19:51:14,568] rhasspyserver_hermes: Subscribed to hermes/audioServer/base/playFinished

Here is should have subscribed to “test” and not “base”

            # Specific site_ids
            for site_id in self.site_ids:
                for message_type in message_types:
                    topics.append(message_type.topic(site_id=site_id))
                    self.subscribed_types.add(message_type)

I am not familiar with the code base but I suspect it’s only registering for it’s own site_id’s instead of the requested siteId.

So after further reading of the code looks like you need to setup the server like so:

According to this line this is supported; I’m sure this is in the docs somewhere and I missed it. Well anyways this is solved now.

Hopefully my rant helps the next person.

boo; I had to undo this change as it breaks other communication on the mqtt network.

I submitted a pull request for this;

but I see other pull requests that have been open since jan/may; does anyone know if code changes are being accepted?

Maybe you can send @synesthesiam a message about this :slight_smile: