Files
napalm-homeassistant/README.md
T
Christian Manivong 7f60d43732
driver / lint (pull_request) Successful in 15s
driver / standard (pull_request) Successful in 18s
driver / lowest (pull_request) Successful in 23s
driver / types (pull_request) Successful in 54s
driver / test (3.12) (pull_request) Successful in 56s
driver / test (3.13) (pull_request) Successful in 49s
driver / build (pull_request) Successful in 31s
driver / security (pull_request) Successful in 1m0s
CI / driver (pull_request) Successful in 1m41s
driver / publish (pull_request) Skipped
feat: the Supervisor as a read-only container engine
container_engines() names the Supervisor (engine supervisor, API
ha-supervisor) and open_container_engine("supervisor") returns read
access to its API, so netOrk can read Core, the Supervisor, its plugins
and the apps as containers (NetOrk/netork#3148). Nothing can be written
through it; without a Supervisor there is no engine.
2026-12-05 22:31:48 +01:00

78 lines
3.5 KiB
Markdown

# napalm-homeassistant
NAPALM driver for Home Assistant OS, built on
[napalm-device-types](https://git.netork.io/NAPALM/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.
```python
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 |
| `container_engines`, `open_container_engine` | the Supervisor as engine `supervisor` (API `ha-supervisor`): read access to its API (`get`), through which netOrk reads Core, the Supervisor, its plugins and the apps as containers; nothing is written through it. None without a Supervisor |
| `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](https://git.netork.io/NAPALM/driver-standard/src/branch/main/STANDARDS.md).
```bash
python -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/pytest --cov
```
## License
Apache-2.0