IpCamera: New IP Camera Binding

Tags: #<Tag:0x00007f51e026f028> #<Tag:0x00007f51e026ee98> #<Tag:0x00007f51e026eba0>

(Nanna Agesen) #643

Thanks :slight_smile: @matt1

It works now - didn’t do the reboot part.

(Nanna Agesen) #644

I’m trying to get my Pan/Tilt/Zoom working for my HikVision camera.

I can control all my Tilt/Pan/Zoom functions from Onvif manager. (Onvif/CGI enabled with Digest/basic turned on)

I have set up the Dimmer Items for the functions, and they are Online.

Nothing happens and this is my Debug message when changing Tilt/Pan/Zoom
I can’t this should have anything to do with these functions?

12:02:06.158 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - Snapshot recieved: Binding will now close the channel.
12:02:06.158 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - commonCameraHandler closed channel:0 	URL:/ISAPI/Streaming/channels/101/picture
12:02:06.158 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - Closing CommonCameraHandler. 		URL:/ISAPI/Streaming/channels/101/picture
12:02:06.584 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - Sending camera at IP:, 	URL:/ISAPI/Streaming/channels/101/picture
12:02:06.585 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - CommonCameraHandler created.... 5 channels tracked (some of these may be closed).
12:02:06.586 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - Have re-opened  the closed channel:0 	GET:/ISAPI/Streaming/channels/101/picture
12:02:06.586 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - Sending camera at IP:, 	URL:/ISAPI/System/IO/inputs/1/status
12:02:06.586 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - ****Using the already open channel:2 	GET:/ISAPI/System/IO/inputs/1/status
12:02:06.590 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 200 OK
Date: Sat, 12 Jan 2019 12:02:05 GMT
Server: webserver
X-Frame-Options: SAMEORIGIN
Content-Length: 221
Connection: keep-alive
Keep-Alive: timeout=10, max=42
Content-Type: application/xml
12:02:06.591 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - DefaultLastHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 221, cap: 221/221, unwrapped: PooledUnsafeDirectByteBuf(ridx: 433, widx: 433, cap: 464)), decoderResult: success)
12:02:06.591 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - Camera has sent some kind of message.Bytes=0
12:02:06.591 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - Camera has sent last part of the message.Bytes=221
12:02:06.591 [DEBUG] [ding.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:<?xml version="1.0" encoding="UTF-8"?>
<IOPortStatus version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">

(bob_dickenson) #645

“AMCRESTIPCameraWithONVIFAndAPISupport_Zoom” is the suggested link name in PaperUI. All-lower-case “zoom” is in the channel parameter (correctly) in my cases. My point was about the peculiarity in the link name NOT the channel parameter.

(Nanna Agesen) #646

My Thing and Item Config


Thing ipcamera:HIKVISION:001 [IPADDRESS="", PASSWORD="xxx", USERNAME="admin", POLL_CAMERA_MS=1000]
Thing ipcamera:HIKVISION:002 [IPADDRESS="", PASSWORD="xxx", USERNAME="admin", PORT=80, POLL_CAMERA_MS=1000]


Image Spisestue (GF_Stue) 			{ channel="ipcamera:HIKVISION:001:image" }
Image Driveway (Have) 				{ channel="ipcamera:HIKVISION:002:image" }
Dimmer DrivewayPan				{ channel="ipcamera:HIKVISION:002:pan" }
Dimmer DrivewayTilt				{ channel="ipcamera:HIKVISION:002:tilt" }
Dimmer DrivewayZoom				{ channel="ipcamera:HIKVISION:002:zoom" }

(Skinah) #647

Watch the log output when the camera is connecting, I suspect something goes wrong. Seems that a few HIK users get that whilst others do not, perhaps check for a firmware update.

Don’t know why as I use manual textual config for reasons just like that, its neater and you see everything on the page at the same time to edit and cut and paste. Possibly your things name is that extra stuff.

(Nanna Agesen) #648

I’m on V5.5.71 build 180725, latest version.

(Holgi) #649

Hello Community,

I am on OH 2.4 Release and also updated binding today. Since the update, Pan and Tilt is not working. Tried to clear cache and tmp and reboot. Camera Picture is shown, motion and audio alarm fire events nicely.

Log outputs:


2019-01-12 22:33:36.130 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Camera is reporting that it supports PTZ control with Absolute movement via ONVIF
2019-01-12 22:34:05.055 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Finished with PTZ with no errors, now fetching the Video URL for RTSP from the camera.


2019-01-12 22:35:46.564 [ome.event.ItemCommandEvent] - Item 'BabyCamPan' received command 0
2019-01-12 22:35:46.569 [nt.ItemStatePredictedEvent] - BabyCamPan predicted to become 0
2019-01-12 22:35:46.581 [vent.ItemStateChangedEvent] - BabyCamPan changed from 50 to 0
2019-01-12 22:43:13.817 [vent.ItemStateChangedEvent] - BabyCamMotionAlarm changed from OFF to ON
2019-01-12 22:43:15.823 [vent.ItemStateChangedEvent] - BabyCamMotionAlarm changed from ON to OFF

Using Pan/Tilt with camera software works. It’s a Foscam FI9816P.

(Skinah) #650

I have not made any changes that could effect PTZ for probably 6 months and all camera brands use the same code, mine is still working 24 hours after upgrading…

Whenever I add new channels or config items like I have just done in this latest build I find it necessary to delete and readd the THING if using paperUI, otherwise the channels just added are not seen and some glitches can occur. Sounds like your issue may be one of these glitches and a removal and re-adding will solve it. With manual textual config I find this is not needed and it just works which is why I recommend this method is used. Textual config makes changing versions as simple as dropping the JAR across and making sure it is the only JAR for my binding as this newer one now has a new file name.

(Holgi) #651


It seems to be a problem with my specific camera. I rolled back to the old binding, configured as thing with text file, still not working, but even before it when it was working, it was not really stable.

(ben draper) #652

Hi there,

Great binding and I have it set up and working with a Hikivision IPC-T140 (4MP turret POE camera). I’ve used the ONVIF binding rather than the Hikivision specific one as it reduced the number of errors in the log file (now disabled in any event).

Two questions if you have time.

  1. The camera has motion detection which works with my Synology Diskstation, but no alarm feed which means it doesn’t appear to work with the Hikivision specific binding - the reason I ask is because…
  2. I don’t want or need to picture to update all the time, only really when I’m viewing the image in a Habpanel or on the app; alternatively when motion is detected.

I figure that having a 1 second update all the time is going to wear heavily on the sd card at some point (am I being paranoid!) but when someone is at the door, I want to be able to see updates in fairly near real time. I’ve got the update button working and that’s great, but it doesn’t make it easy to use, or realtime.

So is there a way to change the image update profile (i.e. to make it update) in those cases - so you turn it on for a minute or so with a specific trigger - rule or button or otherwise - but then it defaults back to off.


Can I use a rule to know when I’m viewing the image - I can’t find anything other than the motion detection on the excellent HabPanelViewer project, which is going to be my interim fix.

Sorry if that is all a little rambling, but just wanted to say thanks again for the binding, it works brilliantly



(Skinah) #653

Sorry I don’t understand why you do not set it up as hikvision as what you are wanting is easy when done that way. Is the camera old and does not support the API, is that the reason? Did you search this thread/forum on the errors in the log?

Another way to do it would be to use the updateimagenow channel and to use a time/cron to keep flipping that switch when you want the image to update. This was why it was added so you can disable all image updates until a doorbell is rung and then it could be manually triggered…

Yes you are being paranoid as the binding uses RAM and does not use the SD card for fetching images. Ram is designed for this and it is fine.

So long as your ram is not full, it will not be using the SD card in the form of a SWAP file/partition. In Linux you do this to check if the swap is in use…

free -h

I use an Odroid C2 with 2gb of ram instead of a PI and my system with 1 camera runs at 5-7% CPU load and 25-30% ram load when doing 1 second updates non stop.

(_) #654

Hi Matt, Thanks for inplementation, In general output control is working ok i will test it longer but need to fix first connection issue to cam (switch to POE 48V to have less voltage drop on line)

(Thomas Binder) #655

I’d like to have a look into this as my China-ONVIF-camera (doesn’t have a brand Name, but identifies as HIKVISION?) has no API also.
I’m running OH2 2.4stable on my raspberry3. So I dropped the 2.4 (31.12.2018) version and the 2.5 (12.01.2019) in /srv/openhab2-addons but nothing happens afterwards… tried it in two instances? Do I miss something?

(ben draper) #656

Hi Matt,

Thanks, I removed everything I’d done and re-added through the PaperUI - I had tried to do it manually as per your guide, but I’d obviously messed something up. Added using Hikivision module through the PaperUI and everything works seemlessly inc motion detection.

Thanks for the reassurance about the images and thanks again for a really great binding.

(Skinah) #657

New build 19-01-2019 has these changes:

  • Cameras now default to updating snapshot every 2 seconds by default instead of 5. Examples in readme also updated.

  • Now PTZ is delayed so if a rule sends updates to all three values they get processed once and the camera makes the movement in a single motion. Example rule and how I use the PTZ feature to give default locations that can be jumped between is found in the readme under the full example section.

  • Less logging is created especially if a camera goes offline it now only logs a single error when the camera first goes offline and not everytime the binding checks if the camera can be reached.

(Skinah) #658

New build 26-01-19 has following changes:

  • Dahua stream should now stay open and not need reopening over and over. Was able to reproduce it @yfaway had this issue. This means you can increase the polling time if you dont want 1 second updates without effecting the alarm stream.
  • Changes to logging.
  • New Netty library version.
  • Changes to way cameras reconnect when they go offline.

(Steve Higton) #659

I have the binding from 31-12-2018 working with a HikVision DS-2CD2042WD-I on firmware v180730 which I believe is the latest firmware for the camera.

I have used the motion detection switch to trigger a rule that sends the most recently captured picture to my devices via Telegram:

rule "Send telegram with fixed message when front door camera intrusion detected"
    Item FrontDoorCamera_IntrusionAlarm changed from OFF to ON
    logInfo("Dev", "Front door camera intrusion detected.")
    sendTelegram("TelegramBot", "Front door camera intrusion detected")
    var String base64Image0 = FrontDoorCamera_JPGImage.state.toFullString
    sendTelegramPhoto("TelegramBot", base64Image0, "Intrusion detected at front door")
	TVLGWebOSTV_1_Toast.sendCommand("Front door camera intrusion detected")

Thanks for this great binding. Are there any tests you’d like me to perform with this camera that would help with further development?

(Thomas Binder) #660

Thanks Matt,

I try to install your binding, but after dropping the JAR in the /srv/openhab2-addons Directory, nothing happens: I don’t get entries in the logfiles. I’m running openHABian on a Raspberry PI: openHAB 2.4 stable. Do I miss something?

(Skinah) #661

You need to start your own thread, something is wrong with your openhab installation. It will mean looking at the bundles in Karaf console or may be a config file stopping it. This is not something I know much about.

(Steve Higton) #662

A similar thing happened to me. After a few restarts and clearing the cache using the command “openhab-cli clean-cache” the binding appeared as an option when trying to add things from the Paper UI.