christianmanivong a0a3dd9554
driver / lint (push) Successful in 14s
driver / standard (push) Successful in 17s
driver / lowest (push) Successful in 25s
driver / test (3.12) (push) Successful in 49s
driver / types (push) Successful in 1m4s
driver / test (3.13) (push) Successful in 51s
driver / build (push) Successful in 30s
driver / security (push) Successful in 1m0s
CI / driver (push) Successful in 1m43s
driver / publish (push) Skipped
Merge pull request 'fix: the driver names itself Home Assistant OS' (#3) from fix/type-label into main
2026-12-03 07:35:04 +00:00
2026-12-03 01:13:15 +01:00
2026-12-03 01:13:15 +01:00

napalm-homeassistant

NAPALM driver for Home Assistant OS, built on napalm-device-types (OSDriver).

It talks to Home Assistant's WebSocket API and, through it, to the Supervisor: the same way Home Assistant's own settings pages do. Nothing is installed on the device, no add-on and no SSH.

Tested against

Install Versions
Home Assistant OS (VM, board ova) OS 18.4, Core 2026.11.3, Supervisor 2026.11.0 — answer shapes from the Supervisor's source; not yet against a device

The fixtures are built from the Supervisor 2026.11.0 API source and are replaced by recordings from the first onboarded device (see tests/fixtures/README.md).

Connection

ws://<host>:8123/api/websocket, or wss:// with use_ssl (the default on port 443). The credential is a long-lived access token of a Home Assistant administrator (Profile → Security → Long-lived access tokens): the Supervisor calls are open to administrators only. It goes in as the password or as optional_args["token_value"]; the username is not used.

from napalm import get_network_driver

driver = get_network_driver("homeassistant")
with driver("192.0.2.21", "", "<long-lived access token>") as device:
    print(device.get_facts())
Optional arg
port Home Assistant's port, default 8123
use_ssl wss:// instead of ws://; default on port 443
ssl_verify / verify_ssl verify the certificate against the system's CAs (default true)
tls_fingerprints, tls_certificate_observer certificate pinning as in device-types' tls_certificates; a changed certificate is refused before the token is sent
token_value the access token, instead of the password

Supported

Getter / action
get_facts vendor, board as model, hostname, OS, uptime, interfaces; without a Supervisor only Core's version
get_interfaces, get_interfaces_ip the interfaces NetworkManager manages (no speed, no MTU)
get_host_status pending reboot (an installed OS waiting for it, or the Supervisor's reboot_required issue), data disk usage
get_available_updates core, os, supervisor and each add-on by its slug
apply_updates add-ons first, then Supervisor, Core (waits until Home Assistant is back) and the OS last (the host restarts); no backup is taken first
refresh_available_updates the Supervisor's /reload_updates
get_services, manage_service add-ons by slug: start, stop, restart; enable/disable sets their start at boot
get_running_backups the Supervisor's backup jobs in progress
reboot_host, shutdown_host the host, through the Supervisor
Discovery Home Assistant's web page on port 8123

Not supported

Anything inside Home Assistant itself (entities, automations, integrations), the Supervisor's health and unsupported reasons, listing or making backups, configuration changes, Home Assistant Container or Core installs beyond their version (they have no Supervisor).

Development

The rules are in STANDARDS.md.

python -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/pytest --cov

License

Apache-2.0

S
Description
NAPALM driver for Home Assistant OS over the Home Assistant WebSocket API
Readme
72 KiB
0 Stars 1 Watchers 0 Forks
Languages
Python 100%