Using Openhab3 with the IPCamera binding using Hikvision type, I am unable to get the ImageUrl working. The binding reports that the camera is online. I have 3 separate Hikvision cameras and all exhibit the same behavior. I’ve set the following settings:
I am able to view the image using a web browser at http://192.168.1.51/Streaming/channels/1/picture
If I omit username/password, I get an error about credentials…
I do not want to use MJPEG as I am using MP4 for other purposes. Any ideas or suggestions to get ImageUrl working?
I’m getting this…
020-12-30 23:24:10.005 [INFO ] [era.internal.handler.IpCameraHandler] - The alarm stream was not running for camera 192.168.1.50, re-starting it now
2020-12-30 23:24:13.111 [INFO ] [era.internal.handler.IpCameraHandler] - The alarm stream was not running for camera 192.168.1.51, re-starting it now
This sequence appears repeatedly with this appearing every so often…
2020-12-30 23:28:53.667 [ERROR] [t.ide.server.concurrent.WriteRequest] - Error during request:
java.lang.IllegalArgumentException: URI has an authority component
at sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:53) ~[?:?]
at sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:103) ~[?:?]
at java.nio.file.Path.of(Path.java:203) ~[?:?]
at java.nio.file.Paths.get(Paths.java:97) ~[?:?]
at org.openhab.core.model.lsp.internal.MappingUriExtensions.toPathAsInXtext212(MappingUriExtensions.java:184) ~[?:?]
at org.openhab.core.model.lsp.internal.MappingUriExtensions.toUri(MappingUriExtensions.java:75) ~[?:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.getURI(LanguageServerImpl.java:567) ~[bundleFile:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.toBuildable(LanguageServerImpl.java:414) ~[bundleFile:?]
at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$didClose$10(LanguageServerImpl.java:407) ~[bundleFile:?]
at org.eclipse.xtext.ide.server.concurrent.WriteRequest.run(WriteRequest.java:50) [bundleFile:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
I had to give the user “operator” privileges instead of just “User”. That cleared up the warning, but still no image…, also, I am not using the stream and have it set to MPEG4. Will that cause problems?
Also fixed the other error, turns out it was from a bad rule.
@matt1 Yes sir, I did read the docs and configured accordingly as in my original post. But still no image. Did I forget something? Also, just curious, I did not want to enable motion alarm, can the capabilities not be used independently?
Username and password are set correctly and verified through the browser, but I am seeing this in the logs:
2021-01-01 15:25:45.811 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.51:80/ISAPI/Streaming/channels/101/picture
2021-01-01 15:25:45.905 [TRACE] [g.ipcamera.internal.HikvisionHandler] - HTTP Result back from camera is
:
That is normal if the camera is using the DIGEST method for handling user/pass. Ignore it if the binding is working, as it is how digest works. If it does not work then this may be a clue, but I can not tell from a short snippet of the log without knowing more info. HIK cameras allow you to select BASIC auth and this wont happen and uses less bandwidth at a reduced security tradeoff.
The binding can create ‘snapshots.mjpeg’ streams for you even if your camera is not capable of mjpeg. It does this by using the snapshots so read the docs to learn more.
The older HIK cameras prefer the non ISAPI urls and some of the newer ones only work with the ISAPI version. If you click on ‘show advanced’ see your very first picture you posted, you can then change the URL used for the snapshot. The HIK camera also come with the CGI/API turned off by default, have you turned in on in the cameras own setup?
I don’t understand why you are asking this? you do not need to use motion detection at all with the binding and most features work without it. The features that are ‘complimented’ by having it are the autofps.mjpeg stream and also when you use the ‘group’ of cameras to display as a single view as the rotating display of cameras will jump to any that have motion.
Looks (from the trace logs) that the binding is talking to the cameras and getting back capabilities as well as subscribing to events. Seems like the imageUrl snapshot is the only thing not working. What can I provide to help diagnose. I’m trying to see the image in the Items view of Openhab3 after creating an Image item from the thing. The binding reports the camera is online.
The documentation tells you not to do this and to use another method. Try using this widget instead.
As mentioned the 401 replies back from the camera can be normal if the camera is using digest auth so it may be that the default URL is fine and does not need over riding.
You don’t need to reboot openhab but try rebooting the camera as if you got the password wrong it can lock you out and a reboot resets any lockouts.
It might be best to reboot both and keep the trace log for when the camera connects. The imageURL is only a string of text that tells you the URL to use based on the IP of openhab and the serverPort.
Another cause may be openHAB is setup to use a non connected network card. Go to the settings of openhab and select network settings.
The next thing to try is seeing if the binding reports that your requesting the jpg when you open this URL in any web browser.
http://openHABip:8000/ipcamera.jpg
The binding should report that it got a request for this, plus you should see the cameras picture in any web broswer, is that what happens? If no then what happens exactly? If no log then try changing from 8000 to a different port in case that one is already in use. No need to reboot when changing that.
Your camera is using BASIC auth now and that Document Error is normal since it only happens once. Everything does look to be working fine.
Discovery…one of the cameras was being stubborn and I just could not get that camera to work using imageUrl. After a lot of checking it turns out that it was running a very old version of firmware. Updated the firmware from v5.2.x to v5.4.5 and image url works.