IpCamera: New IP Camera Binding

Just revisting this binding. I have some of the dahuas (nvr and 4300c cameras).

How should I be setting them up? As far as I know none are onvif. And a quick add of a dahua one I see it trying to use port 80 for onvif. Do I use that, or the generic http?

Primarily I want a way for forcing a snapshot upon another non camera action (contact item)

My conclusion after trying these was that they are not sufficiently compliant with RTSP so donā€™t work with this binding. Pls report back if you get anywhere. I would be interested.

What is the recommended way to update to the latest version?

Bundle uninstall from karaf console and replace jar? If not using config files remove things from Paper UI?

Maybe how to update information should at the top of thread.

I updated and still have issues with jpeg quality for anything over 80-85. Previously I had to use 70 to avoid the too much data error for all conditions now 80 seems OK so far.

I loaded the image directly and found at 85 (night shot) its 716 kb

No idea, that is the openhab framework so you would need to refer to the documentation for Openhab which probably does not cover manually installed JAR files so I would not bother going to lookā€¦
Just swap out the JAR file and reboot the server should be all you need to do and if you have issues clear the tmp and cache folders as a first step but I have not found that to be necessary and usually dropping in the new jar will trigger a reload without needing to reboot.

This only happens with HTTP version 1.0 cameras and it makes sense to run some compression on the JPG, I would never wish to try and run it at 100% or another way to look at it is 0% compression.

Hi @matt1

I missed this build i will try to test this week,
Can you do me a favor and try to add output 1 , 2 control for Dahua?
I would love to replace Hik cam and control main gate :slight_smile:

Hello @matt1. I have a Foscam FI9900P and it was working well via cameras web interface, running cgi scripts via Firefox and OpenHAB binding from you.
Today I closed the Internet for the cameras IP address (it communicates to much private data) and since that moment I do not get the connection running well again between OpenHAB and the cam.
I have attached a part of the debug file.
-> Can you see anything strange or have an idea what else I can do to get the connection again running?
When I copy the content of the urls from the logfile to the browser with IP address added I get a correct output (status info with around 12 lines). And I contacted the hotline of Foscam and they assured me that the camera is also running without any Internet access.

2018-11-16 19:49:46.671 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Getting configuration to initialize a new IP Camera at IP 10.10.10.131
2018-11-16 19:49:46.675 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:10.10.10.131:888
2018-11-16 19:49:46.679 [me.event.ThingUpdatedEvent] - Thing 'ipcamera:FOSCAM:0bdb3d2f' has been updated.
2018-11-16 19:49:51.359 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Fetching the number of Media Profiles this camera supports.
2018-11-16 19:49:54.815 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Checking the selected Media Profile is a valid number.
2018-11-16 19:49:54.817 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Fetching a Token for the selected Media Profile.
2018-11-16 19:49:54.819 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Auto fetching the snapshot URL for the selected Media Profile.
2018-11-16 19:49:57.902 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - About to fetch some information about the Media Profiles from the camera
2018-11-16 19:49:57.904 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - *********** Media Profile 0 details reported by camera at IP:10.10.10.131 ***********
2018-11-16 19:49:57.906 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Camera will use this Media Profile unless you change it in the bindings settings.
2018-11-16 19:49:57.908 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 is named:videoencoder_name0
2018-11-16 19:49:57.909 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 uses video encoder	:H_264
2018-11-16 19:49:57.911 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 uses video quality	:3.0
2018-11-16 19:49:57.913 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 uses video resoltion	:1920 x 1080
2018-11-16 19:49:57.915 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 uses video bitrate	:1024
2018-11-16 19:49:57.917 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - *********** Media Profile 1 details reported by camera at IP:10.10.10.131 ***********
2018-11-16 19:49:57.919 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 is named:videoencoder_name1
2018-11-16 19:49:57.921 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 uses video encoder	:H_264
2018-11-16 19:49:57.923 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 uses video quality	:3.0
2018-11-16 19:49:57.925 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 uses video resoltion	:1280 x 720
2018-11-16 19:49:57.927 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 uses video bitrate	:512
2018-11-16 19:49:57.929 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - About to interrogate the camera to see if it supports PTZ.
2018-11-16 19:50:03.997 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Camera is reporting that it supports PTZ control with Absolute movement via ONVIF
2018-11-16 19:50:04.002 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Checking Pan now.
2018-11-16 19:50:09.745 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Checking Tilt now.
2018-11-16 19:50:15.295 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Checking Zoom now.
2018-11-16 19:50:26.361 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Camera has reported the range of movements it supports via PTZ.
2018-11-16 19:50:26.364 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - The camera can Pan  from -1.0 to 1.0
2018-11-16 19:50:26.367 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - The camera can Tilt from -1.0 to 1.0
2018-11-16 19:50:26.369 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - The camera can Zoom from -1.0 to 1.0
2018-11-16 19:50:26.372 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Fetching the cameras current position.
2018-11-16 19:50:29.138 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Finished with PTZ with no errors, now fetching the Video URL for RTSP from the camera.
2018-11-16 19:50:34.573 [ERROR] [ing.saaj.soap.ver1_2.SOAPPart1_2Impl] - SAAJ0415: InputStream does not represent a valid SOAP 1.2 Message

2018-11-16 19:50:34.579 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera at IP:10.10.10.131, 	URL:/cgi-bin/CGIProxy.fcgi?usr=user&pwd=x_pwd_y&cmd=snapPicture2
2018-11-16 19:50:34.585 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - CommonCameraHandler created.... 0 channels tracked (some of these may be closed).
2018-11-16 19:50:34.593 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Have  opened  a  brand NEW channel:0 	GET:/cgi-bin/CGIProxy.fcgi?usr=user&pwd=x_pwd_y&cmd=snapPicture2
2018-11-16 19:50:34.607 [vent.ItemStateChangedEvent] - Terrasse_Kamera_Imageurl changed from https://10.10.10.131/cgi-bin/CGIProxy.fcgi?usr=user&pwd=x_pwd_y&cmd=snapPicture2 to http://10.10.10.131:88/cgi-bin/CGIProxy.fcgi?usr=user&pwd=x_pwd_y&cmd=snapPicture2
2018-11-16 19:50:34.632 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 200 OK
Content-Type: text/plain
Transfer-Encoding: chunked
Date: Fri, 16 Nov 2018 18:50:32 GMT
Server: lighttpd/1.4.31
2018-11-16 19:50:34.635 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel marked as closing, channel:0 	URL:/cgi-bin/CGIProxy.fcgi?usr=user&pwd=x_pwd_y&cmd=snapPicture2
2018-11-16 19:50:34.638 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 51, cap: 51/51, unwrapped: PooledUnsafeDirectByteBuf(ridx: 192, widx: 197, cap: 1024)), decoderResult: success)
2018-11-16 19:50:34.640 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Camera has sent some kind of message.Bytes=0
2018-11-16 19:50:34.643 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - End of FOSCAM handler reached, so closing the channel to the camera now
2018-11-16 19:50:34.645 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - EmptyLastHttpContent
2018-11-16 19:50:34.647 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Camera has sent some kind of message.Bytes=0
2018-11-16 19:50:34.649 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Camera has sent last part of the message.Bytes=0
2018-11-16 19:50:34.651 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - commonCameraHandler closed channel:0 	URL:/cgi-bin/CGIProxy.fcgi?usr=user&pwd=x_pwd_y&cmd=snapPicture2
2018-11-16 19:50:34.653 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Closing CommonCameraHandler. 		URL:/cgi-bin/CGIProxy.fcgi?usr=user&pwd=x_pwd_y&cmd=snapPicture2

2018-11-16 19:50:35.600 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera at IP:10.10.10.131, 	URL:/cgi-bin/CGIProxy.fcgi?cmd=getDevState&usr=user&pwd=x_pwd_y
2018-11-16 19:50:35.612 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - CommonCameraHandler created.... 1 channels tracked (some of these may be closed).
2018-11-16 19:50:35.624 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Have  opened  a  brand NEW channel:1 	GET:/cgi-bin/CGIProxy.fcgi?cmd=getDevState&usr=user&pwd=x_pwd_y
2018-11-16 19:50:35.640 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 200 OK
Content-Type: text/plain
Transfer-Encoding: chunked
Date: Fri, 16 Nov 2018 18:50:33 GMT
Server: lighttpd/1.4.31
2018-11-16 19:50:35.646 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel marked as closing, channel:1 	URL:/cgi-bin/CGIProxy.fcgi?cmd=getDevState&usr=user&pwd=x_pwd_y
2018-11-16 19:50:35.651 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 51, cap: 51/51, unwrapped: PooledUnsafeDirectByteBuf(ridx: 192, widx: 197, cap: 1024)), decoderResult: success)
2018-11-16 19:50:35.655 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Camera has sent some kind of message.Bytes=0
2018-11-16 19:50:35.661 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - End of FOSCAM handler reached, so closing the channel to the camera now
2018-11-16 19:50:35.666 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - EmptyLastHttpContent
2018-11-16 19:50:35.670 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Camera has sent some kind of message.Bytes=0
2018-11-16 19:50:35.675 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Camera has sent last part of the message.Bytes=0
2018-11-16 19:50:35.680 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - commonCameraHandler closed channel:1 	URL:/cgi-bin/CGIProxy.fcgi?cmd=getDevState&usr=user&pwd=x_pwd_y
2018-11-16 19:50:35.684 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Closing CommonCameraHandler. 		URL:/cgi-bin/CGIProxy.fcgi?cmd=getDevState&usr=user&pwd=x_pwd_y


This logfile content is now repeating ongoing based on polling intervall.
Thanks, Siggi

I have had two reports on github with foscams that may help.

  1. Special characters in user or pass do not work so if using remove any. Just use numbers and letters only.

  2. The camera can lock itself if the wrong password is used and once locked will not work.

The camera is replying with text replies and not a picture so that may point to one of those two things being an issue.

Hi,
iā€™m having an ezviz cam sending images over rstp. If you have time can you implement rstp ?
This cam also supporting 2 way audio but i have no clue how it can works without the ezviz app.
Maybe i can intercept the request with wireshark to see how ezviz is sending audio to the cam?

The rtsp url is rtsp://admin:[camCode]@ip.ip.ip.ip:554/Streaming/Channels/101/

Thank you

Ezviz I believe are made by hikvision so info on two way audio is probably in their api documents with packet break downs. Should give clues as I have seen some brands doing that.
There is a two way issue thread on github here.

Rtsp is very complex for reasons at the below link. I have played with it a bit and have the binding capturing the stream and splitting it into separate mjpeg frames. This is where I stopped due to no time to spend on this and many more important things to do. If you want to know more on this topic see here

Hi matt1,

I had previously replied that my Hikvision model DS-7208HQHI-F1 / N works.
I have no problems with the camera feed and alarm output controls, but Iā€™m unable to the motion sensor and line crossings to work.

I checked the openhab.log file and see that it says: ā€œThe alarm checking stream was not running. Cleaning channels and then going to re-start it now.ā€

Iā€™m running openhab on a windows 10 computer and see that when I start up openhab, there are lots of errors that end with ā€œCould not unmarshal, ended in SOAP faultā€
My camera does not have PTZ functions so based on previous posts in this thread, I assume that could be it.

Is it possible for me to have motion detection/line crossing?

You need to set them up in the cameras control panel first. Off the top of my head you need toā€¦

  1. Enable ONVIF as by default it is turned off and has no user created, see info on this in the very first post of this thread.
  2. The API is also disabled by default and need a box ticked to turn it on before the alarms will work, this is found in the same place as point 1 above.
  3. Set the alarms to use the alarm ā€˜Notify Surveillance Centerā€™. This is on the page that sets up the alarm in particular. Each alarm needs its own box ticked.

Then give the camera the wrong ONVIF port number so the binding skips trying to use ONVIF, I run my non PTZ cameras that way as they connect much faster.

That is normal the first time the camera connects, it should not happen often after that unless something in a more recent build has broken something.

Hi matt1,

Thanks for your help. I had checked the video previously and was not able to turn on the ONVIF since I was running a older firmware, so it was enabled by default.

I have since updated the firmware and enabled ONVIF. I do not see where I can turn on the API (no box that says this). I see that the video says to Enable Hikvision-CGI. I do not have this option in the menu, so is this enabling the API? Or maybe you mean the part where he makes ONVIF discovery mode ā€œdiscoverableā€? I have enabled this.

When I enable motion, should the camera web view also display a checkbox?

Hi @matt1
I just bought an Reolink RCL-410, my old foscam diedā€¦ Anywayā€¦
I first used the old 2.3 binding, and then upgraded the binding to the latest 2.4 27.11.2018 (just downloaded). And everything seems fine. However IĀ“m getting this error in the tail log.

2018-11-28 22:49:51.161 [ERROR] [ing.saaj.soap.ver1_2.SOAPPart1_2Impl] - SAAJ0415: InputStream does not represent a valid SOAP 1.2 Message

@Kim_Andersen
Any mention of SOAP means it is the ONVIF reporting this.
Setup the camera as httponly or give the camera the wrong ONVIF port number so the binding skips trying to use ONVIF, I run my non PTZ cameras that way as they connect much faster.

If I use the ONVIF username/password within the openhab binding, I would not be able to use the ONVIF device manager program. The camera would show as connected, but I would not be able to control motion detection/line crossing/alarm output or anything.

If I shutdown openhab, I could connect to the ONVIF device manager and control alarm output.

If I use the device username/password, I would not be able to get motion detection/line crossing working, but alarm output would work.

How do I know if API is enabled? I think it should be as I can control the alarm output from the ONVIF device manager.

This is quite a weird phenomenon, but at least I can control my alarm output.

Yes that is what is in my genuine Hikvision cameras with up to date firmware. CGI is the API. Sorry but for any questions about the camera you will need to contact HIK support as I do not work for them and have little experience with them. I recommend you download the API document and try some of the commands to see if they work or not using any browser that will soon tell you if the camera has it disabled or is missing support.

Also try following the info in the very first post of this thread and enable TRACE log output and see what the logs are telling you, often cameras reply back with helpful messages.

Hi matt1,

Thanks for your help, seems like my model does not support enabling API yet.
I have contacted Hikvision to see if they can support this in a future firmware update.

will Reolink RLC-410-5MP work? it was mentioned several times in this thread but not in the opening postā€¦

It works for images (snapshots).
But I can not get streaming to work. No alarms or motions detections either. Had to install it as HTTPonly, since ONVIF doesnĀ“t really work and gives en soap error.

ItĀ“s sad it doesnt provide an API Matt can use, cause I think its a pretty nice cam (taking its price into consideration).

I wonder how come openhab doesnĀ“t support rtcp protocol. Any comments on this?, @matt1

too bad :frowning:
regarding Hikvision iā€™ve read that they are communicating with thier ā€œmother-serverā€ in china and thatā€™s an absolute nogo for me. so if i want/need ā€œsmart alarmā€ that ony leaves the dahua cams, right?
(please donā€™t tell me the also have a ā€œstrong connectionā€ to home!?)

Peter