openhab 3.1 as a vm on a x86 linux
camera: raspberry pi 3 wired network using camera module
as the tittle suggests: accessable via myopenhab
accessing the dashboard localy works fine, as expected. updating the image every second or every 0.1 seconds works great. the image-widget of habpanel refreshes this url http://192.168.1.64/html/cam_pic.php?
as soon as i access the dashboard from outside the network the image wont load. no matter the devices (pc browser or android app, same outcome). its either a “broken image” icon or a black screen
192.168.1.64 is a local IP address that only exists on your LAN. When you are not on your LAN your browser cannot reach that IP address and therefore cannot access that image.
If you used this exact URL I doubt it worked before. Something else must have changed.
myopenhab.org is not a generic reverse proxy. It only gives access to the web stuff served by openHAB itself, not extra stuff you might have running on your LAN like IP cameras, Graphana, VNC servers, etc. If you want to access that camera from the Internet you have two choices:
expose the camera to the Internet and use that Internet exposed URL in your HABPanel (not recommended
Somehow make it so that openHAB serves up that camera’s feed itself.
Since 1 is not recommended, the ways you can manage 2 is using the IP Camera binding or writing a rule or script or something to save the camera feed to $OH_CONF/html which will then let you access it through the openHAB web server.
yep, ofc i need them. with them i could create a image widget which does not work outside the network (the original issue)
and the ip camera binding is only for onvif or am i wrong?
i tried to configure it but it always results in configuration error
Using the direct URL is never going to work. If it did you wouldn’t need the IP Camera binding in the first place.
I don’t use HABPanel so I don’t know how it treats Image Items. Sitemaps and MainUI let you use an Image Item as the URL to the image to show. If you can’t use an Image Item in HABPanel, look at the state of that Item and use that URL instead.
haaaa? thats exactly what i did
i created an ipcamera thing (and ofc an item for the image) and linked it to the widget. it breaks the same way
am i missing something? i dont understand how / what i could do differently
The image widget can display an image, directly or via an openHAB String item, and can refresh it at regular intervals.
Are you using an Image widget? Are you looking at the logs for errors from the IP Camera binding? Have you looked at the String Item linked to the Image URL Channel to see that it’s actually populated with the URL? If it does, have you tried to open that URL yourself in the browser? Have you tried to use the URL directly in the widget instead of Image URL Item?
If you have tried those things, you need to tell us. If you don’t say we assume you haven’t done. But be specific. For example:
Which specific Channel did you link to the Item and try to use in the widget? An IP Camera Thing has dozens of Channels, many of which with “Image” in the name. You’ve not yet mentioned what type of widget you are trying to use in HABPanel. You’ve not mentioned anything about logs at all, have you watched them for errors?
yes, no errors, yes it is. its the exactly url i put in there, yes i did. the result is a html page with the image, as expected. its the exact image the widget shows me when i use openhab in lan. ofc i tried using the url directly. it was the starting point. then i tried the ipcamera binding where i set the ip and url to the known values and selected the string item in the widget. which worked but only inside the lan.
true. there are several. i used the “Image URL” channel.
here is the code-version of this thing.
logs? yes. there is nothing that happens during the call of the widget
(i start openhab-cli showlogs, i grab my phone, i open the app, i open the part witht he widget, log says nothing except for items that were updated in that moment)
the issue is that openhab does not “wrap” the image.
it only forwards the url to the browser/device that calls the widget
that means that if the url is not working outisde the lan, there will be no image in the widget
the solution would be to make openhab the “wraper” (i really dont know how to call it) so that i do need to call the address because openhab is providing the image itself.
but i dont have a clue how
its not an error or bug or issue. i think its by design. but there must be a solution for it, where openhab caches the image and presents it “as its own” (“wraper”) to the device
To be clear, we are talking about the URL that was put into the String Item linked to the Image URL Channel of the IP Camera Thing. It’ll look something like http://<openhab's address>:8080/ipcamera/<name of thihng>/ipcamera.jpg.
We are not trying to use the URL to the RPi.
Assuming that is the URL you are working with, perhaps HABPanel requires us to use a relative URL. Try it without the http://<openhab address>:8080 and just use /ipcamera/<name of thing>/ipcamera.jpg.
The whole point of this feature of the IP Camera binding is to allow openHAB to act as the web server to get to your camera feeds. Because openHAB is the web server, myopenhab.org can proxy it so it should be available outside your lan through myopenhab.org.
As I’ve said repeatedly though, I don’t have any experience with HABPanel. I know just using the Item works for sitemaps and MainUI. But perhaps it doesn’t work with HABPanel. But assuming that HABPanal can use relative URLs you should be able to make it work. If not it may never work with HABPanel.
My guess is your using http to acess the main UI when your inside your network, then your using https to connect with when your outside. This is a problem as any http links will not work when your connected via Https. The solution is to use the port 8443 version of the ipcamera links.
great idea. does not work.
even with hikvision kameras i dont get an image outside of the lan
no matter if i choose “string item” which points to the image or if i just set a static url with or without https, it always results in “broken image” outside the lan via myopenhab
(ofc i made sure that the image is there by calling the url in the browser)
The myopenhab cloud will not proxy video streams for bandwidth reasons, for an image that updates last time I checked which was years ago it did work. For remote viewing of cameras it is a good idea to use a VPN to connect back to your internal network as then you show up as if you were home. This is different to a VPN that most people know of, its free to use a VPN package like wireguard or openVPN to connect with back to your server.