On this page
๐ Overview
| What | Details |
|---|---|
| Use case | Smart home control via natural language over messaging |
| Primary channel | WhatsApp or iMessage (for quick voice note commands) |
| Integrations | Home Assistant, Apple HomeKit (via Shortcuts), Hue, MQTT |
| Cron jobs | Good morning routine, good night routine, energy report |
| Estimated cost | $5-10/mo (mostly Flash for simple commands) |
๐งฌ SOUL.md template
# Smart Home Agent
## Role
You are a smart home controller for [YOUR_NAME]'s home.
You can control lights, thermostat, locks, cameras,
and other connected devices.
## Devices
- Living room: Hue lights (4 bulbs), TV, speakers
- Bedroom: Hue lights (2 bulbs), AC unit
- Kitchen: Smart plugs (coffee maker, dishwasher)
- Garage: Smart door opener, camera
- Thermostat: Nest/Ecobee at [IP_OR_HA_ENTITY]
- Security: Ring doorbell, 2 cameras
## Home Assistant
- URL: http://homeassistant.local:8123
- Long-lived access token in env: HA_TOKEN
- Use the REST API to control devices
- Entity IDs follow pattern: light.living_room_1
## Rules
- Never unlock doors without explicit confirmation
- Never disable security cameras without asking twice
- Thermostat range: 18-25ยฐC only
- After 11pm: dim lights to 20% max
- Guest mode: limited to lights + thermostat only
## Common Commands
"Lights off" โ Turn off all lights
"Movie mode" โ Dim living room to 15%, TV on
"Good morning" โ Lights on 80%, coffee maker on
"Good night" โ All lights off, doors locked, thermostat to 19ยฐC
"Away mode" โ Lights random schedule, cameras armed
๐ Home Assistant integration
OpenClaw connects to Home Assistant via its REST API:
# Create a long-lived access token in Home Assistant:
# Profile โ Long-lived Access Tokens โ Create Token
# Set as env var:
export HA_TOKEN="eyJ0eXAiOiJKV1QiLCJhbGciOi..."
# Or in openclaw.json:
{
"env": {
"HA_TOKEN": "your_token",
"HA_URL": "http://homeassistant.local:8123"
}
}
Example commands via exec/fetch
# Turn on a light
curl -X POST "$HA_URL/api/services/light/turn_on" \
-H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"entity_id":"light.living_room"}'
# Set thermostat
curl -X POST "$HA_URL/api/services/climate/set_temperature" \
-H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"entity_id":"climate.thermostat","temperature":21}'
# Get device state
curl -s "$HA_URL/api/states/sensor.temperature" \
-H "Authorization: Bearer $HA_TOKEN"
โ
Community skill: Look for home-assistant skill on ClawHub that wraps the REST API into simple tool calls. Faster than raw curl commands.
๐ฑ Apple Shortcuts
For Apple ecosystem users, OpenClaw can trigger Shortcuts via the apple-shortcuts skill:
# Run a shortcut from OpenClaw
shortcuts run "Movie Mode"
shortcuts run "Good Morning"
shortcuts run "Coffee"
This gives you HomeKit control without Home Assistant. Each Shortcut can control HomeKit scenes, accessories, and automations.
๐๏ธ Voice control
Send voice notes on WhatsApp or Telegram for hands-free home control:
- "Hey, turn off the kitchen lights" โ Whisper transcribes โ agent calls Home Assistant API
- "What's the temperature inside?" โ Agent queries sensor โ responds with reading
- Talk Mode: Use wake word "hey claw" for continuous voice interaction
See Voice & Talk Mode Guide for setup.
โฐ Automated routines
# Good morning routine (7am weekdays)
openclaw cron add \
--name "Good morning" \
--cron "0 7 * * 1-5" \
--model "google/gemini-2.5-flash-lite" \
--session isolated \
--message "Run the morning routine: \
Turn on living room lights to 80%. \
Start the coffee maker. \
Check today's weather and calendar. \
Send me a morning summary."
# Good night routine (11pm daily)
openclaw cron add \
--name "Good night" \
--cron "0 23 * * *" \
--model "google/gemini-2.5-flash-lite" \
--session isolated \
--message "Run the night routine: \
Turn off all lights. \
Lock all doors. \
Set thermostat to 19ยฐC. \
Arm security cameras. \
Confirm all done."
# Weekly energy report (Sunday 6pm)
openclaw cron add \
--name "Energy report" \
--cron "0 18 * * 0" \
--session isolated \
--message "Query Home Assistant for this week's energy usage. \
Compare to last week. \
Flag any devices with unusual consumption."
๐ Security considerations
- Never expose Home Assistant to the internet โ use Tailscale or VPN for remote access
- Lock down high-risk actions โ require confirmation for door locks, camera disabling
- Use allowlists โ only your phone number can send commands
- Sandbox the agent โ if on a shared network, use Docker sandboxing
- Guest mode โ create a separate agent with limited device access for house guests
โ๏ธ Config snippet
{
"agents": {
"defaults": {
"model": {
"primary": "google/gemini-2.5-flash"
},
"heartbeat": {
"every": "15m",
"model": "google/gemini-2.5-flash-lite"
}
}
},
"channels": {
"whatsapp": {
"allowFrom": ["+YOUR_NUMBER"],
"selfChatMode": true
}
}
}