IpCamera: New IP Camera Binding

hi Skinah.

I really appreciate the sheer volume of your contribution here. I have done a lot of reading across the forum but there are parts which are little holes in my understanding which are keeping me from getting a full picture/next step.

To be more specific on my case.

HIKVISION NVR Hybrid version DS-7216HUHI-K2
Connected to Openhab (users/isapi etc) setup.
As far as my limited understanding is concerned since openhab doesnt have ffmpeg by default it isnt installed.
my DVR doesnt support mjpeg video.
When i test the image url provided by the channel of the binding i get an image back of the first of 16 cameras.
It is installed via the binding as an onvif (should it be hikvision api or something like that?)

what my use case is, is:

to be able to use your habpanel widget to access the screenshots of cameras and then get video back when clicked (this is what is does as i understand) - i have the widget installed but i dont know how to get the urls of other cameras beside the first one and certainly a video stream one - dont need amazing resolution but it would be nice. Ideally without heavy processor usage. the heavy processor usage isnt a major issue however if it only occurs during watching the video stream (i have an RPI4b 8gb) - it wont be the default habpanel just an alternate one. only one i accessed during an alarm incident - so it may have a increase but it will be for max 1 minutes

What i see from trace log (by the way how do you switch it off afterwards?)

ffmpeg errors nothing else as such. I guess this means it just isn’t installed.

I can also use this url to access camera 2 of the nvr but need to login first with the admin username and password. I guess this means that i can bypass the login/pass part by using the binding but I don’t know how to get the right url.

So how can i get access to all cameras via widget in video? do i need ffmpeg installed or no joy?
(i should mention text installs etc arent my think i am a OH3 newbie.

thanks Alex

I believe there are two ways to use a hikvision nvr. One way is to allow each camera to be fullly accessed from its own port. This would allow mjpeg to be accessed directly if the nvr does not.

Yes you have to install ffmpeg for some features to work, but many will work without ffmpeg like the snapshots.mjpeg stream.

If you want to use a channel of the nvr you can tell the binding which nvr channel you wish to use as it is a config you can change and it will then use that URL you wrote works. See bindings documentation.

Yes you should manually add a hikvision thing if it has the hikvision API, then you will be able to specify a NVR Channel to fetch the correct picture. Auto detection may not always work, so some trace logs from when you do a scan may help to improve the auto detection.

hello! i’ve installed ipcamera binding but i’m in trouble with a strange issue.
if i add video card to openhab3 gui it says thet’s impossibile to display the page (pointing both to item or address) but if i add web frame pointing to http address it works and camera streaming is working perfectly.
is it possibile to set camera live to a video card? because i have to add 3 streams from 3 different cameras…


OH3 Widget: Building a camera widget - Add-ons / UIs - openHAB Community

Hi @matt1, can the binding change the Dahua camera profile, as pictured in this screenshot?

I can manually do it for my camera using this:

To switch to day:


curl --digest -u 'user:pass' 'http://<ip>/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=0'

To Switch to night:


curl --digest -u 'user:pass' 'http://<ip>/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1'

The tricky part is perhaps the api url to change this isn’t the same for different cameras.

Does the binding support a generic GET/POST to the camera url using the user/password configured in the thing? That would offer the most flexibility although not an ideal solution.

The binding used to have that but I took it out as I saw it as a security risk. Anyone could delete a user or change a password etc. however now we have authentication on the openHAB rest api perhaps it is not as big an issue?!! Don’t know but it is easier to not implement that and just add support for features directly like your wanting. Is it the same for all cameras? What is different between them at the api level for that feature?

I have 3 different dahua models and they all worked the same way. This only works when the profile management is set to “Full time”. The purpose for this is so we can use sunrise/sunset to switch between day and night profiles. There’s a Windows utility to do this too but I’d rather do it from openhab.

Yes, I understand that I can just write code (in jruby, or whatever other scripting language of choice) to do direct http requests myself and that’s probably the easiest / quickest way.

It is not just sunrise/sunset that is important, what if it is an overcast day VS sunny, the time to switch over is always a problem and it may be better to base it on a LUX sensor from a weather station. Some cameras now have starlight features that help. I am not keen to add the feature unless a few people are wanting it, as it is simple to add it via a script as you wrote, and if it needs another mode to be in place for it to work then it raises the problem of people complaining about a bug when it is because the camera was not placed in the right mode first.

It would be interesting to look to see if the same/similar thing can be achieved via ONVIF, this way all brands could benefit. A quick look to see if it can be done with the ONVIF device manager software may show it the camera can be controlled or if the feature is lacking.

I’m trying to get my Dahua IVS alert to trigger the ipcamera binding presumably via fieldDetectionAlarm channel, but it doesn’t work. My thing file:

Thing ipcamera:dahua:driveway "Driveway Camera"
    onvifPort=80, //normally 80 check what it needs

items file:

Switch    Driveway_Camera_Intrusion          {channel="ipcamera:dahua:driveway:fieldDetectionAlarm"}
Switch    Driveway_Camera_IntrusionEnable    {channel="ipcamera:dahua:driveway:enableFieldDetectionAlarm"}

Both items remain “NULL”.

I have set the log level to trace

Second question: in the trace log, I noticed a periodic event:

Sending camera: GET:

How do I disable this completely?

I don’t see a first question.
To stop the periodic polling of a snapshot u need to update to the latest milestone as that was one thing I changed recently.

The first question / problem is how do I make my dahua IVS (intrusion detection) to trigger the binding’s fieldDetectionAlarm channel? Currently my item linked to this channel just has NULL value.

do you see any events of any type getting logged in trace mode? if so and you never see that one coming in then it will be a camera setup issue which I can not help with. The binding will log any unknown events so if it is missing it can only be that the camera is not sending them.

I am seeing this whenever the camera’s IVS “trips” (i.e. either the tripwire type or the “intrusion” type)

20:28:47.385 [DEBUG] [mera.internal.handler.IpCameraHandler] - Unrecognised Dahua event, Code=IntelliFrame, action=Pulse

OK it seems there is a newer API and the tripwire now sends this…

\r\nCode=IntelliFrame;action=Pulse;index=0;data={\n   "Action" : "Start"\n
\r\nCode=IntelliFrame;action=Pulse;index=0;data={\n   "Action" : "Stop"\n

Are you able to PM me the full event if you watch the stream in a normal browser? I will need to work out how to tell the tripwire and intrusion alarms apart. The data= probably has a longer json that contains more info then what is above.

How do I do this?

  1. I could create a newer jar for you to use that will log it.
  2. The binding tells you what URLs it is sending to the camera in the logs. Grab the url for the event stream and paste it into any browser. It is sent just as the camera is connecting and only sent once. Pause and unpause the camera to trigger it to reconnect. You could also use the ‘wget’ or ‘curl’ commands in Linux to see the stream. I forget if the stream it viewable in a browser so the Linux commands are better as they will show the raw data coming in.

I found that on OpenHAB 3.2M1 fieldDetectionAlarm didn’t work. After compiling the latest source, I got it to work. I will upgrade my openhab when I have more time.

I’d like to say a big thank you to @matt1 for creating this excellent binding.

I used to use Blue Iris + Deep Stack for detecting a person entering a zone then sending an MQTT message to OH in order to trigger an alert. It was laggy. Now I’m using the IVS feature from the camera and with the IPcamera binding, it happens instantaneously.

1 Like

Hi Matt,

I’m running the OH3.2. Trying to add a Hikvision DS-2CD2185FWD-I


I’m receiving the following error when trying to SCAN:

[ERROR] [nternal.DiscoveryServiceRegistryImpl] - Cannot trigger scan for thing types '[ipcamera:hikvision, ipcamera:onvif, ipcamera:foscam, ipcamera:doorbird, ipcamera:generic, ipcamera:dahua, ipcamera:instar, ipcamera:amcrest]' on 'IpCameraDiscoveryService'!

io.netty.channel.ChannelPipelineException: org.openhab.binding.ipcamera.internal.onvif.OnvifDiscovery$2 is not a @Sharable handler, so can't be added or removed multiple times.

If I add it manually I get these showing in the log:

[INFO ] [era.internal.handler.IpCameraHandler] - The alarm stream was not running for camera, re-starting it now

Any thoughts?


hi @matt1

ok so did more reading.

  1. I am pretty pretty sure my NVR doesnt do mpeg. so that is off the table. I wanted Mpeg because that seems to be the lightest on the processor (heat creation also)
  2. in my current test I, 1. added a hikvision device, 2. added ffmpeg because i want video. 3. tried mpeg (no joy) and 4. enabled hls and run it via vlc on my pc (it crashes) and via my adroid device and I get 1 camera showing.
  3. What I dont know is how to a) minimize the load on my processor to only use it when i am looking at the video (can HLS be enabled when i use it?) b) i have no idea how to link to each of my 16 camera streams from the the thing :slight_smile: (they arent all ip btw). how do i tell the bidning there are multiple channels to look at and not only the first one?

The info line is normal when the camera first starts, do you get it multiple times or just once?

Are you running snapshots or exactly which version? I am doing searches on 3.2milestone3 without any issues.