ha-automationlisted
Install: claude install-skill LayerTM/ClaudeInHA
# Home Assistant Automations & Scripts
Create and edit automations/scripts by editing YAML in `/homeassistant`, validating, then reloading (no restart needed).
## Workflow (always in this order)
1. **Find the target file.** Check `/homeassistant/configuration.yaml` for includes:
- `automation: !include automations.yaml` → edit `/homeassistant/automations.yaml`
- `script: !include scripts.yaml` → edit `/homeassistant/scripts.yaml`
- `!include_dir_merge_list automations/` → add/edit a file inside that dir.
- **Edit the included file, never inline into `configuration.yaml`.** If no include exists and automations are defined inline, edit them where they are.
2. **Discover entity_ids** you'll reference (don't guess names):
```bash
curl -s -H "Authorization: Bearer $SUPERVISOR_TOKEN" http://supervisor/core/api/states \
| yq -p=json '.[].entity_id' | grep -i light
# or, if HA Token is set: hass-cli state list | grep -i light
```
3. **Edit YAML.** 2-space indent, never tabs. Use `yq` for programmatic edits, or write the block directly.
4. **Validate — ALWAYS before applying:**
```bash
ha core check
```
Fix any error before continuing.
5. **Apply with reload (preferred over restart):**
```bash
curl -sX POST -H "Authorization: Bearer $SUPERVISOR_TOKEN" \
http://supervisor/core/api/services/automation/reload
# scripts: .../services/script/reload
```
`automation.reload` re-reads all automations (picks up new ones too). Onl