Skip to content

Latest commit

 

History

History
71 lines (52 loc) · 1.66 KB

home_assistant.md

File metadata and controls

71 lines (52 loc) · 1.66 KB

Home Assistant

This will connect Rhasspy to Home Assistant via Assist.

Install the Home Assistant intent handler:

mkdir -p config/programs/handle/
cp -R programs/handle/home_assistant config/programs/handle/

Create a long-lived access token in Home Assistant (inside your profile):

Long-lived access token

Copy the entire access token (with CTRL+A, not just selecting what you can see) and put it in the data directory:

mkdir -p config/data/handle/home_assistant/
echo "MY-LONG-LIVED-ACCESS-TOKEN" > config/data/handle/home_assistant/token

Add to your configuration.yaml:

programs:
  handle:
    home_assistant:
      command: |
        bin/converse.py --language "${language}" "${url}" "${token_file}"
      adapter: |
        handle_adapter_text.py
      template_args:
        url: "http://localhost:8123/api/conversation/process"
        token_file: "${data_dir}/token"
        language: "en"

pipelines:
  default:
    mic: ...
    vad: ...
    asr: ...
    wake: ...
    handle:
      name: home_assistant
    tts: ...
    snd: ...

Make sure your Home Assistant server is running, and test out a command:

script/run bin/handle_text.py "Turn on the bed light"

Replace "bed light" with the name of a device you have connected to Home Assistant.

If successful, you should see JSON printed with the response text, like:

{"type": "handled", "data": {"text": "Turned on light"}}

This also works over HTTP:

curl -X POST --data 'Turn on the bed light' 'localhost:13331/handle/handle'

Now you can run your full pipeline and control Home Assistant!