Cannot sends intents or events to the home assistant container

Hi, I’m using home assistant container with rhasspy container on Linux pop os.

I can’t figure out what is wrong, these are the main points i checked:

  • rhasspy works fine, wake word is recognized and also the intents
  • rhasspy log show that it sends message through websocket but nothing happens in home assistant and nothing logged here
  • In the home assistant configuration.yaml I have “api:”, “intent:” and custom “intent_script:” (Get temperature like in the documentation example)
  • I’m using internal MQTT broker and in home assistant I added MQTT integration which points to rhasspy’s mqtt server
  • rhasspy intent handler is configurated with home assistant IP:port and with an access token. I have tried both events and intents but neither of them work.
  • In home assistant I have add an automation triggered by event but event is never received
  • I have tried to add rhasspy integration in home assistant, but I don’t understand what its use is, it has no configurations to do

What am i missing?

Rhasspy, like Home Assistant, has multiple options and ways it can work and it took me some time to get mine working. Not sure everything I did was actually necessary … but I wasn’t going to change it once it worked.

Lets first confirm how you are trying to set it up. You have

  • installed Home Assistant Supervised (but not HAOS) onto a PC running POP OS flavour of linux.
  • installed full Rhasspy v2.5.11 in Docker on the same machine (following instructions Installation - Rhasspy)
  • connected the audio microphone and speaker to the same machine; and have tested that they’re both working - you are seeing the intent on Rhasspys home page
  • installed HA’s Mosquitto MQTT add-on ? This would be required to use the External MQTT option, but doesn’t hurt.

Getting the Intents from the Satellite to Host

Have you set up a Long-lived Access Token ? I
You may need to use a Long-lived Access Token. This is done at the very bottom of your profile page in Home Assistant

Click [Create Token], give it a name (I called mine “Rhasspy”) and a long sequence of characters (well beyond the left and right sides of the window) will be shown. Click your mouse anywhere in the line of code, press the [Home] key to move the cursor to the start of the code, press [Shift-End] to highlight to the end of the code, and [Ctrl-C] to copy the code to clipboard.

In Rhasspy on the Satellite, set [Intent Handling] to “Home Assistant”, [Save], add the URL for Home Assistant – the “http://” protocol, hostname or IP address of the Home Assistant machine, and port number :8123.

Go to the browser window with your Satellite and paste that long code above into the “Access Token” field and click [Save Settings].

I am using intents in HA, so selected the “send intents”… option.

Action the intents within Home Assistant

Now to Home Assistant and we will add the intents into configuration.yaml so that Home Assistant will action them.

There are several ways to edit the .yaml files, and I have installed the “File editor” Add-on from Configuration > Add-ons.

I have added into the configuration.yaml page:

intent: 
intent_script: !include intents.yaml

The keywords “intent:” and “intent_script:” are required. In my case I have chosen to place the actual intents in a separate file to make them easier to edit; but you can simply list the intents directly after “intent_script:”.

In my new intents.yaml file I have:

#
# intents.yaml - the actions to be performed by Rhasspy voice commands
#

GetTime:
  speech:
    text: The current time is {{ now().strftime("%H %M") }}

LightState:
  speech:
    text: Turning {{ name }} {{state }}
  action:
    - service: light.turn_{{ state }}
      target:
        entity_id: light.{{ name | replace(" ","_") }}

And that’s it !
When the words “Porcupine, turn on the study light” are spoken, Rhasspy determines that the “LightState” intent is to be called with slot “name” having a value of “study light” and slot “value” having a value of “on”.
This intent is passed (in a JSON format file) to Home Assistant, where the intent name is looked up in the configuration.yaml (or intents.yaml) file.

Intent name “LightState” matches with “LightState:”, and parameters are substituted, so that Home Assistant performs the action:

LightState:
  speech:
    text: Turning study light on
  action:
    - service: light.turn_on
      target:
        entity_id: light.study_light

Hi, thank you for your support!

I think I have found the issue, was in my compose file.
Home assistant compose section was configured with network_mode: host (as stated in the installation guide) but rhasspy was not (because their guide does not state to do this).

My knowledge of containers is very basic, phreaps rhasspy container had an isolated network without the host mode?
There is a way to do things works without network_mode: host?

version: '3'
services:
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - ./homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    privileged: true
    network_mode: host
  rhasspy:
    image: "rhasspy/rhasspy"
    container_name: rhasspy
    restart: unless-stopped
    privileged: true
    volumes:
        - "./rhasspy/profiles:/profiles"
        - "/etc/localtime:/etc/localtime:ro"
    ports:
        - 12101:12101
        - 12183:12183
    network_mode: host  # <-- without this rhasspy cant connect to home assistant
    devices:
        - "/dev/snd:/dev/snd"
    command: --user-profiles /profiles --profile en

Pleased that you found it, and shared your solution :slight_smile:

Personally Docker is one learning curve (more like a mountain at my age) that I have not yet attempted to tackle.

I have found that documentation on FOSS projects, and in the videos and tutorials, often makes undocumented assumptions (like using packages that the author has previously installed).