Rhasspy does not seem to send events to Home Assistant

Hey folks!

I’ve got rhasspy installed as home assistant addon (v. 2.5.10.2) I’m running home assistant on a pi4 with the Home Assistant OS 5.13.

I haven’t gotten a microphone set up, but my understanding is, that if everything is set up correctly, I should be able to send a GetTime event to home assistant by writing “what time is it” into the input field next to “Recognize”, check “handle” and click “recognize”. Doing this, while simultaneously listening to rhasspy_GetTime events in home assistants dev-tools, I would assume an event to show up in dev-tools. This does not happen.

My profile contains a long-living access token and I’ve verified that I can post to http://172.17.0.1:8123/api/events/rhasspy_GetTime from within the rhasspy container.
curl -X POST -H "Authorization: Bearer TOKEN" -H "Content-Type: application/json" http://172.17.0.1:8123/api/events/rhasspy_GetTime

Listening to rhasspy_GetTime events in home assistant at the same time, receives the curled event.

Here’s my profile (from Advanced view)

{
    "dialogue": {
        "system": "rhasspy"
    },
    "handle": {
        "system": "hass"
    },
    "home_assistant": {
        "access_token": "TOKEN",
        "handle_type": "event",
        "pem_file": "$RHASSPY_PROFILE_DIR/fullchain.pem",
        "url": "http://172.17.0.1:8123"
    },
    "intent": {
        "system": "fsticuffs"
    },
    "microphone": {
        "system": "pyaudio"
    },
    "sounds": {
        "system": "aplay"
    },
    "speech_to_text": {
        "system": "pocketsphinx"
    },
    "text_to_speech": {
        "system": "espeak"
    }
}

I had rhasspy installed once previously in december, but could not get it to work back then either. I’m not sure whether I have some kind of profile snafu from back then, or if the profile was reset with the new installation.

Here’s the log from the Add-ons log tab in supervisor:

[DEBUG:2021-04-28 12:35:51,817] rhasspyserver_hermes: -> NluQuery(input='what time is it', site_id='default', id='cb56ba81-a18b-46ef-9003-b08139ba805c', intent_filter=None, session_id='cb56ba81-a18b-46ef-9003-b08139ba805c', wakeword_id=None, lang=None, custom_data=None, asr_confidence=None, custom_entities=None)
[DEBUG:2021-04-28 12:35:51,817] rhasspyserver_hermes: Publishing 271 bytes(s) to hermes/nlu/query
[DEBUG:2021-04-28 12:35:51,824] rhasspynlu_hermes: <- NluQuery(input='what time is it', site_id='default', id='cb56ba81-a18b-46ef-9003-b08139ba805c', intent_filter=None, session_id='cb56ba81-a18b-46ef-9003-b08139ba805c', wakeword_id=None, lang=None, custom_data=None, asr_confidence=None, custom_entities=None)
[DEBUG:2021-04-28 12:35:51,826] rhasspynlu_hermes: -> NluIntentParsed(input='what time is it', intent=Intent(intent_name='GetTime', confidence_score=1.0), site_id='default', id='cb56ba81-a18b-46ef-9003-b08139ba805c', slots=[], session_id='cb56ba81-a18b-46ef-9003-b08139ba805c')
[DEBUG:2021-04-28 12:35:51,827] rhasspynlu_hermes: Publishing 222 bytes(s) to hermes/nlu/intentParsed
[DEBUG:2021-04-28 12:35:51,831] rhasspynlu_hermes: -> NluIntent(input='what time is it', intent=Intent(intent_name='GetTime', confidence_score=1.0), site_id='default', id='cb56ba81-a18b-46ef-9003-b08139ba805c', slots=[], session_id='cb56ba81-a18b-46ef-9003-b08139ba805c', custom_data=None, asr_tokens=[[AsrToken(value='what', confidence=1.0, range_start=0, range_end=4, time=None), AsrToken(value='time', confidence=1.0, range_start=5, range_end=9, time=None), AsrToken(value='is', confidence=1.0, range_start=10, range_end=12, time=None), AsrToken(value='it', confidence=1.0, range_start=13, range_end=15, time=None)]], asr_confidence=None, raw_input='what time is it', wakeword_id=None, lang=None)
[DEBUG:2021-04-28 12:35:51,832] rhasspynlu_hermes: Publishing 683 bytes(s) to hermes/intent/GetTime
[DEBUG:2021-04-28 12:35:51,888] rhasspyserver_hermes: <- NluIntent(input='what time is it', intent=Intent(intent_name='GetTime', confidence_score=1.0), site_id='default', id='cb56ba81-a18b-46ef-9003-b08139ba805c', slots=[], session_id='cb56ba81-a18b-46ef-9003-b08139ba805c', custom_data=None, asr_tokens=[[AsrToken(value='what', confidence=1.0, range_start=0, range_end=4, time=None), AsrToken(value='time', confidence=1.0, range_start=5, range_end=9, time=None), AsrToken(value='is', confidence=1.0, range_start=10, range_end=12, time=None), AsrToken(value='it', confidence=1.0, range_start=13, range_end=15, time=None)]], asr_confidence=None, raw_input='what time is it', wakeword_id=None, lang=None)
[DEBUG:2021-04-28 12:35:51,888] rhasspydialogue_hermes: <- NluIntent(input='what time is it', intent=Intent(intent_name='GetTime', confidence_score=1.0), site_id='default', id='cb56ba81-a18b-46ef-9003-b08139ba805c', slots=[], session_id='cb56ba81-a18b-46ef-9003-b08139ba805c', custom_data=None, asr_tokens=[[AsrToken(value='what', confidence=1.0, range_start=0, range_end=4, time=None), AsrToken(value='time', confidence=1.0, range_start=5, range_end=9, time=None), AsrToken(value='is', confidence=1.0, range_start=10, range_end=12, time=None), AsrToken(value='it', confidence=1.0, range_start=13, range_end=15, time=None)]], asr_confidence=None, raw_input='what time is it', wakeword_id=None, lang=None)
[DEBUG:2021-04-28 12:35:51,890] rhasspyserver_hermes: Handling NluIntent (topic=hermes/intent/GetTime, id=7903f0cd-9cf3-4f2d-9f76-6e8467e3221d)
[DEBUG:2021-04-28 12:35:51,892] rhasspyserver_hermes: Sent 370 char(s) to websocket
[WARNING:2021-04-28 12:35:51,889] rhasspydialogue_hermes: No session for id cb56ba81-a18b-46ef-9003-b08139ba805c. Dropping recognition.

I would expect that if the post to the HASS api would fail, I would be able to see an error message somewhere.

Amongst others, I have to following two lines in my home assistant configuration. My understanding is, that I don’t actually need the intent_script: line, if I only want to receive events, but I thought it could not hurt.

intent:

intent_script:

What am I missing?

Thanks in advance

When using the addon, you can use this as url:
http://supervisor/core/api

and you can leave the token empty
See this page for documentation:

If you want to use a token, try to use the IP address of your hassio, not the internal docker ip address

1 Like

Hi @romkabouter,

thank you for your reply, I really appreciate it!

The result for my LAN IP address is the same as the result for the internal docker IP. Curling from the command line from inside the rhasspy-container successfully sends an event to home-assistant, however, if I set it as the url (“http://xxx.xxx.x.xx:8123”) in the profile and attempting to recognize “What time is it”, no rhasspy_GetTime event shows up in hassio.

I’ve also tried following the documentation you linked, though I’m not sure I did it correctly :wink:

  1. I’ve added homeassistant_api: true to the configuration of the rhasspy add-on (assuming that this is the place to add it, it seems some add-ons use json, some have yaml)
  2. I’ve tried curling from inside the rhasspy-docker curl -X POST -H "Authorization: Bearer ${SUPERVISOR_TOKEN}" -H "Content-Type: application/json" http://supervisor/core/api/events/rhasspy_GetTime, which resulted in a rhasspy_GetTime event in home assistant
  3. I’ve changed the home_assistant part of the profile to the one below
"home_assistant": {
        "handle_type": "event",
        "pem_file": "$RHASSPY_PROFILE_DIR/fullchain.pem",
        "url": "http://supervisor/core/api"
    },
  1. I’ve tried to “recognize” “What time is it” as before, but no event showed up in hassio.

I’ve also tried steps 3 and 4 with the following profile:

"home_assistant": {
    "access_token": "$SUPERVISOR_TOKEN",
    "handle_type": "event",
    "pem_file": "$RHASSPY_PROFILE_DIR/fullchain.pem",
    "url": "http://supervisor/core/api"
},

But to no avail.

This is the log from a recognition-try with the second profile pasted above.

[DEBUG:2021-04-28 19:00:48,903] rhasspyserver_hermes: Sent 370 char(s) to websocket
[DEBUG:2021-04-28 19:00:48,898] rhasspyserver_hermes: Handling NluIntent (topic=hermes/intent/GetTime, id=fadc51d8-b445-4379-b1ed-4a1d78f1cbf7)
[DEBUG:2021-04-28 19:00:48,897] rhasspyserver_hermes: <- NluIntent(input='what time is it', intent=Intent(intent_name='GetTime', confidence_score=1.0), site_id='default', id='1c40dc41-17f6-4e3d-a1b2-0d4895bc5bd4', slots=[], session_id='1c40dc41-17f6-4e3d-a1b2-0d4895bc5bd4', custom_data=None, asr_tokens=[[AsrToken(value='what', confidence=1.0, range_start=0, range_end=4, time=None), AsrToken(value='time', confidence=1.0, range_start=5, range_end=9, time=None), AsrToken(value='is', confidence=1.0, range_start=10, range_end=12, time=None), AsrToken(value='it', confidence=1.0, range_start=13, range_end=15, time=None)]], asr_confidence=None, raw_input='what time is it', wakeword_id=None, lang=None)
[DEBUG:2021-04-28 19:00:48,826] rhasspyserver_hermes: Publishing 271 bytes(s) to hermes/nlu/query
[DEBUG:2021-04-28 19:00:48,825] rhasspyserver_hermes: -> NluQuery(input='what time is it', site_id='default', id='1c40dc41-17f6-4e3d-a1b2-0d4895bc5bd4', intent_filter=None, session_id='1c40dc41-17f6-4e3d-a1b2-0d4895bc5bd4', wakeword_id=None, lang=None, custom_data=None, asr_confidence=None, custom_entities=None)

Is rhasspy trying to send something to the API? Shouldn’t I see some kind of error in the log? I thought that if I can successfully curl from the rhasspy container, token and url settings should be good.

Should not be needed, I use the Rhasspy Addon without any modifications.

Indeed, not needed

Can you remove the setting for PEM file? When comparing my profile, this seems different,

This is my profile and I can put in the text an click Recognize:

{
    "dialogue": {
        "system": "rhasspy"
    },
    "handle": {
        "system": "hass"
    },
    "home_assistant": {
        "access_token": "TOKEN",
        "handle_type": "event",
        "url": "http://192.168.43.54:8123"
    },
    "intent": {
        "system": "fsticuffs"
    },
    "mqtt": {
        "enabled": "true",
        "host": "192.168.43.54",
        "password": "pass",
        "site_id": "base",
        "username": "user"
    },
    "speech_to_text": {
        "system": "pocketsphinx"
    },
    "text_to_speech": {
        "system": "espeak"
    },
    "wake": {
        "system": "snowboy"
    }
}

1 Like

THANK YOU!

Removing the PEM setting and putting the token and LAN IP back in again made it work.

Posting the final profile for future reference:

{
    "dialogue": {
        "system": "rhasspy"
    },
    "handle": {
        "system": "hass"
    },
    "home_assistant": {
        "access_token": "TOKEN",
        "handle_type": "event",
        "url": "http://192.0.1.40:8123"
    },
    "intent": {
        "system": "fsticuffs"
    },
    "microphone": {
        "system": "pyaudio"
    },
    "sounds": {
        "system": "aplay"
    },
    "speech_to_text": {
        "system": "pocketsphinx"
    },
    "text_to_speech": {
        "system": "espeak"
    }
}

Thanks a bunch @romkabouter, I’ve been going crazy with this!

1 Like

Sorry romkabouter, I’ve been a thorn in your side.

Would you have any advice for hogrex to go from here if it still was not working?

My setup is identical, made my profile look just like the ones posted here and I can also curl inside the Rhasspy container and home assistant will see the event. But it won’t show if I fire the intent is recognized in Rhasspy.

To anyone still having trouble: make sure the “Handle” box is checked on the Rhasspy home page before you ‘Recognize’ the event!! All working now! romkabouter you’re awesome! And thanks hogrex too, would not have solved this without you coming back and posting what worked!