Configuration (all file based):
ipCamera Binding 5.1.1 - is installed OK (uninstalled and reinstalled)
Things UID ipcamera:hikvision:FrontYard - is ONLINE
Channel Image URL /ipcamera/FrondYard/ipcamera.jpg - seems well formatted
The PROBLEM:
Camera image will not display in Basic UI
Camera image will not display on IOS App
Camera image will display in HABPanel
Camera image will display from Floorplans when item selected
It appears there are two methods to display a camera image in the sitemap.
Image item=[itemname]
Image url=[string]
Which definition method creates the most efficient openHAB process?
I have 12 cameras. Loading the iOS sitemap cameras (all in one Text item=Cameras {}) it attempts to load the images but fails. The Log Viewer shows a continuing refreshing of GET:/ipcamera.jpg, received from 127.0.0.1.
There are several ways how to display images, I know of two:
through the ipcamera binding:
Image url="http://<ip_of_openhab>:8080/ipcamera/dahua2/ipcamera.gif"
(ipcamera.gif located in /html/dahua2/ipcamera.gif, but can be in any folder specified by the binding config)
This should also work with jpg images, but does not with my Dahua cams.
and through the integrated webserver which serves images in the /html subfolder:
Image url="http://<ip_of_openhab>:8080/static/dahua2/test.jpg"
(test.jpg located in /html/dahua2/test.jpg))
Thanks for your guidance. I may have mislead you in how I asked the question… “displaying a static image”. I apologize. I understand and have several uses of displaying a static image in my sitemap. (e.g. Image url=“http://localhost:8080/static/moon_phases.png”).
What I meant is how to display a snapshot of a camera not a video stream.
I am most interested in the most efficient method to display multiple Hikvision snapshot images on the Basic UI sitemap and iOS app.
For some reason the method I was using is no longer working with openHAB 5.
The recordingGif Channel counts from 5 to 0 through the binding logic. As soon as the Item linked to that Channel is 0, the image gets saved to the folder specified in the Thing config (FFmpeg Output Folder).
A rule is triggered through that item via Item Dahua2KameraRecordGif changed to 0 and sends the animated gif via pushover to my phone.
This is working for me since openHAB version 2.x and still works in 5.x.
Make sure the Item linked to the recordingGif Channel is not uninitialized, then it won’t work. Set it manually to 0 once.
Edit: in javascript it is: actions.Things.getActions("ipcamera", "ipcamera:dahua:dahua2").recordGIF("ipcamera",5);
It should work. Just check what URL is generated by the binding by adding a Text widget for this item or by checking the logs. If this URL can be acceded from your browser and is a valid image, it should work.
Did you try with different browsers to be sure that it is not a browser issue ? You are running your browser on what kind of device ?
There is another way where the binding is putting the image data instead of an URL in the item state. The syntax remains the same in sitemap. Don’t know what was implemented in the ipcamera binding.
LOG VIEWER
15:53:58.784 DEBUG org.openhab.ui.basic.internal.servlet.WebAppServlet Servlet request received!
15:53:58.804 WARN org.eclipse.jetty.server.HttpChannel /proxy
15:53:58.807 DEBUG org.openhab.binding.ipcamera.internal.servlet.CameraServlet GET:/ipcamera.jpg, received from 127.0.0.1
15:53:58.807 DEBUG org.openhab.binding.ipcamera.internal.servlet.CameraServlet
GET:/ipcamera.jpg, received from 127.0.0.1
15:53:58.807 DEBUG org.openhab.binding.ipcamera.internal.servlet.CameraServlet GET:/ipcamera.mjpeg, received from 127.0.0.1
15:53:58.808 DEBUG org.openhab.binding.ipcamera.internal.servlet.CameraServlet First stream requested, opening up stream from camera
For clarity, in the ITEMS file there are 2 defined items:
FrontPorchPic = imageUrl with the binding returning = /ipcamera/FrontPorch/ipcamera.jpg
FrontPorch = mjpegUrl with the binding returning = /ipcamera/FrontPorch/ipcamera.mjpeg
I have in the SITEMAP:
Text item=FrontPorchPic - returns text string value
Image item=FrontPorchPic - returns broken image icon
Text item=FrontPorch - returns snapshot!
Image item=FrontPorch - returns video stream 2!
*Confirming your observation that the binding is setting different HTTP headers for video widgets.
To move forward I will use the mjpeg format.
Unclear what changed in openHAB 5.
Thanks again for all of you guidance!
Hmm…
Hikvision For MJPEG to work, you need to set the first sub-stream to be in MJPEG format, otherwise you can override the default with the mjpegUrl config with a valid URL for MJPEG streams.
I checked the camera and the first sub-stream (Main Stream) is set to H.264
The second sub-stream (Sub stream) is set to mjpeg