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

+4 -2
View File
@@ -32,10 +32,12 @@ with driver("192.0.2.20") as speaker:
|---|---|
| `get_facts` | from the speaker info read at `open()` |
| `get_interfaces`, `get_interfaces_ip` | one interface, `wlan0`, for the speaker's network connection (see below) |
| `get_playback_state`, `get_current_track` | yes |
| `get_playback_state` | `{"state": "playing"\|"paused"\|"stopped"\|"transitioning", "source": …}` (media contract) |
| `get_current_track` | yes |
| `get_volume`, `set_volume`, `get_mute`, `set_mute` | yes |
| `play`, `pause`, `stop`, `next_track`, `previous_track` | yes |
| `get_group_info`, `get_zone_info` | yes |
| `get_zone_info` | `[{"name", "coordinator", "members"}]` (media contract) |
| `get_group_info` | the group's coordinator and members with uid and address |
Whether a speaker is wired or wireless is **not known**: SoCo offers no reading for it
(`deviceProperties` is the UPnP service of that name, and none of its actions says), so