Send response from sattelite somewhere else

Hi mates,

I wanted to try out making an wyoming satellite using a USB mic and a VM running Ubuntu on Proxmox.

That part went fine. I simply passed the USB device into the Ubuntu VM, installed wyoming-satellite, configured it and it’s working properly.

Now, I don’t have, nor want, a speaker connected to the system running the satellite. I’d rather have the response sent somewhere else (cough, old google home/nest). Send it to telegram, or a phone, or whatever.

Hence, I am looking for a way to grab the response of the voice command, save it as a variable end reuse it in another service.

But, how do I do that? I have been looking through the issues on the satellite github page, and in this forum. I thought that I somehow could grab the event, parse it somehow and grab the response, but I cant find what the event would be named.

In short, I would want an automation that listens for the response sent after a voice command from a specific wyoming satellite, grab the response and use it for another action.

I had a similar need where I needed to output the text to a Sonos speaker, so I ended up creating a script within HA to process it, which is then invoked from the HA API. The text is passed via the Wyoming satellite using the --synthesize-command flag, as outlined in the documentation.

Once you define the path to the script and restart your service, you’ll have access to the text within the shell script, and then you can pass it to another service, or anything else you can dream of. Here is what my synthesized script looks like:

#!/usr/bin/env sh

text="$(cat)"
echo "Text to speech text: ${text}"

token='INPUT_TOKEN'

curlData='{
  "volume_level": 0.4,
  "target": "media_player.main_speaker",
  "message": "'$text'"
}';
echo "$curlData" | jq '.'

curl \
  -k \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $token" \
  -d "$curlData" \
  https://YOUR_IP:8123/api/services/script/wyoming_satellite_speak