homelab-codex-ws/scripts/ha/tests/fixtures/api_states.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

40 lines
748 B
JSON

[
{
"entity_id": "automation.morning_lights",
"state": "on",
"attributes": {
"id": "111",
"friendly_name": "Morning lights"
}
},
{
"entity_id": "automation.legacy_yaml_automation",
"state": "on",
"attributes": {
"friendly_name": "Legacy YAML automation (no storage id)"
}
},
{
"entity_id": "script.demo_script",
"state": "off",
"attributes": {
"friendly_name": "Demo script"
}
},
{
"entity_id": "scene.demo_scene",
"state": "scening",
"attributes": {
"id": "222",
"friendly_name": "Demo scene"
}
},
{
"entity_id": "input_boolean.on_leave",
"state": "off",
"attributes": {
"friendly_name": "On leave"
}
}
]