feat: Home Assistant OS driver over the WebSocket API (0.1.0) #1

Merged
christianmanivong merged 2 commits from feature/driver into main 2026-12-03 01:05:27 +00:00
Owner

First version of the driver for Home Assistant OS and Supervised installs (NetOrk/netork#3068).

How it connects: Home Assistant's WebSocket API (/api/websocket) with an administrator's long-lived access token. An administrator's supervisor/api messages reach the Supervisor, which carries every getter and action. No add-on, no SSH. Over TLS, the certificate is checked against tls_fingerprints (device-types CertificateCheck) before the token is sent.

Getters: facts, interfaces/IPs, host status (pending reboot, data disk), pending updates (Core, OS, Supervisor, add-ons), add-ons as services, running backups.
Actions: apply updates (add-ons → Supervisor → Core → OS; after Core it waits for Home Assistant to come back), add-on start/stop/restart and start at boot, refresh updates, reboot and shutdown.

Deviation from STANDARDS §4, decided 2026-12-03: the fixtures are not recordings. They are built from the answer shapes in the Supervisor 2026.11.0 source (supervisor/api/*.py), with anonymised values of a HAOS 18.4 VM. They will be replaced by recordings once the first Home Assistant is onboarded. tests/fixtures/README.md says so.

Tested:

  • Fixtures only: 90 tests, coverage 100 %, mypy --strict, ruff, bandit and napalm-standard check/ratchet clean.
  • The live WebSocket/TLS path (excluded from coverage) was driven against a local stand-in server that speaks HA's auth and result protocol:
    • login and refused token
    • getters, with events in between
    • reboot with the connection dropping
    • TLS with a pinned fingerprint, plus a refused fingerprint (the token is never sent), a CA failure and connection refused
  • Not yet run against a real device.

Floors: napalm-device-types ≥ 4.56 (ServiceDict.result, SERVICE_RESULT_*), websockets ≥ 13.

First version of the driver for Home Assistant OS and Supervised installs (NetOrk/netork#3068). **How it connects:** Home Assistant's WebSocket API (`/api/websocket`) with an administrator's long-lived access token. An administrator's `supervisor/api` messages reach the Supervisor, which carries every getter and action. No add-on, no SSH. Over TLS, the certificate is checked against `tls_fingerprints` (device-types `CertificateCheck`) before the token is sent. **Getters:** facts, interfaces/IPs, host status (pending reboot, data disk), pending updates (Core, OS, Supervisor, add-ons), add-ons as services, running backups. **Actions:** apply updates (add-ons → Supervisor → Core → OS; after Core it waits for Home Assistant to come back), add-on start/stop/restart and start at boot, refresh updates, reboot and shutdown. **Deviation from STANDARDS §4, decided 2026-12-03:** the fixtures are not recordings. They are built from the answer shapes in the Supervisor 2026.11.0 source (`supervisor/api/*.py`), with anonymised values of a HAOS 18.4 VM. They will be replaced by recordings once the first Home Assistant is onboarded. `tests/fixtures/README.md` says so. **Tested:** - Fixtures only: 90 tests, coverage 100 %, `mypy --strict`, ruff, bandit and `napalm-standard check`/`ratchet` clean. - The live WebSocket/TLS path (excluded from coverage) was driven against a local stand-in server that speaks HA's auth and result protocol: - login and refused token - getters, with events in between - reboot with the connection dropping - TLS with a pinned fingerprint, plus a refused fingerprint (the token is never sent), a CA failure and connection refused - Not yet run against a real device. **Floors:** napalm-device-types ≥ 4.56 (`ServiceDict.result`, `SERVICE_RESULT_*`), websockets ≥ 13.
christianmanivong added the
prio
P2
enhancement
labels 2026-12-03 00:22:54 +00:00
christianmanivong added 1 commit 2026-12-03 00:22:54 +00:00
feat: Home Assistant OS driver over the WebSocket API (0.1.0)
driver / lint (pull_request) Successful in 15s
driver / standard (pull_request) Successful in 19s
driver / lowest (pull_request) Failing after 25s
driver / types (pull_request) Successful in 1m5s
driver / test (3.12) (pull_request) Successful in 1m11s
driver / test (3.13) (pull_request) Successful in 1m3s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m8s
CI / driver (pull_request) Failing after 1m52s
driver / publish (pull_request) Skipped
ed8e58267a
A driver for Home Assistant OS and Supervised installs. It reaches the
Supervisor through Home Assistant's WebSocket (supervisor/api) with an
administrator's long-lived access token: no add-on, no SSH.

Getters: facts, interfaces and addresses, host status (pending reboot,
data disk), pending updates of Core, OS, Supervisor and add-ons, add-ons
as services, running backups. Actions: apply updates, add-on start/stop/
restart and start at boot, refresh updates, reboot and shutdown.

The fixtures are built from the Supervisor 2026.11.0 API source, not
recorded; they are replaced once the first device is onboarded.
christianmanivong added 1 commit 2026-12-03 00:25:04 +00:00
fix: the floor on napalm-device-types is 4.56
driver / lint (pull_request) Successful in 15s
driver / standard (pull_request) Successful in 20s
driver / lowest (pull_request) Successful in 31s
driver / test (3.12) (pull_request) Successful in 1m6s
driver / test (3.13) (pull_request) Successful in 58s
driver / types (pull_request) Successful in 1m19s
driver / build (pull_request) Successful in 37s
driver / security (pull_request) Successful in 1m24s
CI / driver (pull_request) Successful in 2m15s
driver / publish (pull_request) Skipped
37e88aaeb5
ServiceDict.result and the SERVICE_RESULT_* words the add-on states map
to came with 4.56.0; the lowest job imported 4.34.
christianmanivong merged commit 8a7ac3ff0a into main 2026-12-03 01:05:27 +00:00
christianmanivong deleted branch feature/driver 2026-12-03 01:05:27 +00:00
Sign in to join this conversation.