For OpenClaw v2026.2 | Requires a Home Assistant instance or smart devices, and the
home-assistantskill installed.
TL;DR: Install skill openclaw skill install home-assistant. Configure connection: "url": "http://homeassistant.local:8123", "token": "...". Control devices: "Turn on lights" → light.living_room.on. Automation scenes: "scenes": [{"id": "morning", "schedule": "0 7 * * *"}]. Energy monitoring: query power usage stats. Security monitoring: door/window sensors + motion detection + anomaly alerts.
Practice Goals
Build a smart home control center that can:
- Control smart home devices
- Create automation scenes
- Voice control appliances
- Monitor and optimize energy consumption
- Security monitoring and alerts
Installing Required Skills
# Home Assistant skill
openclaw skill install home-assistant
# Smart home skill
openclaw skill install smart-home-io
# Weather skill
openclaw skill install weather-api
Home Assistant Integration
Configuring Connection
{
"skills": {
"home-assistant": {
"url": "http://homeassistant.local:8123",
"token": "${HOME_ASSISTANT_TOKEN}",
"entities": {
"lights": ["light.living_room", "light.bedroom"],
"climate": ["climate.living_room"],
"sensors": ["sensor.temperature", "sensor.humidity"],
"switches": ["switch.tv", "switch.air_purifier"]
}
}
}
}
Device Control Scenarios
User: Turn on the living room lights
Agent: Sure, turning on the living room lights...
[Call Home Assistant API]
light.living_room → on
Living room lights are on. Current brightness 80%.
Would you like to adjust the brightness?
User: Set the AC to 25 degrees
Agent: Setting the AC temperature...
[Call climate API]
climate.living_room → 25°C
AC set to 25°C, mode: Cooling.
Current room temperature: 28°C, expected to reach target in about 20 minutes.
Batch Control
User: I'm going to bed, turn off all the lights
Agent: Good night!
[Batch control devices]
light.living_room → off
light.bedroom → off
light.kitchen → off
switch.tv → off
All lights and TV are off. AC switched to sleep mode (26°C).
Would you like me to set an alarm for tomorrow morning?
Automation Scenes
Scene Configuration
{
"scenes": [
{
"id": "morning",
"name": "Morning Mode",
"trigger": {
"type": "time",
"time": "07:00"
},
"actions": [
{ "entity": "light.bedroom", "action": "turn_on", "brightness": 30 },
{ "entity": "switch.coffee_machine", "action": "turn_on" },
{ "entity": "climate.living_room", "action": "set_temperature", "value": 22 }
]
},
{
"id": "leave_home",
"name": "Leave Home Mode",
"trigger": {
"type": "location",
"condition": "leave_home"
},
"actions": [
{ "entity": "group.all_lights", "action": "turn_off" },
{ "entity": "switch.tv", "action": "turn_off" },
{ "entity": "climate.home", "action": "turn_off" }
]
}
]
}
Scene Triggering
User: I'm leaving home
Agent: Activating Leave Home mode...
[Trigger scene: leave_home]
Leave Home mode activated:
- ✅ All lights off
- ✅ TV off
- ✅ AC off
- ✅ Security monitoring enabled
When do you expect to be back? I can prepare a Welcome Home scene for you.
Smart Scenes
User: Set up an evening arrival home scene
Agent: Sure, creating the Arrival Home scene...
Scene "Arrival Home Mode" created:
- Trigger: Location at home + Time 18:00-23:00
- Actions:
1. Turn on living room lights (50% brightness)
2. Turn on AC (auto-select mode based on current temperature)
3. Play welcome message
4. Start water heater
Would you like to add any other devices?
Voice Control
Voice Command Mapping
{
"voiceCommands": {
"Turn on lights": { "action": "light.turn_on" },
"Turn off lights": { "action": "light.turn_off" },
"Brighten": { "action": "light.brightness_up" },
"Dim": { "action": "light.brightness_down" },
"Turn on AC": { "action": "climate.turn_on" },
"Turn off AC": { "action": "climate.turn_off" }
}
}
Natural Language Control
User: It's a bit cold, turn up the temperature a little
Agent: Current room temperature 22°C, AC is off.
Would you like to turn on the AC and set it to what temperature?
- Suggestion: 24-25°C
- Comfort range: 23-26°C
User: Turn on the AC, set to 25 degrees
Agent: Sure...
[climate.living_room → on, temperature: 25]
AC is on, set to 25°C heating mode.
Expected to reach target temperature in about 15 minutes.
Energy Monitoring
Energy Statistics
User: How's today's power usage?
Agent: Let me check today's energy data...
[Fetch energy data]
[Analyze usage]
## Today's Energy Report
### Total Power Consumption
- Today: 12.5 kWh
- Yesterday: 14.2 kWh
- Saved: 1.7 kWh (-12%)
### Device Power Ranking
1. AC: 5.2 kWh (42%)
2. Water heater: 3.1 kWh (25%)
3. Lighting: 1.8 kWh (14%)
4. TV: 1.2 kWh (10%)
5. Other: 1.2 kWh (9%)
### Energy-Saving Tips
- 💡 Set AC to 26°C to save ~20%
- 💡 Set water heater to turn off on a schedule
- 💡 Replace traditional bulbs with LED lights
### Peak Hours
- 18:00-21:00 has highest usage; consider shifting high-power appliance use
Would you like me to set up an automated energy-saving scene?
Energy-Saving Scene
{
"scenes": [
{
"id": "energy_saving",
"name": "Energy Saving Mode",
"actions": [
{ "entity": "climate.home", "action": "set_temperature", "value": 26 },
{ "entity": "light.*", "action": "set_brightness", "value": 50 },
{ "entity": "switch.standby_devices", "action": "turn_off" }
]
}
]
}
Security Monitoring
Security Configuration
{
"security": {
"sensors": {
"motion": ["binary_sensor.motion_living_room", "binary_sensor.motion_bedroom"],
"door": ["binary_sensor.door_main", "binary_sensor.door_back"],
"window": ["binary_sensor.window_bedroom", "binary_sensor.window_living"],
"camera": ["camera.living_room", "camera.door"]
},
"alerts": {
"motion_detected": {
"enabled": true,
"notify": true,
"record": true
},
"door_opened": {
"enabled": true,
"notify": true
}
}
}
}
Security Alerts
User: I'm leaving, enable security mode
Agent: Activating security mode...
[Security mode activated]
Security status:
- ✅ Door/window sensors: Enabled
- ✅ Motion detection: Enabled
- ✅ Camera recording: Enabled
- ✅ Anomaly notifications: Enabled
I will monitor:
- Door and window open/close status
- Indoor motion detection
- Unusual sound detection
If any anomaly is detected, I will notify you immediately.
Anomaly Handling
[Alert triggered]
Agent: 🚨 Security Alert!
Anomaly detected:
- Time: 2026-02-26 14:30:25
- Type: Motion at front door
- Device: camera.door
[Attached: front door camera snapshot]
Would you like me to:
1. View live feed
2. Call emergency services
3. Notify family members
4. Turn on warning lights
Please respond immediately!
Automation Rules
Rule Configuration
{
"automations": [
{
"id": "auto_lights_sunset",
"name": "Auto Lights at Sunset",
"trigger": {
"type": "sun",
"event": "sunset"
},
"actions": [
{ "entity": "light.living_room", "action": "turn_on", "brightness": 70 },
{ "entity": "light.hallway", "action": "turn_on", "brightness": 50 }
]
},
{
"id": "auto_climate_temp",
"name": "Auto Climate Control",
"trigger": {
"type": "sensor",
"entity": "sensor.temperature",
"above": 28
},
"actions": [
{ "entity": "climate.living_room", "action": "turn_on" },
{ "entity": "climate.living_room", "action": "set_temperature", "value": 25 }
]
}
]
}
Rule Management
User: Create a rule: automatically turn on AC when temperature exceeds 28 degrees
Agent: Sure, creating this rule...
[Create automation rule]
Rule created:
- Name: Auto Climate Control
- Trigger: Temperature sensor > 28°C
- Action: Turn on AC, set to 25°C
Would you like to add other conditions?
For example:
- Only trigger when someone is home
- Only active during specific time windows
- Send notification reminder
Integrated Experience
A Day of Smart Living
{
"dailyAutomations": [
{
"time": "07:00",
"name": "Good Morning",
"actions": ["Lights 30%", "AC 22°C", "Coffee machine on"]
},
{
"time": "08:30",
"name": "Leave Home",
"condition": "Location away from home",
"actions": ["All lights off", "AC off", "Security on"]
},
{
"time": "18:00",
"name": "Arrival Prep",
"condition": "15 min before arrival",
"actions": ["Living room lights on", "AC on", "Water heater on"]
},
{
"time": "22:00",
"name": "Sleep Prep",
"actions": ["Living room lights off", "Bedroom lights 30%", "AC 26°C"]
},
{
"time": "23:00",
"name": "Good Night",
"actions": ["All lights off", "AC sleep mode", "Security on"]
}
]
}
One-Click Scenes
User: I want to watch a movie
Agent: Activating Movie mode...
[Movie mode activated]
- ✅ Living room lights: Dimmed to 20%
- ✅ Curtains: Closed
- ✅ TV: On
- ✅ Sound system: Switched to movie mode
- ✅ AC: Comfort temperature 24°C
Would you like me to recommend a movie?
Summary
Building a smart home control center with OpenClaw:
- Device control: Lights, AC, appliances
- Automation scenes: Morning, Leave Home, Arrival, Sleep
- Voice control: Natural language commands
- Energy monitoring: Power stats and saving tips
- Security monitoring: Door/window sensors, motion detection, anomaly alerts
Changelog:
- 2026-02-26: Initial release
Series Navigation:
- ← Previous: Practice: Building a Coding Assistant
- → Next: Practice: Building a Team Collaboration Agent