| name | home-assistant |
| description | Manage Home Assistant via ha-mcp (API) and SSH (config-level). Covers automations, dashboards, entity registry, and log analysis. |
| user-invocable | true |
Home Assistant Management
Environment
Tool Selection
Use ha-mcp for:
- Listing, creating, editing, enabling/disabling automations
- Controlling entities and calling services
- Querying entity states and device info
- Creating and managing helpers (input_boolean, input_number, etc.)
- Dashboard operations supported by the API
Use SSH for:
- Reading/writing YAML config files directly
- Editing
.storage files (entity registry, device registry, core.config_entries)
- Log analysis and debugging
- Supervisor operations (restart, reload, check, update)
- Anything ha-mcp can't do or when you need to see raw config
Default to ha-mcp. Only SSH when the API can't do what's needed.
Key File Paths (via SSH)
/config/configuration.yaml # Main config
/config/automations.yaml # All automations
/config/scripts.yaml # Scripts
/config/scenes.yaml # Scenes
/config/customize.yaml # Entity customizations
/config/.storage/ # Internal registries
/config/.storage/core.entity_registry # Entity IDs, names, disabled status
/config/.storage/core.device_registry # Device info
/config/.storage/core.config_entries # Integration configs
/config/.storage/lovelace.dashboards # Dashboard registry
/config/.storage/lovelace # Default dashboard config
SSH Command Patterns
ssh homeassistant 'cat /config/automations.yaml'
ssh homeassistant 'cat > /tmp/patch.yaml << "PATCH"
<content>
PATCH
'
ssh homeassistant 'ha core check'
ssh homeassistant 'ha core restart'
ssh homeassistant 'ha core logs'
ssh homeassistant 'ha supervisor logs'
ssh homeassistant 'ha addons logs core_ssh'
ssh homeassistant 'source /config/.env && curl -s -H "Authorization: Bearer $HA_TOKEN" http://172.30.32.1:8123/api/states' | python3 -m json.tool
ssh homeassistant 'source /config/.env && curl -s -H "Authorization: Bearer $HA_TOKEN" -X POST http://172.30.32.1:8123/api/services/automation/reload'
ssh homeassistant 'source /config/.env && curl -s -H "Authorization: Bearer $HA_TOKEN" -X POST http://172.30.32.1:8123/api/services/script/reload'
ssh homeassistant 'source /config/.env && curl -s -H "Authorization: Bearer $HA_TOKEN" -X POST http://172.30.32.1:8123/api/services/scene/reload'
ssh homeassistant 'source /config/.env && curl -s -H "Authorization: Bearer $HA_TOKEN" -X POST http://172.30.32.1:8123/api/services/homeassistant/reload_core_config'
Automation Management
Creating automations
- Prefer ha-mcp for creating automations — it handles YAML syntax and ID generation.
- For complex automations or bulk edits, SSH into
/config/automations.yaml.
- Every automation needs a unique
id (use lowercase with underscores, e.g. kitchen_motion_light).
- Always specify
mode: explicitly (single, restart, queued, parallel).
Editing automations
- Try ha-mcp first.
- If editing YAML directly via SSH:
- Read the full file first:
ssh homeassistant 'cat /config/automations.yaml'
- Make targeted edits — never regenerate the entire file.
- Validate:
ssh homeassistant 'ha core check'
- Reload: use the automation reload curl command above (no restart needed).
Debugging automations
- Check if it's enabled: query state via ha-mcp or
ssh homeassistant 'source /config/.env && curl -s -H "Authorization: Bearer $HA_TOKEN" http://172.30.32.1:8123/api/states/automation.<id>'
- Check logs:
ssh homeassistant 'ha core logs' | grep -i automation
- Trigger manually via ha-mcp or:
ssh homeassistant 'source /config/.env && curl -s -H "Authorization: Bearer $HA_TOKEN" -X POST http://172.30.32.1:8123/api/services/automation/trigger -d "{\"entity_id\": \"automation.<id>\"}"'
- Check trace: HA UI → Settings → Automations → click automation → Traces tab
Best practices
- Prefer native triggers/conditions over Jinja2 templates where possible.
- Use
choose: for branching logic instead of multiple automations.
- Use
input_boolean helpers for conditional enable/disable rather than removing automations.
- Use
trigger.id with choose: when an automation has multiple triggers.
- Set
max_exceeded: silent on automations that may fire frequently.
Dashboard / Lovelace Management
Via SSH
Dashboard configs live in /config/.storage/lovelace (default) and /config/.storage/lovelace.dashboards (custom dashboards).
ssh homeassistant 'cat /config/.storage/lovelace' | python3 -m json.tool
ssh homeassistant 'cat /config/.storage/lovelace.dashboards' | python3 -m json.tool
Editing dashboards
- For simple changes, use ha-mcp if it supports the operation.
- For direct edits via SSH:
- Stop HA core first if editing
.storage files: ssh homeassistant 'ha core stop'
- Back up the file:
ssh homeassistant 'cp /config/.storage/lovelace /config/.storage/lovelace.bak'
- Edit the JSON.
- Start HA core:
ssh homeassistant 'ha core start'
- For YAML-mode dashboards defined in
configuration.yaml, edit the YAML file and reload.
Best practices
- Use sections view (
type: sections) for new dashboards — it's the modern default.
- Prefer
type: tile cards for entity control.
- Group cards by area/room.
- Use
type: conditional to show/hide cards based on state.
Entity Registry Operations
The entity registry lives at /config/.storage/core.entity_registry. It's a JSON file.
Reading
ssh homeassistant 'cat /config/.storage/core.entity_registry' | python3 -m json.tool
ssh homeassistant 'cat /config/.storage/core.entity_registry' | python3 -c "
import json, sys
data = json.load(sys.stdin)
for e in data[\"data\"][\"entities\"]:
if \"kitchen\" in e.get(\"entity_id\", \"\").lower():
print(json.dumps(e, indent=2))
"
Modifying (rename, disable, delete)
This requires stopping HA core to prevent the registry being overwritten on shutdown.
ssh homeassistant 'ha core stop'
ssh homeassistant 'cp /config/.storage/core.entity_registry /config/.storage/core.entity_registry.bak'
ssh homeassistant 'python3 << "SCRIPT"
import json
with open("/config/.storage/core.entity_registry") as f:
data = json.load(f)
for e in data["data"]["entities"]:
if e["entity_id"] == "light.old_name":
e["entity_id"] = "light.new_name"
# Also update unique_id if needed
with open("/config/.storage/core.entity_registry", "w") as f:
json.dump(data, f, indent=2)
SCRIPT'
ssh homeassistant 'ha core start'
Disabling an entity
Same stop/edit/start pattern. Set "disabled_by": "user" on the entity. Set to null to re-enable.
Log Analysis and Debugging
Reading logs
ssh homeassistant 'ha core logs' | tail -200
ssh homeassistant 'ha core logs --follow'
ssh homeassistant 'ha supervisor logs' | tail -100
ssh homeassistant 'ha core logs' | grep -i 'zwave\|zigbee\|mqtt\|<integration>'
ssh homeassistant 'ha core logs' | grep -iE '(error|warning|exception|traceback)'
Common debugging patterns
- Automation not firing: Check logs for the automation ID, verify trigger entity exists, check conditions, manually trigger to test.
- Entity unavailable: Check integration logs, verify device is online, check config entries in
.storage/core.config_entries.
- Integration failing:
ssh homeassistant 'ha core logs' | grep -i <integration_name> — look for auth errors, connection timeouts, API changes.
- Performance issues:
ssh homeassistant 'ha core logs' | grep -i 'took too long\|timeout\|slow'
Checking HA info
ssh homeassistant 'ha core info'
ssh homeassistant 'ha supervisor info'
ssh homeassistant 'ha host info'
ssh homeassistant 'ha network info'
Safety Rules
- Always read before writing. Never generate a full config file from scratch — read the existing one and make targeted edits.
- Validate before restart. Run
ha core check before any restart.
- Prefer reload over restart. Use domain-specific reload endpoints when possible (automations, scripts, scenes). Only restart for
configuration.yaml changes.
- Back up before .storage edits. Always
cp the file before modifying it.
- Stop core before .storage writes. HA overwrites
.storage files on shutdown — if you edit while running, your changes will be lost.
- Never store tokens in plain files other than
/config/.env.
- Test automations after changes. Trigger manually and check logs to verify behavior.
- Preserve formatting. When editing YAML, maintain existing indentation and comment style. When editing JSON
.storage files, maintain the structure.