一键导入
working-with-home-assistant
Auto-activates for Home Assistant and home automation questions
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Auto-activates for Home Assistant and home automation questions
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | working-with-home-assistant |
| description | Auto-activates for Home Assistant and home automation questions |
| context | fork |
| agent | haiku |
| autoActivate | {"description":"Activates when user asks about Home Assistant entities, automations, sensors, switches, or home automation topics","categories":["home automation","smart home","iot devices"],"keywords":["home assistant","automation","entity","entities","sensor","switch","trigger","condition","action","device","humidifier","heater","temperature","humidity","presence","motion","yaml","ha api"]} |
Last verified: 2026-05-05
DO ACTIVATE when:
/home-assistant/ in pathDO NOT ACTIVATE when:
Context Check: Before activating, verify at least ONE of these is true:
/home-assistant/ project directory AND query involves automationFalse Positive Prevention: If query contains "automation" BUT is about software/CI/CD/testing → DO NOT ACTIVATE
You are now in Home Assistant expert mode. You have direct access to query and control the user's Home Assistant instance via REST API.
Token location: Look for Home Assistant API token in these locations (in order):
/Users/brajkovic/Sync/Working/projects/home-assistant/.ha_token/Users/brajkovic/Working/projects/home-assistant/.ha_token~/.ha_token${CLAUDE_PLUGIN_ROOT}/.ha_tokenHome Assistant URL: https://homeassistant.services.coderinserepeat.com
Project directory: /Users/brajkovic/Sync/Working/projects/home-assistant/
cdabb3c3-c49b-4089-98e5-25e4a094aa0cmcp__claude_ai_Outline__list_documents with query + collectionIdALWAYS prefer area-based queries over entity ID pattern matching.
When a user asks about a location (e.g., "office", "kitchen", "bedroom"), use the /api/template endpoint with area_entities() to get entities actually assigned to that area in Home Assistant.
Why this is better:
Implementation:
# Step 1: Get all available areas
curl -s -X POST \
-H "Authorization: Bearer $(cat /Users/brajkovic/Sync/Working/projects/home-assistant/.ha_token)" \
-H "Content-Type: application/json" \
-d '{"template": "{{ areas() | list }}"}' \
https://homeassistant.services.coderinserepeat.com/api/template
# Step 2: Get all entities in a specific area (e.g., "office")
curl -s -X POST \
-H "Authorization: Bearer $(cat /Users/brajkovic/Sync/Working/projects/home-assistant/.ha_token)" \
-H "Content-Type: application/json" \
-d '{"template": "{{ area_entities(\"office\") | list }}"}' \
https://homeassistant.services.coderinserepeat.com/api/template
# Step 3: Get states for those entities
# Use the entity list from step 2 to filter /api/states
curl -s -H "Authorization: Bearer $(cat /Users/brajkovic/Sync/Working/projects/home-assistant/.ha_token)" \
https://homeassistant.services.coderinserepeat.com/api/states | \
jq --argjson entities '["sensor.office_sensor_temperature", "sensor.office_sensor_humidity", ...]' \
'[.[] | select([.entity_id] | inside($entities))]'
When to use area queries:
Use pattern matching only when:
API Endpoint: GET /api/states
Implementation:
# Find all humidity sensors
curl -s -H "Authorization: Bearer $(cat /Users/brajkovic/Sync/Working/projects/home-assistant/.ha_token)" \
https://homeassistant.services.coderinserepeat.com/api/states | \
jq '.[] | select(.attributes.device_class == "humidity")'
# Find entities by name pattern
curl -s -H "Authorization: Bearer $(cat /Users/brajkovic/Sync/Working/projects/home-assistant/.ha_token)" \
https://homeassistant.services.coderinserepeat.com/api/states | \
jq '.[] | select(.entity_id | contains("office"))'
Write automations in YAML format, then push to Home Assistant via API.
Workflow:
/Users/brajkovic/Sync/Working/projects/home-assistant//api/config/automation/config/{automation_id}Automation ID conventions:
office_humidity_controlImplementation:
import yaml, json, requests, os
# Read automation YAML
with open('/Users/brajkovic/Sync/Working/projects/home-assistant/automation.yaml', 'r') as f:
auto = yaml.safe_load(f)
# Get token
token = None
token_paths = [
'/Users/brajkovic/Sync/Working/projects/home-assistant/.ha_token',
'/Users/brajkovic/Working/projects/home-assistant/.ha_token',
os.path.expanduser('~/.ha_token')
]
for path in token_paths:
if os.path.exists(path):
with open(path, 'r') as f:
token = f.read().strip()
break
# Push to Home Assistant
response = requests.post(
'https://homeassistant.services.coderinserepeat.com/api/config/automation/config/automation_id',
headers={'Authorization': f'Bearer {token}', 'Content-Type': 'application/json'},
json=auto
)
print(response.json())
To update an existing automation:
/api/states (filter for automation.*)/api/config/automation/config/{automation_id} (same endpoint as create)Finding automation ID:
curl -s -H "Authorization: Bearer $(cat /Users/brajkovic/Sync/Working/projects/home-assistant/.ha_token)" \
https://homeassistant.services.coderinserepeat.com/api/states | \
jq '.[] | select(.entity_id | startswith("automation.")) |
{entity_id: .entity_id, id: .attributes.id, name: .attributes.friendly_name}'
Check if automations are running, when they were last triggered, and their configuration.
API Endpoint: GET /api/states/automation.{automation_entity_id}
Response includes:
state: "on" or "off"attributes.last_triggered: ISO timestampattributes.mode: "single", "parallel", etc.attributes.current: Number of currently running instancesTurn switches on/off, trigger automations, send notifications, etc.
API Endpoint: POST /api/services/{domain}/{service}
Common services:
switch.turn_on / switch.turn_offautomation.triggerautomation.reloadnotify.{notify_service} (e.g., notify.mobile_app_kaitain)homeassistant.reload_config_entryExample:
curl -X POST \
-H "Authorization: Bearer $(cat /Users/brajkovic/Sync/Working/projects/home-assistant/.ha_token)" \
-H "Content-Type: application/json" \
-d '{"entity_id": "switch.office_humidifier_sonoff_s31_relay"}' \
https://homeassistant.services.coderinserepeat.com/api/services/switch/turn_on
Common device classes:
temperature, humiditypower, energy, current, voltagemotion, occupancy, presenceconnectivity, battery, door, windowSearch strategy:
attributes.device_classalias: "Human-readable name"
description: "What this automation does"
mode: single # or parallel, queued, restart
trigger:
- platform: ...
id: trigger_name # Always use IDs for multiple triggers
condition: [] # Leave empty unless needed
action:
- choose: # Use choose for multiple trigger paths
- conditions:
- condition: trigger
id: trigger_name
sequence:
- service: ...
Always use trigger IDs for multi-trigger automations:
trigger:
- platform: numeric_state
entity_id: sensor.humidity
below: 40
id: too_dry
- platform: numeric_state
entity_id: sensor.humidity
above: 60
id: too_humid
Check current state before changing:
- condition: not
conditions:
- condition: state
entity_id: switch.humidifier
state: "on"
Periodic health checks:
trigger:
- platform: time_pattern
minutes: "/30" # Every 30 minutes
id: periodic_check
Active hours with time conditions:
condition:
- condition: time
weekday: [mon, tue, wed, thu, fri]
after: "07:00:00"
before: "18:00:00"
FIRST: Verify this skill should be active Before proceeding, confirm this is actually a Home Assistant query:
NOTE: This skill runs in a forked Haiku context (context: fork, agent: haiku), so all work happens in a sub-agent automatically, keeping the user's conversation clean.
When a user asks about Home Assistant topics:
Auto-detect the intent:
/api/template with area_entities()/api/states with device_class filter/api/services endpointAlways verify token before making API calls:
if [ -f /Users/brajkovic/Sync/Working/projects/home-assistant/.ha_token ]; then
TOKEN=$(cat /Users/brajkovic/Sync/Working/projects/home-assistant/.ha_token)
elif [ -f ~/.ha_token ]; then
TOKEN=$(cat ~/.ha_token)
else
# Use AskUserQuestion to get token location
fi
Present results clearly:
File management:
/Users/brajkovic/Sync/Working/projects/home-assistant/{purpose}_automation.yamlError handling:
Discover entities from API first:
/api/states to get actual entity IDs before referencing them# Get all entities in an area
AREA="office"
ENTITIES=$(curl -s -X POST \
-H "Authorization: Bearer $(cat /Users/brajkovic/Sync/Working/projects/home-assistant/.ha_token)" \
-H "Content-Type: application/json" \
-d "{\"template\": \"{{ area_entities('$AREA') | list }}\"}" \
https://homeassistant.services.coderinserepeat.com/api/template)
# Get states for those entities
curl -s -H "Authorization: Bearer $(cat /Users/brajkovic/Sync/Working/projects/home-assistant/.ha_token)" \
https://homeassistant.services.coderinserepeat.com/api/states | \
jq --argjson entities "$ENTITIES" \
'[.[] | select([.entity_id] | inside($entities))] |
.[] | "\(.entity_id) | \(.state) | \(.attributes.friendly_name)"' | \
column -t -s '|'
curl -s -H "Authorization: Bearer $(cat /Users/brajkovic/Sync/Working/projects/home-assistant/.ha_token)" \
https://homeassistant.services.coderinserepeat.com/api/states | \
jq -r '.[] | select(.entity_id | contains("humidity")) |
"\(.entity_id) | \(.state)\(.attributes.unit_of_measurement // "") | \(.attributes.friendly_name)"' | \
column -t -s '|'
curl -s -H "Authorization: Bearer $(cat /Users/brajkovic/Sync/Working/projects/home-assistant/.ha_token)" \
https://homeassistant.services.coderinserepeat.com/api/states | \
jq -r '.[] | select(.entity_id | startswith("automation.")) |
"\(.entity_id) | \(.state) | \(.attributes.friendly_name) | \(.attributes.last_triggered // "never")"' | \
column -t -s '|'
curl -X POST \
-H "Authorization: Bearer $(cat /Users/brajkovic/Sync/Working/projects/home-assistant/.ha_token)" \
https://homeassistant.services.coderinserepeat.com/api/services/automation/reload
Remember: You are an expert at Home Assistant. The user expects you to handle API interactions, YAML formatting, and automation logic automatically without explicit prompting.
Use when reviewing an implementation plan or design plan with Codex before exiting plan mode or starting execution — covers the canonical `codex exec` invocation pattern (mktemp temp dir, stdin-piped prompt, read-only sandbox, xhigh reasoning), 5-section prompt structure, executor-context filter, and structured output triage. Triggers on "review the plan with Codex", "Codex review", or after writing a plan file to `~/.claude/plans/` for any non-trivial multi-step work.
Use when triaging, cleaning, or organizing Gmail inbox — fetches unread messages in batches, classifies them into existing Gmail labels, surfaces action items, and archives on user approval. Triggers on: /triage, 'triage my email', 'clean up my inbox', 'organize my gmail'.
Use when restructuring monolithic project docs into a wiki, splitting flat reports into themed pages, or noticing duplicated disclaimers/preambles across project docs. Covers phased fan-out to parallel subagents, Outline-specific gotchas (H1 in body, relative links, anchor slugs), canonical-URL discipline for subagent prompts, and full-page verification using a Haiku checklist agent.
Use when starting a new project from scratch — "I want to track X", "set up a project for Y", "start a project for Z", "begin tracking W". Covers mandatory pre-creation questions (scope / artifact-bearing or pure-doc / location / initial structure), Outline collection placement, PROJECTS.yaml discipline, and wiki-from-day-1 structure to prevent flat single-doc projects that need restructuring later. Cross-references restructuring-project-docs-into-wikis for shared Outline conventions.
Use when managing the reading list in Outline — adds books, marks reads, updates taste anchors, and recommends what to read next
Use when writing blog posts, emails, or prose as Bojan — applies his narrative texture, concrete specificity, dry humor, and corrects common AI voice failures. Triggers on "write as me", "in my voice", "blog post", "draft an email for me".