[solved] Send command from HA to Rhasspy

Hi,

Just playing around with HA and Rhasspy.

I’m able to send “text to speech” from HA to Rhasspy …
I would like to be able to send a command to make Rhasspy waiting for a sentence (then create an intent and send it to HA)

What I use is :
in configuration.yaml (the part tts: work perfectly…)

 rest_command:
  tts:
      url: 'http://192.168.0.3:12101/api/text-to-speech'
      method: 'POST'
      content_type: text/plain
      payload: '{{payload}}'
  
  wake:
      url: 'http://192.168.0.3:12101/api/listen-for-command?nohass=false'
      method: 'POST'
      content_type: text/plain
      payload: '{{payload}}'

and the call in automation.yaml

- alias: 'Aide Generale'
  trigger:
    platform: event
    event_type: rhasspy_AideGenerale
  action:
    - service: light.turn_on
      entity_id: light.bureau
    - service: rest_command.tts
      data_template: 
        payload: >
          {% set aide = trigger.event.data.aidegenerale %}
          {% if trigger.event.data.aidegenerale %}
          "Je peux m'occuper des lumières ou de la radio, dites aide lumière ou aide radio"
          {% else %}
          "y'a pas d'aide"
          {% endif %} }
    - service: rest_command.wake
      data: {payload: ""}

In Rhasspy log, I see nothing about receiving a command from API
nor I can hear the ready ‘ding’ … like if I use the command from Rhasspy API web interface.

Thanks for your help
p

self solved

The problem was the blank line in configuration.yaml, between tts: block and wake: block

Just want to understand the setup. So you speak to some mic connected to your server where HA is running (like RPI) and you are connect to a seperate Rhasspy server?

@manju-rn

That’s it : 2 separates raspberry PI 3B+
1 for HA (not HASS)
1 for Rhasspy (and waiting for 2.5.0 1 :slight_smile: )

Why ?

First reason I asked is because I find it kind of strange (rather different) I would say that you are using HA instance to send the voice to Rhasspy, wouldn’t it be better to have a Rhasspy directly listen to the mic connected to it’s instance?
Second reason was that I have both running in single RPI 4, but the current add-on (2.4.19) has issues with Audio (believe it is because the HA is grabbing the audio in a separate container). so thinking your approach may solve. I also tried 2.5 version and it has a strange behavior - sometimes it does send intent properly to HA and sometimes it does not - logs are not helping. So I guess I would have to try your appraoch of running Rhasspy is separate PI

didn’t see your 2nd post … sorry

I’m not using PI4 (more powerful) but PI 3B+ (less powerful) …
The idea was to separate servers to not overcharge them.

1°) Speak to raspy server
2°) identify sentence/intent
3°) send intent to HA with slots/tags
4°) do something (like turn light on …) with HA
5°) HA send TTS to rhasspy (like confirmation : the {{light.room}} has been turn{{light.state}} )
6°) rhasspy says the received confirmation
PS : 5) & 6) can be done directly by HA, after sensor trigger for example …
works perfectly …

Waiting for rhasspy 2.5 to include some satellites …
Audio from sattelite will be decoded -or locally -or by rhasspy server (probably localy, if PI Zero W are enough powerfull, was ok with Snips)

If satellite intent can be processed localy (like : play radio XXX, through local script), nothing sent to rhasspy server, nor HA.
If satellite intent must be processed by HA (like : turn light on), intend will be sent to rhasspy server and the to HA.

may be not absolutly the most efficient way … but funny to setup and test

comment and advice … or testing suggestion are welcome !

:slight_smile:

Thanks. Is your 2.4.19 version working without the libasound2-plugins component?

Hi,

As fas as I remember, nothing added for sound (except, obviously the voice2seed routines from their github site).
But, I had trouble to get sound from rhasspy… until I recreate an /etc/asound.conf under docker !
Works perfectly !

PS : sometimes, after main electricity switch off … the voice2seed get number changed.
Aplay -l to get the number … modify asound.conf
(don’t know why the # change …)

Hope it helps

Nope doesn’t work for me. I completely shifted to 2.5pre which does not have this problem (but has others). Unfortunately, looks like RPI 3B is too slow for the 2.5pre, the voice processing has a delay (varies from 3 sec to even 10 secs) at least for me. Hence, I installed 2.5pre in the same RPI4 as that of HA. Works fine now. There was an issue with JSON that is sent back to HA, but have done adjustments in automation / Intents to sort that out for now.

hi,

pi3b too slow for rhasspy 2,5 ?
bad news…

you runned only rhasspy on this machine or with ha ?

The RPI3B is a fresh rasbian install with just a docker, portainer and 2.5pre. I am also just using fsticuff and pocketsphinx, not kaldi or rasa NLU for the same. and yet, there is a delay.

The RPI4 with 4GB RAM, has HA, bunch of add-ons and Rhasspy 2.5pre and it runs perfectly fine. I can see that the 2.5pre is using about 400 - 500 MB RAM.

Okee …
I guess I’ll have to buy a PI4
:frowning:

Do you still need the rasberry pi 4 ? I can buy it for you