Connects your project to Home Assistant's API for smart home control and data ingestion. The skill walks you through getting your Long-Lived Access Token, validates the connection with a curl test, then provides Python and Node.js reference docs. The interesting bit is it pushes you toward WebSocket commands like subscribe_trigger and execute_script instead of polling, which means you write less code and lean on Home Assistant's automation engine. If you're building dashboards, custom automations, or want to pipe sensor data into another system, this gets you set up properly. The URL normalization step alone will save you ten minutes of debugging.
npx -y skills add balloob/llm-skills --skill home-assistant --agent claude-codeInstalls into .claude/skills of the current project.
This skill helps users integrate Home Assistant into their projects, whether to control smart home devices or to ingest sensor data and state information. The skill guides users through connection setup, validates credentials, and provides comprehensive API reference documentation for both Python and Node.js.
Use this skill when users want to:
Collect two pieces of information from the user:
If the user provides a URL with a path component (e.g., http://homeassistant.local:8123/lovelace/dashboard), normalize it by removing everything after the host and port. The base URL should only include the scheme, host, and port:
http://homeassistant.local:8123http://homeassistant.local:8123/lovelace/dashboardIf users don't know where to find their Long-Lived Access Token, provide these instructions:
Use curl to test the connection and retrieve Home Assistant configuration information.
curl -X GET \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
<URL>/api/config
Example:
curl -X GET \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "Content-Type: application/json" \
http://homeassistant.local:8123/api/config
Success output:
{
"location_name": "Home",
"latitude": 37.7749,
"longitude": -122.4194,
"elevation": 0,
"unit_system": {
"length": "km",
"mass": "g",
"temperature": "°C",
"volume": "L"
},
"time_zone": "America/Los_Angeles",
"version": "2024.1.0",
"config_dir": "/config",
"allowlist_external_dirs": [],
"allowlist_external_urls": [],
"components": ["automation", "light", "switch", ...],
"config_source": "storage"
}
Key information from the response:
version: Home Assistant version (e.g., "2024.1.0")location_name: Name of the Home Assistant instancetime_zone: Configured time zonecomponents: List of loaded components/integrationsFailure scenarios:
Authentication failure (401):
{"message": "Invalid authentication"}
Connection failure:
curl: (7) Failed to connect to homeassistant.local port 8123: Connection refused
If authentication fails, verify:
Once the connection is validated, help the user implement their integration based on their programming language and requirements.
IMPORTANT: The following WebSocket API commands form the core of how users should interact with Home Assistant. These leverage the automation engine and keep scripts minimal by using native Home Assistant syntax.
These commands require WebSocket API connection and provide the most powerful and flexible way to interact with Home Assistant:
Use this when: You want to be notified when specific conditions occur (state changes, time patterns, webhooks, etc.)
Command structure:
{
"type": "subscribe_trigger",
"trigger": {
"platform": "state",
"entity_id": "binary_sensor.motion_sensor",
"to": "on"
},
"variables": {
"custom_var": "value"
}
}
Why use this: Instead of subscribing to all state changes and filtering, subscribe directly to the triggers you care about. This is more efficient and uses Home Assistant's native trigger syntax.
Use this when: You need to check if a condition is met without implementing the logic in your script
Command structure:
{
"type": "test_condition",
"condition": {
"condition": "numeric_state",
"entity_id": "sensor.temperature",
"above": 20
},
"variables": {
"custom_var": "value"
}
}
Why use this: Offload condition logic to Home Assistant. Your script stays simple while using Home Assistant's powerful condition engine.
Use this when: You need to execute a sequence of actions, including wait_for_trigger, delays, service calls, and more
Command structure:
{
"type": "execute_script",
"sequence": [
{
"service": "light.turn_on",
"target": {"entity_id": "light.living_room"}
},
{
"wait_for_trigger": [
{
"platform": "state",
"entity_id": "binary_sensor.motion",
"to": "off",
"for": {"minutes": 5}
}
]
},
{
"service": "light.turn_off",
"target": {"entity_id": "light.living_room"}
}
],
"variables": {
"custom_var": "value"
}
}
Why use this:
wait_for_trigger to wait for eventsExample with response data:
{
"type": "execute_script",
"sequence": [
{
"service": "weather.get_forecasts",
"target": {"entity_id": "weather.home"},
"response_variable": "weather_data"
},
{
"stop": "Done",
"response_variable": "weather_data"
}
]
}
To understand Home Assistant's information architecture, also use:
If the user is building an application that wants to represent the current state of the home, use:
For Python-based projects, refer to the Python API reference:
references/python_api.mdFor Node.js-based projects, refer to the Node.js API reference:
references/node_api.mdhome-assistant-js-websocket libraryIf users want to test their code without connecting to a real Home Assistant instance, they can use empty-hass, a CLI tool that starts an empty Home Assistant instance with pre-configured authentication.
Run empty-hass using uvx (requires Python with uv installed):
uvx --from git+https://github.com/balloob/empty-hass empty-hass
This will start a Home Assistant instance on http://localhost:8123 with:
Run with --help to see available options and login credentials:
uvx --from git+https://github.com/balloob/empty-hass empty-hass --help
This is useful for:
Read sensor states and display them in a custom dashboard or monitoring application.
Subscribe to entity state changes and trigger custom actions based on conditions.
Call Home Assistant services from external events (webhooks, scheduled jobs, user actions).
Retrieve historical data from Home Assistant for analysis or backup purposes.
sickn33/antigravity-awesome-skills
moizibnyousaf/ai-agent-skills
github/awesome-copilot