Hello Forum Members
A persistent cold has given me some downtime, which I’ve used to transition from my previous MQTT-based solution to the openHAB binding for Sonos. My goal is to simplify my setup, and while I’ve had some success, a few challenges remain.
Current Setup
I have five Sonos speakers in my system, primarily used for streaming music. I’ve predefined the standard content to play in a YAML file. While basic controls such as volume adjustment, pause, play, and stop work seamlessly, I’ve encountered significant difficulties when trying to play specific content.
What I’m Trying to Achieve
I’d like to be able to play:
- Playlists from Tidal
- Playlists from Spotify
- Sonos Radio Stations
I know it’s possible to save playlists as favorites in the Sonos app, but the distinction between “Sonos Favorites” and general “Favorites” is a bit unclear.
Issues Encountered
Despite several attempts, I’ve been unable to play any of the desired content. For example:
- Sending commands to the
playuri
channel using URIs such asx-sonosapi-radio:2997?sid=303&flags=0&sn=9
hasn’t worked as expected. - Using predefined favorites, playlists, or radio channels doesn’t yield the desired results either.
Configuration Details
Here are some of the items I’ve defined for controlling Sonos:
Switch Sonos_TV_Rummet_Play_Queue "Play queue [%s]" <switch> (G_Sonos) {channel="sonos:Arc:Sonos_TV_Rummet:playqueue"} // Play the songs from the current queue
String Sonos_TV_Rummet_Favorite "Play favorite [%s]" <text> (G_Sonos) {channel="sonos:Arc:Sonos_TV_Rummet:favorite"} // Play the given favorite entry. The favorite entry has to be predefined in the Sonos Controller app
String Sonos_TV_Rummet_Radio "Play radio [%s]" <text> (G_Sonos) {channel="sonos:Arc:Sonos_TV_Rummet:radio"} // Play the given radio station. The radio station has to be predefined in the Sonos Controller app
String Sonos_TV_Rummet_Playlist "Play playlist [%s]" <text> (G_Sonos) {channel="sonos:Arc:Sonos_TV_Rummet:playlist"} // Play the given playlist. The playlist has to predefined in the Sonos Controller app
String Sonos_TV_Rummet_Play_Uri "Play URI [%s]" <text> (G_Sonos) {channel="sonos:Arc:Sonos_TV_Rummet:playuri"} // Play the given URI
String Sonos_TV_Rummet_Tunein_Station_Id "Tunein station ID [%s]" <text> (G_Sonos) {channel="sonos:Arc:Sonos_TV_Rummet:tuneinstationid"} // Provide the current TuneIn station id or play the TuneIn radio given by its station id
Documentation Challenges
The official documentation on the openHAB website does include an example, such as playing a German radio station:
Sonos_PlayUri.sendCommand("x-rincon-mp3radio://https://streams.egofm.de/egoFMBW-hq")
This example works, but I’ve found the number of available channels and their uses somewhat confusing. I’ve been unable to locate examples or clear guidance on playing playlists or streaming services like Tidal or Spotify.
Request for Help
I’m reaching out to see if anyone else has successfully configured openHAB to play Tidal or Spotify playlists and Sonos radio stations. Are there specific URIs, item configurations, or approaches I might have overlooked? If you’ve managed to make this work, I would be incredibly grateful for any tips or examples you could share.
Thank you so much for your time and assistance!
Warm regards