I am trying to get my speakers to answer an intent with a sound, an mp3 file. I have a main server and then a few rpi satellites. I have a python script that handles the intents. So i create an MQTT client and connect to a broker.
I normally answer intents with a sentence and it gets published to hermes/tts/say. the little code snippet is below
site_id = nlu_payload["siteId"]
sentence = "answer to the intent"
client.publish("hermes/tts/say", json.dumps({"text": sentence, "siteId": site_id}))
So I was thinking there would be a different client.publish I could do for the mp3. something like
site_id = nlu_payload["siteId"]
sound = /path/to/mp3
client.publish("hermes/tts/say", json.dumps({"audio": sound, "siteId": site_id}))
But I am a little new with the hermes stuff so i wasnt sure if that was possible
I have seen other threads that mention cmd line commands that can be run. But wasnt sure what the requestID is or how to get it. Also not sure if that will work in a python script
mosquitto_pub -p 12183 -t hermes/audioServer/$siteId/playBytes/$requestId -s < /path/to/file.wav
or the hermes audio server. So i was thinking could i use hermes/audioServer/siteId/playBytes/requestId as the first part of the client.publish() but with the variables it expects, I wasnt sure how that would work.
So if anyone has got this to work before I would be grateful to learn how you did it
Thanks for the help!