- soloist_api_key gesetzt (amd64/aarch64) → Spotify Soloist, sonst librespot - Soloist wird zur Laufzeit von Spotify geladen und alle 12 h aktualisiert (Builds laufen nach 90 Tagen ab) - Audio über PipeWire-Senke busch_radio → pw-record → bestehende Icecast-Pipeline - amd64/aarch64 auf Debian-Basis (glibc für Soloist), 32-Bit bleibt Alpine - Build-Fix: librespot auf Commit 99b6088 gepinnt, Browse-to-Patch an neuen Code angepasst - README, DOCS und CHANGELOG überarbeitet Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CGNdWh2jLNNb3tb9v1WEuK
246 lines
9.7 KiB
Markdown
246 lines
9.7 KiB
Markdown
<p align="center">
|
||
<img src="busch_radio_spotify/logo.png" alt="Busch-Radio Spotify Bridge" width="180"/>
|
||
</p>
|
||
|
||
<h1 align="center">Busch-Radio Spotify Bridge</h1>
|
||
|
||
<p align="center">
|
||
Spotify-Musik auf dem Busch-Jäger Unterputz-Internetradio – ohne Bluetooth.
|
||
</p>
|
||
|
||
---
|
||
|
||
## Problem
|
||
|
||
Das **Busch-Jäger Unterputz-Internetradio** kann nur Internetradio-Streams abspielen. Es hat kein Bluetooth und keine Spotify-Integration. Spotify-Musik lässt sich damit direkt nicht wiedergeben.
|
||
|
||
## Lösung
|
||
|
||
Dieses Home Assistant Add-on erstellt ein virtuelles Spotify Connect-Gerät und stellt das Audio als MP3- oder AAC-Stream über Icecast bereit.
|
||
|
||
Als Spotify-Empfänger dient ab Version 1.1.0 **[Spotify Soloist](https://developer.spotify.com)**, Spotifys offizieller Client für Linux.
|
||
Ohne Soloist-API-Key (und auf 32-Bit-Geräten) läuft weiterhin **[librespot](https://github.com/librespot-org/librespot)** als Rückfall.
|
||
|
||
> **Warum Soloist?** Spotify verweigert librespot seit 2025/26 bei vielen Konten die Audio-Schlüssel.
|
||
> Im Log erscheint dann bei jedem Titel `error audio key 0 1` und es bleibt still
|
||
> ([librespot #1649](https://github.com/librespot-org/librespot/issues/1649)). Mit Soloist tritt das nicht auf.
|
||
|
||
### Funktionsweise
|
||
|
||
```
|
||
Spotify-App → [Spotify Connect] → Soloist → PipeWire → pw-record ─┐
|
||
librespot (Rückfall) ───────────┴→ PCM → ffmpeg → Icecast → Busch-Jäger Radio
|
||
```
|
||
|
||
---
|
||
|
||
## Voraussetzungen
|
||
|
||
| Anforderung | Details |
|
||
|---|---|
|
||
| Home Assistant | OS, Supervised oder Container |
|
||
| Spotify Premium | Pflicht für Spotify Connect und für den Soloist-API-Key |
|
||
| Architektur | Soloist: amd64 oder aarch64 (z. B. Raspberry Pi 4/5 mit 64-Bit-OS); 32-Bit nur librespot |
|
||
| Internet | Soloist wird beim Start von Spotify geladen und alle 12 h aktualisiert |
|
||
| Busch-Jäger Radio | Muss benutzerdefinierte Stream-URLs unterstützen |
|
||
|
||
---
|
||
|
||
## Installation
|
||
|
||
### 1. Repository in HA hinzufügen
|
||
|
||
1. **Einstellungen → Add-ons → Add-on Store**
|
||
2. Drei Punkte oben rechts → **Repositories**
|
||
3. URL eintragen: `https://gitea.bitfire.work/retr0/Busch-Radio-Spotify`
|
||
4. **Busch-Radio Spotify Bridge** erscheint im Store
|
||
5. Installieren (der erste Build dauert ~10–15 Minuten wegen Rust-Kompilierung)
|
||
|
||
### 2. Add-on konfigurieren
|
||
|
||
```yaml
|
||
device_name: "Busch-Radio" # Name in der Spotify-App
|
||
bitrate: 160 # 96 / 128 / 160 / 192 kbps
|
||
stream_format: "mp3" # mp3 oder aac
|
||
stream_port: 8000 # HTTP-Port des Streams
|
||
stream_mount: "/stream" # URL-Pfad
|
||
icecast_password: "geheim" # Icecast-Passwort (bitte ändern)
|
||
soloist_api_key: "" # Soloist-API-Key (leer = librespot)
|
||
```
|
||
|
||
### 3a. Mit Soloist (empfohlen)
|
||
|
||
1. Im [Spotify-for-Developers-Dashboard](https://developer.spotify.com/dashboard) mit dem **Premium-Konto** anmelden
|
||
2. Im Bereich **Soloist API Key** einen Schlüssel erzeugen
|
||
3. Schlüssel in `soloist_api_key` eintragen, speichern, Add-on (neu) starten
|
||
4. Im Log steht `Empfänger : soloist`
|
||
5. Spotify-App öffnen (Handy **im selben Netz** wie Home Assistant) und **„Busch-Radio"** als Gerät wählen.
|
||
Beim ersten Mal meldet sich Soloist dabei mit deinem Konto an, danach bleibt die Anmeldung gespeichert.
|
||
|
||
Der Schlüssel ist persönlich: nicht weitergeben, nicht in Logs oder Issues posten.
|
||
Mit der Nutzung von Soloist gelten die Nutzungsbedingungen von Spotify. Soloist ist **nicht** im Add-on enthalten
|
||
(Spotify erlaubt keine Weitergabe), sondern wird beim Start direkt von Spotify geladen.
|
||
|
||
### 3b. Mit librespot (Rückfall, ohne API-Key)
|
||
|
||
Beim **ersten Start** erscheint im Log:
|
||
|
||
```
|
||
Öffne die Einrichtungs-Seite im Browser:
|
||
http://<homeassistant-ip>:5589
|
||
```
|
||
|
||
Öffne diese Adresse im Browser. Der **Einrichtungs-Assistent** führt dich durch die Spotify-Anmeldung:
|
||
|
||
1. Klicke auf **„Mit Spotify anmelden"**
|
||
2. Melde dich mit deinem Spotify-Konto an und bestätige die Berechtigung
|
||
3. Dein Browser wird auf `http://127.0.0.1:5588/login?code=...` weitergeleitet – diese Seite ist nicht erreichbar
|
||
4. Kopiere die URL aus der Adressleiste und füge sie auf der Einrichtungs-Seite ein
|
||
5. Klicke **„Weiter"** – der Assistent leitet die URL korrekt weiter
|
||
6. Bei Erfolg erscheint: **Autorisierung erfolgreich!**
|
||
|
||
Die Credentials werden dauerhaft gespeichert – **dieser Schritt ist nur einmalig nötig**.
|
||
|
||
### 4. Stream im Radio eintragen
|
||
|
||
Trage folgende URL im Busch-Jäger Radio ein:
|
||
|
||
```
|
||
http://<homeassistant-ip>:8000/stream
|
||
```
|
||
|
||
### 5. Musik abspielen
|
||
|
||
1. **Spotify-App** öffnen
|
||
2. Abspielgerät wechseln → **„Busch-Radio"** auswählen
|
||
3. Das Radio spielt den Stream automatisch ab
|
||
|
||
---
|
||
|
||
## Custom Component (optional)
|
||
|
||
Die Custom Component zeigt den Stream-Status als Media-Player-Entity in HA.
|
||
|
||
**Installation:**
|
||
|
||
```bash
|
||
cp -r custom_components/busch_radio_spotify /config/custom_components/
|
||
# HA neu starten
|
||
```
|
||
|
||
Dann unter **Einstellungen → Integrationen → Busch-Radio Spotify Bridge** einrichten. Das Passwort muss mit `icecast_password` aus der Add-on-Konfiguration übereinstimmen.
|
||
|
||
**Entity-Attribute:**
|
||
|
||
| Attribut | Beschreibung |
|
||
|---|---|
|
||
| `stream_url` | Die URL für das Radio |
|
||
| `listeners` | Anzahl aktiver Hörer |
|
||
| `source_connected` | Ob Audio gestreamt wird |
|
||
|
||
---
|
||
|
||
## Nützliche URLs
|
||
|
||
| URL | Funktion |
|
||
|---|---|
|
||
| `http://<ha-ip>:5589` | Einrichtungs-Assistent (OAuth, nur librespot) |
|
||
| `http://<ha-ip>:8000/stream` | Stream-URL für das Radio |
|
||
| `http://<ha-ip>:8000` | Icecast-Statusseite |
|
||
|
||
---
|
||
|
||
## Technische Details
|
||
|
||
### Komponenten
|
||
|
||
| Komponente | Funktion |
|
||
|---|---|
|
||
| Spotify Soloist | Offizieller Spotify Connect Client, spielt in eine PipeWire-Senke (amd64/aarch64) |
|
||
| [PipeWire](https://pipewire.org) + WirePlumber | Virtuelle Senke `busch_radio`, `pw-record` greift sie als PCM ab |
|
||
| [librespot](https://github.com/librespot-org/librespot) main | Rückfall: Spotify Connect Client (PCM-Ausgabe via Pipe) |
|
||
| [ffmpeg](https://ffmpeg.org) | PCM → MP3/AAC Transkodierung |
|
||
| [Icecast](https://icecast.org) | HTTP-Stream-Server |
|
||
|
||
### Signalfluss
|
||
|
||
```
|
||
Soloist: Spotify → Soloist → PipeWire-Senke "busch_radio" → pw-record (PCM auf stdout)
|
||
librespot: Spotify → librespot (dekodiert, PCM auf stdout)
|
||
→ silence-injector (hält Stream bei Pause aufrecht)
|
||
→ ffmpeg (Encoding → MP3/AAC; bei librespot mit -re für Echtzeit)
|
||
→ Icecast (HTTP-Stream)
|
||
→ Busch-Jäger Radio
|
||
```
|
||
|
||
### Hinweise zum Build
|
||
|
||
- amd64/aarch64 nutzen ein Debian-Basisimage (Soloist braucht glibc ≥ 2.38), 32-Bit bleibt Alpine
|
||
- librespot wird aus dem Quellcode kompiliert (Rust, ~10–15 Min.), statisch gelinkt – läuft auf beiden Basisimages
|
||
- Soloist liegt in `/data/soloist/bin`; Builds laufen nach 90 Tagen ab, das Add-on lädt rechtzeitig neue
|
||
und wechselt, sobald gerade nichts spielt
|
||
- Der OAuth-Callback-Server bindet an `0.0.0.0` statt `127.0.0.1`, damit der Browser-Login aus dem Heimnetz funktioniert
|
||
- Credentials werden in `/data/librespot-cache/` persistent gespeichert
|
||
|
||
---
|
||
|
||
## Fehlerbehebung
|
||
|
||
| Problem | Lösung |
|
||
|---|---|
|
||
| Jeder Titel wird übersprungen, Log zeigt `error audio key 0 1` | Spotify verweigert librespot für dieses Konto → Soloist-API-Key eintragen (ab 1.1.0) |
|
||
| „Busch-Radio" erscheint nicht in Spotify (Soloist) | Handy im selben Netz wie HA? Im Log `Empfänger : soloist` und `Soloist wird gestartet` prüfen |
|
||
| `Soloist konnte nicht geladen werden` | Internetzugang von HA prüfen; das Add-on fällt solange auf librespot zurück |
|
||
| „Busch-Radio" erscheint nicht in Spotify (librespot) | Einrichtungs-Seite öffnen: `http://<ha-ip>:5589` |
|
||
| Stream nicht erreichbar | Icecast-Status prüfen: `http://<ha-ip>:8000` |
|
||
| Stream bricht bei Pause ab | Auf Version 1.0.11+ aktualisieren |
|
||
| Songs wechseln zu schnell | Auf Version 1.0.10+ aktualisieren |
|
||
| Neu autorisieren | Add-on stoppen → `/data/librespot-cache/credentials.json` löschen → neu starten |
|
||
| Build schlägt fehl | Logs im Add-on Store prüfen |
|
||
|
||
---
|
||
|
||
## Projektstruktur
|
||
|
||
```
|
||
busch-radio-spotify/
|
||
├── busch_radio_spotify/ # Home Assistant Add-on
|
||
│ ├── Dockerfile # Multi-Stage Build (Rust → Debian bzw. Alpine)
|
||
│ ├── config.yaml # Add-on Manifest & Optionen
|
||
│ ├── build.yaml # Multi-Arch Konfiguration
|
||
│ ├── DOCS.md # Add-on Dokumentation (in HA angezeigt)
|
||
│ ├── run.sh # Startup-Script
|
||
│ ├── oauth_helper.py # OAuth-Einrichtungs-Assistent (Port 5589, librespot)
|
||
│ ├── soloist-fetch.sh # Lädt/aktualisiert Spotify Soloist
|
||
│ ├── pipewire/ # PipeWire-Senke für Soloist
|
||
│ ├── wireplumber/ # WirePlumber ohne Hardware/D-Bus
|
||
│ ├── icon.png # Add-on Icon (Store)
|
||
│ └── logo.png # Add-on Logo (Detailseite)
|
||
├── custom_components/ # Optionale HA Integration
|
||
│ └── busch_radio_spotify/
|
||
│ ├── __init__.py
|
||
│ ├── manifest.json
|
||
│ ├── media_player.py
|
||
│ ├── config_flow.py
|
||
│ └── translations/
|
||
├── repository.yaml # HA Repository-Manifest
|
||
└── README.md
|
||
```
|
||
|
||
---
|
||
|
||
## Rechtliche Hinweise
|
||
|
||
- **Spotify Soloist** ist Software von Spotify; sie wird nicht mit diesem Projekt verteilt, sondern direkt von Spotify geladen.
|
||
Dieses Projekt ist nicht mit Spotify verbunden.
|
||
- Als Rückfall nutzt das Projekt **librespot**, eine Open-Source-Reimplementierung des Spotify-Clients
|
||
- Audio wird **nicht gespeichert** – ausschließlich live gestreamt
|
||
- Ausschließlich für den **privaten Heimgebrauch** gedacht
|
||
- **Spotify Premium** ist für Spotify Connect erforderlich
|
||
|
||
---
|
||
|
||
## Lizenz
|
||
|
||
MIT License
|