Home assistant - rhasspy integration

i’ve gotten rhasspy and home assistant OS working together by writing the automation to activate based on the event type sent from rhasspy, meaning that the “lights on” automation triggers when the HASSLightOn event type is sent from Rhasspy. but i’m trying to have get the light name and state to be based on the JSON from Rhasspy, similar to Hassio any Light on off - #3 by czadikem but it’s not working.

i’m fairly ignorant in JSON and programming in general, so any help would be appreciated. i feel like i’m defining entities or devices incorrectly?

Please give some more info on what you have now, otherwise we cannot spot errors in your definitions.

literally using the same sentence definition in rhasspy and automation in HA. here’s what shows up in HA when listening for rhasspy_ChangeLightState

    "event_type": "rhasspy_ChangeLightState",
    "data": {
        "state": "off",
        "state_raw_value": "off",
        "light": "light.downstairs_light",
        "light_raw_value": "downstairs lights",
        "_text": "turn off the light.downstairs_light",
        "_raw_text": "turn off the downstairs lights",
        "_intent": {
            "input": "turn off the light.downstairs_light",
            "intent": {
                "intentName": "ChangeLightState",
                "confidenceScore": 1
            "siteId": "base",
            "id": "f58fda75-5474-4dd6-875f-eb784dfa5c36",
            "slots": [
                    "entity": "state_on_off",
                    "value": {
                        "kind": "Unknown",
                        "value": "off"
                    "slotName": "state",
                    "rawValue": "off",
                    "confidence": 1,
                    "range": {
                        "start": 5,
                        "end": 8,
                        "rawStart": 5,
                        "rawEnd": 8
                    "entity": "lights",
                    "value": {
                        "kind": "Unknown",
                        "value": "light.downstairs_light"
                    "slotName": "light",
                    "rawValue": "downstairs lights",
                    "confidence": 1,
                    "range": {
                        "start": 13,
                        "end": 35,
                        "rawStart": 13,
                        "rawEnd": 30
            "sessionId": "f58fda75-5474-4dd6-875f-eb784dfa5c36",
            "customData": null,
            "asrTokens": [
                        "value": "turn",
                        "confidence": 1,
                        "rangeStart": 0,
                        "rangeEnd": 4,
                        "time": null
                        "value": "off",
                        "confidence": 1,
                        "rangeStart": 5,
                        "rangeEnd": 8,
                        "time": null
                        "value": "the",
                        "confidence": 1,
                        "rangeStart": 9,
                        "rangeEnd": 12,
                        "time": null
                        "value": "light.downstairs_light",
                        "confidence": 1,
                        "rangeStart": 13,
                        "rangeEnd": 35,
                        "time": null
            "asrConfidence": null,
            "rawInput": "turn off the downstairs lights",
            "wakewordId": null,
            "lang": null
        "_site_id": "base"
    "origin": "REMOTE",
    "time_fired": "2022-06-11T00:51:10.185392+00:00",
    "context": {
        "id": "01G583WM79J0X03CFQ59QVW1WH",
        "parent_id": null,
        "user_id": "a2b22642e2ca4f82ad0f0b4af6d003c5"

The automation which you referred to includes:

    service_template: 'switch.turn_{{ trigger.event.data["state"] }}'
      entity_id: '{{ trigger.event.data["light"] }}'
  • Your automation wants to execute a “switch.turn_on” or “switch.turn_off” on your light entity in Home Assistant. It expects you to pass the full entityID for the light from rhasspy (which it looks that it does), but only needs “on” or “off” to be added to 'switch.turn_

  • “trigger.event.data[…]” represents the entity data being passed from rhasspy … so you just need the [“state”] and [“light”] names in your automation to match up with the names you are actually sending from rhasspy sentence.

  • I personally don’t use events between Rhasspy and Home Assistant, but looking at what you quoted immediately above, I guess you should use [“state_on_off”] and [“lights”]

Also the exact same slots? Because in there is no “light.downstairs_light”, but there is a group.
The trick in that topic is that the slots map the light to an entityid

Can you please paste your slots and sentences here so we do not have to swtich to that other topic?
Also please post you automation

right, i modified the slots to match the entities that are picked up in HA. again, the “switch.” objects work fine, but the “light.” objects don’t respond. these are all TPLink Kasa devices, and are manually operable from HA.

$lights slot:

(downstairs lamp):switch.downstairs_light
(bedroom lights):light.bedroom_light
(downstairs lights):light.downstairs_light

$state_on_off slot:


just got this error when trying to restart HA

Error loading /config/configuration.yaml: while parsing a flow mapping in “/config/automations.yaml”, line 9, column 19 expected ‘,’ or ‘}’, but got ‘[’ in “/config/automations.yaml”, line 9, column 39

And the line is what? :wink: Post your automations.yaml so we can see, what is in line 9.

In general, why are you keeping your information for yourself? :wink: There are no secrets in these files, and the more of your config files and automations you post, the easier it gets to spot the/an error. The json you posted above is as well not part of your configuration, it’s more like a log.

the automations.yaml is literally copy pasted from the link in op.

i figured it out anyway. the line

'switch.turn_{{ trigger.event.data["state"] }}'

only works on entities with “switch.” the dimmers are “light.”, so the command didn’t work. i just created 2 different automations, same events from Rhasspy but one commanding switch and one commanding light.

Good you found the error, I totally missed that mistake
You can also use the generic homeassistant.turn_on and off, saves you an automation