No TTS via Rhasspy w/REST API

I’m not receiving output from my speaker when I test the a rest_command.tts service through hassio.

my configuration.yml is as follows:

rest_command:
  tts:
    url: http://192.168.0.n:12101/api/text-to-speech
    method: POST
    payload: '{{ payload }}'
    headers:
      content_type: 'text/plain'

The logs on my rhasspy are:

[INFO:78300838] quart.serving: 192.168.0.n:34294 POST /api/text-to-speech 1.1 200 0 319763
[DEBUG:78300826] InboxActor:  -> stopped
[DEBUG:78300823] EspeakSentenceSpeaker: speaking -> ready
[DEBUG:78300624] APlayAudioPlayer: ['aplay', '-q', '-D', 'sysdefault:CARD=sndrpigooglevoi']
[DEBUG:78300622] EspeakSentenceSpeaker: ready -> speaking
[DEBUG:78300525] EspeakSentenceSpeaker: ['espeak', '-v', 'en', '--stdout', '']

However running the following curl command works
curl -X POST -d "hi world" http://192.168.0.n:12101/api/text-to-speech

The logs on my rhasspy are:

[INFO:78777418] quart.serving: 192.168.0.20:57326 POST /api/text-to-speech 1.1 200 8 1257370
[DEBUG:78777402] InboxActor:  -> stopped
[DEBUG:78777398] EspeakSentenceSpeaker: speaking -> ready
[DEBUG:78776315] APlayAudioPlayer: ['aplay', '-q', '-D', 'sysdefault:CARD=sndrpigooglevoi']
[DEBUG:78776311] EspeakSentenceSpeaker: ready -> speaking
[INFO:78776211] quart.serving: 172.17.0.1:60340 GET /api/events/log 1.1 101 - 101697175
[DEBUG:78776166] EspeakSentenceSpeaker: ['espeak', '-v', 'en', '--stdout', 'hi world']

Your command in the “service dev tool” is wrong. Your “Service Data” should be:

This is because in your config file you have

rest_command:
  tts:
    url: http://192.168.0.n:12101/api/text-to-speech
    method: POST
    payload: '{{ payload }}' <--- This is the name of the 'variable' that gets replaced
    headers:
      content_type: 'text/plain'

The payload in between the curly braces (mustaches) is the name of the variable you need to use in your data.

2 Likes