Skip to content

feat: add VIS Sonos Control widget - #359

Open
kosmix1980 wants to merge 30 commits into
ioBroker:masterfrom
kosmix1980:cursor/vis-widget-no-build-93d4
Open

feat: add VIS Sonos Control widget#359
kosmix1980 wants to merge 30 commits into
ioBroker:masterfrom
kosmix1980:cursor/vis-widget-no-build-93d4

Conversation

@kosmix1980

Copy link
Copy Markdown

Summary

This PR adds a VIS widget Sonos Control (data-vis-set="sonos"). One widget can switch rooms, control playback, form groups, and start favorites, playlists, queue tracks, recent tracks and sources (including TV HDMI).

The adapter version stays 4.0.3. Changelog entries are under ### **WORK IN PROGRESS** so the release script can set the next version. Compiled build/ is not committed (same as today; CI / prepublishOnly still compiles).

Widget

  • Bind the widget to the instance object, e.g. sonos.0 — not a single play state.
  • Suggested size: 900 × 520.
  • After install, vis / vis-2 are restarted (common.restartAdapters). Reload the VIS editor with Ctrl+F5.
  • Rooms are chips at the top. Group membership is toggled with checkboxes. Now-playing and transport follow the group coordinator.
  • Library buttons under the rooms (Favorites, Playlists, Queue, Recent, Sources) open a slightly transparent sheet below the buttons. Search filters the open list. Playable items and click-outside close the sheet; folders stay open.
  • Volume, mute, night sound and speech enhancement apply to the selected room.
  • The last selected room is remembered per widget (localStorage).

Sources

  • TuneIn, music library, network shares, line-in
  • Spotify and other music services via SMAPI search
  • YouTube Music catalog search; play sends a sid=284 URI to the speaker (the official YTM account on the player). There is no YouTube stream extraction or proxy. If a title does not start, save it as a favorite in the Sonos app.
  • TV HDMI (x-sonos-htastream:{UUID}:spdif) is the first source item and plays on the selected room (Arc, Beam, Playbar, Playbase, Ray, Amp).

TV HDMI

  • Now-playing title is TV. Artist is the audio format (e.g. Stereo PCM via HTAudioIn); empty when there is no signal.
  • Seek, play/pause, prev/next, shuffle and repeat are hidden. Mute stays. Night sound and speech enhancement are shown.
  • Play is not sent after SetAVTransportURI (that call returns HTTP 500 on HDMI).
  • When the TV signal stops, the format field is cleared (silent HTAudioIn codes).

Adapter / states

New or used per-room states for the widget:

State Purpose
playlist_list / playlist_list_array Sonos playlists
recent_tracks Last tracks of that room
media_browse / media_browse_result Content directory / SMAPI browse
media_play Play a browsed item (uri, metadata, favorite, playlist, tv)
play_uri Play a URI
night_mode / speech_enhancement Home-theater HDMI

widgets/ is included in the npm package files.

Docs

README section VIS widget with install steps and screenshots.

Notes for reviewers

  • Existing HTML states (favorites_list_html, queue_html) are unchanged.
  • I can split this if you prefer the widget UI and the browse/play backend as separate PRs.

cursoragent and others added 30 commits September 4, 2026 15:56
Ship a classic VIS widget with the adapter so one control can switch
rooms, manage groups, and start favorites, playlists and queue tracks.
Playlist names are now also exposed as adapter states for the widget.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
ioBroker starts the adapter from build/main.js. That folder was
gitignored, so a GitHub install had no start file.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Classic VIS often has no global $, and waiting for a wildcard getStates
left the widget empty. Render immediately, discover players via
getObjectView, and ship CSS/JS inside sonos.html.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Grouped rooms were displaying the last local title (often paused) because
Sonos only emits transport-state on the coordinator. The widget now reads
playback from the group master, the adapter copies that track onto members,
and each room keeps a recent-tracks list in a new Zuletzt tab.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Play, pause, next, prev and seek go to the group coordinator only when
the selected room is actually a member. A room that is not in a group
keeps controlling itself. Volume stays per room. Elapsed time is now
copied onto group members so the progress bar keeps moving.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
The seek bar only moved when VIS forwarded adapter elapsed updates, which
often never arrived. The widget now advances the bar every 500 ms from the
last known position and resyncs when Sonos reports a new elapsed time.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
ioBroker Admin can now show this fork as 4.1.0 instead of 4.0.3.
The VIS widget also displays 4.1.0 next to the SONOS label.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Rooms in one group share a name color. A room that is not in a group
stays white. Admin and the widget show version 4.1.1.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
The coordinator keeps the full group color and a slightly lighter chip.
Other rooms in the same group use a darker shade of that color.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
The widget browses the Sonos content directory. YouTube and other music
services are listed by name only; their catalogs need the Sonos app, so
play them via favorites. Version 4.2.0.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Spotify always appears under Quellen. Opening it lists matching Sonos
favorites and playlists so they can be started from that folder.
Version 4.2.1.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
The VIS Sources tab talks to music services over SMAPI: browse, search
and play. Tokens come from the speaker when readable, otherwise App-Link
sign-in. Version 4.3.0.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Parse namespaced SMAPI/UPnP XML so Spotify folders and search results
are not dropped. Add a Search button and App-Link when the catalog is
empty. YouTube Music has no SOAP catalog. Version 4.3.1.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Show TuneIn, Spotify, library, shares and line-in when the browse
path is empty, reload root if a stale service result is left over,
and translate the emptySources label.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Google's YouTube Music endpoint rejects third-party SMAPI calls.
List YTM like Spotify, match sid 284, and search favorites,
playlists and recently played tracks from the Sonos app.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Search lists public YTM songs. Play sends a sid=284 SMAPI URI
to the speaker so it can resolve the track. No stream proxy.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Arc, Beam, Playbar, Playbase, Ray and Amp switch via x-sonos-htastream
on the selected room, same as the Sonos app TV input.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Sonos leaves track metadata blank for the HDMI input, so the widget
fell through to Nichts spielt. Map x-sonos-htastream to TV / HDMI.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
The HDMI input has no track duration, so the seek bar is omitted
when the widget detects TV as the current source.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Sonos reports the compression as stream content (Stereo PCM, Dolby…).
Now-playing keeps the title TV, shows that format, and uses a television
cover instead of the vinyl No Cover placeholder.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Drop the oldest changelog item so package tests stay within the limit.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Also read the HDMI audio format from HTAudioIn (Stereo PCM, Dolby…)
and remember the last selected room across page reloads.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
On TV HDMI the transport row now shows mute only. TV HDMI is the first
item in Quellen so it is visible without scrolling.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
SetAVTransportURI starts HDMI; a following Play often returns HTTP 500.
Transport commands are ignored while TV is selected. Errors now include
the state name and room so the next 500 is identifiable.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
HTAudioIn is polled while TV is selected. Codes for no signal (0, 21, 22,
silent PCM) clear current_artist instead of keeping the last format.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Favorites, playlists, queue, recent and sources are pill buttons under
the rooms. A click opens a covering sheet with search; playing a title
or clicking outside closes it.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
The sheet over the player uses a translucent background so cover and
now-playing remain faintly visible underneath.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Match the official adapter for an upstream PR: keep 4.0.3, put the
widget work under WORK IN PROGRESS, and gitignore compiled output again.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Document the player, library sheet, sources and TV HDMI views
and drop the outdated note that this branch ships build/.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Point GitHub installs at cursor/vis-sonos-widget-93d4, which ships
the compiled adapter so the start file is present.

Co-authored-by: kosmix1980 <kosmix1980@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants