OpenClaw and Home Assistant - The Ultimate Smart Home Setup
Bringing Natural Language to Your Smart Home
Home Assistant is the most capable open source home automation platform available. It supports thousands of devices, offers powerful automation rules, and gives you full local control over your smart home. But its power comes with complexity -- writing automations in YAML, navigating a dense UI, and remembering the exact names and entities of your devices.
OpenClaw can bridge that gap. By connecting an OpenClaw agent to your Home Assistant instance through its REST API, you get a conversational interface to your entire smart home. Instead of opening the Home Assistant dashboard and clicking through menus, you tell your agent what you want and it handles the API calls. "Turn off all the lights downstairs," "set the thermostat to 20 degrees," or "what is the temperature in the garage?" -- your agent translates natural language into Home Assistant service calls.
The community has built a Home Assistant skill for OpenClaw that wraps the Home Assistant REST API. This guide covers how to set it up and the most useful ways to use it.
Connecting OpenClaw to Home Assistant
Home Assistant exposes a REST API that allows external tools to query device states, trigger services, and manage automations. OpenClaw connects to this API using a long-lived access token.
Generating an Access Token
In Home Assistant, go to your user profile, scroll down to "Long-Lived Access Tokens," and create a new token. Give it a descriptive name like "OpenClaw Agent." Copy the token -- you will not be able to see it again.
Network Configuration
Your OpenClaw instance needs to be able to reach your Home Assistant instance over the network. If both run on your local network, this is straightforward. If your OpenClaw instance is hosted remotely (on a Hetzner server, for example), you have a few options:
- VPN tunnel: Set up a WireGuard or Tailscale tunnel between your OpenClaw server and your home network. This is the most secure approach
- Reverse proxy with authentication: Expose your Home Assistant through a reverse proxy (like Nginx or Caddy) with proper TLS and additional authentication
- Cloudflare Tunnel: Use a Cloudflare Tunnel to securely expose your Home Assistant without opening ports on your router
The VPN approach is recommended because it keeps your Home Assistant completely off the public internet while still allowing your OpenClaw agent to communicate with it.
Installing the Skill
Install the Home Assistant skill from ClawHub. Configure it with your Home Assistant URL (e.g., http://homeassistant.local:8123 or the tunnel address) and the long-lived access token. The skill exposes actions for querying states, calling services, managing automations, and retrieving entity information.
Voice Control Through OpenClaw
One of the most natural ways to interact with your smart home is through voice. OpenClaw has built-in text-to-speech capabilities through its Piper TTS integration, and when combined with the Home Assistant skill, you get a voice-controlled smart home that runs entirely on your own hardware.
How It Works
You speak to your OpenClaw agent through the voice mode interface. The agent processes your request, determines which Home Assistant entities and services are involved, makes the appropriate API calls, and responds with a confirmation. The entire chain -- speech recognition, intent parsing, API calls, and response -- happens without sending your voice data to any third-party cloud service.
Practical Voice Commands
The strength of using an AI agent for voice control (rather than a rigid command system) is that you do not need to memorize exact phrases. All of these work:
- "Turn on the kitchen lights"
- "Can you switch off the lights in the kitchen"
- "Kitchen lights off"
- "Make the kitchen dark"
The agent understands the intent behind each phrasing and maps it to the correct Home Assistant service call (light.turn_off for the kitchen light entity).
Multi-Step Commands
Unlike traditional voice assistants that handle one command at a time, your OpenClaw agent can process compound requests. "Turn off all the lights, lock the front door, and set the thermostat to 18 degrees" becomes three separate Home Assistant API calls executed in sequence. The agent confirms each action as it completes.
Device Management and Status
Knowing the state of your home at a glance is one of the core benefits of home automation.
Querying Device States
Ask your agent about any device or sensor: "Is the garage door open?", "What is the humidity in the basement?", "Are any windows open?", "How much energy did the solar panels generate today?" The agent queries the relevant entities in Home Assistant and returns their current states.
Area-Based Queries
If you have organized your devices by area in Home Assistant (which you should), you can ask about entire rooms or floors. "What is the status of everything in the living room?" returns the state of all lights, sensors, switches, and media players in that area.
Device Discovery
If you have recently added new devices and cannot remember their exact entity names, ask your agent. "What devices are in the kitchen?" or "Show me all my temperature sensors." The agent queries Home Assistant's entity registry and presents the results.
Automation Rules
Home Assistant automations are powerful but writing them in YAML or through the UI can be cumbersome. Your OpenClaw agent can help you create, modify, and manage automations through conversation.
Creating Automations Conversationally
Instead of writing YAML, describe what you want: "When the front door opens after 10 PM, turn on the porch light and send me a notification." The agent translates this into the appropriate automation configuration -- trigger (door sensor state change), condition (time after 22:00), and action (light service call plus notification).
The agent can create the automation through the Home Assistant API or generate the YAML for you to review before adding it to your configuration.
Troubleshooting Automations
When an automation is not working as expected, describe the problem to your agent. It can query the automation's state, check the trigger conditions, verify that the entities involved are available, and look at the Home Assistant logs for relevant errors. This is significantly faster than manually checking each piece of the automation.
Temporary Automations
Sometimes you need a rule that only applies temporarily -- "keep the hallway light on until midnight" or "turn on the heater if the temperature drops below 15 degrees until tomorrow morning." Your agent can create these with an expiration condition so they deactivate automatically.
Scene Management
Scenes in Home Assistant capture the desired state of multiple devices at once. Your OpenClaw agent makes scenes easier to create and activate.
Creating Scenes from Current State
"Save the current state of the living room as 'Movie Night'" -- your agent queries all entities in the living room area, captures their current states, and creates a scene in Home Assistant. The next time you want to recreate that ambiance, just say "activate movie night."
Modifying Scenes
"Add the hallway dimmer at 20% to the movie night scene" -- the agent updates the existing scene definition without requiring you to recreate it from scratch.
Context-Aware Activation
Your agent can activate scenes based on context. "I am going to bed" might trigger your bedtime scene (all lights off, doors locked, thermostat lowered). "I am working from home today" might activate your home office scene (office lights on, thermostat adjusted, do-not-disturb mode on smart speakers).
Energy Monitoring
If you have energy monitoring set up in Home Assistant, your OpenClaw agent can help you make sense of the data.
Usage Reports
"How much electricity did we use yesterday?" or "Compare this month's energy usage to last month." The agent queries the Home Assistant energy sensors and presents the data in a readable format. It can break down usage by area or device if you have individual power monitoring.
Anomaly Detection
You can ask your agent to watch for unusual energy usage. If the HVAC system is running more than usual or a device is consuming more power than expected, the agent can alert you. This helps catch issues like a refrigerator with a failing compressor or a heater running in an unoccupied room.
Solar and Battery
For homes with solar panels and battery storage, the agent can report on generation, consumption, battery levels, and grid import/export. "Should I run the dishwasher now or wait for more solar?" -- the agent can check current solar generation and battery levels to give you a practical answer.
Security and Privacy
Local Processing
Both OpenClaw and Home Assistant can run entirely on your own hardware. Your voice commands, device states, and automation rules never leave your network. This is a fundamental advantage over cloud-dependent smart home systems where every light switch command routes through someone else's servers.
Access Control
The long-lived access token you give to OpenClaw has full access to Home Assistant by default. For additional security, you can create a separate Home Assistant user with restricted permissions and generate the token from that user. This lets you limit what the agent can control -- perhaps it can manage lights and climate but not door locks or the alarm system.
Network Isolation
For the security-conscious, you can place your Home Assistant on a separate VLAN from your OpenClaw server and only allow the specific API traffic between them. This limits the blast radius if either system is compromised.
Getting Started
- Generate a long-lived access token in Home Assistant
- Ensure network connectivity between your OpenClaw instance and Home Assistant (VPN recommended for remote setups)
- Install the Home Assistant skill from ClawHub
- Configure the skill with your Home Assistant URL and token
- Start with queries -- ask about device states before trying to control anything
- Try basic controls -- turn lights on and off, adjust thermostats
- Build up to automations -- once comfortable, start creating automations through conversation
The combination of OpenClaw's conversational AI with Home Assistant's device ecosystem gives you a smart home interface that is both powerful and natural to use. You get the flexibility of Home Assistant's thousands of integrations with the ease of just saying what you want.