IpCamera: New IP Camera Binding

@sroettgermann
Glad u like it. RE PTZ not working I would need to see the debug log output when the camera is making its connection to determine what is wrong. Just because the camera works in a web interface does not mean the camera does not have an issue in the ONVIF implementation. I would use the ONVIF device manager program that is opensource to test the camera and check what onvif version the camera reports it supports. Also upgrade the firmware of the camera. The logs are the first thing you should check when things are not working.

@toroid
PM sent where u can email log outputs.

The control labelled enable/disable motion alarm does not send the correct http requests for hikvision, it is setup to send different requests.
turn the control ON will send something different to when you turn it OFF, also the BETA control will also send a request. If you can watch the logs to see if the output allows the binding to determin if the camera is detecting movement or not this is what I need first. Once the motion alarm is working, I will then move on to enabling and disabling the alarm.

I saw Your address, Iā€™m trying to get the log from the camera. But that is not very good :frowning:

Thanks @matt1. I had a quick look on the camera manufacturers web site and got this information: ā€œOnvif Protocol: Support Onvif Protocol, Support NVR(above Onvif version 2.4.2)ā€
I cannot find any new firmware online.
I will test the camera with the ONVIF device manager when Iā€™m back home in the evening.

Hey @matt1, I tested the camera with just another application. I wasnā€™t able to test it with the recommended tool, since Iā€™m using Linux and Mac machines. I tested it with the application ā€œSecuritySpyā€ under macOS and everything is working fine -> PTZ in the special case.
The application states, that Iā€™m using an ONVIF protocol via TCP or UDP. Does this information help?

EDIT: I also had a look in the OpenHAB logs and found the following information

2018-05-18 13:13:46.258 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - About to interrogate the camera to see if it supports PTZ.
2018-05-18 13:14:11.679 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Camera is reporting it supports PTZ controls via ONVIF

Therefore I think, I should be able to operate the cam with PTZ via ONVIF and your binding.

2ND EDIT:
I installed the ONVIF Device Manager Software on my office notebook to get some more information about my camera. What I found out:

  • ONVIF Version is 2.04
  • PTZ is supported and working with the device manager software
  • When I use the built-in PTZ controls of the application, I can decide if I want to use ā€œabsolute moveā€, ā€œrelative moveā€ or ā€œcontinuous moveā€. Here, I found out, that only the ā€œcontinous moveā€ is working.

I added both my Hikvision cameras no problem. It works great, thank you.

Just trying to add a generic Chinese one now, but all I get is OFFLINE - COMMUNICATION_ERROR

Onvif device manager can show the camera ok. It tells me the onvif port is:8899, all the info Iā€™ve added seems to be correct. Have I missed something?

Then that is the cause of the problem. Your camera is telling the binding that it works with absolute move, yet it has an issue with absolute move. Cameras do not need to support all the movement methods, but they should report that a method is not supported if it does not work. All I can suggest is you upgrade the firmware of the camera and report the problem to the cameras support.

Latest build 19-05-2018

Added some minor changes as a few users are having issues with PTZ. @toroid I noticed in your logs a NPE that I suspect is caused by the camera replying with null when it is asked its current location. I have added some more logging and some changes that may address this.

I am still on holidays and can not test with my camera. Once I am back I can make some more serious changes to the binding and do some tests.

@matt In the new version of binding now writes this error, although the ip and port settings for my camera are correct.

And the picture from the camera still shows.

Thanks @matt1. Well, that is the problem, but since I can move the camera with continuous move in the ONVIF device manager, I think there should be a chance to do so somewhere else.
So, if I got you right, your binding only supports absolute movement?! What about integrating the other movement types too? If I can help you with this, feel free to contact me.

Regarding the firmwareā€¦ I havenā€™t found some new firmware online. :frowning:
Iā€™ll try to contact the supportā€¦

Correct currenty only absolute is implemented as I felt it was the cleanest and most useful form to use. You can tell the camera to move to show the front door, then tell it to move to a side window and the camera moves to a repeatable location.To implement constant movement you would need a button for each direction plus a stop button. It may be possible to use the current sliders by using the middle of the slider as stop as I would prefer to keep things the same at a channel level to keep the code cleaner.
If you want to implement it, push requests are welcome just need to discuss how it will work.
This link covers how it is done
http://www.milgo.de/onvif/java-library/ptz-operations

@toroid
I always need the log output as it tells me so much information and where things went wrong.

Hi,

Great job on this! :slight_smile:

How I can use de videourl in sitemap? The image I can use like describe in the readme (https://github.com/Skinah/IpCamera/blob/master/README.md), but no mention to video.

This is the items list:
items list ipca*
ipcamera_ONVIF_001_image (Type=ImageItem, State=raw type (image/jpeg): 34779 bytes, Label=null, Category=null, Groups=[gTest])
ipcamera_ONVIF_001_imageurl (Type=StringItem, State=http://192.168.1.76:80/web/auto.jpg?-usr=admin&-pwd=admin&, Label=null, Category=null, Groups=[gTest])
ipcamera_ONVIF_001_videourl (Type=StringItem, State=rtsp://192.168.1.76:554/11, Label=null, Category=null, Groups=[gTest])

Best Regards,
Fernando Gomes

I donā€™t know is the short answer, I put the video URL there because the camera reports it and I thought it may be useful?!? I suspect it is useless especially if your camera is secured as the link is useless if the binding can not handle the auth for you. Most cameras report a RTSP stream for the video url and Openhab only uses mjpeg in all of its interfaces and apps AFAIK. What some people do with cameras is use ffmpeg.exe to do a conversion but this uses CPU power not to mention the network traffic of a video stream, multiply this by 8 cameras and Iā€™m guessing this will add up potentially causing issues on low powered setups.

I use my camera to update the picture every second, which I find great as the CPU and network loads are much smaller and I donā€™t have to reduce the quality. I plan to get the camera to record the video to a NAS/FTP/SD the next few weeks so I have access to the video evidence should I need it, but for 99.9% of the time I feel the picture works very well and I have it set not to update the picture unless an alarm is triggered.

If someone can suggest a good way the binding can do something different feel free to make a suggestion.

https://docs.openhab.org/configuration/sitemaps.html#element-type-video

item can refer to a String Item whose state is a URL to a video.

The video URL in a String item is useful (I used that in the zoneminder binding as well). Also, most cameras have a MJPEG URL, but that may or may not get announced via ONVIF (Connecting to IP Cameras has most of them). If the cam supports basic auth, itā€™s possible to add the auth info to the URL, and the OpenHAB video proxy will not reflect that externally - the URL is rewritten (so, donā€™t put the video URL string itself into the sitemap, but as part of a ā€˜Videoā€™ element itā€™s ok).

However, the most limiting factor currently is an outstanding bug in ESH that limits video transmission to 60 seconds, see Proxy timeout when streaming with video widget Ā· Issue #4873 Ā· eclipse-archived/smarthome Ā· GitHub
IIRC, there is a fix that should eventually get merged into master. (and then there is still this: Proxy fails to open https/ssl streams Ā· Issue #4918 Ā· eclipse-archived/smarthome Ā· GitHub).

Cheers,
-Th

Yes but that will not work in two cases.

  1. If the video stream is RTSP unless you convert it into another format or simply get the camera to use a MJPEG stream. Most good cameras can do MJPEG but mine for example does not do it in full resolution, meaning the snapshots give far greater detail.
  2. If the camera is password protected with Digest Authorization for example. The moment you give the url to Openhab to fetch the stream the binding can not handle the authorization and it will fail to work. The binding would need to handle the authorization and then pass the stream onto openhab which the binding currently does not do. I am open to suggestions but currently I donā€™t see an easy way to do this that would work with all camera types, resolutions and formats/codecs. With cameras with basic authorization I may be able to present the URL in a way that would work if someone wants to do some testing.

Yes but I dont see any cases where a user can not do this directly and save me hours of work for a very small use case because as you said most cameras via ONVIF seem to report a RTSP stream and not MJPEG. So if the user needs to provide a URL manually to the binding they may as well do it manually to their openhab item and sitemap files and save me hours of coding I dont get paid for :slight_smile: . Currently my opinion is the video string channel is pretty much useless and I have been thinking of removing it, so if anyone finds it useful then great I will leave it in place but I see it as something that will confuse new users and the downsides outweigh any benefits which I can not see.

Happy to be proven wrong.

@matt1 Today I tested a new version of your Binding.
Camera status is now displayed correctly :+1:

Camera picture is updated itself after a specified time in things. :+1:

I canā€™t check the motion detector yet - only at home in the evening.

Hi Thomas,

I already saw this, but not works with rtsp.

hi matt,
i have added my hikvision camera through your binding. image part is working fine but motion detection part is not working.
below is the out put of ipcamerabinding for motion detection button.
when motion is triggered nothing shows in log files.
also motion alarm button is grayed out.

15:16:15.165 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - Trying to connect with new request for camera at IP:172.29.8.70
15:16:15.233 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - + The request is going to be GET:/MotionDetection/1:
15:16:15.276 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - Camera at IP:172.29.8.70 is using Basic Auth
15:16:15.354 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 200 OK
Date: Mon, 21 May 2018 15:17:10 GMT
Server: App-webs/
Connection: close
Content-Length: 406
Content-Type: application/xml
15:16:15.461 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - DefaultLastHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 406, cap: 406/406, unwrapped: PooledUnsafeDirectByteBuf(ridx: 552, widx: 552, cap: 1024)), decoderResult: success)
15:16:15.554 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is :<?xml version="1.0" encoding="UTF-8"?>

1
true
grid

18
22


5


:

Capture

Matt,

thank you very much for this binding. I have an Instar 5907HD camera and would be happy about new features for this camera. I would like to support you, if you need somebody to test your development regarding INSTAR features.
Thank you