IpCamera: New IP Camera Binding

Tags: #<Tag:0x00007fd3220f7470> #<Tag:0x00007fd3220f7330> #<Tag:0x00007fd3220f71c8>

(Sergey) #281

In the latest version, the same error on onvif is caused when connecting the camera directly.

And no picture from the camera.

The status of things - provisioning. In early versions of binding the status was initialized and there was a picture from the camera (though ptz did not work)

Through NVR everything works (except PTZ) as binding does not support such type of control (countur)

(Skinah) #282

I own a Hikvision and have tested it extensively direct to openhab with no NVR as I do not own one. Please delete the camera, re-add it and check your settings. Recent builds have different channels so you must delete and re-add if you do not use TEXTUAL CONFIG. The error as I have mentioned before is your camera not replying when asked about PTZ, it should not stop the camera working. The error should disable the PTZ from working, but it is not related to your picture issue. Check the setting are correct and the NVR input channel is set to 1 for cameras not connected to a NVR.

(Sergey) #283

I turned off onvif on the camera (still it does not work as it should) and things immediately changed to online.

And the picture also appeared

(Chad D) #284

ā€“ the latest build did not enable the schedule when using the switch on the paper UI of OH.

I was able to get my desired results with the following get request::


linkage param is enabling my cameras sound/siren, sensitivity is being set to medium, triggerInterval is saying only trigger every 15 secs motion is present, then the schedule^N and area^N params are enabling motion detection 24/7 as well as setting the motion area for all cells of the cameras motion grid.

Iā€™m considering branching your git repo to try and contributeā€¦ You let me know what I can do to help.

Thanks again for all your work.


Also, I just realized that the Motion Alarm state through OH never changes when motion is detected.

Earlier you had asked me to check the value at:: /cgi-bin/CGIProxy.fcgi?cmd=getDevState
and param motionDetectAlarms value never changed from 1 (no alarm). Now with your help and the troubleshooting that has been done, with the proper setting in my cameras configuration, that value does change from 1 to 2 (detect alarm) when motion is detected.

Am I misconfiguring OH? I also have OH configured to ā€œUpdate the image during motion alarmā€ and the image does not update.

Thanks again!

(Skinah) #285

New Build 21-06-2018 has these changes:

  • Fixed bug for All brands that was causing errors under Openhab version 2.3
  • Foscam improvements to allow user to specify their own ā€œmotion enableā€ command. See bindings settings for the camera, more on this belowā€¦
  • Foscam updated code to be cleaner and use the same methods the other cameras use for only updating picture when movement occurs. Much easier to read and maintain.
  • Foscam now listens to both ā€œmotionDetectAlarmā€ and ā€œmotionDetectAlarmsā€ so both will trigger the motion alarm.


Since this build has changes effecting Foscam users Iā€™ll give a shout out to the people who posted they have foscam in this thread.

Chad has posted his camera appears to be working differently as most of you have already posted the alarm is working fine. In case you find the binding is not turning the alarm back on correctly, I have added another setting in the binding that allows you to enter your own custom url in this formatā€¦


Note there is no IP and it starts with a /.
I have done this because I do not wish for the binding to over write the detection area as many people will want to stop motion detection in areas with tree branches that move in the wind. If you leave this setting blank, it will work the way it did in previous builds.

The other change is Chad seems to be reporting his camera uses ā€œmotionDetectAlarmsā€ and other cameras use ā€œmotionDetectAlarmā€, so the binding should now accept both, but it needs to be tested.

Any problems please contact Chad as he now handles all Foscam complaints :wink: just kidding, all push requests are welcome and the binding now has the framework to allow users to make changes easily without needing to understand the workings of netty.

(OzZy) #286

Hi matt1,
first of all, thank you very much for this binding! It already works great with my Foscam C1 and C1 Lite.
I have a little request: My wife sometimes plugs out the wifi repeater where one of my camera is connected to.
In the Logfile I can see every minute the following Message:

2018-06-22 10:37:56.485 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:foscam02:888
2018-06-22 10:37:59.493 [ERROR] [ing.ipcamera.handler.IpCameraHandler] - Can not connect with ONVIF to the camera at foscam02, check the ONVIF_PORT is correct. Fault was java.net.ConnectException: Host not available.
2018-06-22 10:38:02.494 [ERROR] [ing.ipcamera.handler.IpCameraHandler] - Can not connect with HTTP to the camera at foscam02:88 check your network for issues.
2018-06-22 13:10:16.137 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - Can't find ch when removing handler    URL:/cgi-bin/CGIProxy.fcgi?usr=openhab&pwd=yxenSg2zrOZ4&cmd=snapPicture2
2018-06-22 13:16:07.376 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:foscam02:888
2018-06-22 13:16:17.945 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Camera is reporting that it does NOT support Absolute PTZ controls via ONVIF
2018-06-22 13:16:17.947 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Finished with PTZ with no errors, now fetching the Video URL for RTSP from the camera.

Is it possible to just report just once that the connection to the camera is lost? The thing state reflects the actual connection state.

(Marco Salinardi) #287

@matt1 Hey, i had a little time to investigate. I was never be able to check getMotionDetectConfig but with your recent posts i found out that i need to check getMotionDetectConfig1 Now that i am able to fully investigate I had some test with my C2 Foscam camera. Before i connected the enable motion alarm switch to my presence rule. When i was going out of home the motionAlarm get activated but since there was nobody home i always assumed it would have worked fine. After last posts i checked and motionalarm never got triggered (changed to 2).
I used the link sent from @chaderick9 and was not working too. So i factory reset my camera and got it working and checked the getMotionDetectConfig1 parameter. I have no area, mine has different parameter. Here is the standard response of the C2 straight out of the box that is working.


(Chad D) #288

This change is working great. Thanks for that addition

My formatting on my last comment was misleading. The camera does not use ā€œmotionDetectAlarmsā€, it is the same as the other cameras and uses, ā€œmotionDetectAlarmā€

I am still not getting motion triggered notifications for some reason though, despite the motionDetectAlarm value changing from 1 to 2.


I will turn on logging and try and figure things out.

logging enabled I am not getting much of anything while motion is being detectedā€¦

(Skinah) #289

New build 25-06-2018 only has minor logging changes for Ozzy and Foscam changes for Chadā€¦

It looks like that log output may be from an old build as the newer ones have less output. I just made a change that all ONVIF errors are now only warnings. What this means is you can set your log output to ERROR and you will then only see errors and get what you are after, just donā€™t forget if you ever have issues to step the log back up to TRACE before asking for help. How to change the log level is found in the very first post of this thread.

Download the PDF from this link and on the very last page is an example url for your camera type using the getMotionDetectConfig1 format. Use that example in the binding and it may be that simple.


OK I reversed the changes in newer builds.

What you need to look for is ā€œHTTP Result back from camera isā€ and then in TRACE you will see the reply back from the camera. Your log output stopped too short, it should have been in the next 10+ lines of the log. Because the binding is now async comms, the binding can be asking multiple things of the camera before a reply comes back. I added a line that tells you when the foscam handler is closing the connection to the camera, it is possible the entire message is not reaching the handler in a single packet and it gets closed before the full message comes in. Your camera does not send a length header so I have an idea what may be causing it and I put a change in that may resolve it, hopefully without causing issues for foscam users that have no problems.

(Ahmed Saad) #290

I installed this binding using ā€œDAHUAā€ ip camera ā€¦ It works well but It is very Slow to update The image.
And what does ths log mean?

2018-06-26 00:14:53.203 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - !!!! Alertstream was not running, Cleaning channels and then going to re-start it now.


(Skinah) #291

Can you define slow? I see you have it set to update every second, is it not doing that? Cameras need a key frame to generate a snapshot from so the video settings can effect the snapshot ability.

That warning should happen when first connecting as it means the alarm checking was not running. If it continues in the logs then it will be an issue to look at. Dahua and hikvision both have the ability to open a single stream and keep it open so the camera can inform openhab a alarm is going off. If the stream is not staying open that warning occurs.

(Ahmed Saad) #292

yes !

(Ahmed Saad) #293

Do you mean this settings?

(Skinah) #294

Thank you for the feedback it is greatly valued as I have not heard how it works on Dahua yet. Iā€™m sorry but I am still unclear if your picture updates every second? If you think there is an issue then please create some trace log output and I can take a look. As I donā€™t own Dahua cameras I am very limited to what I can do without log files to show what is going on. First post of this thread explains how to change to trace log output.

(Skinah) #295

The I frame setting try reducing that or play with all settings on that page. The hikvision cameras I have actually send 3 requests for a snapshot before the first request actually gets a picture. The compression also takes time on high resolution cameras so the binding needs to ask multiple times and that may not be happening on your camera, canā€™t tell without log output.

(Mohammad Chaaban) #296

guys, how u r getting the jar file from latest build of this binding?

(Sergey) #297


(Ahmed Saad) #298

Hi @matt1
Thank you for your interest.
yes you are right but unfortunately, my log viewer has stooped,I am trying to fix it

(Mihai Badea) #299


Testing latestā€¦
On my two Foscams C1 almost everything seems to work properly. Almostā€¦
Whatā€™s not working is pulling the state of enableMotionAlarm and enableAudioAlarm from the camera.
If I disable motion or audio alarm from the camera interface or app the channels are not updated.
the response from the camera is:

$ curl ""

(Skinah) #300

The API states that if the alarms are disabled those two should report as 0. If the alarms are enabled and not occurring 1 is the value. Value of 2 for when the alarm is detectedā€¦ Perhaps check for a newer firmware for your camera.