IPcamera binding and Motion Detect does not work as expected

I am using on a windows PC the OH 4.1.2 with a foscam and the IPcamera binding. The mobile foscam app is working and detects motion without problem. In OH I have a video stream but the motion detection is not working at all.

The thing URL setup for motion is:

Create your own custom enable Motion Alarm settings by entering a custom URL

The camera channel “Enable Motion Alarm” is OFF and when manually switch it to ON it goes automatically back to OFF after about 7s. The channel “Motion Alarm” remains always OFF.

The event log shows:

 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'IP_Kamera_OG__Foscam_Camera_with_API_Enable_Motion_Alarm' updated to OFF
 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'IP_Kamera_OG__Foscam_Camera_with_API_Enable_Motion_Alarm' changed from ON to OFF
 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'IP_Kamera_OG__Foscam_Camera_with_API_LED_Controls' updated to 0

And the OH-Log:

 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET:***&pwd=***
[TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result back from camera is 	:<CGI_Result>

Can someone help pls?

Your camera has human and other newer alarms that are not yet added into the foscam support of the binding. It is easy to add them so thank you for posting your cameras output.

The motion alarm enable channel is for turning the detection feature on and off. It will only work if you setup the url as per the readme, but this is not needed if you turn it on with the cameras app and leave it turned on. There is a separate channel without the enable word in it that shows if the alarm is on or off.

Thanks for your reply. I do not fully understand what it means. In my app the detection is set to ON and the app gets the human detection. On the other hand I set the URL in OH like this:

[quote="Norick, post:1, topic:155697"]

which should also activate the human detection - correct?

The channel “Motion Alarm” says “Motion has been detected” and is in my case always OFF. So you mean you have to change your binding in order it works and/or can I do a workaround to fix it?


This according to the source code means the motion alarm is disabled. It goes to a value of 1 and 2 when it is enabled.

No idea, you need to read the api to know what the url does, I am not tech support and won’t spend hours reading documents for cameras I do not own. If there is a bug then I am happy to help out. The car, pet and also human alarms can be added and I can look at doing this in around a weeks time. They won’t work till I make a newer build.

This makes sense whten the “motionDetectAlarm” is 0! In the api docu for setting the URL they say:

isEnable -> Is enable motion detect alarm

In my URL I set:


Now I am not sure if the binding reads that URL correct or the API in this case does something wrong or I missunderstood this parameter. What is your opinion about this point?

When reading out the CGI for the getMotionDetectConfig I get this:


Here the second entry is:


which tells me the detection is ON - correct?

But the OH trace log gives me:


Do you have an idea why the binding says 0 here even when I set it?

Thank you

Is it possible that the IP binding is not working and therefore the binding returns 0???

Not possible, the binding just gives to the log EXACTLY what the camera returns. Of course I have no idea if FOSCAM has changed the cgi or if it is a bug in the camera, only their support would be able to answer such questions.

The documentation is here

It however appears older than your camera as it does not have the line crossing, human, pet or car alarms that yours has.

I have implemented the new alarms in a special build here, if you can test them, I can then raise a PR to get these changes merged. Since they are not documented I assumed the same is true that a value of 2 means the alarm is active and 1 means it is not in the alarm state.


So the big question is what the camera returns. Therefore I have this latest foscam API docu:

[type or paste code here](https://alarmforum.de/attachment.php?aid=2467)

Motion Isenable is therefore “1” and disabled a “0” in my opinion. I understood that in your binding it is different. I will test your version and let you know if I can see a difference or not.


Just for clarification: You check the CGI flag “humanDetectAlarmState” if a motion has been detected?

Is this correct? If yes, what is the default value when NOT detected and what is the value when motion is detected?

Correct, you should now have access to a new channel, i think it is called humanAlarm and this should tell you when the camera sees a human. Animal, car and line crossing are also now added. The line crossing is a very good alarm to use that can prevent false positives and its much better then dumb motion detection.

2 = motion
1 = no motion
0 = alarm disabled

None of the CGI / API documentations that I can find list what they should actually be, so this is why I am asking if you mind testing that it is correct? thanks…

I am actually surprised that Foscam seems to have updated the CGI as they have been following a trend of removing the CGI features from models in years past. Hopefully they are changing their mind and adding them as most of their competition has been adding more A.I object detection alarms. Please contact Foscam and ask them questions as I can only guess as I do not work for them and only have access to the same documents like you do.