I’ve got a network monitoring software which exports an image. This image should be displayed on a sitemap.
Picture is updating every 10 sec on a local Windows running PC which have OpenHub server also.
So the question is how can I do that?
As I understood you can display an image only from a web server.
Image [item=<itemname>] [icon="<iconname>"] url="<url of image>" [label="<labelname>"] [refresh=xxxx]
Thanks for reply but it doesn’t work. Tried it on a remote and local address. Any other ideas?
I’ve aslo found a software which can automatically copy files to a different folder so I’m copying the image to the habmin directory and I can access it by a simle url, but another problem is that openHAB probably locks this file so I cannot rewrite it after…
Bumping this thread as I’m also wondering how an image can be updated while OH is running. Seems like once it is loaded, regardless of whether it is actively being shown anywhere or not, you can’t update it without exiting out of OH.
I would like to refresh topic regarding openHAB2. In “old” openHAB there were $OPENHAB_ROOT/webapps directory and it works. In openHAB2 I cannot find such place. Do anyone know how to display local images in openHAB2?
I’ve tried a little bit and could get it working the following way:
place the image file in the conf/icons/classic folder of your openhab2 installation (see Iconset (where is in OH2?)
created the following sitemap entry: Image label="test" icon="camera" url="http://serverip:8080/icon/filename.png" refresh=60000'
where you just have to change serverip regarding the ip of your OH2 server and the correct filename.
as an alternative you could also use the WebView Item in you sitemap:
But it turns out that on the url address file extension is ignored and assumed to be only png is shown. I have tried even situation when I have to files: image.png and image.jpg and there is no difference in following lines: Image url="http://localhost:8080/icon/image.png" refresh=60000' Image url="http://localhost:8080/icon/image.jpg" refresh=60000' Image url="http://localhost:8080/icon/image" refresh=60000'
in all cases image.png appears. Webview way won’t work neither for png nor for jpg: Webview url="http://localhost:8080/icon/image.png"
Yes, you’re right. I’ve tested it only with png, and jpg also doesn’t work here with me either. I think only png is supported as they say in the icons thread
I ran into this file locking issue again after upgrading my openhab runtime to 1.8.3. @scooter_seh gets the credit for the ‘fix’ for this, but the issue is that the Jetty webserver has a default setting that locks files.
In the OPENHAB_ROOT/etc/webdefault.xml file, change the ‘useFileMappedBuffer’ setting to ‘false’ and restart the runtime.
There is now an alternate approach possible in openHAB 2 (not 1.x) where your Image and Video sitemap widgets can have an optional item= that references a String item. If the item’s state is a URL, the widget will proxy to that URL instead of the mandatory-supplied URL in the url= parameter. Whenever the item referenced by item= changes state, the Class UI, Basic UI and mobile apps will show the image or video referenced by the item.
These are a really good news. Last thing I’ve heard was a discussion about safety issues with that approach. Didn’t know it was implemented in the meantime. Thank you for this information.
There are no new security issues with support for item= because it is a choice you make to include item= in your sitemap. Check out the demo configuration for an example. You could even implement a rotating display of security cameras by having a rule periodically update the item to point to the next camera in the list every X seconds. Of if a binding updates an item to be some dynamic URL only known via the binding, etc.
I was referring to some old discussion between Kai and Chris, and Kai said using String item as Image URL was a security hole, so he rejected the idea. I haven’t looked at this solution for a pretty long time, since I’ve used Apache. Anyway, this is definitely much easier way to show dynamic images (i.e. Plex cover image). My home network is not open from the outside, so I don’t have that kind of concerns, it was just the reason it was not implemented before (the thread was from 2013 if I recall correctly). Once again, thank you for your help.