Zum Hauptinhalt springen

Subsonic Smart-Home-Integration, kostenlos und Open Source

Subsonic-Integration für Gladys Assistant

Verbinde Gladys mit einem Subsonic-kompatiblen Musikserver: Navidrome, Airsonic, Gonic...

Info

Die Dokumentation dieser Integration wird von ihrem Autor geschrieben und ist bisher nur auf Englisch verfügbar.

This integration (Gladys 5.3 or later) links Gladys Assistant with any music server implementing the Subsonic API: Navidrome, Airsonic-Advanced, Gonic, LMS, Subsonic… It was designed and tested first against Navidrome.

What you get​

  • A Subsonic server device with five periodically refreshed sensors, usable in your scenes and on your dashboard:
    • Now playing: the track being played right now, as Artist — Title (listener). Gladys fires its scene triggers when this value changes, so you can react to every new track;
    • Active streams: how many songs are being played right now (handy for a "don't cut the sound while someone is listening" scene);
    • Album cover: the artwork of the album being played. It travels on the Gladys image channel, so it shows up in the dashboard Camera widget (pick the "Subsonic server" device). When playback stops the last cover stays on screen; until anything has ever been played, a neutral placeholder takes its place;
    • Songs, Artists and Albums counted in the library.
  • An optional Subsonic jukebox device to control server-side playback: with Gladys 5.3 it is a real player in the Music widget (artwork, track, progress, queue, library search) — see "Gladys 5.3 music player".
  • Buttons in the Configuration screen: test the connection, start a library scan, play random songs or a playlist on the jukebox.
  • Three dashboard widgets (Gladys 5.1 or later): Now playing, Jukebox and Library — see below.

Configuration​

  1. Open the Configuration tab of the integration.
  2. Fill in:
    • Server URL: the root of your server, without /rest — for example https://music.mydomain.com or http://192.168.1.10:4533 (Navidrome's default port);
    • Username and Password: an account on your server. Prefer a dedicated account for Gladys;
    • Authentication method: keep Token (the password never transits, only a salted md5 hash is sent). Switch to Legacy only for very old servers (API < 1.13) or LDAP accounts that reject tokens (error 41);
    • Refresh interval: how often the sensors are polled (60 s by default).
  3. Save, then click Test the connection: the server answers with its name and version (for example navidrome 0.52).
  4. The devices show up in the Discovery tab, ready to be added.

The jukebox (server-side playback)​

Jukebox mode plays the music on the machine hosting the server (the one wired to your speakers), through the jukeboxControl API endpoint. It must be enabled on both sides:

  1. Server side. For Navidrome, in navidrome.toml:

    [Jukebox]
    Enabled = true

    or with the ND_JUKEBOX_ENABLED=true environment variable. The host needs a working audio output (see the Navidrome jukebox mode documentation).

  2. Gladys side. Turn on Enable the jukebox device in the integration configuration: the "Subsonic jukebox" device then appears in discovery.

From your scenes or the dashboard you can then: play/pause, skip to the next or previous track, set the volume, and trigger the Play random songs (N random tracks) or Play a playlist (by exact name, case-insensitive) buttons.

Gladys 5.3 music player​

With Gladys 5.3 or later, the jukebox is a player of the dashboard Music widget (pick the "Subsonic jukebox" device):

  • Now playing: artwork, title, artist, album, a progress bar (drag or click it to move in the song), play/pause, previous/next and volume. Gladys reads the jukebox again right after each song ends: the next one shows within seconds, even with a 60 s polling interval. A change made elsewhere (another app driving the jukebox) shows at the next poll.
  • Library: the search button opens a panel with the Albums, Artists and Playlists folders, and a search (artists, albums, playlists, songs). Tapping an item plays it; an album, an artist or a playlist can also be queued next or at the end. An artist or a playlist plays 500 songs at most. The language of these folders and of the panel's messages is set in the configuration (Language of the music panel, French by default).
  • Queue: the songs of the jukebox, the current one highlighted; tap one to play it.
  • Scenes: the Play music on a speaker action plays an album, an artist, a playlist or a song picked from the library. The playback state can be set from a scene too: 0 pause, 1 play, 2 stop.

The Subsonic API has no shuffle mode (only a one-time shuffle of the queue, kept on the Shuffle button of the Jukebox widget), no repeat and no mute: those buttons do not show in the player.

Playback state. It is 1 while playing, 0 when paused and 2 when stopped: empty queue, end of the queue, or a stop asked by Gladys (the jukebox pauses and goes back to the start of the song). Before 1.3.0 a stop read 0: a scene waiting for "= 0" no longer fires at the end of the queue.

Jukebox already added. After updating the integration, open its Discover tab and click Update on the jukebox: it gets the new features (title, artist, album, artwork, duration, position) and its playback state becomes writable. The ids do not change: scenes and dashboards keep working. Until then, the Music widget keeps its simple layout (buttons and volume).

Only the jukebox plays. What your apps play (DSub, Symfonium, the web interface…) stays visible through the Now playing sensor and widget, read only: the Subsonic API cannot drive those players.

Queuing "next". The API cannot insert: the integration removes the songs that follow, adds the new ones, then puts the others back, without cutting the current song. When more than 50 songs follow, or the current song is also higher in the queue, it rebuilds the queue and resumes at the same second: the sound then stops for an instant.

Dashboard widgets​

With Gladys 5.1 or later, the integration offers three widgets (Edit the dashboard → Add a widget). They have no settings: each one follows the configured server. The number tiles are bound to the sensors of the "Subsonic server" device: add it to Gladys for them to show a value.

  • Now playing — the number of streams in progress (the tile follows the sensor live) and one row per session the server lists: title, artist · album, the cover, and as a badge the listener name (or else the player name), green when the session really plays, grey when it is paused or stopped (the server keeps a session listed for a while after it stops). Eight rows at most, the active streams first. Nothing playing: "Nothing is playing right now." Refreshed every 30 seconds; the list read by the periodic poll is reused while it is less than 30 seconds old.
  • Jukebox — the server-side playback as a remote: the cover and the title of the current track, artist · album, then the state (Playing / Stopped), the volume and the position in the queue ("2 / 20"), and four buttons: Pause or Play depending on the state, Previous, Next and Shuffle (20 random songs, like the configuration button). An empty queue only offers Shuffle. Until the jukebox device is enabled in the configuration, the widget says so. Refreshed every 30 seconds, and as soon as a button acted. The buttons work even if the "Subsonic jukebox" device was not added to Gladys; the playback state published to Gladys follows every command.
  • Library — three live tiles (Songs, Artists, Albums), the server identity (type and version returned by the ping, for example navidrome 0.53.3), the scan status ("Running · n" or "Done · n songs"; "Unavailable" when the server refuses getScanStatus to this account) and a Scan button. Refreshed every 15 minutes, every 10 seconds during a scan. The button is subject to the same rights as the configuration one: Navidrome reserves scans to administrators.

The widget covers are served by the integration (asked to the server at 300 px) and cached one hour by Gladys. A track without a cover shows without an image.

Troubleshooting​

  • "Wrong username or password" (error 40): double-check the credentials by logging into the server's web interface.
  • Error 41: your account (often LDAP) does not accept token authentication — switch the method to Legacy.
  • "Cannot reach the Subsonic server": make sure the URL is reachable from Gladys (same machine/network as the integration container), not only from your browser.
  • The jukebox makes no sound: the audio comes out of the server host, not the device running Gladys. Check Jukebox.Enabled and the host's audio output (audio device access for a Docker container, if applicable).
  • The sensors show "no recent value": the integration reads the server itself as soon as the device is added, then at the chosen interval (60 s by default), whatever Gladys' own polling does. If the values stay empty, the server does not answer: Test the connection says why, and the integration logs say it once (and once more when it answers again). A value that does not change is only sent again every 12 hours.
  • "The server refuses a scan from this account": starting a scan is reserved to administrators (Navidrome does so). It does not matter: the button is only a shortcut, the server scans on its own schedule and the sensors follow. Make the account an administrator if you want the button.
  • "Jukebox is admin only" (error 50): Navidrome reserves the jukebox to administrators (Jukebox.AdminOnly, true by default). Use an administrator account, or set ND_JUKEBOX_ADMINONLY=false on the server.
  • A track stays on screen although playback stopped: the server keeps the session in its "now playing" list for a while after the music stops. The integration only counts sessions whose reported state is really playing, but a player that simply goes silent without telling the server (the classic Subsonic protocol has no notion of stopping) stays listed until the track would have ended.
  • The sensors never change: the artist/album counters only move after a library scan — use the Scan the music library button.

Konfigurationseinstellungen​

Diese Einstellungen fragt Subsonic in seinem Konfigurationsbildschirm in Gladys ab.

EinstellungTypPflichtfeldBeschreibung
Verbindung zum ServersectionNeinFunktioniert mit jedem Server, der die Subsonic-API umsetzt (Navidrome, Airsonic-Advanced, Gonic...). Verwende nach Möglichkeit ein eigenes Benutzerkonto. Die URL ist die Wurzel des Servers, z. B. https://music.example.com oder http://192.168.1.10:4533.
Server-URLstringJaWurzel-URL des Subsonic-Servers, ohne /rest.
BenutzernamestringJa
PasswortsecretJa
AuthentifizierungsmethodeselectNeinDas Token (md5 + Salt) wird von allen modernen Servern unterstützt. Verwende Legacy nur für Server vor 1.13 oder LDAP-Konten.
Aktualisierungsintervall (s)numberNeinWie oft die Sensoren des Servers abgefragt werden, in Sekunden. Gladys unterstützt nur 10, 15, 30 oder 60 s: Der Wert wird auf den nächstgelegenen gerundet.
Jukebox (Wiedergabe auf dem Server)sectionNeinDie Jukebox spielt Musik auf dem Rechner ab, auf dem der Server läuft. Auf dem Server muss sie ebenfalls aktiviert sein: Setze in Navidrome Jukebox.Enabled = true (ND_JUKEBOX_ENABLED=true) und prüfe, ob der Rechner einen Audioausgang hat.
Jukebox-Gerät aktivierenbooleanNein
Sprache des Musik-PanelsselectNeinSprache der Ordner und Meldungen des Musik-Panels von Gladys (die Integration kann deine nicht kennen).

So installierst du Subsonic in Gladys​

  1. Öffne in Gladys Integrationen: Subsonic erscheint im Katalog neben den nativen Integrationen, mit einem Community-Badge.
  2. Klicke auf Installieren. Gladys lädt das Docker-Image (ghcr.io/guim31/gladys-subsonic:1.3.0) herunter, startet es in einer vom Kern isolierten Sandbox und erzeugt die Oberfläche der Integration (Geräte, Erkennung und Konfiguration).
  3. Öffne den Bildschirm Konfiguration der Integration, fülle die Einstellungen aus und speichere.
  4. Du kannst sie auch direkt über die URL ihres Repositorys installieren: https://github.com/guim31/gladys-subsonic.

Subsonic benötigt Gladys >=5.3.0. Der Katalog in Gladys wird stündlich aktualisiert, eine neue Version ist also spätestens eine Stunde nach ihrer Veröffentlichung verfügbar.

Du nutzt Gladys noch nicht? Es ist kostenlos und Open Source: folge der Installationsanleitung, um loszulegen.

Über externe Integrationen​

Subsonic ist eine externe Integration: eine Community-Integration, die als Docker-Container verpackt und auf GitHub veröffentlicht wird. Gladys installiert sie mit einem Klick und führt sie in einer vom Kern isolierten Sandbox aus. Sie wird von guim31 veröffentlicht und gepflegt, nicht vom Gladys-Kernteam.

Abonniere den Newsletter von Gladys Assistant

Ein paar E-Mails im Monat zu neuen Releases und Neuigkeiten aus dem Projekt. Verschickt von Pierre-Gilles Leymarie, dem Gründer des Projekts. Jederzeit abbestellbar 🙂