homelab-codex-ws/scripts/ha/tests/fixtures/api_automation_config_111.json
oskar 5b9111afa7 feat(ha): api adapter for import.sh
ken is HAOS (no SSH/docker exec path), so it needs a REST/WebSocket-only
adapter: automations/scripts/scenes via one GET per
/api/config/<domain>/config/<id>, dashboards/area+entity registries/
input_* helpers via the HA WebSocket API (read-only commands only).

scripts/ha/lib/ha_api.py and ha_ws.py never take a token as a value —
only a token_path, read from disk in-process — so the bearer token never
touches a subprocess argv or a log line. ha_ws.py depends on the optional
websocket-client package and raises a clear, actionable ImportError if
it's missing rather than a raw traceback; import.sh still completes the
REST-only part of the import in that case.

Automations/scripts/scenes reuse split.write_split() so both adapters
produce byte-identical config/<instance>/ layouts and the same
idempotent stale-file cleanup on re-run.

docker-exec adapter logic is untouched.
2026-07-22 18:07:26 +02:00

22 lines
337 B
JSON

{
"id": "111",
"alias": "Morning lights",
"description": "",
"trigger": [
{
"platform": "time",
"at": "07:00:00"
}
],
"condition": [],
"action": [
{
"type": "turn_on",
"device_id": "abc123",
"entity_id": "light.living_room",
"domain": "light"
}
],
"mode": "single"
}