IpCamera: New IP Camera Binding

camera
ip-cam
onvif
Tags: #<Tag:0x00007fd30fb8be08> #<Tag:0x00007fd30fb8bc78> #<Tag:0x00007fd30fb8bac0>

(Jan) #161

I downloaded the newest version from today.

First try:
I added my Instar camera as a new thing, with ONFIV authentification as on and entered credentials in the PAPER UI


image

Connection was not successful:

2018-05-22 20:57:54.585 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Camera dispose called, about to remove/change or fix a Cameras connection or settings.
2018-05-22 20:57:54.635 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Getting configuration to initialize a new IP Camera at IP 192.168.178.110
2018-05-22 20:57:54.638 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.178.110:8080
2018-05-22 20:57:55.387 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Checking the selected Media Profile is a valid number.
2018-05-22 20:57:55.400 [ERROR] [l.internal.messaging.saaj.client.p2p] - SAAJ0008: Bad Response; Unauthorized
2018-05-22 20:57:55.404 [ERROR] [ing.ipcamera.handler.IpCameraHandler] - Camera replied with NULL when trying to get a list of the media profiles
2018-05-22 20:57:55.406 [ERROR] [ing.ipcamera.handler.IpCameraHandler] - NPE occured when trying to connect to the camera with ONVIF
2018-05-22 20:57:55.416 [ERROR] [ing.ipcamera.handler.IpCameraHandler] - Camera failed to report a valid Snaphot URL, try over-riding the Snapshot URL auto detection by entering a known URL.

Second try:
I switched off the ONFIV authentification and deleted the user credetials in the Paper UI.

Result: working, but how does the binding get my password???

2018-05-22 21:31:19.572 [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)
2018-05-22 21:31:19.573 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 8192, cap: 8192/8192, unwrapped: PooledUnsafeDirectByteBuf(ridx: 8192, widx: 12008, cap: 16384)), decoderResult: success)
2018-05-22 21:31:19.574 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 3816, cap: 3816/3816, unwrapped: PooledUnsafeDirectByteBuf(ridx: 12008, widx: 12008, cap: 16384)), decoderResult: success)
2018-05-22 21:31:19.575 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultLastHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 5169, cap: 5169/5169, unwrapped: PooledUnsafeDirectByteBuf(ridx: 5169, widx: 5169, cap: 16384)), decoderResult: success)
2018-05-22 21:31:24.542 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to connect with new request for camera at IP:192.168.178.110
2018-05-22 21:31:24.547 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - + The request is going to be GET:/web/auto.jpg?-usr=admin&-pwd=**PASSWORD**&:
2018-05-22 21:31:24.548 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Camera at IP:192.168.178.110 is using Basic Auth
2018-05-22 21:31:24.562 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 200 OK
Server: Ipcam
Access-Control-Allow-Origin: *
Date: Tue, 22 May 2018 19:31:24 GMT
Last-Modified: Tue, 22 May 2018 19:31:24 GMT
Content-Type: image/jpeg
Content-Length: 18175
Connection: close
Accept-Ranges: bytes

I tried to use the zoom, but nothing happend in the pricture

2018-05-22 21:18:44.605 [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)
2018-05-22 21:18:44.607 [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)
2018-05-22 21:18:44.608 [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)
2018-05-22 21:18:44.609 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultLastHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 742, cap: 742/742, unwrapped: PooledUnsafeDirectByteBuf(ridx: 742, widx: 742, cap: 65536)), decoderResult: success)
2018-05-22 21:18:45.436 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Cameras Zoom has changed to:1.0
2018-05-22 21:18:49.542 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to connect with new request for camera at IP:192.168.178.110
2018-05-22 21:18:49.549 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - + The request is going to be GET:/web/auto.jpg?-usr=admin&-pwd=PASSWORD&:
2018-05-22 21:18:49.597 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)

When I try to switch on/off the alarm, nothing happens as well:

2018-05-22 21:23:34.608 [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)
2018-05-22 21:23:34.609 [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)
2018-05-22 21:23:34.610 [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)
2018-05-22 21:23:34.611 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultLastHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 750, cap: 750/750, unwrapped: PooledUnsafeDirectByteBuf(ridx: 750, widx: 750, cap: 65536)), decoderResult: success)
2018-05-22 21:23:36.707 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to connect with new request for camera at IP:192.168.178.110
2018-05-22 21:23:36.717 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - + The request is going to be GET:/cgi-bin/hi3510/param.cgi?cmd=setmdattr&-enable=0:
2018-05-22 21:23:36.718 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Camera at IP:192.168.178.110 is using Basic Auth
2018-05-22 21:23:36.720 [DEBUG] [ipcamera.internal.MyNettyAuthHandler] - 401: This reply from the camera is normal if it needs Basic or Digest auth details.
2018-05-22 21:23:36.721 [DEBUG] [ipcamera.internal.MyNettyAuthHandler] - Setting up the camera to use Basic Auth and resending last request with correct auth.
2018-05-22 21:23:36.721 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Setting up the BASIC auth now, this should only happen once.
2018-05-22 21:23:36.722 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 401 Unauthorized
Access-Control-Allow-Origin: *
Date: Tue, 22 May 2018 19:23:36 GMT
Last-Modified: Tue, 22 May 2018 19:23:36 GMT
Connection: close
Cache-Control: no-cache,no-store
WWW-Authenticate: Basic realm="cgi-bin/hi3510/param.cgi"
2018-05-22 21:23:36.723 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 436, cap: 436/436, unwrapped: PooledUnsafeDirectByteBuf(ridx: 691, widx: 691, cap: 1024)), decoderResult: success)
2018-05-22 21:23:36.723 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is :<html>
<head>
<title>Login</title>
<meta content="text/html"; charset="utf-8" http-equiv="content-type">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
<META http-equiv="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<meta HTTP-EQUIV="Expires" CONTENT="Tue, 22 May 2018 19:23:36 GMT">
</head>
<body>
Error: username or password error,please input again.
</body>
</html>

(Arsalan Alli) #162

@toroid is your binding working or you are having same issue of “motion Alarm” state not changing when there is no motion ! ?
And are you able to change the state of “Enable/Disable Motion Alarm” based on in-camera motion enable/disable setting, as you were we to do so earlier.?


(Skinah) #163

@japhias
Guessing as one possible cause is your ONVIF user does not have full rights?


Try with an admin user or contact your camera support to find out why you connected successfully but then get an unauthorized response further into the ONVIF methods. PTZ requires the onvif to work, so unless this is solved the PTZ will not work. Have you done a restart of the server running openhab? Worth trying as is checking for any newer firmwares for your camera.

RE your password. You gave the binding a URL for the snapshot and in that url is your user and password. If you look at your last log output it clearly shows it is failing due to no valid user/password. Only the snapshot is working as you included the user/pass.

@ArsalanAlli
I’ll make another build tonight which hopefully addresses this and makes the alarm turn back off.


(Sergey) #164

On motion alarm matt is now working, I now works as well as You.

The binding can only read the “Enable/Disable Motion Alarm” parameter from the camera.
If you change the camera settings you have correctly displayed its status?


(Skinah) #165

New build 23-05-2018 has the following changes:

  • HIKVISION should now stop showing the alarm is always occuring.
  • I stripped out a lot of the useless logging unless you have debug turned on when a camera is connecting as there is a chance this will cause an issue for a camera that does not have all ONVIF features fully supported.
  • More logging added to help fault find ONVIF connections.
  • Reset auths when the binding has a setting change made.
  • Cleaned up backend PTZ coding into get and set methods to make it cleaner and easier for @sroettgermann to follow as an example of how to add continuous movement. If you cant work out how to connect the code up to the controls, just write new get and set methods and I can help out as I know the binding back to front and will make changes faster. Best we chat on a github issue on how it will work first before you start writing any code.

(Tahir Mahmood) #166

New build 23-05-2018 has the following changes:

@matt1 new build 23-05-2018 works fine with hikvision camera, on motion detection motion alarm (switch) state changed from OFF to ON as well as on no motion detection alarm state changed from ON to OFF successfully


(Sergey) #167

@matt1 I confirm the above, Motion alarm now works correctly. :+1:


(Arsalan Alli) #168

@matt1 you are the champ…motion detection is working now along with motion enable/disable status.
I just want to confirm one thing that, is there a possibility of using “Enable/disable motion alarm” switch to actually changing the state of camera setting !!

I do appreciate your hard work. Is there anything else related to hikvision cameras that you want us to test( for your binding) ? We would be more than happy to help you out…


(Skinah) #169

Thanks to all who helped with logs and testing, and also took the time to post it works.

YES, but this requires many many hours of work adding new features to the binding just for HIKVISION before I can start on the feature. Getting information from the HIK cameras is easy, it is the other direction that is a pain.

It would be worth checking the settings to see if the image only updates on the start and/or duration of the motion alarms when you select these options in the binding settings.

You can also test the URLs in the api to see if audio alarms work with your cameras and post the output. Same for Line detection which from what I read gives less false alarms compared to VMD.


(Arsalan Alli) #170

It would be worth checking the settings to see if the image only updates on the start and/or duration of the motion alarms when you select these options in the binding settings.

I’ll check it out in the morning and let you know…
As far as audio and line detection is concerned,my camera doesn’t support these features.

@matt1 another thing I noticed that there is a noticeable delay in motion detection and it’s state showing in switch state…could you please fix that as well…!! Delay is of about 6, to 7 seconds between motion and it’s alert.


(Sergey) #171

@matt1 I checked the smart functions on the camera and got the following camera output in the event:

  1. Intrusion Detection
<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>172.18.2.13</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>94:e1:ac:11:cd:86</macAddress>
<channelID>1</channelID>
<dateTime>2018-05-23T20:40:13+03:00</dateTime>
<activePostCount>1</activePostCount>
<eventType>fielddetection</eventType>
<eventState>active</eventState>
<eventDescription>fielddetection alarm</eventDescription>
<DetectionRegionList>
<DetectionRegionEntry>
<regionID>1</regionID>
<sensitivityLevel>99</sensitivityLevel>
<RegionCoordinatesList>
<RegionCoordinates>
<positionX>970</positionX>
<positionY>576</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>36</positionX>
<positionY>118</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>34</positionX>
<positionY>765</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>606</positionX>
<positionY>776</positionY>
</RegionCoordinates>
</RegionCoordinatesList>
</DetectionRegionEntry>
</DetectionRegionList>
<channelName>Cam-1</channelName>
</EventNotificationAlert>
--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 1127
  1. Line Crossing Detection
<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>172.18.2.13</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>94:e1:ac:11:cd:86</macAddress>
<channelID>1</channelID>
<dateTime>2018-05-23T20:45:00+03:00</dateTime>
<activePostCount>1</activePostCount>
<eventType>linedetection</eventType>
<eventState>active</eventState>
<eventDescription>linedetection alarm</eventDescription>
<DetectionRegionList>
<DetectionRegionEntry>
<regionID>1</regionID>
<sensitivityLevel>9</sensitivityLevel>
<RegionCoordinatesList>
<RegionCoordinates>
<positionX>772</positionX>
<positionY>519</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>250</positionX>
<positionY>164</positionY>
</RegionCoordinates>
</RegionCoordinatesList>
</DetectionRegionEntry>
</DetectionRegionList>
<channelName>Cam-1</channelName>
</EventNotificationAlert>
--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 928
  1. Region Entrance Detection
<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>172.18.2.13</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>94:e1:ac:11:cd:86</macAddress>
<channelID>1</channelID>
<dateTime>2018-05-23T20:48:52+03:00</dateTime>
<activePostCount>1</activePostCount>
<eventType>regionEntrance</eventType>
<eventState>active</eventState>
<eventDescription>regionEntrance alarm</eventDescription>
<DetectionRegionList>
<DetectionRegionEntry>
<regionID>1</regionID>
<sensitivityLevel>50</sensitivityLevel>
<RegionCoordinatesList>
<RegionCoordinates>
<positionX>802</positionX>
<positionY>368</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>651</positionX>
<positionY>171</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>36</positionX>
<positionY>176</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>426</positionX>
<positionY>368</positionY>
</RegionCoordinates>
</RegionCoordinatesList>
</DetectionRegionEntry>
</DetectionRegionList>
<channelName>Cam-1</channelName>
</EventNotificationAlert>
--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 1128

  1. Region Exiting Detection
<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>172.18.2.13</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>94:e1:ac:11:cd:86</macAddress>
<channelID>1</channelID>
<dateTime>2018-05-23T20:51:10+03:00</dateTime>
<activePostCount>2</activePostCount>
<eventType>regionExiting</eventType>
<eventState>active</eventState>
<eventDescription>regionExiting alarm</eventDescription>
<DetectionRegionList>
<DetectionRegionEntry>
<regionID>1</regionID>
<sensitivityLevel>50</sensitivityLevel>
<RegionCoordinatesList>
<RegionCoordinates>
<positionX>360</positionX>
<positionY>768</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>365</positionX>
<positionY>46</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>12</positionX>
<positionY>49</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>17</positionX>
<positionY>765</positionY>
</RegionCoordinates>
</RegionCoordinatesList>
</DetectionRegionEntry>
</DetectionRegionList>
<channelName>Cam-1</channelName>
</EventNotificationAlert>
--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 1123
  1. Unattended Baggage Detection
<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>172.18.2.13</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>94:e1:ac:11:cd:86</macAddress>
<channelID>1</channelID>
<dateTime>2018-05-23T20:53:25+03:00</dateTime>
<activePostCount>5</activePostCount>
<eventType>unattendedBaggage</eventType>
<eventState>active</eventState>
<eventDescription>unattendedBaggage alarm</eventDescription>
<DetectionRegionList>
<DetectionRegionEntry>
<regionID>1</regionID>
<sensitivityLevel>10</sensitivityLevel>
<RegionCoordinatesList>
<RegionCoordinates>
<positionX>818</positionX>
<positionY>385</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>686</positionX>
<positionY>234</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>249</positionX>
<positionY>234</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>464</positionX>
<positionY>365</positionY>
</RegionCoordinates>
</RegionCoordinatesList>
</DetectionRegionEntry>
</DetectionRegionList>
<channelName>Cam-1</channelName>
</EventNotificationAlert>
--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 1135
  1. Object Removal Detection
<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>172.18.2.13</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>94:e1:ac:11:cd:86</macAddress>
<channelID>1</channelID>
<dateTime>2018-05-23T20:59:09+03:00</dateTime>
<activePostCount>19</activePostCount>
<eventType>attendedBaggage</eventType>
<eventState>active</eventState>
<eventDescription>attendedBaggage alarm</eventDescription>
<DetectionRegionList>
<DetectionRegionEntry>
<regionID>1</regionID>
<sensitivityLevel>20</sensitivityLevel>
<RegionCoordinatesList>
<RegionCoordinates>
<positionX>870</positionX>
<positionY>408</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>691</positionX>
<positionY>194</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>355</positionX>
<positionY>260</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>608</positionX>
<positionY>565</positionY>
</RegionCoordinates>
</RegionCoordinatesList>
</DetectionRegionEntry>
</DetectionRegionList>
<channelName>Cam-1</channelName>
</EventNotificationAlert>
--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 1132

  1. IO input
<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>172.18.2.13</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>94:e1:ac:11:cd:86</macAddress>
<channelID>1</channelID>
<dateTime>2018-05-23T21:03:36+03:00</dateTime>
<activePostCount>20</activePostCount>
<eventType>IO</eventType>
<eventState>active</eventState>
<eventDescription>IO alarm</eventDescription>
<inputIOPortID>1</inputIOPortID>
<channelName>Cam-1</channelName>
</EventNotificationAlert>
--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 532

Event as with motion detection appear only when active.
The last event in the list is the closing of the alarm input on the camera (wired)

P.S. I look at binding you periodically polls xml for the presence of an alarm.
Accidentally there is no possibility to make binding xml was being parsed continuously?
I think then the issue with the delay alarm will be resolved immediately.


(Qenf) #172

Hello!
I’m trying to configure your add-on, but I get an error:

2018-05-23 20:57:09.132 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to connect with new request for camera at IP:192.168.x.x
2018-05-23 20:57:09.137 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - + The request is going to be GET:/webcapture.jpg?command=snap&channel=0:
2018-05-23 20:57:09.231 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.0)
HTTP/1.0 200 OK
Content-type: image/jpeg
Cache-Control: max-age=315360000Server: uc-httpd 1.0.0
Expires: 0
2018-05-23 20:57:09.643 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 512, cap: 512/512, unwrapped: PooledUnsafeDirectByteBuf(ridx: 512, widx: 512, cap: 512)), decoderResult: success)
2018-05-23 20:57:09.643 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - !!! Camera may have closed the connection which can be normal. Cause reported is:{}
java.lang.ArrayIndexOutOfBoundsException: 0
    at org.openhab.binding.ipcamera.handler.IpCameraHandler$CommonCameraHandler.channelRead(IpCameraHandler.java:365) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at org.openhab.binding.ipcamera.internal.MyNettyAuthHandler.channelRead(MyNettyAuthHandler.java:193) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [262:org.openhab.binding.ipcamera:2.3.0.201805230847]
    at java.lang.Thread.run(Thread.java:748) [?:?]
2018-05-23 20:57:09.645 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - EmptyLastHttpContent

This is generic IP camera with ONVIF 2.0 support (“Gadinan 720p”). RTSP and snapshots works normal, but there is no any image in openhab.


(Jan) #173

I think the authentification is working now?

2018-05-23 19:47:36.547 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Camera dispose called, about to remove/change a Cameras settings.
2018-05-23 19:47:36.559 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Getting configuration to initialize a new IP Camera at IP 192.168.178.110
2018-05-23 19:47:36.571 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.178.110:8080
2018-05-23 19:47:37.299 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Fetching the number of Media Profile this camera supports.
2018-05-23 19:47:37.962 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Checking the selected Media Profile is a valid number.
2018-05-23 19:47:37.963 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Fetching a Token for the selected Media Profile.
2018-05-23 19:47:37.964 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Auto fetching the snapshot URL for the selected Media Profile.
2018-05-23 19:47:38.490 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - About to fetch some information about the Media Profiles from the camera
2018-05-23 19:47:38.491 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - ********************* Media Profile 0 details reported by camera at IP:192.168.178.110 *********************
2018-05-23 19:47:38.491 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Camera will use this Media Profile unless you change it in the binding by pressing on the pencil icon in PaperUI.
2018-05-23 19:47:38.492 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 is named:main_video_encoder_cfg
2018-05-23 19:47:38.492 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 uses video encoder	:H_264
2018-05-23 19:47:38.493 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 uses video quality	:4.0
2018-05-23 19:47:38.493 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 uses video resoltion	:1280 x 720
2018-05-23 19:47:38.494 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 uses video bitrate	:2048
2018-05-23 19:47:38.495 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - ********************* Media Profile 1 details reported by camera at IP:192.168.178.110 *********************
2018-05-23 19:47:38.495 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 is named:sub_video_encoder_cfg
2018-05-23 19:47:38.496 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 uses video encoder	:H_264
2018-05-23 19:47:38.496 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 uses video quality	:4.0
2018-05-23 19:47:38.497 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 uses video resoltion	:640 x 352
2018-05-23 19:47:38.497 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 uses video bitrate	:512
2018-05-23 19:47:38.498 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - About to interrogate the camera to see if it supports PTZ.
2018-05-23 19:47:44.691 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Camera is reporting it supports PTZ controls via ONVIF
2018-05-23 19:47:44.692 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - The camera can Pan  from -1.0 to 1.0
2018-05-23 19:47:44.693 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - The camera can Tilt from -1.0 to 1.0
2018-05-23 19:47:44.694 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - The camera can Zoom from -1.0 to 1.0
2018-05-23 19:47:45.573 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - Camera replied with null when asked what its position was, going to fake the position so PTZ still works.
2018-05-23 19:47:45.574 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Finished with PTZ, now fetching the Video URL's the camera supports.
2018-05-23 19:47:46.588 [ERROR] [ing.saaj.soap.ver1_2.SOAPPart1_2Impl] - SAAJ0415: InputStream does not represent a valid SOAP 1.2 Message
2018-05-23 19:47:46.590 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to connect with new request for camera at IP:192.168.178.110
2018-05-23 19:47:46.597 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - + The request is going to be GET:/web/auto.jpg?-usr=admin&-pwd=PASSWORD&:
2018-05-23 19:47:46.627 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 200 OK
Server: Ipcam
Access-Control-Allow-Origin: *
Date: Wed, 23 May 2018 17:47:46 GMT
Last-Modified: Wed, 23 May 2018 17:47:46 GMT
Content-Type: image/jpeg
Content-Length: 24814
Connection: close
Accept-Ranges: bytes
2018-05-23 19:47:46.635 [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)
2018-05-23 19:47:46.637 [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)
2018-05-23 19:47:46.639 [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)
2018-05-23 19:47:46.641 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultLastHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 7406, cap: 7406/7406, unwrapped: PooledUnsafeDirectByteBuf(ridx: 7406, widx: 7406, cap: 65536)), decoderResult: success)
2018-05-23 19:47:46.643 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to connect with new request for camera at IP:192.168.178.110
2018-05-23 19:47:46.650 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - + The request is going to be GET:/web/auto.jpg?-usr=admin&-pwd=PASSWORD&:
2018-05-23 19:47:46.759 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)

but the motion alarm switch doesn’t change.
And I still have a lot of debug messages, even after I updated to the latest version


(G) #174

@matt1 Sorry, for which camera? One of the two working Hikvisions, or the generic one that I’m currently unable to get online?

The generic cam shows “OFFLINE - CONFIGURATION_ERROR” in paperui.

Even though port should be correct, as I got it from Onvif Device Manager.
URI: http://192.168.1.203:8899/onvif/device_service
Onvif ver 2.0

Can’t think what else to try, everything looks correct, I’ve tried different ports.

Here is the log file, it was too large to add as text to the post, so I had to upload it as .xml.
xml.xml (115.6 KB)

I flipped the test switch on the Hiks during motion, and nothing. What am I looking for?
The Hiks are forever filling the log file like so:

2018-05-24 00:07:27.728 [vent.ItemStateChangedEvent] - CamBG_IMG changed from raw type (image/jpeg): 179480 bytes to raw type (image/jpeg): 277852 bytes

2018-05-24 00:07:30.812 [vent.ItemStateChangedEvent] - CamFG_IMG changed from raw type (image/jpeg): 178928 bytes to raw type (image/jpeg): 180136 bytes

2018-05-24 00:07:31.904 [vent.ItemStateChangedEvent] - CamBG_IMG changed from raw type (image/jpeg): 277852 bytes to raw type (image/jpeg): 275988 bytes

2018-05-24 00:07:35.756 [vent.ItemStateChangedEvent] - CamFG_IMG changed from raw type (image/jpeg): 180136 bytes to raw type (image/jpeg): 179980 bytes

2018-05-24 00:07:36.745 [vent.ItemStateChangedEvent] - CamBG_IMG changed from raw type (image/jpeg): 275988 bytes to raw type (image/jpeg): 271228 bytes

2018-05-24 00:07:40.774 [vent.ItemStateChangedEvent] - CamFG_IMG changed from raw type (image/jpeg): 179980 bytes to raw type (image/jpeg): 178600 bytes

2018-05-24 00:07:41.796 [vent.ItemStateChangedEvent] - CamBG_IMG changed from raw type (image/jpeg): 271228 bytes to raw type (image/jpeg): 271332 bytes

2018-05-24 00:07:45.759 [vent.ItemStateChangedEvent] - CamFG_IMG changed from raw type (image/jpeg): 178600 bytes to raw type (image/jpeg): 180640 bytes

2018-05-24 00:07:46.874 [vent.ItemStateChangedEvent] - CamBG_IMG changed from raw type (image/jpeg): 271332 bytes to raw type (image/jpeg): 273996 bytes

2018-05-24 00:07:50.749 [vent.ItemStateChangedEvent] - CamFG_IMG changed from raw type (image/jpeg): 180640 bytes to raw type (image/jpeg): 179364 bytes

2018-05-24 00:07:52.778 [vent.ItemStateChangedEvent] - CamBG_IMG changed from raw type (image/jpeg): 273996 bytes to raw type (image/jpeg): 176668 bytes

2018-05-24 00:07:55.754 [vent.ItemStateChangedEvent] - CamFG_IMG changed from raw type (image/jpeg): 179364 bytes to raw type (image/jpeg): 178844 bytes

2018-05-24 00:07:57.854 [vent.ItemStateChangedEvent] - CamBG_IMG changed from raw type (image/jpeg): 176668 bytes to raw type (image/jpeg): 273276 bytes

2018-05-24 00:08:00.735 [vent.ItemStateChangedEvent] - CamFG_IMG changed from raw type (image/jpeg): 178844 bytes to raw type (image/jpeg): 178332 bytes

2018-05-24 00:08:01.870 [vent.ItemStateChangedEvent] - CamBG_IMG changed from raw type (image/jpeg): 273276 bytes to raw type (image/jpeg): 274484 bytes

2018-05-24 00:08:05.763 [vent.ItemStateChangedEvent] - CamFG_IMG changed from raw type (image/jpeg): 178332 bytes to raw type (image/jpeg): 180072 bytes

2018-05-24 00:08:06.845 [vent.ItemStateChangedEvent] - CamBG_IMG changed from raw type (image/jpeg): 274484 bytes to raw type (image/jpeg): 273984 bytes

(Skinah) #175

@japhias
Yes it looks like it is working and it is fine to ignore the error for the videoURL which is not used currently.
I will need some examples of what your camera outputs, and learning from the last few days, I think it is best I give you the links to use in a browser even though they are in the binding already. Once I get some example output I can add more functionality. At the moment you may find some features work if you move the controls and watch the cameras setup.

@gman

This error explains the reason is the camera replies with NULL when asked for a snapshot url.

Camera failed to report a valid Snaphot URL, try over-riding the Snapshot URL auto detection by entering a known URL.

If you enter in a URL manually for the camera it will skip this and it may allow the camera to come online. If the camera does not have PTZ features then just set it up as a HTTPONLY thing. It will make life easier if you only watch openhab.log and not all the log files.

You do not need to flip the switch anymore unless your cameras do not work with the auto URL for checking the motion alarm. There are two URLS so one is sent automatically and the other is still on the test button. Check if the enable/disable switch is sitting at the ON position, then the motion switch should move when the alarm is detected. If the switch is off then it means you need to enable it in the cameras setup as the binding can not enable/disable the alarm yet.

Yes, this is why the binding has the ability to stop the image from updating unless an event occurs. You find this in paperUI by pressing the pencil icon.


(G) #176

You’re right, adding an Over-ride does allow the camera to come online, but I don’t know a snapshot url for this camera, only rtsp stream. So I’ll have to wait for that addition to the binding to be able to get screenshots from the camera, correct?


(Skinah) #177

@Yura_Qenf
Currently your camera is not compatible with the binding, it misses the content-length before sending the image. I’ll create an issue on github regarding this to see how many cameras do this.

@toroid
Thank you, I will look at this soon, please be patient as I may have a few nights off.

@ArsalanAlli
Yes the binding defaults to polling every 5000 milli seconds, try setting it to 1000 or a lower valve that works as it may be possible to flood some cameras with too many requests or to create a load on your openhab servers CPU.

@gman
Yes or you may be able to use a script to turn the rtsp into a snapshot, but it may be simply easier to use Motion, Zoneminder or blueiris to do this for you. I have not used those programs so not sure which ones can do it.
edit: Here are some example scripts that people are using


(Skinah) #178

New build 24-05-2018 has following changes:

  • HIKVISION only, New channel for line crossing alarm.
  • Backend changes to make multiple motion alarms possible, may cause issues in other brands but is testing fine on AMCREST.

@japhias
Using any web browser please enter these addresses corrected for your camera. Please enable basic or digest auth in the cameras settings as I don’t like to use urls in plain text if the camera supports another way. If you need to adjust the URL to get it to work please post what you changed and also what comes up in the browser. Feel free to send by PM or in github issue as that makes it easier to find.

Check if audio alarm is happening

http://192.168.178.88/cgi-bin/hi3510/param.cgi?cmd=getaudioalarmattr

enable/disable motion alarm

http://192.168.1.2/cgi-bin/hi3510/param.cgi?cmd=setmdattr&-enable=1

http://192.168.1.2/cgi-bin/hi3510/param.cgi?cmd=setmdattr&-enable=0

enable/disable the audio alarm

http://192.168.178.88/cgi-bin/hi3510/param.cgi?cmd=setaudioalarmattr&-aa_enable=1

http://192.168.178.88/cgi-bin/hi3510/param.cgi?cmd=setaudioalarmattr&-aa_enable=0

set the audio alarm threshold to 50

http://192.168.178.88/cgi-bin/hi3510/param.cgi?cmd=setaudioalarmattr&-aa_enable=1&-aa_value=50

(Arsalan Alli) #179

Yes the binding defaults to polling every 5000 milli seconds, try setting it to 1000 or a lower valve that works as it may be possible to flood some cameras with too many requests or to create a load on your openhab servers CPU.

@matt1i have lower the value of refreshinterval but there is still some delay present in motion alarm detection…well I am emphasising on delay so much is due to the fact that I have also used node.js script from ragingcomputer.com, u might have heared about that script…it detects the motion instantly…can we achsieve that kind of speed in alarm triggering…sorry if am asking too much here…U have done a great job in enabling us to control our cameras via binding…


(Sergey) #180

Thanks for the improvements,
I haven’t checked how it works yet.
But immediately there is one desire.
Perhaps we should add a text item where we indicate which signal is working.
Simply, several types of smart Analytics can be enabled on the camera at the same time.