[SOLVED] Chromecast binding - set image (channel image) manually to a PNG file

Hello,

if I play an internet radio station on my chromecast (not a local mp3 file), no cover will be displayed. I would like to set the cover manually (PNG file in the file system), is that possible and if so how?

Image Chromecast_Audio1_Kitchen_Image "Cover" { channel="chromecast:audio:Chromecast_Audio1_Kitchen:image" }
rule "play an mp3 file or radiostream ..."
when   
    Item  Chromecast_Audio1_Kitchen_Trigger changed
then
    try {
      Chromecast_Audio1_Kitchen_playuri.sendCommand("http://br-br1-franken.cast.addradio.de/br/br1/franken/mp3/56/stream.mp3")
    }
    catch(Throwable t) {
      logError("Chromecast_Audio1_Kitchen", "Error " + t.toString())
    }
	Chromecast_Audio1_Kitchen_Remote.sendCommand(PLAY)
    // here I would like to set the picture of the radio station!
	Chromecast_Audio1_Kitchen_Image.postUpdate("radiostaion.png") // ?????
end
2018-10-21 19:24:27.144 [WARN ] [rthome.model.script.actions.BusEvent] - Cannot convert 'radiostaion.png' to a state type which item 'Chromecast_Audio1_Kitchen_Image' accepts: [RawType, UnDefType].

You need to store the image in the html folder of openHAB.
Then you do:

Chromecast_Audio1_Kitchen_Image.postUpdate("http://openHAB_IP:8080/radiostation.jpg")

I don’t know it that will stop the radio playing though…

Unfortunately that does not work:

2018-10-22 19:56:41.185 [WARN ] [rthome.model.script.actions.BusEvent] - Cannot convert 'http://192.168.137.29:8080/radiostation.png' to a state type which item 'Chromecast_Audio1_Kitchen_Image' accepts: [RawType, UnDefType].

jpg returns the same error.

here is the solution:

convert the picture with e.g. https://www.base64-image.de/ and then:

// the coded picture is shortened here
Chromecast_Audio1_Kitchen_Image.postUpdate("data:image/png;base64,iVBORw0KGgoAAA........AAElFTkSuQmCC")

by the way, the radio does not stop playing!

Thanks for this wonderfull solution! I was always working with separate items to display these kind of images.