IpCamera: New IP Camera Binding

Build 2.3.0.201805021159.

  • enableMotionAlarm detects if motion alarm was disabled from camera. I think the same should be done for enableAudioAlarm:
10:24:15.779 [INFO ] [smarthome.event.ItemStateChangedEvent] - SufraCAM_MotionAlarmEnabled changed from ON to OFF
  • Setting thresholdAudioAlarm to non-zero value activates enableAudioAlarm. However, I think enableAudioAlarm switch and thresholdAudioaAlarm should be linked somehow. For example, I had the threshold set to 69, AudioAlarm disabled. When I enabled AudioAlarm, it didnā€™t set it to high as per threshold. Instead it enabled the audio alarm with sensitivity set to low. Likewise, setting the threshold to 0 doesnā€™t disable the audio alarm. It remains enabled and sensitivity set to low.

  • audioAlarm channel doesnā€™t get triggered:

10:16:40.889 [INFO ] [smarthome.event.ItemStateChangedEvent] - SufraCAM_MotionAlarm changed from ON to OFF
10:16:45.967 [INFO ] [smarthome.event.ItemStateChangedEvent] - SufraCAM_MotionAlarm changed from OFF to ON
10:16:50.920 [INFO ] [smarthome.event.ItemStateChangedEvent] - SufraCAM_MotionAlarm changed from ON to OFF
10:17:01.184 [INFO ] [smarthome.event.ItemStateChangedEvent] - SufraCAM_MotionAlarm changed from OFF to ON
03-May-2018 10:16:45.525 [DEBUG] [g.openhab.binding.ipcamera.handler.IpCameraHandler] - ++ The request is going to be :/cgi-bin/CGIProxy.fcgi?cmd=getDevState&usr=XXXXX&pwd=XXXXX:
03-May-2018 10:16:45.956 [DEBUG] [g.openhab.binding.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 200 OK
Content-Type: text/plain
Connection: close
Transfer-Encoding: chunked
Date: Thu, 03 May 2018 07:16:53 GMT
Server: lighttpd/1.4.35
03-May-2018 10:16:45.957 [DEBUG] [g.openhab.binding.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 528, cap: 528/528, unwrapped: PooledUnsafeDirectByteBuf(ridx: 689, widx: 694, cap: 1024)), decoderResult: success)
03-May-2018 10:16:45.957 [DEBUG] [g.openhab.binding.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is :<CGI_Result>
    <result>0</result>
    <IOAlarm>0</IOAlarm>
    <motionDetectAlarm>2</motionDetectAlarm>
    <soundAlarm>2</soundAlarm>
    <record>0</record>
    <sdState>0</sdState>
    <sdFreeSpace>0k</sdFreeSpace>
    <sdTotalSpace>0k</sdTotalSpace>
    <ntpState>0</ntpState>
    <ddnsState>0</ddnsState>
    <url>XXXXX</url>
    <upnpState>0</upnpState>
    <isWifiConnected>1</isWifiConnected>
    <wifiConnectedAP>XXXXX</wifiConnectedAP>
    <infraLedState>0</infraLedState>
</CGI_Result>
:
03-May-2018 10:16:45.960 [DEBUG] [g.openhab.binding.ipcamera.handler.IpCameraHandler] - EmptyLastHttpContent
03-May-2018 10:16:45.961 [DEBUG] [g.openhab.binding.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is ::
03-May-2018 10:16:50.513 [DEBUG] [g.openhab.binding.ipcamera.handler.IpCameraHandler] - Trying to connect with new request for camera at IP:192.168.200.199
03-May-2018 10:16:50.521 [DEBUG] [g.openhab.binding.ipcamera.handler.IpCameraHandler] - ++ The request is going to be :/cgi-bin/CGIProxy.fcgi?cmd=getDevState&usr=XXXXX&pwd=XXXXX:
03-May-2018 10:16:50.911 [DEBUG] [g.openhab.binding.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 200 OK
Content-Type: text/plain
Connection: close
Transfer-Encoding: chunked
Date: Thu, 03 May 2018 07:16:58 GMT
Server: lighttpd/1.4.35
03-May-2018 10:16:50.913 [DEBUG] [g.openhab.binding.ipcamera.handler.IpCameraHandler] - DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 528, cap: 528/528, unwrapped: PooledUnsafeDirectByteBuf(ridx: 689, widx: 694, cap: 1024)), decoderResult: success)
03-May-2018 10:16:50.914 [DEBUG] [g.openhab.binding.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is :<CGI_Result>
    <result>0</result>
    <IOAlarm>0</IOAlarm>
    <motionDetectAlarm>1</motionDetectAlarm>
    <soundAlarm>2</soundAlarm>
    <record>0</record>
    <sdState>0</sdState>
    <sdFreeSpace>0k</sdFreeSpace>
    <sdTotalSpace>0k</sdTotalSpace>
    <ntpState>0</ntpState>
    <ddnsState>0</ddnsState>
    <url>XXXXX</url>
    <upnpState>0</upnpState>
    <isWifiConnected>1</isWifiConnected>
    <wifiConnectedAP>XXXXX</wifiConnectedAP>
    <infraLedState>0</infraLedState>
</CGI_Result>
:
03-May-2018 10:16:50.916 [DEBUG] [g.openhab.binding.ipcamera.handler.IpCameraHandler] - EmptyLastHttpContent
03-May-2018 10:16:50.917 [DEBUG] [g.openhab.binding.ipcamera.handler.IpCameraHandler] - HTTP Result back from camera is ::

Build 03-05-2018 has following changes:

  • Foscam only: Threshold 0 will turn off the audio alarm. Any value above will turn it on with the three settings spaced out over the slider.
  • Foscam only: Fixed bug that stopped audio alarm from working and it would have caused other issues.
  • All brands will now do a single image update when first connected if the camera is setup to restrict the image updates so the image is not blank whilst waiting for an alarm.
  • Cameras will only try to reconnect once after 10 seconds from the camera going offline and then every 60 seconds if the first try fails. Was filling my logs up as previously it was every 10 seconds.

Going to do some major changes making the backend code more streamlined and neater for the next few days and look at some new functionality to add like looking at HTTPS in more depth. This may stop me from being able to make quick changes until it tests fine on my setup.

1 Like

Build 06-05-2018 marked as HIK-ALPHA2

  • Is not alpha for other brands other then HIKVISION, all other brands it is a normal build and can be used. Should there be an issue the build 05-05-2018 is almost the same with the hik stuff not added.
  • New thing type for hikvision that needs testing by someone with a camera. It will send 3 different requests out to check the motion alarm and if someone can provide some sample outputs it will assist in getting it working if it does not already. The enable and disable the motion alarm will trigger two of the methods and hence this control will not work as it is used to send out the alternative methods.
  • Big backend changes were made to make adding and maintaining multiple camera brands easier.
  • Backend changes mean I am not limited to GET requests. POST PUT DELETE etcā€¦ are now possible. Looks like these were going to be needed for hikvision so had to get the backend ready.
  • Digest auth improvements made to get closer to being able to do full async comms.

Hello,

A camera with only rtsp://192.XXX.XXX:554/onvif1 adress is working with this binding? (camera doesnt have credentials for login, simply putt the stream on network and doesnt have any api also )

If it has ONVIF then it is still worth trying. To be considered ONVIF compatible the camera needs to be able to do snapshots which is not rtsp and will be a jpeg most likely. The binding will ask your camera what it can do and report to you in the logs what is possible and then display the links in two string channels.

If you want motion detection with a basic camera you may be interested to look at this opensource software.
https://motion-project.github.io/
However with the right brand of camera and this binding, you can skip needing to process the video in a software package and gain direct access from the camera to openhab.

anyone have any screen shots of what this looks like in basicUI/IOS app?

Take a look at these to give you a basic idea of how an Amcrest displays. This is for my baby monitor and I am just getting it hooked up so when the audio alarm is triggered I can get a picture/video or a text message displaying on my TV via kodi. Also it can auto turn on lights in the middle of the night to very low level of light to help walking around to the babys room.

Settings allow the camera to keep network traffic low until a motion or audio event occurs, plenty of options to choose from as they would not all display at the same time.

2 Likes

Legend, that exactly what I was after thanks.

Ive installed this binding based on the instructions in the top post - ive then wanted to uninstall - I renamed the jar file and recommented the binding line and restarted but the binding and thing are still there -how do I uninstall this binding?

Hi,

thanks for this nice binding. My cam with onvif is shown correctly in paper ui. In the paper ui refresh the image automaticly but in die sitemap not. the switch update the image is on.

Sitemap:

Default item=DE_Cam_Hauseingang_AJPGImageThatCanBeMadeToUpdateFromYourCamerasFeed

have any user a idea?

thanks!

I purchased advr from night owl, just thinking that it would be capable it supporting remote apps other than theirs. I hate it and have for 2 years. Ipcamviewer on Android is the only app capable of it, but it is opaque and I wish the developer would publish the information needed to connect.
Tried the hacks to feed through zoneminder. Didnā€™t work. Then night the cheap winbook DVR, doesnā€™t support the night owl hd analog cameras.
Now that this binding is working and being worked on, I am thinking about replacing the whole setup with an amcrest DVR.
AMNV20M8-4B-B which is Poe.

Will the binding with with this, or only with individual cameras? Iā€™ve been working on the camera thing for over a week now and Iā€™m pretty close to giving up for now. Any insight would be great. Thanks for the binding work!

@gravidigit the channel is called image and you used the description of the channel not the name, plus I donā€™t see any unique Id number.
Recommend you read this and follow the example setup.

I will put a copy of the readme with the jar files.

@Andrew_Pawelski
You probably have items in your inbox that you want gone, if so if you press the rubbish bin icon a second time it then gives you the option to force remove. This is something that is not clear in openhab.

Short answer is I do not know. I donā€™t work for Amcrest and have very little experience to none with setting up DVR devices. Best to check with Amcrest sales/support and ask them if the API works with that model and allows access to each camera individually.

There is more than 1 way to approach the storage of video and Amcrest depending on the model supports some or all of these methods:

  1. NAS Network storage which can use raid for data security if a drive fails. Linux has some good projects and you can use the NAS for so many other things.

  2. SD card in the camera. If someone steals your DVR the sd card is still in the camera and the cards are cheap.

  3. FTP site which I have this ability and it costs me $50 a year to have my own ftp and web server hosted, much cheaper than a cloud based solution sold by many brands.

  4. Email, who likes 100+ emails a day from a spider crawling over the camera? Setup a Hotmail account and you get free offsite storage.

Iā€™m still playing with my first camera to see how well each one works, but I like the idea of not relying on only 1 method of storage.

Also check out the motion software it may work but I have never used itā€¦
https://en.wikipedia.org/wiki/Motion_(surveillance_software)
Also blue iris software is cheaper than new cameras, since you found zoneminder not to work for you.

Thanks, Iā€™ll contact their support and ask. I have not been able to get the current DVR to be picked up but anything other than ipcamviewer. The night owl products are locked down and they will not talk about how to communicate with them.
The amcrest nvr is cheaper than buying the 4 cameras by themselves, at microcenter. Iā€™m assuming the cameras can be used independent of the nvr, but wanted to check with anyone here in case they used an nvr/DVR with the binding.

Thanks for the work on this Binding.
I have 2 generic IP cameras of the same type but cannot get them past ā€œStatus=OFFLINE (CONFIGURATION_PENDING): Making a new connection to the camera now.ā€
In VLC the stream address is rtsp://username:password@192.168.1.104:554/onvif2 and they use UDP so TCP is set to off in Motion. I have tried setting the ONVIF Media Profile stream number to 1 and then 2 with no change.
There is no API available for these cams.
Any tips on what I may have missed?

thanks, this works nice.

1 Like

What have you set the onvif port as? Your link suggests it may be port 554 but to check this I would recommend you check out the onvif device manager application to check the connection and confirm the port number.

Hi,

first of all thank you for the binding.
My objectif is to be able to use my Hikvision IP cameras with openhab and to get motion event to decide to do Something. The first thing I would like to be able to do is just to enable/disable detection. Unfortunately it seems it is not possible with the current binding (Generic Onvif support). However I understood an API exists for Hikvision cam. So I just wonder if you plan to implement it or if I have to find another way to proceed or may be I missed Something as I am just discovering the field ?

It is not yet possible but I have started to play with the HIKVISION api, download the 10-05-2018 build and give it a try. The enable/disable button is currently coded to send two different motion detection requests, one when moved to the off position and the other when it is moved to the on position. Once I have the detection working I will move onto making the control work as intended to enable and disable the motion alarm. If you are able to help with the testing to post the debug log output when you have no motion alarm and also when the alarm is on I can use that to finish this feature. Since I dont own a HIK camera I am un-able to do this myself.

You need to do this to get hikvision cameras working as a recent firmware update has disabled ONVIF.

How can I include the Video URL in the sitemap?

Video url=ā€œWHATURLNEEDSTOBEHEREā€ item=GenericIPCameraWithOnlyONVIFSupport_VideoURL

I use a dericam s1

this is the url to the video accoding to what I could find out:
http://Username:password@192.168.1.127/tmpfs/auto.jpg