Home assistant core + Rasspy configuration

Hello, I install home assistant core and rhasppy on Pi4. Boh are working separately.
I read some topics and documentation but I don’t understand how to configure rhasspy in home assistant. I have no add-ons because I don’t have supervisor, only core.
There’s an example of all files that I have to configure in rhasspy and home assistant ?

Thanks

  • Create a longlived token in Home Assistant
  • Set Intent Handling to Home Assistant
  • Enter the URL or ip address of HA (including http://) and the token in the specified field
  • Set Rhasspy to send events and not intents
  • Create sentences in Rhasspy as per documentation
  • Create automations for events (rhasspy_<YourIntents>)

Example for Lights with location and action as slot:

- id: '1581372525473'
  alias: EventLights
  trigger:
  - event_data: {}
    event_type: rhasspy_Lights
    platform: event
  condition: []
  action:
  - data_template:
      entity_id: light.{{ trigger.event.data.location }}
    service_template: light.turn_{{ trigger.event.data.action }}
  - service: mqtt.publish
    data:
      topic: hermes/dialogueManager/endSession
      payload_template: '{"sessionId": "{{trigger.event.data._intent.sessionId}}",
        "text": "Ok, {{ trigger.event.data.location }} {{ trigger.event.data.action}} "'
  mode: single

It works
After add the token I listen to events from develop tools of HA.
When it works I had automation.

Thanks

Hi romkabouter,
I am new to Rhasspy and Home Assistant. I have read good sharing from you that help others in this community.

Let me run up thru my setup and probably you can guide me on with previous sharing or others useful tips.

I am current running on Pi 4B with 2 different Home Assistant setup as below:

  1. Raspbian OS, Home Assistant Docker with Rhasspy and OpenTTS as Add-On
  2. Home Assistant OS with Rhasspy and OpenTTS as Add-On

My progress at the moment are:

  1. Rhasspy side Wake word, Intent Recognition - working
  2. Home Assistant side Integration to Philip Hue lights and Automation thru Events setup -working
  3. Rhasspy SST to HA - working
  4. HA Automation - working

What I am struggling for the pass 2 week was I am unable to have HA TTS back to Rhasspy although these same steps mentioned on Rhasspy and HA guide plus all responses in this and HA community.

And I have also define Rest_Command.rhasspy_speak as a service.

So I am not sure where/what when wrong. Any help is much appreciated.

Please share your automation for this:

id: '1622905820207'
alias: SpotifyPause
description: Pause a song
trigger:
  - platform: event
    event_type: rhasspy_SpotifyPause
condition: []
action:
  - service: media_player.media_pause
    target:
      area_id: living_room
      device_id: 5aaf4542ff34d8d28c52f5d1c985adaa
      entity_id: media_player.spotify_rockman_sg
  - service: rest_command.rhasspy_speak
mode: single

As requested above a sample of my automation.

You need to use this extra service, not rhasspy_speak (that is old):

  action:
  - service: mqtt.publish
    data:
      topic: hermes/dialogueManager/endSession
      payload_template: '{"sessionId": "{{trigger.event.data._intent.sessionId}}", "text": "Ok, I  will pause the song"}'

This will end the session and speak out “Ok, I will pause the song”

id: '1622913354480'
alias: SpotifyPlay
description: ''
trigger:
  - platform: event
    event_type: rhasspy_SpotifyPlay
condition: []
action:
  - service: media_player.media_play
    target:
      area_id: living_room
      device_id: 5aaf4542ff34d8d28c52f5d1c985adaa
      entity_id: media_player.spotify_rockman_sg
  - service: mqtt.publish
    data:
      topic: hermes/dialogueManager/endSession
      payload_template: >-
        {"sessionId": "{{trigger.event.data._intent.sessionId}}", "text": "Ok,
        I  will pause the song"}
mode: single

Hi Romkabouter,
Is this the correct setup in automation?

Looks ok to me, did you try it?

For your understanding, you can add as much services as you need in the actions.
But for correctly end the session from Rhasspy with an answer to the correct satellite (or server if no sats), a message must be published to the Rhasspy server with the sessionID

I assume you have Rhasspy mqtt set to the same broker as Home Assistant (so external and not internal)
If not, do so, otherwise it still will not work

Yes, I tried and still not getting any response as Rhasspy MQTT is internal. So I have change it to External now. Encounter below error:
MQTT_External_error

Here is my MQTT External setting that encounter the above error.
MQTT_Setting

You must the the host as IP address and port 1883

After changing to port 1883 at rhasspy external MQTT, still encounter same "RuntimeError: Failed to connect to MQTT broker. Not sure what else is the issue here?

Do you have set the right ip adress and are you running the MQTT addon in Home Assistant?
The ipadress must be the ipadress of your HA instance, running the MQTT addon (since you are running Home Assistant OS)

You need a MQTT connection between Home Assistant and Rhasspy. The both need to be connected to the same broker.

You are right. I saw on HA server log that Mosquitto Core failed to login to HA. And also Rhasspy is looping in HA thus unable to launch Rhasspy Web UI now.

Let me look into these 2 issue before I can resume. Will try and give you a update again in 30 mins time.

Add this in the addon configuration:
image

Create a folder in “mosquitto” in share (accessable via samba, so install that addon as well)

Add a file acl.conf with this contents:

acl_file /share/mosquitto/accesscontrollist

Add a file accesscontrollist with this contents:

user homeassistant
topic readwrite #

user addons
topic readwrite #

user paul
topic readwrite #

replace paul with the user you want rhasspy to be able to login.
I think it also needs to be a user in HA, so you can use your own user as well

You can also read this on the Documentation tab form the addon :slight_smile:

Use the same user and password in Rhasspy and it should work

Both Rhasspy Add-On as per my below setup has crashed for the same reason as soon as I enable MQTT External. It goes on infinite loop and taking up 95% cpu power.

  1. HA docker with Rhasspy Add-On
  2. HA OS with Rhasspy Add-On

Prior to this, all were running well except last leg of TTS from HA to Rhasspy.

Too tired to proceed further. May need to do the whole setup from scratch all over again once I rest enough. Good night and thanks for your help.

Do you have two setups?