Install
openclaw skills install smart-home-assistantMonitor and analyze Home Assistant energy consumption. Use when the user asks about power usage, energy monitoring, consumption by room/area, or wants to generate Home Assistant automations based on power thresholds. Do NOT use for device control, scene management, or general Home Assistant configuration tasks outside energy analysis.
openclaw skills install smart-home-assistantAnalyze real-time energy consumption from your Home Assistant instance. Identifies the highest consumers, groups usage by room/area, and generates actionable automations.
unit_of_measurement set to W or kWSet the environment variable before running:
export HA_TOKEN="your-home-assistant-long-lived-access-token"
The skill reads smart_home/skill.yaml for all other settings:
home_assistant:
url: "http://homeassistant.local:8123" # Your HA URL
token: "${HA_TOKEN}" # Resolved from env var
units:
power: ["W", "kW"]
energy: ["Wh", "kWh"]
rules:
- name: "High Power Shutoff"
threshold_watts: 2000 # Trigger above this
time_window: { after: "06:00", before: "22:00" }
require_occupancy: "off" # Only trigger when unoccupied
action: "turn_off" # turn_off, turn_on, or notify
outputs:
default: ["summary", "table"] # Formats produced when none specified
| Field | Default | Description |
|---|---|---|
home_assistant.url | Required | HA instance URL |
home_assistant.token | Required | Long-lived access token (use ${HA_TOKEN} env var) |
rules[].threshold_watts | 2000 | Power threshold for automation triggers |
rules[].time_window.after | "06:00" | Automation active after this time |
rules[].time_window.before | "22:00" | Automation active before this time |
rules[].require_occupancy | "off" | Occupancy state required for trigger |
rules[].action | "turn_off" | Action: turn_off, turn_on, or notify |
outputs.default | ["summary", "table"] | Output formats when none specified |
Three formats, selectable per request. Request by name: summary, table, automation.
summary — Text InsightA 2-3 sentence human-readable energy snapshot:
Laundry is drawing 2,200W — 57% of your total 3,842W. The Dryer is the single highest consumer at 2,200W. No anomalies detected.
table — Markdown Comparison| Area | Device | Consumption (W) |
|---|---|---|
| Laundry | Dryer | 2,200.0 |
| Kitchen | Fridge | 180.5 |
| Unassigned | Smart Plug 3 | 45.0 |
Sorted by consumption descending, grouped by area.
automation — HA Automation JSONGenerates a JSON payload ready for Home Assistant's automation.create service:
[
{
"alias": "High Power Alert - Laundry",
"trigger": {
"platform": "numeric_state",
"entity_id": "sensor.dryer_power",
"above": 2000
},
"condition": [
{
"condition": "time",
"after": "06:00:00",
"before": "22:00:00"
},
{
"condition": "state",
"entity_id": "binary_sensor.laundry_occupancy",
"state": "off"
}
],
"action": {
"service": "switch.turn_off",
"target": { "entity_id": "switch.dryer" }
}
}
]
Conditions are generated based on your config rules:
threshold_watts get automationstime_window configbinary_sensor.<area>_occupancy in your entities. Omitted if no occupancy sensor exists for that area.The skill runs a three-stage pipeline:
FETCH ANALYZE FORMAT
HA REST API → Filter energy → Summary
/api/states entities Markdown table
Area registry Normalize kW→W Automation JSON
Device reg. Group by area
Rank consumers
Entity detection: The skill identifies energy entities by checking for a numeric state value and a unit_of_measurement of W, kW, kWh, or Wh. Power values are auto-detected from the entity state, falling back to power, current_power, or power_consumption attributes.
Area mapping: Entities are mapped to rooms using the Home Assistant device and area registries. Entities without an area assignment appear under "Unassigned".
Read-only: This skill never modifies Home Assistant state. The automation JSON is a draft payload for you to review and apply manually.
| Problem | Cause | Fix |
|---|---|---|
| "HA_URL is not configured" | Missing home_assistant.url in skill.yaml | Add your HA URL to smart_home/skill.yaml |
| "HA_TOKEN is not configured" | Env var not set | Run export HA_TOKEN="your-token" |
| "Cannot reach Home Assistant" | Network or URL issue | Verify HA is running and URL is correct |
| "No energy data available" | No matching entities | Ensure devices report unit_of_measurement: W or kW |
| All devices show "Unassigned" | No area registry data | Assign devices to areas in HA Settings > Areas |
| Automation JSON is empty | No devices exceed threshold | Lower threshold_watts in config |