Send response from satellite 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
1 Like

Amazing! Thank you for sharing!

What I did is based on your script, however I didn’t want to use tokens so I ended up using webhooks.

First. I am running one of my satellites in a docker container on an Ubuntu system, which has a mic.

When the response is sent to the satellite after an intent, I send that text as JSON to a webhook in an automation, which I then can do whatever I want with.

Script satellite-response.sh

#!/usr/bin/env sh
text="$(cat)"
webhookurl="https://192.168.0.11:8123/api/webhook/abc"
echo "Text to speech text: ${text} to $webhookurl"
json_payload='{ "response": "'"$text"'" }'
echo "Payload: ${json_payload}"
curl -k -X POST -H "Content-Type: application/json" -d "$json_payload" "$webhookurl" -v

Automation

alias: Satellite response
description: ""
trigger:
  - platform: webhook
    allowed_methods:
      - POST
      - PUT
    local_only: true
    webhook_id: "abc"
condition: []
action:
  - service: telegram_bot.send_message
    metadata: {}
    data:
      message: "{{ trigger.json.response }}"
      title: Smarto
  - service: tts.cloud_say
    data:
      entity_id: media_player.name
      cache: false
      message: "{{ trigger.json.response }}"
mode: single

This is great - nice and simple. I’ve set it up similarly to output via a sonos device, but notice that while it does output correctly on the sonos, it’s also still outputting on the satellite speaker too.

Is there something necessary to tell the local speaker to skip playback?