JSON image declaration

Hi there,

I’m currently trying to add a image to my sitemap. The problem: the image’s url is transmitted by JSON.
Normally I would handle this in a rule, but I’m asking myself if there is a possibility to make this happen with a item declaration?

Something like

Image test {http="<[https://test.com/json:23000:JSONPATH($.url)]"}

Or maybe in the sitemap itself? Is this even possible?

Lex

Looks like you are using OH2.

No, there is no way to dynamically change parameter text in a sitemap. Items don’t cost anything.

Sidenote; I’m always baffled by the lengths people sometimes go to avoid creating an Item to do the job directly.

1 Like

Yes, I’m still using OH2.

Well, I would like to do it with an item :slight_smile: but I don’t know how!

Okay, you’ll want to know about the Image sitemap widget
https://v2.openhab.org/v2.5/docs/configuration/sitemaps.html#element-type-image
quote

item can refer to … a String Item whose state is an URL that points to an image.

So as you almost had originally, use the HTTP binding or whatever to extract the target image URL to a String type Item, use that Item as the parameter to an Image widget.

thanks a lot! That’s what I was searching for.

Unfortunatelly it doesn’t work on my machine. Everything I add the item (filled with the url), ALL my other image items are not shown anymore…

When you’re ready for some help, show us the String Item state and your sitemap entry. Try copy-pasting that to your browser bar.