IpCamera: New IP Camera Binding

Anyone know if the
Dahua IPC-HFW2421R-ZS/VFS-IRE6
work with this binding?

I did read it couple of times, both here and Github.
I can’t see anything related to alarm learning and stuff.

I think, you need to follow this:

Changing the log level
Start the Karaf console https://docs.openhab.org/administration/console.html 28
Enter in
log:set TRACE org.openhab.binding.ipcamera
Type in logout to exit the console or you can also type in log:tail to view a live stream of the log.
Highly recommend using FRONTAIL if you are using Linux to view the logs as it has a filter/search ability which is very handy. This is accessed the same way as paperUI if you are using Openhabian. The Openhabian tool can be used to install frontail as well See…
https://www.openhab.org/docs/installation/openhabian.html#openhabian-configuration-tool 

And checking your logs to the API from Dahua to see what is happening.

I started the debug, but I need direction what to look for, its heavy debug.

Hi,

Even i am not 100% sure
these are my logs when i make a change in the cameras.

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

2019-02-20 11:20:52.581 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 99, cap: 99/99, unwrapped: PooledUnsafeDirectByteBuf(ridx: 99, widx: 99, cap: 112)), decoderResult: success)

2019-02-20 11:20:52.588 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:--myboundary

Content-Type: text/plain

Content-Length:36

Code=TimeChange;action=Pulse;index=0

:

2019-02-20 11:20:52.630 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 102, cap: 102/102, unwrapped: PooledUnsafeDirectByteBuf(ridx: 102, widx: 102, cap: 112)), decoderResult: success)

2019-02-20 11:20:52.636 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:--myboundary

Content-Type: text/plain

Content-Length:39

Code=NTPAdjustTime;action=Pulse;index=0

Code=TimeChange;action=Pulse;index=0 This actually states what is happening with my camera when time gets updated

when motion is detected,

2019-02-19 18:04:05.795 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:--myboundary
Content-Type: text/plain
Content-Length:41
Code=VideoMotionInfo;action=State;index=0

:
2019-02-19 18:04:05.859 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 100, cap: 100/100, unwrapped: PooledUnsafeDirectByteBuf(ridx: 100, widx: 100, cap: 112)), decoderResult: success)
2019-02-19 18:04:05.863 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:--myboundary
Content-Type: text/plain
Content-Length:37
Code=VideoMotion;action=Start;index=0

:
2019-02-19 18:04:06.180 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 104, cap: 104/104, unwrapped: PooledUnsafeDirectByteBuf(ridx: 104, widx: 104, cap: 112)), decoderResult: success)
2019-02-19 18:04:06.183 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:--myboundary
Content-Type: text/plain
Content-Length:41
Code=VideoMotionInfo;action=State;index=0

:
2019-02-19 18:04:06.298 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 96, cap: 96/96, unwrapped: PooledUnsafeDirectByteBuf(ridx: 96, widx: 96, cap: 112)), decoderResult: success)
2019-02-19 18:04:06.301 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:--myboundary
Content-Type: text/plain
Content-Length:33
Code=NewFile;action=Pulse;index=0

:
2019-02-19 18:04:06.505 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 96, cap: 96/96, unwrapped: PooledUnsafeDirectByteBuf(ridx: 96, widx: 96, cap: 112)), decoderResult: success)
2019-02-19 18:04:06.507 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:--myboundary
Content-Type: text/plain
Content-Length:33
Code=NewFile;action=Pulse;index=0

:
2019-02-19 18:04:07.060 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 104, cap: 104/104, unwrapped: PooledUnsafeDirectByteBuf(ridx: 104, widx: 104, cap: 112)), decoderResult: success)
2019-02-19 18:04:07.063 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:--myboundary
Content-Type: text/plain
Content-Length:41
Code=VideoMotionInfo;action=State;index=0

:
2019-02-19 18:04:07.113 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 100, cap: 100/100, unwrapped: PooledUnsafeDirectByteBuf(ridx: 100, widx: 100, cap: 112)), decoderResult: success)
2019-02-19 18:04:07.116 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:--myboundary
Content-Type: text/plain
Content-Length:37
Code=VideoMotion;action=Start;index=0

:
2019-02-19 18:04:07.351 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 104, cap: 104/104, unwrapped: PooledUnsafeDirectByteBuf(ridx: 104, widx: 104, cap: 112)), decoderResult: success)
2019-02-19 18:04:07.354 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:--myboundary
Content-Type: text/plain
Content-Length:41
Code=VideoMotionInfo;action=State;index=0

:
2019-02-19 18:04:07.474 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 96, cap: 96/96, unwrapped: PooledUnsafeDirectByteBuf(ridx: 96, widx: 96, cap: 112)), decoderResult: success)
2019-02-19 18:04:07.477 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:--myboundary
Content-Type: text/plain
Content-Length:33
Code=NewFile;action=Pulse;index=0

:
2019-02-19 18:04:07.554 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 104, cap: 104/104, unwrapped: PooledUnsafeDirectByteBuf(ridx: 104, widx: 104, cap: 112)), decoderResult: success)
2019-02-19 18:04:07.555 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:--myboundary
Content-Type: text/plain
Content-Length:41
Code=VideoMotionInfo;action=State;index=0

:
2019-02-19 18:04:07.705 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 99, cap: 99/99, unwrapped: PooledUnsafeDirectByteBuf(ridx: 99, widx: 99, cap: 112)), decoderResult: success)
2019-02-19 18:04:07.707 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:--myboundary
Content-Type: text/plain
Content-Length:36
Code=VideoMotion;action=Stop;index=0

:
2019-02-19 18:04:08.193 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 104, cap: 104/104, unwrapped: PooledUnsafeDirectByteBuf(ridx: 104, widx: 104, cap: 112)), decoderResult: success)
2019-02-19 18:04:08.195 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:--myboundary
Content-Type: text/plain
Content-Length:41
Code=VideoMotionInfo;action=State;index=0

:
2019-02-19 18:04:08.305 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 96, cap: 96/96, unwrapped: PooledUnsafeDirectByteBuf(ridx: 96, widx: 96, cap: 112)), decoderResult: success)
2019-02-19 18:04:08.308 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is 	:--myboundary
Content-Type: text/plain
Content-Length:33
Code=NewFile;action=Pulse;index=0

So you need to cross reference with the API and get to a understanding

Hi,

I was looking at the same function and had to come up with this …

Check my topic

It might help you

1 Like

Hi I have moved my openHAB installation to Raspberry Pi and everything seems to be working fine, but I am getting a load of errors from the binding:
The alarm checking stream was not running. Cleaning channels and then going to re-start it now.
I have 8 Hikvision cameras for which I have unlined all the channels except “Update the image” and " A JPG Image that can be made to update from your cameras feed."
Please help what it means, as this is a warning and is filling the log file, but I would not like to disable logging warnings for the binding, rather to fix the issue.
Thanks
Pawel

Type this into any browser replacing the IP of course…

http://192.168.1.x/ISAPI/Event/notification/alertStream

You should get regularly scrolling
XML output like the below… Can you post what your camera gives? if the camera does not reply in I think it is 15 seconds the message you are reporting will occur.

<EventNotificationAlert version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.1.x</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>my:mac:address</macAddress>
<channelID>1</channelID>
<dateTime>2019-02-07T17:59:19+12:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
<channelName>Camera 01</channelName>
</EventNotificationAlert>

When I run this on the DVR, which is what I setup for the camera views (same IP, different channels), I get this text response:
Can't locate the url

But when I run this on the cameras, which I would prefer not to do (I have all cameras on a separate vlan and only DVR exposed to the network), I am getting this, which I suppose correctly indicates I am using a user with insufficient privileges:

<ResponseStatus xmlns="http://www.hikvision.com/ver20/XMLSchema" version="2.0">
<requestURL>/ISAPI/Event/notification/alertStream</requestURL>
<statusCode>4</statusCode>
<statusString>Invalid Operation</statusString>
<subStatusCode>lowPrivilege</subStatusCode>
</ResponseStatus>

Sounds like u will be able to work it out. It may be the dvr does not support the api or it may be disabled as hik commonly turn the cgi features off by default. Refer to manual and hik support.

If you don’t care about the alarms then set your camera up as httponly thing type.

Frankly I don’t know what to look for. There is no option for what API is exposed in the DVR. At the same time there are alarms that can be configured. Also, the access to the DVR by specifying input channel works fine and binding can retrieve the paths to video and image. Can it have something to do with the fact that I unlinked all the alarm channels? Or maybe DVRs can have different capabilities and binding could take that into account? As a workaround I will increase the log severity to error.

This thread may interest users of this binding. It would be great to get an idea of how hard it is to get this running on different cameras and on a raspberry Pi.

after the binding installation the log tells me this…
why?

Interesting, what brand and model camera and what is the snapshot URL that the binding is using? It could possibly be that the URL is a “subscribe” to a snapshot and not asking for only a single jpg file. The camera is sending multiple jpg files without the binding asking for it, at least that small amount of the log indicates this.

New feature to discuss in new thread linked below. Love to hear from anyone who has been using or trying to setup Habpanel with cameras…

New Build 2019-03-10-Beta, has these changes which INCLUDES BREAKING CHANGES.

  • New streaming server ability which is described in more detail in the post/thread just above this one. This is turned off by default and the binding should work the same as ever with this turned off, but consider this BETA the moment you enable the proxy server feature by chaning the port from -1.
    To use the new streaming features you need to change the new SERVER_PORT config from -1 to a valid and unused port number. Warnings in the log should guide you as well. This only works on 1 stream at a time and it is Beta but it appears fine for a single stream to gain feedback. Your camera needs to produce a MJPEG stream and for it to be useful until ffmpeg support is added. Only known issue at this point is you need to reboot if you change the port for it to take effect, possibly other settings are the same so if in doubt, reboot.

example textual setup for a things file is…

Thing ipcamera:DAHUA:001 [IPADDRESS="192.168.1.2", PASSWORD="password", USERNAME="foo", POLL_CAMERA_MS=2000, SERVER_PORT=54321, IP_WHITELIST="(192.168.1.120)(localhost)(192.168.1.33)(192.168.1.74)", IMAGE_UPDATE_EVENTS=0]
  • Fix typo in multiple config names that contained OVERIDE ie. SNAPSHOT_URL_OVERIDE is now SNAPSHOT_URL_OVERRIDE. If you used config files, it should be as easy as opening the file adding the extra letter and saving.

  • Changed multiple channel names to now be camelCase so they are now consistent and all the same format.If you used item files, it should be as easy as opening the file and using find and replace. All the important channels did not change so it is unlikely it will effect many people.

  • videourl channel is now rtspUrl to save confusion with the new channel for streaming. Since it was not useful I this change won’t effect many people.

Note: If using paperUI to setup the cameras and not textual config you probably will hit issues until you delete the camera and setup from scratch, this is due to new channels and multiple changes outlined above. I can’t stress enough how much easier it is with textual config when a binding is changing often.

I have tried for several hours to get my FOSCAM P1 camera connected to openhab but it won’t work.

I tried to configure the camera via text configuration and also via de paper UI. In the paper UI when I input all settings and click save it it says error500 request failed. Im able to acces the log files but I can’t make heads or tails of it.

I’m from holland so my English may be a bit off sometimes…

Thank you for all your help.

My camera does support ONVIF an API support as far as I can see. Help setting up this camera would be nice. Where to start?

Update

After some fooling around with the camera I noticed the following thing:

Adding a simple HTTPONLY camera gives the same result, upon adding and clicking safe it says connection error. Saving an second time gives a 409 conflict error. When trying to setup my camera with a android ONVIF app it errors out on trying to connect via RTSP over HTTP, then it defaults to RTSP over TCP and succeeds… This might be usefull to know? Im on Ubuntu 18.04 btw. Installed Openhab via ubuntu. NOT Manually.

Thank you for any help.

Hi,

I have received a Hikam A7 from the 2nd Generation for a very cheap price. This supports ONVIF but I am not completely able to add it to my OpenHab.

I have installed your binding. I used the information from the camera vendor itself: http://supportus.hi-kam.com/en/support/solutions/articles/16000072606-how-to-watch-live-streams-with-onvif-clients-for-s6-a7-2018-version-

I took the generic ONVIF setting in your binding. It seems to work so the Video URL was recognized automatically:
video_url

But where can I get the live stream or a picture from the camera?

Edit: Maybe is it possible to run FFMPEG directly on the Openhabian for the convertion of the RTSP to HTTP?

This shows that you are not using the latest build which has the first of a number of streaming features. I have updated the readme and documentation so they are now only accurate with the latest build due to the breaking changes I listed in my post above…

The binding will handle snapshots very well but if the camera does not report a url via ONVIF then you will need to manually enter the snapshot url until rtsp features are added. The same goes for the mjpeg http based stream, it will need to be manually entered for cameras that are not HIK, Dahua or Amcrest until further features are added to give rtsp.

Create your own thread and include in it your items and things file contents (remove passwords).

I suspect the conflict errors are from you trying to modify with PaperUI after you have already setup items and things files, the readme warns you against this, so please take the time to read the readme file at the github project, link found in first post of this thread.

Thank you for your reply, but I tried both ways (PaperUI & Files) But I could not get it to work. Out of pure frustration (other things didn’t work either) I deleted the whole stuff and started from scratch again… hahah. But thank you for your reply.