Files
napalm-homeassistant/README.md
T
Christian Manivong 36bfd6d6c1
driver / lint (pull_request) Successful in 17s
driver / standard (pull_request) Successful in 24s
driver / lowest (pull_request) Successful in 36s
driver / test (3.13) (pull_request) Successful in 53s
driver / types (pull_request) Successful in 1m10s
driver / test (3.12) (pull_request) Successful in 1m22s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m19s
CI / driver (pull_request) Successful in 2m20s
driver / publish (pull_request) Skipped
feat: the host ports a started add-on maps, as its listening sockets
netOrk names a service's port from the sockets its unit holds. An add-on's
container ports are published by Docker, so no socket names it: a service
on an add-on (Zigbee2MQTT's frontend, netork#3147) got no port.

get_listening_sockets now reads /addons/<slug>/info of each started add-on
and reports every host port it maps, with the slug as the socket's unit.
A port mapped to null is off; an add-on on the host network applies no
mapping and names none. Core, the Supervisor and the OS are not told, so
the reading is not attributed.
2026-12-05 17:47:09 +01:00

3.4 KiB

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
get_listening_sockets the host ports each started add-on maps, the add-on's slug as unit; not attributed: add-ons on the host network, Core and the OS are not told
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