OH3: Item Image Type - How to specify a URL?

Another “getting used to OH3” Q!

I’ve created an Item of Image Type but can’t see how you specify the path (in my case a URL from a security camera) for this Item???

The image shown is blank, and if I click on it, it points to my openhab setup at http://192.168.xxx.xxx:xxx/#!/settings/items/FrontDoor/photos/ but I want it to go to Image url=“http://192.168.xxx.xxx/api/camera/snapshot?width=1280&height=960

1 Like

Why are you trying to create an image item? Remove the item from the cards setup and just provide the URL. If the camera needs a user and pass or it does not
Handle refresh requests correctly the ipcamera binding can be used.

I’m trying to build up my Model as follows, including adding a point for the camera grab (no user/pass).

I had no issues with this in OH2 using the following, just trying to get my head around the new way of doing things in OH3.

	Frame label="Home" {
		Text label="Front Door" icon="door" {
			Text item=Door_Ring_LUD label="Last Ring"
			Text item=Door_Opened_LUD label="Last Opened"
			Image url="http://192.168.xxx.xxx/api/camera/snapshot?width=1280&height=960"

That’s fine to do that. Are you storing the sitemap in a file or in the json DB via creating a sitemap in the page builder? If so, try doing it with a sitemap file instead to see if it then works.

I’m trying to build it in the new OH3 GUI --> Model as shown in the pic above, but for the life of me can’t work out the concept of how to add a simple picture grab.

The code I showed above is from my OH2 site where it of course just works fine with 1 line of code.

I really want to try to use the “new” method, but as some of the concepts are unfamiliar, I’m just clicking around trying to work this out.

Its possible there is a bug currently and you will need to do it in a sitemap file until addressed.

Thanks Matt, the thing is I don’t know if I’m doing it correctly in OH3 the first place to call it a bug?!?!!?

All I want to do is show an image from a url when the page opens/refreshes. I don’t know if creating a Point, assigning it as an Image, adding the URL is the correct method.

Hi Nathan,
Did you ever solve this problem?
I have the same problem with OH3.1.4 milestone trying to display a weather meteogram. As you said, it was oh-so simple in OH2, 1 line of code. Tbh, I don’t think Matt Skinah really understood what you were asking judging by the questions he asked & his answers.
Isn’t is frustrating that now in November, one still can’t do a simple thing like this?!!
I have posted my problem a few days ago but no replies yet… :slightly_frowning_face:
My post: OH3 url Image won't display

That’s not an Image Item, it’s an image widget. There’s no Item involved at all, which I think was where OP got into trouble by trying to drag one in. With this widget, openHAB never sees the image, it’s a transaction between viewer/browser and target.

There’s a fairly lengthy exploration here - using a String Item to hold the URL

Hello Ross,
I tried to decipher the discussions in that link you offered but it was like going down and down a rabbit hole… all seems ridiculously complicated… is there no simple way to do what I (with my Meteogram) or the other users that is elegant like the OH2 method? Your distinction between an Image Item and an Image Widget intrigues me too…what useful thing does this widget do if it doesn’t provide a link to the image that the user wants??? The whole thing has so geeky and opaque imho… common sense would say “I want to display an image so I’ll create an image item”… I despair! :exploding_head:

Start with something simple. Focus on the first post in that thread.

with a helpful screenshot. Then -

the rest of it is fiddling about with refresh

Hello Ross, thanks for your reply. If you could please take a look at my post link about my Meteogram you’ll see I couldn’t even get the Meteogram url image to show at all in the card. It was visible when inspected by other avenues and WAS updating.
I do not know how to get a string item to “hold the url” in OH3. In OH2 sitemaps I would have ‘assigned’ the value to the string with an equals sign…?. But I didn’t have to go creating a string in OH2 and then creating rules to try get updates… it was a 1-liner code for the image item. Have we seriously gone backwards in OH3??? I’m totally lost tbh despite working with OH3 for months now. :dizzy_face:

You can of course continue to use sitemaps with BasicUI. Come to that, you can continue to use OH2 - I do.

Okay, this a fairly basic handicap.

Ross I’m not sure if you think I’m handicapped or stupid… I’m neither… If I could build everything AND get everything to work with the old sitemaps, I can’t be too dim.
In OH3 when you create a String item in the UI, I can only see the option to add Metadata… how do I actually assign/give the string a value?
I know one can use the old Sitemaps with OH3 but I was trying to migrate over to the colour card UI using the semantic model. I’ve managed to recreate EVERYTHING in the new UI BUT I’m stumped by how to simply get this bloody Meteogram displayed. I need a simple clear explanation.

I answered on the original post.
Basically you have to pursue one of the following options:

  1. “URL-item”: the item just stores a URL to an image. then the item is of type string and you should use a corresponding widget (e.g. oh-webframe-card)
  2. “Image-item”: the item stores an image. then the item is of type image and the corresponding widget is oh-image-card)

This is like updating the state of any other Item in openHAB.
You can link it to something supplied by external service or device, doubt that’s what is wanted here.
You can post state updates to it from a rule. Say it’s never going to change, you might use a ‘system started’ rule.
You can send it commands from UI - that’s not often helpful for String types, because there is no free-text widget for typing in. But you can construct a multiple-choice widget for string values, typically used for OFF-MIN-MED-MAX type choices, but in your case you might have different URLs for different charts.
Or you can use API Explorer tojust update it manually.

It looks simple to you, but there is more to it than meets the eye. You’re asking to embed something alien and external into a private viewer. Most of the web includes security features specifically to stop you doing that. Behind the “Image” widget in a sitemap is a hidden proxy image servlet. I do not think MainUI uses the same technique, perhaps because of its architecture, perhaps because OH3 has higher security levels.

Hi Ross,
Apologies for snapping at you the other day… I was a bit frazzled with frustration.
Thank you for your detailed reply which has given me further insights and I’ve learned a few new details about the underbelly of OH too… :crazy_face:
As it turns out Oliver2 helped me out in my original posting article and the solution is there now. He actually ‘re-enacted’ the exact thing I was trying to do and diagnosed the problem. We did try your suggestion about API assigning a url to a string and using the string item as the target item of the image item but it didn’t work. The overriding problem was that the image item seemed to remain empty (even though we could see the meteogram) and thus UI Card saw an empty item and went looking for an image in the Photos directory (folder in Mac speak). That was why i was getting this bizarre url ending of ‘Photos’ in the address bar.
Anyway, you’ll see (if you’re curious) what exactly we did because I put screen shots in the solution discussion. The solution process and exchanges are all there.
Let me know if it makes sense to you and if you found it interesting too.
Thanks again and sorry for being a bit sharp the other day. :slightly_smiling_face:
Original post: OH3 url Image won't display

Not required. This stuff is frustrating.

Embedding a foreign image in MainUI seems to be a fraught business.

The workaround you’ve ended up with is to use openHAB machinery to fetch a copy of the foreign image, where the OH server has all the control and no security risks. “Build your own proxy.”
Then show that local copy in UI.

Hi, yes that’s an excellent summary of what we did! :ok_hand:

I hope other (frustrated) folk may benefit from the solution/approach.
No I think it’s important to avoid being sharp with folk, it does happen of course, and thanks for accepting the apology. :slightly_smiling_face: