Achieving Local Voice Control with Rhasspy and Home Assistant
- #automation

Achieving Local Voice Control with Rhasspy and Home Assistant
The convenience of voice control in a smart home is undeniable. Saying "Turn off the lights" is often quicker and easier than finding your phone or walking to a switch. However, relying solely on cloud-based voice assistants like Alexa or Google Assistant raises concerns about privacy, internet dependency, and vendor lock-in. This is where local voice control solutions shine. One powerful open-source option is Rhasspy, a complete voice assistant toolkit designed for offline, private operation. Integrating Rhasspy with Home Assistant allows you to combine the flexibility of Home Assistant with the power of local voice commands. This article guides you through setting up Rhasspy and integrating it with Home Assistant for a truly local smart home voice experience.
Why Local Voice Control?
Local voice control offers several key advantages:
- Privacy: Your voice commands are processed locally, without being sent to external servers.
- Reliability: Your smart home doesn't become 'dumb' if your internet connection drops. Commands are processed within your local network.
- Speed: Local processing can be faster than cloud roundtrips.
- Customization: Full control over wake words, commands, and responses.
Rhasspy aligns perfectly with these principles.
Prerequisites
Before you begin, you'll need:
- An operational Home Assistant instance.
- Hardware to run Rhasspy (Raspberry Pi, mini-PC, Docker).
- A quality USB microphone connected to the Rhasspy hardware.
- Speakers (optional, for voice feedback).
Setting Up Rhasspy
Setting up Rhasspy can vary based on your chosen hardware and installation. The simplest approach for many Home Assistant users is the official Rhasspy add-on if you're running Home Assistant OS or Supervised.
Rhasspy Home Assistant Add-on
- Install the "Rhasspy" add-on from the Supervisor -> Add-on Store.
- Configure key settings: language, wake word, STT, intent recognition, TTS.
- In "Intent Handling," configure it to send intents to Home Assistant.
- Start the add-on and use the Web UI to train commands and test your setup.
Other Installation Methods
For other HA installations, you'll install Rhasspy separately. Configure it to communicate with Home Assistant via:
- MQTT: Rhasspy publishes intents to an MQTT broker HA subscribes to.
- Webhook: Rhasspy sends an HTTP POST request to a Home Assistant webhook URL.
These methods require manual configuration in Rhasspy's profile settings and ensuring network access.
Integrating Rhasspy with Home Assistant
Home Assistant needs to listen for the intents sent by Rhasspy.
Using the Rhasspy Add-on Integration
If using the add-on configured to send intents, Home Assistant receives rhasspy_intent
events automatically. Trigger automations based on these events.
Using MQTT or Webhook Integration
If using MQTT, configure the MQTT Integration and create automations triggered by messages on the Rhasspy intent topic. For webhooks, use the Webhook Trigger.
Handling Intents in Home Assistant
Home Assistant receives the intent name and slot data (parameters). Use automations or the intent_script
integration.
Using intent_script (Recommended for Simplicity)
Define scripts linked directly to intent names. Slot values are accessible within the script.
# configuration.yaml
intent_script:
TurnOnLight:
speech:
text: "OK, turning on the {{ name | default('specified') }} light."
action:
- service: light.turn_on
data:
entity_id: "light.{{ name | replace(' ', '_') | lower }}"
SetBrightness:
speech:
text: "Setting the {{ name | default('light') }} brightness to {{ brightness }} percent."
action:
- service: light.turn_on
data:
entity_id: "light.{{ name | replace(' ', '_') | lower }}"
brightness_pct: "{{ brightness }}"
Home Assistant responds with speech and executes services using slot values.
Using Automations (More Flexibility)
Trigger standard automations with the rhasspy_intent
event (or MQTT/webhook). Manually parse event data.
# automations.yaml
- alias: "Rhasspy - Turn on Light"
trigger:
- platform: event
event_type: rhasspy_intent
event_data:
intent:
name: "TurnOnLight"
action:
- service: light.turn_on
data:
entity_id: "light.{{ trigger.event.data.intent.slots.name | replace(' ', '_') | lower }}"
- service: tts.speak # Optional: Provide voice feedback
data:
media_player_entity_id: media_player.your_speaker
message: "Okay, turning on the light."
Device Integration Tips
Train Rhasspy with your device names in the 'Sentences' tab of its web UI. Define templates for intents and list slot values (device names).
Example Sentence Definition:
[TurnOnLight]
turn on the (living room light | kitchen light | bedroom lamp){name}
This maps spoken phrases to intents and slots.
Best Practice: Use consistent, easy-to-pronounce device names. Train Rhasspy with variations.
Best Practices for Reliability
- Microphone: Use a quality mic placed away from noise.
- Acoustic Environment: Minimize echoes.
- Train Frequently: Update training as you add devices/commands.
- Robust Handling: Handle missing/unexpected slots in HA. Provide feedback.
- Monitor Logs: Use Rhasspy and HA logs for troubleshooting.
- MQTT Decoupling: Ensure MQTT broker reliability if used.
- Resource Management: Ensure sufficient hardware for Rhasspy, especially for STT.
Conclusion
Integrating Rhasspy with Home Assistant provides a powerful, private, and reliable local voice control solution. While it requires initial setup, the privacy, offline capability, and customization benefits are significant. By following these steps and best practices, you can build a voice-controlled smart home that respects your privacy and works reliably.

NGC 224
Author bio: