Add the Panama Home Assistant bridge

This commit is contained in:
Gabriel Brown
2026-08-17 13:27:11 -04:00
parent 3a903934c0
commit 173c00fca7
3 changed files with 651 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -euo pipefail
fail() {
printf 'Home Assistant helper contract: %s\n' "$1" >&2
exit 1
}
project_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
helper="$project_root/config/dot/quickshell/scripts/panama-home-assistant"
[[ -x "$helper" ]] || fail 'helper is missing or not executable'
probe="$($helper probe)"
jq -e '
.configured == true and
.reachable == true and
(.entityCount | type == "number" and . > 0) and
.error == ""
' <<<"$probe" >/dev/null || fail 'live API probe failed'
snapshot="$($helper snapshot)"
jq -e --argjson expected "$(jq '.entityCount' <<<"$probe")" '
.ok == true and
.configured == true and
.error == "" and
(.generatedAt | type == "number") and
(.entities | type == "array" and length == $expected) and
([.entities[] | (keys | sort) == (["active", "available", "domain", "id", "name", "state"] | sort)] | all) and
([.entities[] | (.active | type == "boolean") and (.available | type == "boolean")] | all)
' <<<"$snapshot" >/dev/null || fail 'live snapshot shape is invalid'
printf 'Home Assistant helper contract: PASS (configured=true, %s favourites; contents redacted)\n' \
"$(jq '.entities | length' <<<"$snapshot")"