IpCamera: New IP Camera Binding

Thanks for reporting the camera model, added it to the list in the first post of this thread. If you want to help with testing, then download the latest version and see if you can find a bug. Also it would be great to have some more examples of rules like the one you posted in the readme.md file. Feel free to do a PR on github to add your example rule and any others you think people may find useful.

Just wondering if this binding will work with any of the Panasonic ONVIF IP cameras?

The answer to that in detail is found here first paragraph of readme.

Hi matt1,
You can add my cameras and the recorder to the list.
They work well with binding (only without PTZ control)

NVR - DS-7616NI-K2 / 16P
CAM - DS-2DE3304W-DE

1 Like

Thanks - now after cleaning the cache, I had the binding up and running - but still no entry in the log for “Installation”. @matt1 perhaps you could add a log entry after successfully Installation of the item. Other JAR-Drop-Bindings offer that, so I guess, there must be some Kind of Event for add-on Installation! would be great to know I guess?

Thanks - now I’m working through my camera.

Ok - as my cam is a nobrand China IP camera (here the link at gearbest), I used the “ONVIF”-channel in my thing-configuration (I masked the credentials):

Thing ipcamera:ONVIF:001 [ IPADDRESS="192.168.xx.yy", PASSWORD="<<PASS>>", USERNAME="<<USER>>", ONVIF_PORT=8080, PORT=80, POLL_CAMERA_MS=10000]

while using the Sliders in your .sitemap example, the camera just moves but never stops until it is at the end of physical movement…

It appears, the camera says it supports absolute PAN/TILT, but doesn’t? Or do I miss something? (I use the .items and .sitemap from your examples)
the log in TRACE:

2019-01-28 13:15:46.628 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.xx.yy:8080
2019-01-28 13:15:50.688 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Fetching the number of Media Profiles this camera supports.
2019-01-28 13:15:53.892 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Checking the selected Media Profile is a valid number.
2019-01-28 13:15:53.894 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Fetching a Token for the selected Media Profile.
2019-01-28 13:15:53.896 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Auto fetching the snapshot URL for the selected Media Profile.
2019-01-28 13:15:56.596 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - About to fetch some information about the Media Profiles from the camera
2019-01-28 13:15:56.600 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - *********** Media Profile 0 details reported by camera at IP:192.168.xx.yy ***********
2019-01-28 13:15:56.602 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Camera will use this Media Profile unless you change it in the bindings settings.
2019-01-28 13:15:56.605 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 is named:main_video_encoder_cfg
2019-01-28 13:15:56.607 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 uses video encoder	:H_264
2019-01-28 13:15:56.609 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 uses video quality	:6.0
2019-01-28 13:15:56.611 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 uses video resoltion	:1280 x 720
2019-01-28 13:15:56.613 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 uses video bitrate	:4096
2019-01-28 13:15:56.614 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - *********** Media Profile 1 details reported by camera at IP:192.168.xx.yy ***********
2019-01-28 13:15:56.616 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 is named:sub_video_encoder_cfg
2019-01-28 13:15:56.618 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 uses video encoder	:H_264
2019-01-28 13:15:56.620 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 uses video quality	:6.0
2019-01-28 13:15:56.621 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 uses video resoltion	:640 x 352
2019-01-28 13:15:56.623 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 uses video bitrate	:1024
2019-01-28 13:15:56.624 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - About to interrogate the camera to see if it supports PTZ.
2019-01-28 13:16:02.516 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Camera is reporting that it supports PTZ control with Absolute movement via ONVIF
2019-01-28 13:16:02.519 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Checking Pan now.
2019-01-28 13:16:08.060 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Checking Tilt now.
2019-01-28 13:16:14.089 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Checking Zoom now.
2019-01-28 13:16:25.077 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Camera has reported the range of movements it supports via PTZ.
2019-01-28 13:16:25.080 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - The camera can Pan  from -1.0 to 1.0
2019-01-28 13:16:25.082 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - The camera can Tilt from -1.0 to 1.0
2019-01-28 13:16:25.085 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - The camera can Zoom from -1.0 to 1.0
2019-01-28 13:16:25.087 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Fetching the cameras current position.
2019-01-28 13:16:27.659 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - Camera did not give a good reply when asked what its position was, going to fake the position so PTZ still works.
2019-01-28 13:16:27.662 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Finished with PTZ with no errors, now fetching the Video URL for RTSP from the camera.
2019-01-28 13:16:32.836 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera at IP:192.168.xx.yy, 	URL:/web/auto.jpg?-usr=<<USER>>&-pwd=<<PASS>>&
2019-01-28 13:16:32.844 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - CommonCameraHandler created.... 0 channels tracked (some of these may be closed).
2019-01-28 13:16:32.851 [TRACE] [ipcamera.internal.MyNettyAuthHandler] - MyNettyAuthHandler is now setup for 	GET:/web/auto.jpg?-usr=<<USER>>&-pwd=<<PASS>>&
2019-01-28 13:16:32.855 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Have  opened  a  brand NEW channel:0 	GET:/web/auto.jpg?-usr=<<USER>>&-pwd=<<PASS>>&
2019-01-28 13:16:32.869 [hingStatusInfoChangedEvent] - 'ipcamera:ONVIF:001' changed from INITIALIZING to ONLINE
2019-01-28 13:16:32.879 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Pan is updating to:50 and the cam value is 0.0
2019-01-28 13:16:32.884 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Tilt is updating to:50 and the cam value is 0.0
2019-01-28 13:16:32.884 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Zoom is updating to:50 and the cam value is 0.0
2019-01-28 13:16:32.900 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
2019-01-28 13:16:32.904 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel marked as closing, channel:0 	URL:/web/auto.jpg?-usr=<<USER>>&-pwd=<<PASS>>&
2019-01-28 13:16:32.923 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 1024, cap: 1024/1024, unwrapped: PooledUnsafeDirectByteBuf(ridx: 1024, widx: 1024, cap: 1024)), decoderResult: success)
2019-01-28 13:16:32.935 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 8192, cap: 8192/8192, unwrapped: PooledUnsafeDirectByteBuf(ridx: 8192, widx: 16384, cap: 16384)), decoderResult: success)
2019-01-28 13:16:32.968 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 8192, cap: 8192/8192, unwrapped: PooledUnsafeDirectByteBuf(ridx: 16384, widx: 16384, cap: 16384)), decoderResult: success)
2019-01-28 13:16:32.973 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 8192, cap: 8192/8192, unwrapped: PooledUnsafeDirectByteBuf(ridx: 8192, widx: 30660, cap: 65536)), decoderResult: success)
2019-01-28 13:16:32.979 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 8192, cap: 8192/8192, unwrapped: PooledUnsafeDirectByteBuf(ridx: 16384, widx: 30660, cap: 65536)), decoderResult: success)
2019-01-28 13:16:32.983 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 8192, cap: 8192/8192, unwrapped: PooledUnsafeDirectByteBuf(ridx: 24576, widx: 30660, cap: 65536)), decoderResult: success)
2019-01-28 13:16:32.989 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultLastHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 6084, cap: 6084/6084, unwrapped: PooledUnsafeDirectByteBuf(ridx: 30660, widx: 30660, cap: 65536)), decoderResult: success)
2019-01-28 13:16:33.000 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Snapshot recieved: Binding will now close the channel.
2019-01-28 13:16:33.003 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - commonCameraHandler closed channel:0 	URL:/web/auto.jpg?-usr=<<USER>>&-pwd=<<PASS>>&
2019-01-28 13:16:33.005 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Closing CommonCameraHandler. 		URL:/web/auto.jpg?-usr=<<USER>>&-pwd=<<PASS>>&
2019-01-28 13:16:33.862 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera at IP:192.168.xx.yy, 	URL:/web/auto.jpg?-usr=<<USER>>&-pwd=<<PASS>>&
2019-01-28 13:16:33.872 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - CommonCameraHandler created.... 1 channels tracked (some of these may be closed).
2019-01-28 13:16:33.879 [TRACE] [ipcamera.internal.MyNettyAuthHandler] - MyNettyAuthHandler is now setup for 	GET:/web/auto.jpg?-usr=<<USER>>&-pwd=<<PASS>>&
2019-01-28 13:16:33.880 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Have re-opened  the closed channel:0 	GET:/web/auto.jpg?-usr=<<USER>>&-pwd=<<PASS>>&
2019-01-28 13:16:33.905 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
2019-01-28 13:16:33.912 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel marked as closing, channel:0 	URL:/web/auto.jpg?-usr=<<USER>>&-pwd=<<PASS>>&
2019-01-28 13:16:33.925 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 1024, cap: 1024/1024, unwrapped: PooledUnsafeDirectByteBuf(ridx: 1024, widx: 1024, cap: 1024)), decoderResult: success)
2019-01-28 13:16:33.930 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 8192, cap: 8192/8192, unwrapped: PooledUnsafeDirectByteBuf(ridx: 8192, widx: 16384, cap: 16384)), decoderResult: success)
2019-01-28 13:16:33.936 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 8192, cap: 8192/8192, unwrapped: PooledUnsafeDirectByteBuf(ridx: 16384, widx: 16384, cap: 16384)), decoderResult: success)
2019-01-28 13:16:33.943 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 8192, cap: 8192/8192, unwrapped: PooledUnsafeDirectByteBuf(ridx: 8192, widx: 30690, cap: 65536)), decoderResult: success)
2019-01-28 13:16:33.948 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 8192, cap: 8192/8192, unwrapped: PooledUnsafeDirectByteBuf(ridx: 16384, widx: 30690, cap: 65536)), decoderResult: success)
2019-01-28 13:16:33.955 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 8192, cap: 8192/8192, unwrapped: PooledUnsafeDirectByteBuf(ridx: 24576, widx: 30690, cap: 65536)), decoderResult: success)
2019-01-28 13:16:33.960 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultLastHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 6114, cap: 6114/6114, unwrapped: PooledUnsafeDirectByteBuf(ridx: 30690, widx: 30690, cap: 65536)), decoderResult: success)
2019-01-28 13:16:33.971 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Snapshot recieved: Binding will now close the channel.
2019-01-28 13:16:33.975 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - commonCameraHandler closed channel:0 	URL:/web/auto.jpg?-usr=<<USER>>&-pwd=<<PASS>>&
2019-01-28 13:16:33.977 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Closing CommonCameraHandler. 		URL:/web/auto.jpg?-usr=<<USER>>&-pwd=<<PASS>>&
2019-01-28 13:16:43.859 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera at IP:192.168.xx.yy, 	URL:/web/auto.jpg?-usr=<<USER>>&-pwd=<<PASS>>&
2019-01-28 13:16:43.866 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - CommonCameraHandler created.... 1 channels tracked (some of these may be closed).
2019-01-28 13:16:43.875 [TRACE] [ipcamera.internal.MyNettyAuthHandler] - MyNettyAuthHandler is now setup for 	GET:/web/auto.jpg?-usr=<<USER>>&-pwd=<<PASS>>&
2019-01-28 13:16:43.877 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Have re-opened  the closed channel:0 	GET:/web/auto.jpg?-usr=<<USER>>&-pwd=<<PASS>>&
2019-01-28 13:16:43.919 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
2019-01-28 13:16:43.924 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel marked as closing, channel:0 	URL:/web/auto.jpg?-usr=<<USER>>&-pwd=<<PASS>>&
2019-01-28 13:16:43.947 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 1024, cap: 1024/1024, unwrapped: PooledUnsafeDirectByteBuf(ridx: 1024, widx: 1024, cap: 1024)), decoderResult: success)
...

How good are Dahua´s motion detection? Is it rubbish? How fast is it to trigger/re-trigger?

That depends on which motion detection you refer to. You always find the tripwire/line crossing alarms and intrusion alarms to have less false positives than a generic ‘motion alarm’, this is true of both the big selling brands so choose a camera that has at least these smart alarms to give more options as even the entry level cameras now have them. You can also do masking of areas to ignore tree branch movement. Camera with alarm inputs are working and it is common to use external PIR sensor connected to these alarm inputs if that suits what you are trying to do more than other alarm triggers. This forum is not the best place to get feedback on what the alarms are like. A good forum is “IP cam talk”.

Dahua are great for this as they have the ability to change a DEBOUNCE setting by the API, the binding sets this to 1 second so you can have it trigger right away and then have retriggers 1 second later if the movement is start/stop motion. Constant movement is seen as only a single trigger.

Thanks…
My idea was to use ip cameras insted of traditional motion sensors specially outside around our house.

Traditional sensors are cheaper, use less power to run and work based on heat and movement. You can get ones that ignore pets like a neighbours cat. But even PIR sensors trigger false positives but less often than a generic motion alarm.
Cameras with built in pir cost more than ones that do not but they are made.

I know cameras are more expencive also on energy. It´s just that I want motion detection outside around the house, (I was original planning to use traditional motion sensors). But I also wants cameras. Then I thought, why not combine this option and go for cameras with build in motion detection. But the motion detection has to be as good as traditional motion sensors.

I suggest you start your own thread and ask for multiple users opinion on it. It will work just fine if you spend the time setting up masked areas and the like and use tripwire alarm instead of motion only.

I don’t do it yet and things like moths at night attracted to the IR lights can mean a camera may trigger more than a PIR

Matt, I just gave it a new try with my Reolink camera using the latest binding.
The camera is suppose to be ONVIF, and it does has motion detection…

This is what happens when I add it.

2019-01-30 22:58:51.123 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'onvifcamera.things'

==> /var/log/openhab2/events.log <==

2019-01-30 22:58:51.499 [hingStatusInfoChangedEvent] - 'ipcamera:ONVIF:003' changed from UNINITIALIZED to INITIALIZING
2019-01-30 22:58:52.518 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'onvifcamera.things'

2019-01-30 22:59:16.806 [ERROR] [ing.saaj.soap.ver1_2.SOAPPart1_2Impl] - SAAJ0415: InputStream does not represent a valid SOAP 1.2 Message
2019-01-30 22:59:16.874 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - IP Camera at 10.4.28.202:80 is now online.

==> /var/log/openhab2/events.log <==

2019-01-30 22:59:16.877 [hingStatusInfoChangedEvent] - 'ipcamera:ONVIF:003' changed from INITIALIZING to ONLINE

It doesnt support PAN, Tilt and Zoom. I wonder if thats the reason for the soap error above?
But I dont see any motion detection options (channels) with in the added device?

Yes error may be because the camera has an issue with the PTZ java library, you can ignore it but better to setup as http only and then camera will connect faster.

Other question see first paragraph of readme

My camera works like a charm. Unfortunately after ~23h the get lost with OFFLINE-Communication_Error. But when I open the app the cam is still online. Also when I create a new thing the cam goes online but the old thing stays with Offline. I have a Amcrest used with the DAHUA configuration.

Has anybody the same experience? Should I provide any log? At the moment I have deactivated the cam logs but I can reactivate it to show what´s going on.

A couple years ago I had the same idea, but i can assure you that standard IPCam motion detection doesn’t work outside, and it’s even worse at night with IR illuminators.
I haven’t found a solution for this problem, so i added a motion sensor oudoor (pet imune) to my paradox alarm system, this works really great, no fals alarms.

But recently came across Hikvison Accusense new IPCams, and this might be the answer. Remains to be test. This cam uses algorithms to recognise people and cars and filter motion alarms.

I have some of the amcrest cameras. They have motion detection regions. Does the binding support the region feature? It would be particularly useful for one project I am working on. I see where regions are mentioned but I havent seen any examples or docs for how to enable the thing or item.

@Johannes_Bauerstatte

Recent versions of the binding put very minimal lines in your openhab.log file I would not disable the log fully as you can change the log level to 5 different levels, if you dont like INFO, then try WARN… DEBUG will give you single line logs of what the binding is doing which is fairly neat, TRACE gives you the cameras replies and far greater detail but it really fills up the log file. Try debug for a while and see if you can catch the moment that the issue occurs. I did find if I moved the camera I had some issues which is what I have been working on all week and almost finished.

If you have disabled the event.log there is another way which is covered in the readme file…

@kirk_mccann

If you have the cameras, give it a try. You setup the mask or privacy regions in the cameras control panel via its IP, the binding will only see the alarms that the camera reports which will have those settings applied.

I just installed the new binding to work with my HikVision Camera and after enabling ONVIF support and adding an ONVIF user I added the camera to OH. Once I clicked the OK button I got

 2019-02-03 16:02:05.294 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - IP Camera at 192.168.1.117:80 is now online.

then every 12 seconds I get this error until I delete the camera thing.

 2019-02-03 16:02:06.290 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - The alarm checking stream was not running. Cleaning channels and then going to re-start it now.

What am I doing wrong?

New build 03-02-2019 has these changes:

  • Fix for a camera going and staying offline when moving a PTZ camera. Possible this issue was occuring at other times and it was more reproducible when moving the camera.
  • Snapshots continue to occur again when ONVIF is moving the camera.
  • Changes to the way the binding tracks the comms with the camera.

@kevin
See the readme file on what to do when you have issue and how to enable TRACE in the logs.