fix(driver): follow the media contract's shapes, raise on failed reads
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m9s
driver / test (3.12) (pull_request) Successful in 4m21s
driver / test (3.13) (pull_request) Successful in 4m16s
driver / lowest (pull_request) Successful in 3m46s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m14s
CI / driver (pull_request) Successful in 6m10s
driver / publish (pull_request) Skipped

get_playback_state returned SoCo's transport string and get_zone_info
the speaker's details, where napalm-device-types' MediaDriver declares
{"state", "source"} and a list of {"name", "coordinator", "members"}.
Both now return those shapes; the speaker's details stay in get_facts.

get_group_info and get_zone_info caught every exception and answered
{}, so a failed read looked like a speaker in no group. They now raise
like the other getters (#9); {} and [] mean no group.

Closes #11
This commit is contained in:
Christian Manivong committed 2026-11-02 09:28:39 +01:00
1 parent 53ea5f051f
commit 218e2c7a7b
4 files changed
+176 -72

No files matched your search

+12
View File
@@ -7,6 +7,14 @@ All notable changes to this driver. The format follows
## [Unreleased]
### Changed
- **Breaking:** `get_playback_state()` and `get_zone_info()` return the shapes of
napalm-device-types' media contract. `get_playback_state()` is
`{"state": "playing"|"paused"|"stopped"|"transitioning", "source": "radio"|…}`
instead of SoCo's transport string (`"PAUSED_PLAYBACK"`); a speaker with nothing
queued is `stopped`, and a state outside the four raises `CommandErrorException`.
`get_zone_info()` is a list with one `{"name", "coordinator", "members"}` entry for
the speaker's group instead of the speaker's details, which stay in `get_facts()`
(#11).
- Python 3.12 is the floor (`requires-python = ">=3.12"`): netOrk runs every driver
on 3.12, so 3.10 and 3.11 are no longer tested (NAPALM/driver-standard#6).
- The floor on napalm is 5.1: older releases import `pkg_resources`, which a Python
@@ -22,6 +30,10 @@ All notable changes to this driver. The format follows
speaker is wired: SoCo offers no reading for it, and the check looked for an attribute
SoCo does not have, so it never found `eth0` anyway. The speaker reports one
interface, `wlan0`, described as "Network (wired or wireless unknown)" (#2).
- `get_group_info()` and `get_zone_info()` raise instead of answering `{}` when the
driver is not connected (`ConnectionClosedException`) or the read fails
(`ConnectionException`, `CommandErrorException`); `{}` / `[]` now only means the
speaker is in no group (#11).
- `get_playback_state()` reports the speaker's real transport state (`PLAYING`,
`PAUSED_PLAYBACK`, `STOPPED`, `TRANSITIONING`); it called a method SoCo does not
have and answered `STOPPED` for every speaker (#9).