Can't make Home Assistant accept intents

Hi! This is my first post, apologies if this is a dumb question.

Setup:

Home Assistant 2023.4.6 
Supervisor 2023.04.0 
Operating System 10.0 
Frontend 20230411.1 - latest 

Running on a Raspberry Pi 4 with 2 GB RAM.

I have set up Rhasspy to pass intents to Home Assistant, and I have configured Home Assistant to accept some intents. Rhasspy recognises the words, but nothing happens. This is the relevant section of my configuration.yaml file:

intent:
  intent_script: !include intent_script.yaml

And this is the entire contents of the intent_script.yaml file:

HassDimKitchenLights:
  speech:
    type: plaintext
    text: Dimming the lights.
  action:
    service: notify.notify
    data:
      message: Hello from an intent!
  card:
    type: simple
    title: Dim lights card title
    content: Dim lights card content

Nothing happened. To eliminate the possibility that I have misconfigured Rhasspy I send the JSON generated by Rhasspy directly to localhost:8123/api/intent/handle, making sure to use the correct token for authorization.

If I use the full JSON generated by Rhasspy like this:

curl -X POST http://localhost:8123/api/intent/handle -H 'Content-Type: application/json' -H 'Authorization: Bearer <token>' -d   '{"intent": { "confidence": 1, "name": "HassDimKitchenLights" }, "raw_text": "dim the lights", "raw_tokens": [ "dim", "the", "lights" ], "recognize_seconds": 0.09078530201804824, "slots": {}, "speech_confidence": 1, "text": "dim the lights", "tokens": [ "dim", "the", "lights" ], "wakeword_id": null}'

And I get this response:
{"message":"Message format incorrect: extra keys not allowed @ data['intent']"}

If I strip away the extra stuff and just send the intent like this:

curl -X POST http://localhost:8123/api/intent/handle -H 'Content-Type: application/json' -H 'Authorization: Bearer <token>' -d   '{"name": "HassDimKitchenLights"}' 

I get this response:

500 Internal Server Error

Server got itself in trouble

And the log file says:

2023-04-23 12:16:13.617 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 146, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/intent/__init__.py", line 230, in post
    intent_result = await intent.async_handle(
  File "/usr/src/homeassistant/homeassistant/helpers/intent.py", line 73, in async_handle
    raise UnknownIntent(f"Unknown intent {intent_type}")
homeassistant.helpers.intent.UnknownIntent: Unknown intent HassDimKitchenLights

I can’t find the directory /usr/src/homeassistant on my machine so I guess it’s tucked safely away in a docker container somewhere but I can’t find it.

This is a brand new install.

it should just be

intent_script: !include intent_script.yaml
1 Like

That solved it! Thank you!