Control your Home Assistant with natural language through any messaging app supported by OpenClaw (Discord, Telegram, WhatsApp, Feishu, and more). Powered by OpenClaw.
"Turn off the lights" "Set AC to 24" "I'm leaving for work"
β β β
ββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββ
β Your Messaging App β
β (Discord, Telegram, β¦) β
βββββββββββββ¬βββββββββββββ
β
βΌ
ββββββββββββββββββββββββββ
β OpenClaw β
β (AI agent, Claude) β
β β
β Reads skill files in β
β tools/ to know how β
β to control devices β
βββββββββββββ¬βββββββββββββ
β
β MCP protocol (stdio)
β
ββββββββββββββββββββββββββ
β ha-mcp 7.2.0 β
β (~90 structured tools)β
β β
β WebSocket to HA, β
β state verification, β
β tool search β
βββββββββββββ¬βββββββββββββ
β
βΌ
ββββββββββββββββββββββββββ
β Home Assistant β
β (Docker) β
βββββββββββββ¬βββββββββββββ
β
βββββββββββββββββΌββββββββββββββββ
βΌ βΌ βΌ
Lights AC/TV Sensors
Switches Cameras Cookers
Say "I'm leaving for work" and OpenClaw turns off lights, sets the AC to eco, and confirms what it did.
SmartHub now supports two install paths: Linux hosts for the full runtime, and macOS for the official Home Assistant VM path.
install.shon the macOS host checks or installs VirtualBox, detects whether the Mac is Intel or Apple Silicon, and downloads the matching Home Assistant OS disk image.- Intel Macs use the official
haos_ovaVirtualBox image. - Apple Silicon Macs use the official
haos_generic-aarch64VirtualBox image. - The installer creates a bridged VirtualBox VM, attaches the matching disk image, starts Home Assistant OS, creates the initial Home Assistant admin account, and generates a long-lived access token.
- Keep the Mac powered on and on the home LAN while you expect local discovery or direct device control.
Native macOS Docker Desktop is not supported for the SmartHub runtime.
install.sh on macOS now waits for Home Assistant to boot, seeds the first admin account, and syncs the generated long-lived access token into .env before handing you the login URL.
If you need the full SmartHub runtime, run this repo on a Linux host. A Raspberry Pi is the recommended always-on host, but it is no longer the only supported Linux runtime.
If OpenClaw is already running on the machine that will host SmartHub, tell your bot to run the one-command installer:
curl -fsSL https://raw.githubusercontent.com/caiwang0/smarthome-openclaw/main/install.sh -o /tmp/smarthub-install.sh && bash /tmp/smarthub-install.shThe installer auto-detects the host:
- On Linux, it syncs the SmartHub repo, installs the runtime, starts Home Assistant, bootstraps the initial Home Assistant account if needed, and syncs the generated token into
.env. - On macOS, it detects Intel vs Apple Silicon, downloads the matching official Home Assistant OS VirtualBox image, starts the VM, bootstraps the initial Home Assistant account if needed, and syncs the generated token into
.env.
OpenClaw will install everything and continue setup automatically. On a fresh install it prints the generated Home Assistant username/password once, then hands you the login URL.
Pick the platform path that matches where SmartHub will actually run.
Install OpenClaw on the same machine that will host SmartHub. Go to openclaw.ai to install it.
Linux host (Raspberry Pi recommended)
macOS host
Install OpenClaw on the Mac that will host the Home Assistant OS VM. SmartHub does not run Home Assistant directly on macOS.
Follow the OpenClaw Getting Started guide to connect a bot to your messaging app (Discord, Telegram, WhatsApp, Feishu, etc.) and point it at this repo.
Make sure the bot is connected to the same machine that will host SmartHub.
Once the bot comes online, tell it to run the one-command installer:
curl -fsSL https://raw.githubusercontent.com/caiwang0/smarthome-openclaw/main/install.sh -o /tmp/smarthub-install.sh && bash /tmp/smarthub-install.shThe installer auto-detects the host:
- On Linux, it installs the SmartHub runtime, starts Home Assistant, bootstraps the initial Home Assistant admin account if needed, and syncs the generated token into
.env. - On macOS, it boots the matching Home Assistant OS VM in VirtualBox, bootstraps the initial Home Assistant admin account if needed, and syncs the generated token into
.env.
| Step | What happens |
|---|---|
| Repo sync | Clones SmartHub if missing, or updates the existing checkout before setup |
| Install Docker | Checks if Docker is installed and gives you the command if not |
| Start Home Assistant | Launches HA on the Linux host or boots the HA OS VM on macOS |
| First HA login | On a fresh install, bootstraps the initial Home Assistant admin account and prints the generated username/password once |
| Access token | Generates or recovers the Home Assistant token automatically and syncs it into .env |
| Verify runtime | Verifies ha-mcp and the repo config, then starts Home Assistant before handoff |
| Add integrations | Walks you through adding Xiaomi, Philips Hue, or any other brand |
| Discover devices | Shows what devices were found after each integration |
| Remote access (optional) | Sets up a Cloudflare Tunnel so you can reach HA from anywhere |
You: Help me set up SmartHub
OpenClaw: I'll sync the SmartHub repo locally and run the installer from the repo root.
It will start Home Assistant, bootstrap the first login if needed,
and sync the HA token into .env automatically.
OpenClaw: SmartHub + ha-mcp installed.
Home Assistant admin username: alice
Home Assistant admin password: <generated-password>
Save this, it's the only time you'll see it.
Open http://homeassistant.local:8123 in your browser and sign in.
You: I'm signed in.
OpenClaw: Connection verified β Home Assistant 2026.3.4, 0 devices.
Want to add your first device integration?
Talk to OpenClaw naturally:
| You say | What happens |
|---|---|
| "Turn off the living room lights" | Controls the device via HA |
| "Set the AC to 24" | Calls the climate service |
| "I'm leaving for work" | Turns off lights, sets AC to eco, locks doors |
| "Why is the bedroom so hot?" | Checks sensors, AC state, diagnoses the issue |
| "What devices do I have?" | Lists all connected devices by room |
| "Turn off the TV at 3pm every day" | Creates an automation |
| "Add Xiaomi Home" | Walks you through the integration setup |
Destructive actions are protected by two layers:
CLAUDE.mdrule β the agent is told to show you a summary and wait for an explicit "yes" before any persistent change. A soft hint; the model usually follows it, but can rationalize past it under pressure.scripts/approval-gate.pyhook β a Claude Code PreToolUse hook that reads your latest message and denies the call unless it contains an affirmative (yes,confirm,ok,ε₯½,sΓ,γ―γ, β¦). Deterministic β fires regardless of model or permission mode.
What's gated:
| Category | Examples |
|---|---|
| Automations & Scripts | create, modify, delete |
| Integrations | add, remove, enable/disable |
| Devices | remove, rename, update |
| System | restart, reload core, backup restore |
| HACS | add repository, download |
Non-destructive actions (turning on lights, setting AC, reading state) run without confirmation β only changes that persist across restarts are gated.
How it works: The hook is wired in .claude/settings.json to match the destructive tool names above. On each matched call, it reads the conversation transcript, pulls your last message, and checks it against the affirmative patterns. No match β deny β the agent has to show a summary and ask first.
Example β creating an automation:
The agent shows a summary, waits for "yes", then executes. Skip the "yes" and the hook blocks the call.
home-assistant/
βββ CLAUDE.md # Agent behavior rules (auto-loaded)
βββ TOOLS.md # Skill router β maps devices to files
βββ docker-compose.yml # Runs Home Assistant
βββ install.sh # Linux installer + macOS host bootstrap dispatcher
βββ .env.example # Template β copy to .env, fill in HA_TOKEN
βββ .claude/
β βββ settings.json # ha-mcp MCP server + PreToolUse approval hook
β
βββ scripts/
β βββ approval-gate.py # Blocks destructive ha-mcp calls unless the user
β β # explicitly confirmed in their latest message
β βββ macos-vm-bootstrap.sh # VirtualBox + Home Assistant OS VM bootstrap on macOS hosts
β βββ linux-guest-install.sh # SmartHub runtime install on Linux hosts
β
βββ tools/ # Skill files β the agent's knowledge base
β βββ setup.md # First-run setup flow (Docker β HA β token β .env)
β βββ _common.md # ha-mcp tool patterns, network info
β βββ _errors.md # Error handling & recovery
β βββ _services.md # Domain quirks (HVAC modes, brightness 0-255, etc.)
β βββ integrations/
β β βββ _discovery.md # Read-only discovery (passive signals + ordered LAN fallback chain)
β β βββ _lifecycle.md # Integration lifecycle harness (selection β connection β verification)
β β βββ _guide.md # Config-flow sub-skill (HACS, OAuth, recovery during CONNECTING)
β βββ automations/
β β βββ _guide.md # Automation workflow & checklist
β β βββ _reference.md # JSON schema, trigger/action types, templates
β βββ ha-best-practices/
β β βββ SKILL.md # Vendored Home Assistant automation/helper guidance
β β βββ references/ # Supporting best-practices references loaded during drafting
β βββ xiaomi-home/
β β βββ _integration.md # Xiaomi setup, cloud regions, quirks
β β βββ tv.md # TV commands & quirks
β β βββ ma8-ac.md # AC commands & quirks
β β βββ p1v2-cooker.md # Smart cooker commands & quirks
β βββ printer/
β βββ office-printer.md # CUPS printer setup
β
βββ ha-config/ # HA configuration (Docker volume, gitignored)
βββ docs/ # Research, specs, design docs
CLAUDE.md (always loaded)
β
ββ First-run check fails βββββββββ reads tools/setup.md
β (Docker / HA / token / .env bootstrap)
β
ββ "Before controlling a device" β reads tools/_common.md for ha-mcp patterns
β then device skill file for commands & quirks
β then tools/_services.md if unsure about a service
β then tools/_errors.md if a call fails
β
ββ "Before creating automation" ββ reads tools/automations/_guide.md
β then tools/ha-best-practices/ during Step 4 draft creation
β then _reference.md for JSON schema
β
ββ "Before adding integration" βββ reads tools/integrations/_discovery.md
then tools/integrations/_lifecycle.md
then tools/integrations/_guide.md when in CONNECTING
TOOLS.md (loaded on demand)
ββ Quick Reference table maps device names β skill files
Destructive ha-mcp calls (create/modify/delete automations, scripts, integrations,
devices, backups, restarts, HACS downloads)
ββ scripts/approval-gate.py runs as a Claude Code PreToolUse hook and blocks
the call unless the user's latest message is an explicit "yes / confirm"
Skill files are loaded on demand, not all at once. The agent only reads what it needs for the current task β this keeps the LLM context small and replies fast.
- OpenClaw CLI β the AI agent framework
- Docker β runs Home Assistant
- uv β Python package manager for running ha-mcp
- A messaging platform β Discord, Telegram, WhatsApp, Feishu, or any platform supported by OpenClaw
- Claude API access β OpenClaw uses Claude as its backend
Bot doesn't respond:
- Check the bot is online in your messaging app
- Verify your channel config in
openclaw.jsonis correct β see the OpenClaw Getting Started guide - Check logs:
openclaw gateway logs --profile smarthub
HA is unreachable:
- Run
docker psβ ishomeassistantrunning? - Test:
curl http://localhost:8123/api/config -H "Authorization: Bearer YOUR_TOKEN"β should return config JSON with fields likeversion,state, andconfig_source - Check
.envhas the correct token
OAuth redirect fails (Xiaomi, Google, etc.):
The OAuth login redirects to homeassistant.local:8123 (or whichever port HA is running on β check HA_URL in .env). In the Linux runtime path, homeassistant.local belongs to the Linux host, not the browser machine.
First, on the Linux host, get the host IP:
HA_HOST_IP=$(hostname -I | awk '{print $1}')Then update the hosts file on the browser machine that is opening the OAuth link.
Windows β run Command Prompt as administrator:
Then paste the command OpenClaw gave you:
Mac / Linux browser machine:
echo "${HA_HOST_IP} homeassistant.local" | sudo tee -a /etc/hostsTunnel not working:
- Check
cloudflaredis running:ps aux | grep cloudflared - Verify
trusted_proxies: 127.0.0.1underhttp:in HA'sconfiguration.yaml


