OH3 - Sonos audio sink not working

Tags: #<Tag:0x00007f433e039200> #<Tag:0x00007f433e038dc8> #<Tag:0x00007f433ebf37f8>


  • openHAB 3.0.2 - Release Build
  • OpenJDK 64-Bit Server VM version 11.0.10+9-LTS
  • Linux version 5.4.0-71-generic
  • Sonos Binding 3.0.2

Hi all,

I try to get TTS working with the Sonos binding using one of my speakers as audio sink. Unfortunately no sound is produced. The default audio sink was set via MainUI.

To troubleshoot the problem I’ve tried to play an .mp3 file on this audio sink using karaf console: openhab:audio play doorbell.mp3. The speaker remained silence, no audio. The log did not show any exceptions.

I did stop openHAB clear tmp and cache and restarted multiple time, the problem persisted.

Is this a known issue with the Sonos binding, or is something wrong with my configuration?

thanks and kind regards,

for me this is working on my setup also with 3.0.2 so doesn’t seem to be an issue in the sonos binding

does it help to indicate the speaker to use for playing the sound e.g. openhab:audio play sonos:One:logeerkamer doorbell.mp3 50 this would indicate the problem is in de default audio sink configuration or not

further more i had issues a few days ago with playing notifications when that particular speaker was playing a spotify session or still has a spotify session connected. Are you playing anything on that particular speaker?

This is a feature working well since many years. So yes, very probably something wrong with your configuration.

I just tried the doorbell playback from the console command and it works.
Using a recent 3.1 snapshot.

Regarding the notification playback while a “virtual line-in” source is being played (apparently a Sonos feature now used by Spotify), I proposed a fix last week but it is not yet reviewed/merged.

Thank you for the reply - I searched the known issues and found [sonos] notification sound not played (anymore) when spotify playlist is running on sonos box · Issue #10569 · openhab/openhab-addons · GitHub. That’s what I’m facing here - if I do not use a spotify playlist the notification and text to speech works.

Is there a .jar of the binding with the fix available to test (as I’ve seen there is already a PR for the fix)? I could also test the resume playlist functionality with spotify.

with kind regards,

thank you as well - yes, I was using a spotify playlist and this caused the problem.

The condition your Sonos speaker is in could be the problem. What did the selected default speaker play arüg ladt and how was that started? For example using an Alexa device restart playing a radio station could (still?) lead to condition of the player which the binding could not handle.

I could build the jar including the fix but it would only work in a 3.1 version. As you are running a 3.0.2 version, it would not help you at all.

The current problem is not the restore of previous playback but the notification which is not played at all. This is due to the fact that Spotify apparently uses a new kind of audio source provided by Sonos which is called “virtual line-in”. This kind of source was not yet supported by the binding.
With the recent fix I proposed, the notification will now be played in this case too but I am not sure that the Spotify playlist will be restoired after. I tried to implement something but as I cannot test it, I don’t know if this will work or not.

1 Like

First of all thank you for the work on this binding. It adds a lot of value to openHAB.

The .jar package would be appreciated. I’ll upgrade to 3.1M3 to be able to test this. I can also help to test the playlist resume and provide debug data if required.

Good to hear, also glad to hear im not the only one facing this issue. Somehow the issue disappeared on my side without me changing anything. Hopefully the fix will help and forecome issue in the future as well. Hope you can test it, as i dont have a situation to test add anymore

@patrik_gfeller : I added a jar file file in the PR for testing (first unzip it).
I would be curious to know if the channels title, album, artist and album art are correctly set when such vli source is being played.

Great - thanks. I’ve installed OH 3.1 M3 and copied the jar to the addons folder, but I can not start the binding:

248 │ Installed │  80 │      │ openHAB Add-ons :: Bundles :: Sonos Binding
openhab> bundle:start 248
Error executing command: Error executing command on bundles:
	Error starting bundle 248: Could not resolve module: org.openhab.binding.sonos [248]
  Unresolved requirement: Import-Package: org.osgi.framework; version="[1.9.0,2.0.0)"

Do I need a snapshot version, or the upcoming M4 to use this binding?

That’s possible.
I thought M3 would be ok but apparently the breaking change with OSGi occurred after M3.

np - I’ll wait for M4 release and test with that one. Will the bugfix already be part of M4 or will I need the binding version from the PR?

My fix was not yet reviewed and so is not yet merged. So it is neither in a snapshot nor in a 3.1 milestone.

I tried to run the binding with M4, unfortunately it does not work:

openhab> list | grep Sonos
270 │ Installed │  80 │    │ openHAB Add-ons :: Bundles :: Sonos Binding
openhab> bundle:start 270
Error executing command: Error executing command on bundles:
	Error starting bundle 270: Could not resolve module: org.openhab.binding.sonos [270]
  Unresolved requirement: Import-Package: org.openhab.core.config.discovery.upnp

As the system is in daily use I do not want to install a snapshot version, so I can not help with testing at the moment. Unless you can compile a version that is compatible with M4.

You Need to first install thé UPnP stuff.
feature:install openhab-transport-upnp

thanks … making progress here; it’s not complaining about the upnp anymore. But there seems to be another dependency:

openhab> feature:install openhab-transport-upnp
openhab> bundle:start 277
Error executing command: Error executing command on bundles:
	Error starting bundle 277: Could not resolve module: org.openhab.binding.sonos [277]
  Unresolved requirement: Import-Package: org.apache.commons.io; version="[2.2.0,3.0.0)"

Which other feature do I need to install?

Really bad luck!
There were a change yesterday in parallel of my fix to remove dependency to apache.commons.io in openHAB.This impacted the Sonos binding.
My branch is older and so the resulting jar requires apache.commons.io.
A rebase of my branch would be required and then a new jar should be built to get a jar working in M4 and last snapshots.
I will try to do it.

1 Like