Install
$ agentstack add skill-trtmn-agent-skills-home-assistant ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ● Network access Used
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ● Environment & secrets Used
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Home Assistant Control
This skill enables Claude to interact with a Home Assistant instance via its REST API — querying device states, controlling smart home devices, reviewing history, and working with automations.
Slash Command
When invoked via /home-assistant, ensure authentication is set up (see below), then ask the user what they'd like to do — for example: check device status, control lights, adjust the thermostat, view history, or manage automations.
Setup & Authentication
Configuration lives in ~/.config/home-assistant/.env. On first use, check if this file exists:
cat ~/.config/home-assistant/.env 2>/dev/null || echo "NOT_FOUND"
If the file exists, source it to load HA_URL and HA_TOKEN:
source ~/.config/home-assistant/.env
If the file doesn't exist, walk the user through setup:
- Explain what's needed: a Home Assistant URL and a Long-Lived Access Token
- Ask for their HA URL (e.g.,
http://192.168.1.100:8123orhttps://home.example.com) - Guide them to create a token: Go to their HA instance → Profile (bottom-left) → Security tab → scroll to "Long-Lived Access Tokens" → click "Create Token" → give it a name like "Claude" → copy the token
- Create the config:
mkdir -p ~/.config/home-assistant
cat > ~/.config/home-assistant/.env /scripts/discover_entities.sh
This lists all entities grouped by domain (lights, switches, sensors, etc.) with their current states. Use this output to map the user's natural language ("the kitchen light") to actual entity IDs (light.kitchen_ceiling).
If the user asks about a specific type of device, you can filter:
bash /scripts/discover_entities.sh light
bash /scripts/discover_entities.sh sensor
bash /scripts/discover_entities.sh climate
2. Query state
To check the current state of a specific entity:
curl -s -H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
"$HA_URL/api/states/"
The response includes state (the primary value) and attributes (detailed properties like brightness, temperature, friendly name, etc.).
3. Take action (with confirmation)
Before performing any action that changes device state, describe what you're about to do and ask the user to confirm. This applies to all service calls — turning things on/off, locking/unlocking, adjusting temperatures, triggering scenes, etc. The reason: smart home actions affect the physical world and can't be undone with ctrl-z.
To call a service:
curl -s -X POST \
-H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"entity_id": ""}' \
"$HA_URL/api/services//"
Common examples:
- Turn on a light:
domain=light,service=turn_on, data can includebrightness(0-255),color_temp,rgb_color - Turn off a light:
domain=light,service=turn_off - Toggle a switch:
domain=switch,service=toggle - Set thermostat:
domain=climate,service=set_temperature, data includestemperature - Lock/unlock:
domain=lock,service=lockorunlock - Trigger a scene:
domain=scene,service=turn_on - Run a script:
domain=script,service=turn_on(or the script's entity name)
4. Review history
To see what happened with an entity over time:
curl -s -H "Authorization: Bearer $HA_TOKEN" \
"$HA_URL/api/history/period/?filter_entity_id=&end_time=&minimal_response"
Timestamps use ISO 8601 format (e.g., 2025-01-15T08:00:00+00:00). The minimal_response flag reduces payload size.
For the logbook (human-readable event log):
curl -s -H "Authorization: Bearer $HA_TOKEN" \
"$HA_URL/api/logbook/?entity="
Working with automations
Home Assistant automations are entities in the automation domain. You can:
- List automations: Filter discovery output or query
/api/statesfor entities starting withautomation. - Trigger an automation: Call
automation/triggerservice - Enable/disable: Call
automation/turn_onorautomation/turn_off - View automation config: The entity's attributes contain the automation's configuration
To create or modify automations, you'd need to edit the HA configuration files directly (typically automations.yaml), which is outside the scope of the REST API. If the user asks for this, let them know and offer to help draft the YAML instead.
Rendering templates
Home Assistant supports Jinja2 templates for dynamic values. To evaluate a template:
curl -s -X POST \
-H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"template": "{{ states(\"sensor.temperature\") }}"}' \
"$HA_URL/api/template"
This is useful when the user wants computed values or complex state queries.
Error handling
- 401 Unauthorized: Token is invalid or expired. Ask the user to regenerate it.
- 404 Not Found: Entity doesn't exist. Run discovery to find the correct entity_id.
- 400 Bad Request: Usually means malformed service data. Check the service's expected parameters by querying
/api/services.
When a call fails, show the user the error response and suggest what to fix. Don't silently retry.
Tips for natural language mapping
Users will say things like "turn off the bedroom light" rather than giving you entity IDs. To handle this:
- Run discovery to get all entities
- Look at
friendly_nameattributes to match natural language to entity IDs - If ambiguous (multiple "bedroom" lights), ask the user which one they mean
- Cache the entity list mentally within the conversation — no need to re-discover every time
Reference
For the complete REST API endpoint reference (all endpoints, parameters, and response formats), read references/rest-api.md.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: trtmn
- Source: trtmn/agent-skills
- License: Unlicense
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.