IpCamera: New IP Camera Binding

FYI, Some useful tools for cheap cams:


Hi,
Have just setup a Foscam 9928P and having some problems with PTZ.
The ipcamera:FOSCAM:foscam:gotoPreset channel is of type number but the camera is expecting a string. It works ok using the cgi method.
http://CAMERA_IP:PORT/cgi-bin/CGIProxy.fcgi?cmd=ptzGotoPresetPoint&name=<PRESET_NAME>&usr=USR&pwd=PASS

The binding produces the following error:
2020-05-04 10:59:53.271 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value ā€˜frontā€™ of item CameraPreset with format ā€˜%.0fā€™: f != java.lang.String

The binding does not use the CGI method, it uses ONVIF methods to move. If you want me to look at it, please send some DEBUG level log when the camera is connecting and it should have a heap of long XML looking replies in it, send this in a private message and do a find / replace on your password to remove it.

@Sascha_
The binding has most if not all of those abilities already built in and done in java in hopefully a seamless experience for a user with no scripting knowledge. Thanks for the heads up on them thou as it is always good to know.

I have an idea to a system for my mailbox. My mailbox accepts medium packages. I would like to receive a notification of received mail with time stamp and a snapshot with a camera to know if they are letters or packages.

With a motion detector, turns on the camera power and take a photo. After that send the notification.

Iā€™m looking for a cheap ip camera with IR for it. The Reolink can work, right? Reolink D400 45eur camera?

Yes it can work as others have posted other models of Reolink as working, however read the first post of this thread for what extra functionality you get with any brand that has a API supported by the binding. You probably wont want them in your mailbox but if you shop around it does not cost a lot to get a camera with an API.

@matt1

Does the thing parameter POLL_CAMERA_MS only affect the frequency of the snapshot being updated from the camera or does it also affect, how often a camera is checked for alarm state in general?

Or in other words: if i increase POLL_CAMERA_MS to letā€™s say 5000ms, do i only receive an update of my alarm items every 5s?

That depends on the brand of camera as some cameras use EVENT based alarm streams instead of the need to poll. Amcrest, Dahua, Doorbird, Hikvision and Instar all use events so they donā€™t change how the alarms act when the poll time changes. However if the stream closes due to a network issue, then the stream will be closed until the next poll time where the stream will get reopened.

If your using the ffmpeg based motion or audio alarm, it also does not rely on the poll time.

The only camera that would is Foscam.

1 Like

If my Axis A8105E doorcam does not have pan and tilt, is there any advantage to configuring it as an ONVIF camera, as opposed to httponly?

no, only easier setup from auto discovery of urls.

Hello, any chance people with Dahua cameras who confirmed this is working for them will also post firmware version from their cameras? This is still not working for me on Dahua IPC-HDBW4231F-AS with firmware V2.800.0000008.0.R
I set the log level to TRACE on the binding, but Iā€™m not seeing reply from camera and for example for line crossing enable / disable Iā€™m not seeing request from openhab to camera neither.

I cleaned cache and TMP folder after binding upgrade, so I would like to know if this should be somehow related to firmware version.

Thanks!

My guess is, this is a communication issueā€¦ Make sure you got the IP correct.

That could be explained if you made a typo error on the channel linking. The binding would never get the command if the link was not made correctly. Check in paper ui under the control tab if the control does not show up it means it is not linked

@pastynko
Edit:
Two things on further Thought. I believe it is a typo otherwise you would see the request go out from the binding to the camera, but the following may help u narrow it down.

  1. See readme on the special apiAccess channel. You can use that to test if the correct api call triggers the camera to change settings.

  2. There is an issue in my Amcrest camera (which appears to be dahua firmware) turning normal motion on and off. Rolling back firmware solved it for me. There are a number of people on the home assistant forum also complaining of this. If this is the cause then contact your camera support.

Hello,

I created things and items files manually and now it seems to be working, sort of. What I want is Cross Line Detection, but this part is not working for me. Iā€™ve looked into your github repository and to my noob eyes it looks like there is missing call to enable / disable LineCrossingDetection. Iā€™ve created a fork of your git and added the call there but I was unable to compile the jar file so far (trying for first time and Java is not something Iā€™m familiar with :smiley:)

Any chance you can have a look?
I found out the request to enable LineCrossingDetection for my camera (Dahua IPC-HDBW4231F-AS) should be IPADDRESS/cgi-bin/configManager.cgi?action=setConfig&VideoAnalyseRule[0][1].Enable=true
Also to get the config, I have to use IPADDRESS/cgi-bin/configManager.cgi?action=getConfig&name=VideoAnalyseRule[0][1] because when I try the url from your binding IPADDRESS/cgi-bin/configManager.cgi?action=getConfig&name=CrossLineDetection[0] I get Error Bad Request

I will let you know if I will succeed. Thanks for your help so far.

Your easy fix is the api access Chanel.
If you want to build it try using ā€˜mvn clean compile packageā€™ to skip the checks that cause it to fail.
I will take a look at the code tomorrow so if you test what does work from api access channel or any browser I can look at including it.

Looks like I compiled the jar somehow and Iā€™m able to enable / disable CrossLineDetection now. I need to test it little bit more, hopefully tomorrow. Btw, I can send you Dahua HTTP API v2.76 (latest I was able to find), which will probably help you more than me :smiley:

Thanks for reporting, looks like I forgot to paste some code across when I was making it easier to read.

Can you test this url in a browser please and post the output it gives or send via PM? This is used to make sure the control is displayed correctly On vs off when openhab starts upā€¦

/cgi-bin/configManager.cgi?action=getConfig&name=VideoAnalyseRule

I think it is little bit too long, so I will PM it to you

@matt1
If you like to, you can add Hikvision DS-2CD2T46G1-4I/SL as a working camera. Two of them are running properly for months now with all recent versions of your binding.

I love your binding. Thanks for putting so much work into it.

2 Likes

Hi, I tested your updated code and it is partly working. Iā€™ve got 4 cameras, first request for each camera is working (enable linecrossing or disable / enable motion), when I try second request, the binding does nothing. Let me explain:
I hit switch to enable motionDetection -> I can see in the log TRACE ā€¦ the request, but I donā€™t see any reply from camera in the TRACE log (in a browser the camera reply with OK, or bad request if the request isnā€™t correctā€¦)
I hit the same switch again to disable motionDetection -> nothing in the log from the binding

I can do this for each cameraā€¦
Any idea what could be wrong or what to look for?

Maybe problem with me, compiling the jar?