Sonos currentalbumart error

Hi

I’m having troble using Album art, I would like to use it in Habpanel, but i can’t get any image and I get following error in the log, every time a change to a new song.

I can’t find the channels currentalbumart and currentalbumarturl under Things in the Paper UI

20:43:59.143 [ERROR] [.io.transport.upnp.UpnpIOServiceImpl] - Participant threw an exception onValueReceived
java.lang.IllegalArgumentException: Channel with ID 'currentalbumart' does not exists.
        at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.isLinked(BaseThingHandler.java:573)[107:org.eclipse.smarthome.core.thing:0.9.0.201706071228]
        at org.eclipse.smarthome.binding.sonos.handler.ZonePlayerHandler.updateChannel(ZonePlayerHandler.java:582)[224:org.eclipse.smarthome.binding.sonos:0.9.0.201706071228]
        at org.eclipse.smarthome.binding.sonos.handler.ZonePlayerHandler.onValueReceived(ZonePlayerHandler.java:480)[224:org.eclipse.smarthome.binding.sonos:0.9.0.201706071228]
        at org.eclipse.smarthome.binding.sonos.handler.ZonePlayerHandler.updateMediaInformation(ZonePlayerHandler.java:1045)[224:org.eclipse.smarthome.binding.sonos:0.9.0.201706071228]
        at org.eclipse.smarthome.binding.sonos.handler.ZonePlayerHandler.onValueReceived(ZonePlayerHandler.java:389)[224:org.eclipse.smarthome.binding.sonos:0.9.0.201706071228]
        at org.eclipse.smarthome.io.transport.upnp.UpnpIOServiceImpl$UpnpSubscriptionCallback.eventReceived(UpnpIOServiceImpl.java:144)[194:org.eclipse.smarthome.io.transport.upnp:0.9.0.201706071228]
        at org.jupnp.controlpoint.SubscriptionCallback$2.eventReceived(SubscriptionCallback.java:222)[164:org.jupnp:2.2.0]
        at org.jupnp.model.gena.RemoteGENASubscription.receive(RemoteGENASubscription.java:114)[164:org.jupnp:2.2.0]
        at org.jupnp.protocol.sync.ReceivingEvent$2.run(ReceivingEvent.java:130)[164:org.jupnp:2.2.0]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_121]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]

I have tryed adding the items manuely, but that didn’t help

String Sonos03Kueche_CurrentAlbumCoverArtURL	"AlbumCoverUrl [%s]"	 	{channel="sonos:PLAY1:RINCON_949F3E72CEE801400:currentalbumarturl"}	//Cover art URL of the album currently playing
Image  Sonos03Kueche_CurrentAlbumCoverArt	"AlbumCover [%s]"	 	{channel="sonos:PLAY1:RINCON_949F3E72CEE801400:currentalbumart"}	//Cover art of the album currently playing
224 | Active    |  80 | 0.9.0.201706071228     | Sonos Binding

My openhab is 2.1.0-SNAPSHOT
Build #941

Can someone give me a point in the right direction.

Was your thing created by an old version of the Sonos binding ? I mean before these channels were existing. In the case, recreate your thing.

It helped deleting things and install the sonos again, but I can’t see any album art, it just telling me “No image is currently present”, I have try’ed different songs and albums

What service are you using ? TuneIn ? Spotify?
Is it working in Basic UI ?

I have now tested tunein and Spotify, and they work in habpanel.
I am using a Danish music streaming called Yousee music, and it does not show the album art, but is shows up in Sonos app.

Maybe something specific to this Sonos service, I don’t know.
Try to use the URL provided in a WEB browser.

Hello,

I am also trying to get the album cover in working in Paper UI. However the I cannot find the channel “currentalbumart”.

I have tried deleting the thing --> uninstalling the binding --> installing the binding (V2.0, which I think is the most recent) --> re-adding the thing. My links were still there afterwards, but still no channel currentalbumart.

So I tried to add the channel manually in the REST API, but that only led to an 404 Error.

Did anybody here get it to work and can let me know if I’m doing something fundamentally wrong?

THANK YOU!!

It was added after 2.0 was released.

1 Like

Hello Lolodomo,

Thanks for the response!

How can I find out, what the most recent version of the binding is and how can I get it then?
Is there any way to update the binding?

On github I tried to find the version Info for the Binding, but to be honest I don’t really know where to look.

I was getting the same error as the OP and then removed and re-added all the sonos binding and all the components that i have (3x Play1, 2x Play 3, PlayBar and PlaySub) and the error stopped in the logs.

I can now see the album art channel however when it is linked and I open PaperUI, my browser (any browser) hangs and PaperUI becomes unresponsive. If I unlink the album art channels, PaperUI works again. Is there a bug or has something screwed up on my setup?

Hello Chris_Reid,

I have the same Issue. However I learned in some other post that paper UI is only meant to be used for configuration and not to control anything. So I switched to HabPanel, where you can use an image widget to display the Album art from the image URL (just select openHAB String item) and that works like a charm for me.

The image item was therefore not necessary anymore so I deleted it alltogether.

Hi Mads,

I have a rule that is fixing the Yousee music behavior.
Using Fiddler, I found that Sonos gets Yousee Albumcovers from “https://artwork.cdn.247e.com”.

So the rule, if the Item Sonos_Kitchen_CurrentAlbumCoverArtURL (channel type id “currentalbumarturl” of the Sonos binding) contains “yousee”, it gets song id from the “currentalbumarturl” and download the Cover Art from “artwork.cdn.247e.com”, encode it and post it to the image with item (channel type id “currentalbumart”) Sonos_Kitchen_CurrentAlbumCoverArt .

It’s working on version 2.3, HABDroid and UI.

import java.net.URL;
import java.util.Base64;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;

rule "Finding Cover Art for Yousee service"
when
    Item Sonos_Kitchen_CurrentAlbumCoverArt received update 
then
    val String url = Sonos_Kitchen_CurrentAlbumCoverArtURL.state.toString;
    if( Sonos_Kitchen_CurrentAlbumCoverArt.state.toString == 'UNDEF' ) {
        val String covertUrl = "https://artwork.cdn.247e.com/covers/%picName%/436x436";
        val String[] arrUrl = url.split("%252f");  
        var String picName; 
        for (String element : arrUrl) {
            if (element.contains(".mp")){
                picName = element.substring(0,element.indexOf(".")) ;
            }
        }
        if (picName !== null){
            val String coverPath = covertUrl.replace("%picName%",picName);
            val URL imageURL = new URL(coverPath);
            val BufferedImage coverImageJpg=ImageIO.read(imageURL);
            var ByteArrayOutputStream baosCoverArt=new ByteArrayOutputStream();
            ImageIO.write(coverImageJpg, "jpg", baosCoverArt );

		    val String base64Image = Base64.getEncoder().encodeToString(baosCoverArt.toByteArray());

            val String strBase64Image = "data:image/jpeg;base64,"  + base64Image;
            Sonos_Kitchen_CurrentAlbumCoverArt.postUpdate(strBase64Image);
        }
    }
end