[SOLVED] [Sonos] Media information items stay UNDEF

Hi All,

I have an issue with my sonos binding. All the media items (currenttitle, currentalbum, currentalbumarturl, currenttrack) stay UNDEF. Other items like volume, control and mute are working. But I see the track information in the log:

2022-12-27 20:24:28.356 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'LastChange':'<Event xmlns="urn:schemas-upnp-org:metadata-1-0/AVT/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/"><InstanceID val="0"><TransportState val="PLAYING"/><CurrentPlayMode val="NORMAL"/><CurrentCrossfadeMode val="0"/><NumberOfTracks val="1"/><CurrentTrack val="1"/><CurrentSection val="0"/><CurrentTrackURI val="x-rincon-mp3radio://https://orf-live.ors-shoutcast.at/wie-q2a"/><CurrentTrackDuration val="0:00:00"/><CurrentTrackMetaData val="&lt;DIDL-Lite xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot; xmlns:r=&quot;urn:schemas-rinconnetworks-com:metadata-1-0/&quot; xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot;&gt;&lt;item id=&quot;-1&quot; parentID=&quot;-1&quot; restricted=&quot;true&quot;&gt;&lt;res protocolInfo=&quot;x-rincon-mp3radio:*:*:*&quot;&gt;x-rincon-mp3radio://https://orf-live.ors-shoutcast.at/wie-q2a&lt;/res&gt;&lt;r:streamContent&gt;Adele - Water Under The Bridge&lt;/r:streamContent&gt;&lt;r:radioShowMd&gt;&lt;/r:radioShowMd&gt;&lt;r:streamInfo&gt;bd:0,sr:0,c:0,l:0,d:0&lt;/r:streamInfo&gt;&lt;upnp:albumArtURI&gt;https://cdn-profiles.tunein.com/s44255/images/logoq.jpg?t=637855740180000000&lt;/upnp:albumArtURI&gt;&lt;dc:title&gt;wie-q2a&lt;/dc:title&gt;&lt;upnp:class&gt;object.item&lt;/upnp:class&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;"/><r:NextTrackURI val=""/><r:NextTrackMetaData val=""/><r:EnqueuedTransportURI val="x-rincon-mp3radio://https://opml.radiotime.com/Tune.ashx?serial=AET4KLYN4G3DI77GHPQ4NZNCHCNQ&amp;formats=aac,mp3&amp;id=s44255&amp;partnerId=rjyYMwEH"/><r:EnqueuedTransportURIMetaData val="&lt;DIDL-Lite xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot; xmlns:r=&quot;urn:schemas-rinconnetworks-com:metadata-1-0/&quot; xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot;&gt;&lt;item id=&quot;-1&quot; parentID=&quot;-1&quot; restricted=&quot;true&quot;&gt;&lt;dc:title&gt;89.9 Radio Wien Wien, Austria&lt;/dc:title&gt;&lt;upnp:class&gt;object.item.audioItem.audioBroadcast&lt;/upnp:class&gt;&lt;desc id=&quot;cdudn&quot; nameSpace=&quot;urn:schemas-rinconnetworks-com:metadata-1-0/&quot;&gt;&lt;/desc&gt;&lt;r:tiid&gt;7862e956-934d-456a-b36e-0c227917d47b&lt;/r:tiid&gt;&lt;upnp:albumArtURI&gt;https://cdn-profiles.tunein.com/s44255/images/logoq.jpg?t=637855740180000000&lt;/upnp:albumArtURI&gt;&lt;r:contentService id=&quot;254&quot; imageUrl=&quot;https://msp-wordmark-logos.s3.amazonaws.com/tunein_wordmark_white.svg&quot; name=&quot;TuneIn&quot;/&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;"/></InstanceID></Event>' (service 'AVTransport') for thing 'sonos:One:sonosKueche'
2022-12-27 20:24:28.361 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'EnqueuedTransportURIMetaData':'<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="-1" parentID="-1" restricted="true"><dc:title>89.9 Radio Wien Wien, Austria</dc:title><upnp:class>object.item.audioItem.audioBroadcast</upnp:class><desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/"></desc><r:tiid>7862e956-934d-456a-b36e-0c227917d47b</r:tiid><upnp:albumArtURI>https://cdn-profiles.tunein.com/s44255/images/logoq.jpg?t=637855740180000000</upnp:albumArtURI><r:contentService id="254" imageUrl="https://msp-wordmark-logos.s3.amazonaws.com/tunein_wordmark_white.svg" name="TuneIn"/></item></DIDL-Lite>' (service 'AVTransport') for thing 'sonos:One:sonosKueche'
2022-12-27 20:24:28.362 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'CurrentTrackURI':'x-rincon-mp3radio://https://orf-live.ors-shoutcast.at/wie-q2a' (service 'AVTransport') for thing 'sonos:One:sonosKueche'
2022-12-27 20:24:28.363 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'NextTrackMetaData':'' (service 'AVTransport') for thing 'sonos:One:sonosKueche'
2022-12-27 20:24:28.363 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'InstanceID':'0' (service 'AVTransport') for thing 'sonos:One:sonosKueche'
2022-12-27 20:24:28.364 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'CurrentTrackMetaData':'<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="-1" parentID="-1" restricted="true"><res protocolInfo="x-rincon-mp3radio:*:*:*">x-rincon-mp3radio://https://orf-live.ors-shoutcast.at/wie-q2a</res><r:streamContent>Adele - Water Under The Bridge</r:streamContent><r:radioShowMd></r:radioShowMd><r:streamInfo>bd:0,sr:0,c:0,l:0,d:0</r:streamInfo><upnp:albumArtURI>https://cdn-profiles.tunein.com/s44255/images/logoq.jpg?t=637855740180000000</upnp:albumArtURI><dc:title>wie-q2a</dc:title><upnp:class>object.item</upnp:class></item></DIDL-Lite>' (service 'AVTransport') for thing 'sonos:One:sonosKueche'
2022-12-27 20:24:28.364 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'CurrentCrossfadeMode':'0' (service 'AVTransport') for thing 'sonos:One:sonosKueche'
2022-12-27 20:24:28.365 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'NextTrackURI':'' (service 'AVTransport') for thing 'sonos:One:sonosKueche'
2022-12-27 20:24:28.365 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'CurrentPlayMode':'NORMAL' (service 'AVTransport') for thing 'sonos:One:sonosKueche'
2022-12-27 20:24:28.366 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'CurrentTrackDuration':'0:00:00' (service 'AVTransport') for thing 'sonos:One:sonosKueche'
2022-12-27 20:24:28.366 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'CurrentTrack':'1' (service 'AVTransport') for thing 'sonos:One:sonosKueche'
2022-12-27 20:24:28.367 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'NumberOfTracks':'1' (service 'AVTransport') for thing 'sonos:One:sonosKueche'
2022-12-27 20:24:28.367 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'EnqueuedTransportURI':'x-rincon-mp3radio://https://opml.radiotime.com/Tune.ashx?serial=AET4KLYN4G3DI77GHPQ4NZNCHCNQ&formats=aac,mp3&id=s44255&partnerId=rjyYMwEH' (service 'AVTransport') for thing 'sonos:One:sonosKueche'
2022-12-27 20:24:28.367 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'CurrentSection':'0' (service 'AVTransport') for thing 'sonos:One:sonosKueche'
2022-12-27 20:24:28.380 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'CurrentTuneInStationId':'' (service 'AVTransport') for thing 'sonos:One:sonosKueche'
2022-12-27 20:24:28.381 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'CurrentTuneInStationId':'' (service 'AVTransport') for thing 'sonos:Five:sonosWohnzimmerLinks'
2022-12-27 20:24:28.382 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'CurrentTuneInStationId':'' (service 'AVTransport') for thing 'sonos:Five:sonosWohnzimmerRechts'
2022-12-27 20:24:28.383 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'TransportState':'PLAYING' (service 'AVTransport') for thing 'sonos:One:sonosKueche'

Any idea?

Is it when using TuneIn?
For TuneIn, I got the radio title and the radio logo.
I see in your example that you have info in the XML tag “r:streamContent”. I am not sure we are parsing it but I will check.

I have the feeling it is not tunein. What service are you using?

I need your value of AVTransportURI or CurrentURI. You should have a TRACE log for that.

Hi @Lolodomo,

It’s is TuneIn, but startet with an Amazon echo (Alexa).
I’am not sure what I should provide. I do not find an AVTransportURI on my sonosKueche which is playing:

Only:

'CurrentTrackURI':'x-rincon-mp3radio://https://orf-live.ors-shoutcast.at/wie-q2a' (service 'AVTransport') for thing 'sonos:zoneplayer:sonosKueche'
2022-12-27 19:53:19.655 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 

 'EnqueuedTransportURI':'x-rincon-mp3radio://https://opml.radiotime.com/Tune.ashx?serial=AET4KLYN4G3DI77GHPQ4NZNCHCNQ&formats=aac,mp3&id=s44255&partnerId=rjyYMwEH' (service 'AVTransport') for thing 'sonos:zoneplayer:sonosKueche'
2022-12-27 19:53:19.658 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair

I found this for my sonosWohnzimmer, which is part of the group:

'AVTransportURI':'x-rincon:RINCON_48A6B8DBE3AE01400' (service 'AVTransport') for thing 'sonos:zoneplayer:sonosWohnzimmer'

The sonos app shows the radio station, interpret and title and a TuneIn logo.

The relevant information seems to be here:

'EnqueuedTransportURIMetaData':'<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="-1" parentID="-1" restricted="true"><dc:title>89.9 Radio Wien Wien, Austria</dc:title><upnp:class>object.item.audioItem.audioBroadcast</upnp:class><desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/"></desc><r:tiid>7862e956-934d-456a-b36e-0c227917d47b</r:tiid><upnp:albumArtURI>https://cdn-profiles.tunein.com/s44255/images/logoq.jpg?t=637855740180000000</upnp:albumArtURI><r:contentService id="254" imageUrl="https://msp-wordmark-logos.s3.amazonaws.com/tunein_wordmark_white.svg" name="TuneIn"/></item></DIDL-Lite>' (service 'AVTransport') for thing 'sonos:zoneplayer:sonosKueche'
'CurrentTrackURI':'x-rincon-mp3radio://https://orf-live.ors-shoutcast.at/wie-q2a' (service 'AVTransport') for thing 'sonos:zoneplayer:sonosKueche'

For radio, you should get information through the channel “currenttrack”. In your example, this channel should cumulate your radio title follwoed by " - Adele - Water Under The Bridge".
The channels 'currentalbum" and “currentartist” are not set in case of radio.

Edit: no logic was implemented to extract artist and album from the “r:streamContent” XML tag, probably because there is not one unique pattern.

And the URL https://cdn-profiles.tunein.com/s44255/images/logoq.jpg?t=637855740180000000 points to your station logo (please confirm) and not to Adele album art. This logo should normally be dispayed in the appropriate channel (currentalbumart / currentalbumarturl).

Please also check that you did not enter a URL for OPML in the binding configuration parameter. In that case, the retrieval of content information for radio is a little different and uses a specific HTTP request to get them.

This is does not work in my case. I have tested now, there is a difference between starting TuneIn radio station from the Alexa (my case) or with the Sonos App. If I start it from the Sonos App, then everything is working fine.

That is not a good news to me, because it seems that this is the only location where info can be found. I’am wondering, how the Sonos App is working because in the App, the radio station and title information is shown, regardless if started from Alexa or from the app.

Yes this is the radio station logo

The configuration is empty.

Normally, tunein started from Amazon Echo is already implemented.
What I really need is your value of AVTransportURI or CurrentURI, something like this:

2023-01-02 19:26:22.492 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'AVTransportURI':'x-sonosapi-stream:s6586?sid=254&flags=32' (service 'AVTransport') for thing 'sonos:PLAY5:chambre'
2023-01-02 19:26:22.495 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'CurrentURI':'x-sonosapi-stream:s6586?sid=254&flags=32' (service 'AVTransport') for thing 'sonos:PLAY5:chambre'

This will be log only if before you were playing something else than tunein (spotify or a local MP3 file for example).
What I expect when tunein is started from Amazon Echo is that this value contains x-rincon-mp3radio: and http://opml.radiotime.com/Tune.ashx.
If it does not contain both, something changed and a fix is needed.

Yes, I can see this, if I start the playing from the sonos app. But the pairs are missing if I start it from Alexa.

I’am not 100% sure, but I believe that it has worked in the past. So, yes, it seem, sonos has changed something.

They are missing only if they do not change.
So you just need first to start a different audio service and then when you start tunein through Alexa, they should finally appear.

This is the log now if I start playing over Alexa:

2023-01-04 20:34:38.811 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'AVTransportURI':'x-rincon-queue:RINCON_48A6B8DBE3AE01400#13' (service 'AVTransport') for thing 'sonos:One:sonosKueche'

2023-01-04 20:34:38.812 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'CurrentURI':'x-rincon-queue:RINCON_48A6B8DBE3AE01400#13' (service 'AVTransport') for thing 'sonos:One:sonosKueche'

2023-01-04 20:34:39.623 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'AVTransportURI':'x-rincon-mp3radio://https://opml.radiotime.com/Tune.ashx?serial=AET4KLYN4G3DI77GHPQ4NZNCHCNQ&formats=aac,mp3&id=s44255&partnerId=rjyYMwEH' (service 'AVTransport') for thing 'sonos:One:sonosKueche'

2023-01-04 20:34:39.623 [TRACE] [s.internal.handler.ZonePlayerHandler] - Received pair 'CurrentURI':'x-rincon-mp3radio://https://opml.radiotime.com/Tune.ashx?serial=AET4KLYN4G3DI77GHPQ4NZNCHCNQ&formats=aac,mp3&id=s44255&partnerId=rjyYMwEH' (service 'AVTransport') for thing 'sonos:One:sonosKueche'

I do not get something like Received pair 'CurrentTitle' which I get if I start playing from sonos App.

Ok, understood, they moved from http to https. I will prepare a fix.

Here is the fix proposed:

And in case you would like to test it in OH 3.4, here is a jar file (first rename the file extension from pdf to jar):
org.openhab.binding.sonos-3.4.1-SNAPSHOT.pdf (131.6 KB)

I tried to install the binding. But it seems, that it does not work with my OH 3.4.0 installation:

Should I update to a daily snapshot?

Try to first run: feature:install openhab-transport-upnp
And then restart the sonos binding.
PS: I am nor 100% sure of the feature id.

Hi, feature id was correct and the binding is working now.
I can confirm that the fix is also working and the informations about the current title and album is working now with my Alexa.
Thank you very much for the fast bugfix!
Best,
Michael