How do I get Rhasspy to send intents to Home Assistant?

I have installed Home Assistant and Rhasspy 2.5.11.

I have added this sentence:

dim the lights

When I say “dim the ligths” the words are recognized, and the logs claim that the intent has been sent:

[DEBUG:2023-04-23 19:20:53,492] rhasspyserver_hermes: Sent 373 char(s) to websocket
[DEBUG:2023-04-23 19:20:53,482] rhasspyserver_hermes: Publishing 21 bytes(s) to rhasspy/handle/toggleOn
[DEBUG:2023-04-23 19:20:53,481] rhasspyserver_hermes: -> HandleToggleOn(site_id='default')
[DEBUG:2023-04-23 19:20:53,474] rhasspyserver_hermes: Handling NluIntent (topic=hermes/intent/HassDimKitchenLights, id=f72c2288-26f1-488f-8f3d-ae271dac3818)
[DEBUG:2023-04-23 19:20:53,473] rhasspyserver_hermes: <- NluIntent(input='dim the lights', intent=Intent(intent_name='HassDimKitchenLights', confidence_score=1.0), site_id='default', id='1a19c29f-7afb-43cb-8531-257779008048', slots=[], session_id='1a19c29f-7afb-43cb-8531-257779008048', custom_data=None, asr_tokens=[[AsrToken(value='dim', confidence=1.0, range_start=0, range_end=3, time=None), AsrToken(value='the', confidence=1.0, range_start=4, range_end=7, time=None), AsrToken(value='lights', confidence=1.0, range_start=8, range_end=14, time=None)]], asr_confidence=None, raw_input='dim the lights', wakeword_id=None, lang=None)
[DEBUG:2023-04-23 19:20:53,369] rhasspyserver_hermes: Publishing 270 bytes(s) to hermes/nlu/query
[DEBUG:2023-04-23 19:20:53,368] rhasspyserver_hermes: -> NluQuery(input='dim the lights', site_id='default', id='1a19c29f-7afb-43cb-8531-257779008048', intent_filter=None, session_id='1a19c29f-7afb-43cb-8531-257779008048', wakeword_id=None, lang=None, custom_data=None, asr_confidence=None, custom_entities=None)
[DEBUG:2023-04-23 19:20:53,365] rhasspyserver_hermes: Publishing 21 bytes(s) to rhasspy/handle/toggleOff
[DEBUG:2023-04-23 19:20:53,364] rhasspyserver_hermes: -> HandleToggleOff(site_id='default')

But on the Home Assistant side nothing happens. The HA logs do not show anything, and nothing happens.

If I take the intent part of the json generated by Rhasspy and send it directly to HA via curl, it works and I get the response I expected, but Rhasspy apparently does not send the intent at all.

My Intent Handling section is configured as shown in the image.

Check your settings page (the gears in the side-bar). Okay, you’ve got Home Assistant. But is HA running on the same Pi as Rhasspy? If so, then ‘localhost’ should be okay. Otherwise, replace localhost with the DNS node name or IP address of your Home Assistant system.

Also, you’ve selected sending intents to Home Assistant, so be certain you’ve followed the instructions there:
Requires the intent component and intent scripts in your configuration.yaml

is HA running on the same Pi as Rhasspy?

Yes, they are running on the same Pi.

Otherwise, replace localhost with the DNS node name or IP address of your Home Assistant system.

I tried that too, just in case. It did not work.

Requires the intent component and intent scripts in your configuration.yaml

Yes, I’ve followed the instructions there. Sending the intent from the command line works fine, which makes me think the problem is with the Rhasspy config, not HA.

Interestingly, no matter what I change the hostname to, even non-existing hosts, the logs indicate that the intent was sent. There is no indication of an error.

Did you create an intent script in Home Assistant to cover the “HassDimKitchenLights” intent? HA only has a few built in intents and they are documented here: Built-in intents | Home Assistant Developer Docs

If you create intents with these names, HA will respond to them out of the box.

For any other intent name you need to create an intent script in your config file. The syntax of these scripts is pretty much the same as the YAML automations. I like this doc for covering the intent scripts (but there are a few out there): Intent Handling with HA and Intents · rhasspy/rhasspy Wiki · GitHub

@JoeSherman Yes, I created an intent script in HA to cover the HassDimKitchenLights intent. I am able to trigger the intent if I take the json created by Rhasspy and send it via curl on the command line. Which is why I suspect the error is not in the HA config, but in the Rhasspy config.

ok, I don’t know if this will help but I just checked my setup and I do have my satellite IDs listed in the field on that section. I have both my base and my satellites in a comma separated list. Maybe try that and see if it helps?

I don’t have any satellites but I tried adding default to my sattelite id list. It made no difference.

I was trying to control Rhasspy with intents previously and it didn’t work. I’m using events now and it’s working like a charm.

@KotBayun I tried using events instead, did not work. Not even a mention in the HA logs of something being wrong.

I was following that tutorial. Worked really well

This works for me … Rhasspy TTS from HASS - #18 by jeanrocco

I just moved action: to the left …

alias: bonjour
    platform: mqtt
    topic: hermes/intent/bonjour
    service: mqtt.publish
      topic: hermes/tts/say
      payload: “{“text”:” bonjour mon cher maître ! “,“siteId”:”{{ trigger.payload_json[‘siteId’] }}"}"

In the end I gave up and installed OVOS instead. I was really looking for a replacement for Mycroft anyway, so OVOS is a better fit for me.

Thanks for everyone’s help and suggestions!

Too bad, you’ll be missing the fun :slight_smile: … does OVOS interface with HA ?

No, OVOS does its own thing. It’s more like HA and Rhasspy rolled into one. Less slick, but easier to use for me, a programmer with lots of Linux experience.