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