IpCamera: New IP Camera Binding

Read my last post again, I found and fixed an issue that was stopping motion detection under V3 there is already a build you can test with.

I added an ip camera to the system and found that the image is updated every 6-8 seconds. However, I did everything according to the instructions. can someone tell me what the problem may be? Hikvision DS-2CD 2020 camera. openhab 2.5. changing the video quality on the cameras does not help. (New user from Belarus). Thank you in advance

There is on OH 3.1 files SNAPSHOT?

And I have actually disabeled the binding, and now I don’t have the “memory leaks” problem, so I am sure that is due to binding… But I can’t reproduce why it happens, because in a moment, there are a increment in memory that doesn’t return to system. But is not a fixed hour… it happens randomly during the day, not related to any event or rule. I am recording all day resources and persist with influxdb.

Thanks in any case.
(I have build manually a rule to check the motion detection without the binding).

Ruben

Hi - I’m trying to get this working with a hacked Dafang camera that has an RTSP feed.

Here are the camera settings - for codec I can also select h264 or mjpeg:

and here are the thing settings:

If I go to http://openhaburl:8001 I just get a blank screen.

I’ve tried a number of changes but can’t seem to get anything to work. Am I missing something dumb or does this not work? I have an Onvif camera that is working fine.

so i am willing to buy the hikvision DS-KV6113-PE1 video doorbell and i was wondering if its possible to have a trigger channel when someone presses the doorbell button ,using this binding…?

hi
did resolve your issue? i have the same problem!!!

Best wishes

sometimes at one of my hikvision camera i get in the log…

[WARN ] [era.internal.handler.IpCameraHandler] - !!!! Camera possibly closed the channel on the binding, cause reported is: Connection reset by peer

after some seconds camera feed is normal again…
anyone knows why is that?

is the video from the camera showing with a delay or not?

no ,no delay at all.

can I see the configuration?

@matt1 i understand that OH3 plugins are probably your focus from this point forward - I havent had a chance to look into upgrading my OH2.5.11 install to OH3.

But i’ve been having problems getting Alarms to work 100% on my cameras.

I’m running a Hikvision NVR (model: DS-7616NI-I2 / 16P) and multiple Turret ColorVu Hikvision Cameras (Model:DS-2CD2347G1-LU).

I have added my cameras two ways:

  1. Directly though the NVR IP address and specifying nvrChannel=#
  2. Directly to the Camera IP address with the nvrChannel removed (defaults to 1)

Both setups has yielded the same results on these units. Alarms are intermittently triggered. I get the alarms 100% everytime though the Hik-Connect app which indicates the alarm is triggered and the "
“Notify Surveillance Center” is checked off and working.

The Thing for “lineCrossingAlarm” is never triggered On/OFF and i have been getting mixed results by using the “lastMotionType” thing, i will get the alarm most of the time and then it will just stop.

With TRACE enabled for the plugin i see all the xml events but nothing updated for my items:

<ipAddress>192.168.2.58</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>10:12:fb:e3:56:28</macAddress>
<channelID>1</channelID>
<dateTime>2021-02-25T23:10:55-5:00</dateTime>
<activePostCount>67</activePostCount>
<eventType>linedetection</eventType>
<eventState>active</eventState>
<eventDescription>linedetection alarm</eventDescription>
<DetectionRegionList>
<DetectionRegionEntry>
<regionID>1</regionID>
<sensitivityLevel>100</sensitivityLevel>
<RegionCoordinatesList>
<RegionCoordinates>
<positionX>500</positionX>
<positionY>981</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>502</positionX>
<positionY>17</positionY>
</RegionCoordinates>
</RegionCoordinatesList>
</DetectionRegionEntry>
</DetectionRegionList>
<channelName></channelName>
<Extensions version="1.0" xmlns="urn:psialliance-org">
<serialNumber xmlns="urn:selfextension:psiaext-ver10-xsd">DS-2CD2347G1-LU20200917AAWRE80568520</serialNumber>
<eventPush xmlns="urn:selfextension:psiaext-ver10-xsd">IO&amp;&amp;DS-2CD2347G1-LU20200917AAWRE80568520,2021-02-25T23:10:55-5:00,1.0</eventPush>
</Extensions>
</EventNotificationAlert>
:```

Try updating your firmware as this may be a bug in the camera. It all looks fine except the camera is not sending “–boundary” which will stop it working, my guess is you will see the working alarms start with that and the ones that don’t have it missing. A multipart http message I’m pretty sure needs to start with a boundary tag so contact HIK support.

Hi @matt1,
I can confirm i am running the absolute latest firmware versions for both the NVR and Camera. I took a look deeper into the TRACE logs and it apepars i am getting the --boundary its just on a seperate line?

I’m testing my cameras though both methods directly though the NVR and directly to the camera as you can see in the logs.

192.168.3.254 = NVR with nvrChannel specified.
Any other IP is ipCamera binding talking directly to the camera.

Content-Type: application/xml; charset="UTF-8"
Content-Length: 861

<?xml version="1.0" encoding="utf-8"?>
<EventNotificationAlert version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<ipAddress>192.168.3.254</ipAddress>
<portNo>80</portNo>
<protocolType>HTTP</protocolType>
<macAddress>ec:c8:9c:9d:d4:be</macAddress>
<dynChannelID>6</dynChannelID>
<channelID>6</channelID>
<dateTime>2021-02-25T20:18:52-5:00</dateTime>
<activePostCount>22</activePostCount>
<eventType>linedetection</eventType>
<eventState>active</eventState>
<eventDescription>linedetection alarm</eventDescription>
<channelName>Front Yard</channelName>
<DetectionRegionList>
<DetectionRegionEntry>
<regionID>0</regionID>
<RegionCoordinatesList>
</RegionCoordinatesList>
<TargetRect>
<X>0.000000</X>
<Y>0.000000</Y>
<width>0.000000</width>
<height>0.000000</height>
</TargetRect>
</DetectionRegionEntry>
</DetectionRegionList>
</EventNotificationAlert>
:
2021-02-25 20:18:53.918 [TRACE] [g.ipcamera.internal.HikvisionHandler] - HTTP Result back from camera is 	:--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 861

<?xml version="1.0" encoding="utf-8"?>
<EventNotificationAlert version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<ipAddress>192.168.3.254</ipAddress>
<portNo>80</portNo>
<protocolType>HTTP</protocolType>
<macAddress>ec:c8:9c:9d:d4:be</macAddress>
<dynChannelID>6</dynChannelID>
<channelID>6</channelID>
<dateTime>2021-02-25T20:18:52-5:00</dateTime>
<activePostCount>22</activePostCount>
<eventType>linedetection</eventType>
<eventState>active</eventState>
<eventDescription>linedetection alarm</eventDescription>
<channelName>Front Yard</channelName>
<DetectionRegionList>
<DetectionRegionEntry>
<regionID>0</regionID>
<RegionCoordinatesList>
</RegionCoordinatesList>
<TargetRect>
<X>0.000000</X>
<Y>0.000000</Y>
<width>0.000000</width>
<height>0.000000</height>
</TargetRect>
</DetectionRegionEntry>
</DetectionRegionList>
</EventNotificationAlert>
:
2021-02-25 20:18:54.714 [TRACE] [g.ipcamera.internal.HikvisionHandler] - HTTP Result back from camera is 	:--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 1254

:
2021-02-25 20:18:54.715 [TRACE] [g.ipcamera.internal.HikvisionHandler] - HTTP Result back from camera is 	:<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.2.58</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>10:12:fb:e3:56:28</macAddress>
<channelID>1</channelID>
<dateTime>2021-02-25T20:18:52-5:00</dateTime>
<activePostCount>411</activePostCount>
<eventType>linedetection</eventType>
<eventState>active</eventState>
<eventDescription>linedetection alarm</eventDescription>
<DetectionRegionList>
<DetectionRegionEntry>
<regionID>1</regionID>
<sensitivityLevel>100</sensitivityLevel>
<RegionCoordinatesList>
<RegionCoordinates>
<positionX>500</positionX>
<positionY>981</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>502</positionX>
<positionY>17</positionY>
</RegionCoordinates>
</RegionCoordinatesList>
</DetectionRegionEntry>
</DetectionRegionList>
<channelName></channelName>
<Extensions version="1.0" xmlns="urn:psialliance-org">
<serialNumber xmlns="urn:selfextension:psiaext-ver10-xsd">DS-2CD2347G1-LU20200917AAWRE80568520</serialNumber>
<eventPush xmlns="urn:selfextension:psiaext-ver10-xsd">IO&amp;&amp;DS-2CD2347G1-LU20200917AAWRE80568520,2021-02-25T20:18:52-5:00,1.0</eventPush>
</Extensions>
</EventNotificationAlert>
:
2021-02-25 20:18:55.261 [TRACE] [g.ipcamera.internal.HikvisionHandler] - HTTP Result back from camera is 	:--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 837

:
2021-02-25 20:18:55.261 [TRACE] [g.ipcamera.internal.HikvisionHandler] - HTTP Result back from camera is 	:<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.2.174</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>c0:51:7e:c2:c5:33</macAddress>
<channelID>1</channelID>
<dateTime>2021-02-25T20:18:53-5:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
<channelName></channelName>
<Extensions version="1.0" xmlns="urn:psialliance-org">
<serialNumber xmlns="urn:selfextension:psiaext-ver10-xsd">DS-2CD2347G1-LU20201103AAWRE96761883</serialNumber>
<eventPush xmlns="urn:selfextension:psiaext-ver10-xsd">IO&amp;&amp;DS-2CD2347G1-LU20201103AAWRE96761883,2021-02-25T20:18:53-5:00,1.0</eventPush>
</Extensions>
</EventNotificationAlert>
:
2021-02-25 20:18:55.619 [TRACE] [g.ipcamera.internal.HikvisionHandler] - HTTP Result back from camera is 	:--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 1254

:
2021-02-25 20:18:55.619 [TRACE] [g.ipcamera.internal.HikvisionHandler] - HTTP Result back from camera is 	:<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.2.58</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>10:12:fb:e3:56:28</macAddress>
<channelID>1</channelID>
<dateTime>2021-02-25T20:18:53-5:00</dateTime>
<activePostCount>412</activePostCount>
<eventType>linedetection</eventType>
<eventState>active</eventState>
<eventDescription>linedetection alarm</eventDescription>
<DetectionRegionList>
<DetectionRegionEntry>
<regionID>1</regionID>
<sensitivityLevel>100</sensitivityLevel>
<RegionCoordinatesList>
<RegionCoordinates>
<positionX>500</positionX>
<positionY>981</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>502</positionX>
<positionY>17</positionY>
</RegionCoordinates>
</RegionCoordinatesList>
</DetectionRegionEntry>
</DetectionRegionList>
<channelName></channelName>
<Extensions version="1.0" xmlns="urn:psialliance-org">
<serialNumber xmlns="urn:selfextension:psiaext-ver10-xsd">DS-2CD2347G:
2021-02-25 20:18:55.620 [TRACE] [g.ipcamera.internal.HikvisionHandler] - HTTP Result back from camera is 	:1-LU20200917AAWRE80568520</serialNumber>
<eventPush xmlns="urn:selfextension:psiaext-ver10-xsd">IO&amp;&amp;DS-2CD2347G1-LU20200917AAWRE80568520,2021-02-25T20:18:53-5:00,1.0</eventPush>
</Extensions>
</EventNotificationAlert>
:
2021-02-25 20:18:55.620 [DEBUG] [g.ipcamera.internal.HikvisionHandler] - Unhandled reply-1-LU20200917AAWRE80568520</serialNumber>
<eventPush xmlns="urn:selfextension:psiaext-ver10-xsd">IO&amp;&amp;DS-2CD2347G1-LU20200917AAWRE80568520,2021-02-25T20:18:53-5:00,1.0</eventPush>
</Extensions>
</EventNotificationAlert>
.```

Here is an example where a LineCrossing alarm was triggered it did not update my items. The only update i got was for the LastEvent.

Items:

String    G_EXT_CAMERA_GarageFrontLeft_Alarm                "Garage Front Left Alarm"             (SecurityCameras)                            {channel="ipcamera:hikvision:garageleft:lastMotionType", expire="5s,state=NoAlarm"}
//Line Crossing
Switch    G_EXT_CAMERA_GarageFrontLeft_LineCrossing             "Line Crossing Enable/Disable"        (SecurityCameras)                            {channel="ipcamera:hikvision:garageleft:enableLineCrossingAlarm"}
String    G_EXT_CAMERA_GarageFrontLeft_LineCrossingAlarm        "Garage Front Line Crossing Alarm"    (SecurityCameras,GarageFront_Alarms)         {channel="ipcamera:hikvision:garageleft:lineCrossingAlarm"}

Trace Log that triggered the event:

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

:

2021-02-26 10:32:01.171 [TRACE] [g.ipcamera.internal.HikvisionHandler] - HTTP Result back from camera is 	:--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 1254
<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.2.58</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>10:12:fb:e3:56:28</macAddress>
<channelID>1</channelID>
<dateTime>2021-02-26T10:32:00-5:00</dateTime>
<activePostCount>611</activePostCount>
<eventType>linedetection</eventType>
<eventState>active</eventState>
<eventDescription>linedetection alarm</eventDescription>
<DetectionRegionList>
<DetectionRegionEntry>
<regionID>1</regionID>
<sensitivityLevel>100</sensitivityLevel>
<RegionCoordinatesList>
<RegionCoordinates>
<positionX>500</positionX>
<positionY>981</positionY>
</RegionCoordinates
<RegionCoordinates>
<positionX>502</positionX>
<positionY>17</positionY>
</RegionCoordinates>
</RegionCoordinatesList>
</DetectionRegionEntry>
</DetectionRegionList>
<channelName></channelName>
<Extensions version="1.0" xmlns="urn:psialliance-org">
<serialNumber xmlns="urn:selfextension:psiaext-ver10-xsd">DS-2CD2347G1-LU20200917AAWRE80568520</serialNumber>
<eventPush xmlns="urn:selfextension:psiaext-ver10-xsd">IO&amp;&amp;DS-2CD2347G1-LU20200917AAWRE80568520,2021-02-26T10:32:00-5:00,1.0</eventPush>
</Extensions>
</EventNotificationAlert>

The only Event that changed:

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

2021-02-26 10:32:01.173 [vent.ItemStateChangedEvent] - G_EXT_CAMERA_GarageFrontLeft_Alarm changed from NoAlarm to lineCrossingAlarm

Hi, I’m an experienced OH user and developer, but new to the camera topic.

Do you have recommendations for cameras working best with the binding, have

  • a good feature set
  • fully supported by the binding
  • proper support WiFi
  • can be used outdoor
  • no cloud (for security reasons)
  • be able to record on NAS
  • at a reasonable price (< 150€)?

Does somebody has experience with Mibao, it looks cheap, but is commended by amazon and has 4,5* from 500 customers.

A couple of things, please always start your own thread especially when it will mean multiple messages and long traces.

I have not used textual in a while now but it should be a Switch item. See if it works with the GUI method if you use OH3.

Then that will cause an issue, the binding requires it all to be in the one message currently, if it is getting split up then that will require some changes in the binding. So far you have not given me a log output that has not been cut short that shows it is occuring which makes it very hard to know whats going on when the messages are cut to pieces.

See the first post of this thread here: A camera that has both ONVIF and an API will have the most features…
IpCamera: New IP Camera Binding - Add-ons / Bindings - openHAB Community

Also as for which camera is best value in a price range I would point you to a forum that has this asked probably daily…

IP Cameras | IP Cam Talk

Also do not believe any Amazon reviews and do not follow the advice of the many ‘youtube experts’ that only want you to click on the affiliate links to make a commission. Take some time to read the IP cam talk forum and find a camera that is regarded highly and also has good ONVIF support at the bare minimum if not an API camera. You will find one easily in the price range you indicated.

1 Like

I have not used textual in a while now but it should be a Switch item. See if it works with the GUI method if you use OH3.

My mistake. I have corrected this and I am now getting the linCrossing item updated when the alarm is received. Thank you for spotting this typo on my part.

Then that will cause an issue, the binding requires it all to be in the one message currently, if it is getting split up then that will require some changes in the binding. So far you have not given me a log output that has not been cut short that shows it is occuring which makes it very hard to know whats going on when the messages are cut to pieces.

Please see the attached openhab.log with TRACE enabled. I have done multiple tests with line crossing in this log. Here are the exact timestamps when lineCrossing was triggered and the item updated to ON or didn’t update at all:

  • 2021-02-26 21:27:43.093 - Failed. No Item update received.
  • 2021-02-26 21:28:07.582 - Failed. No Item update received.
  • 2021-02-26 21:28:34.093 - worked, Item Updated to ON status
  • 2021-02-26 21:29:08.813 - worked, Item Updated to ON status
  • 2021-02-26 21:29:27.492 - worked, Item Updated to ON status
  • 2021-02-26 21:31:05.044 - Failed. No Item update received.
  • 2021-02-26 21:31:48.823 - worked, Item Updated to ON status
  • 2021-02-26 21:32:14.283 - worked, Item Updated to ON status
  • 2021-02-26 21:32:53.073 - worked, Item Updated to ON status
  • 2021-02-26 21:33:03.262 - Failed. No Item update received.
  • 2021-02-26 21:34:02.304 - worked, Item Updated to ON status
  • 2021-02-26 21:34:25.962 - worked, Item Updated to ON status
  • 2021-02-26 21:34:50.254 - worked, Item Updated to ON status
  • 2021-02-26 21:35:21.903 - worked, Item Updated to ON status
  • 2021-02-26 21:36:33.224 - worked, Item Updated to ON status
  • 2021-02-26 21:37:01.764 - worked, Item Updated to ON status
  • 2021-02-26 21:37:42.553 - Failed. No Item update received.

openhab.log (698.5 KB)

Looks like a camera bug, unless you have three cameras all dumping into that log? It gives three --boundary in a row with a specified Content-Length: 868 and then some of the content it does send does not match the declared content length…

I can see why it does not get detected. I’ll have a think about this so thanks for reporting it, but regardless you really should report this to Hikvision support as a bug to see what they say. Even the latest firmwares can contain bugs.

2021-02-26 21:31:05.043 [TRACE] [g.ipcamera.internal.HikvisionHandler] - HTTP Result back from camera is 	:--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 868

:
2021-02-26 21:31:05.043 [TRACE] [g.ipcamera.internal.HikvisionHandler] - HTTP Result back from camera is 	:--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 868

:
2021-02-26 21:31:05.043 [TRACE] [g.ipcamera.internal.HikvisionHandler] - HTTP Result back from camera is 	:--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 868

:
2021-02-26 21:31:05.044 [TRACE] [g.ipcamera.internal.HikvisionHandler] - HTTP Result back from camera is 	:<?xml version="1.0" encoding="utf-8"?>
<EventNotificationAlert version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<ipAddress>192.168.3.254</ipAddress>
<portNo>80</portNo>
<protocolType>HTTP</protocolType>
<macAddress>ec:c8:9c:9d:d4:be</macAddress>
<dynChannelID>6</dynChannelID>
<channelID>6</channelID>
<dateTime>2021-02-26T21:31:04-5:00</dateTime>
<activePostCount>54</activePostCount>
<eventType>linedetection</eventType>
<eventState>active</eventState>
<eventDescription>linedetection alarm</eventDescription>
<channelName>Garage Front Left</channelName>
<DetectionRegionList>
<DetectionRegionEntry>
<regionID>0</regionID>
<RegionCoordinatesList>
</RegionCoordinatesList>
<TargetRect>
<X>0.000000</X>
<Y>0.000000</Y>
<width>0.000000</width>
<height>0.000000</height>
</TargetRect>
</DetectionRegionEntry>
</DetectionRegionList>
</EventNotificationAlert>
:
2021-02-26 21:31:05.044 [TRACE] [g.ipcamera.internal.HikvisionHandler] - HTTP Result back from camera is 	:<?xml version="1.0" encoding="utf-8"?>
<EventNotificationAlert version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<ipAddress>192.168.3.254</ipAddress>
<portNo>80</portNo>
<protocolType>HTTP</protocolType>
<macAddress>ec:c8:9c:9d:d4:be</macAddress>
<dynChannelID>6</dynChannelID>
<channelID>6</channelID>
<dateTime>2021-02-26T21:31:04-5:00</dateTime>
<activePostCount>72</activePostCount>
<eventType>linedetection</eventType>
<eventState>active</eventState>
<eventDescription>linedetection alarm</eventD:

I have 5 cameras configured in my .things, all are configured with the NVR ip address (192.168.3.254) and nvrChannel=X specified for the appropiate camera channel. The Channels specified are 1,2,3,4, and 6 for all five cameras cameras.

Do you think that would be causing this. I can remove all the cameras and leave just the one I been testing with to see if the results change.