IpCamera: New IP Camera Binding

camera
ip-cam
onvif
Tags: #<Tag:0x00007fd317712ab8> #<Tag:0x00007fd317712928> #<Tag:0x00007fd3177127c0>

(Skinah) #1

This binding is now available to download in JAR format (link is in this post below). If this binding works for you then please post what brand and model you have so I can start compiling a compatibility list and it is always nice to hear from people with no issues :slight_smile: Report any feature requests or issues you find on github or PM me if you don’t have a github account.

The binding is tested on my raspberry PI2 Openhab server with these cameras:
Amcrest IP2M-841EW : Camera is an indoor POE camera with PTZ and 2 way audio.
Hikvision DS-2CD2385FWD-I : Outdoor 4K turret style POE camera with good night vision and has a number of SMART alarms.

Users have reported these cameras as working:
Amcrest:
IP2M-841EW

Foscam:
FI9831W
FI9821P
C1
C1 Lite
C2

Hikvision:
DS-2CD2385FWD-I
DS-7208HUI-K2

Working features in this binding are:

  • Picture (snapshot) with adjustable refresh ability down to 1FPS which does not require you to disable authentication.
  • PTZ absolute move with any ONVIF compatible camera that supports ABSOLUTE movement. You can easily implement scenes and presets with openhab rules.
  • Motion Alarm features with Amcrest, Foscam HD, and HIKVISION cameras.
  • Enable/Disable the motion alarm with Amcrest, Foscam HD, HIKVISION, and Instar cameras.
  • Advanced SMART alarms with HIKVISION only. Line crossing, Item stolen, Face detection, and unattended baggage alarms should now be working.
  • Audio Alarm features only with Amcrest, Foscam HD, HIKVISION and Instar cameras.
  • Audio Alarm THRESHOLD control feature (3 levels) with Foscam HD. INSTAR has the ability to do 100 levels of control, it is not yet confirmed as working. Amcrest has good control over sensitivity and threshold levels, but it appears to have no API for the binding to access these, so manual setup is needed.

Because this binding uses basic Openhab controls/channels it should work well with the myopenhab cloud and hence make it easier to get through any firewalls without opening up ports. Please use the Image channel wisely so as not to use bandwidth from a community run server. The binding has options to stop the image updating unless an alarm event occurs. Please do not leave remote sessions open and also use these features to keep the load small.

  • Download the binding already built in JAR format from here:
    http://www.pcmus.com/openhab/
  • Place JAR file into your openhab2-addons folder.
  • Restart Openhab2

You now should have the binding working which can be setup with text files OR with paperUI. More details on configuration and also a full example of how to get your image in a sitemap are found in the readme at github, or the readme is also in the same location you downloaded the JAR from.

I have uploaded to github here:

If you find a bug then please create an issue on github and be sure to post a number of lines from the openhab.log file before any errors occurred. Enabling TRACE gives a lot more information to help trace what is wrong. Setting it to INFO reduces the log output greatly.

To change the log level:

  1. Start the Karaf console https://docs.openhab.org/administration/console.html
  2. Enter in
log:set TRACE org.openhab.binding.ipcamera
  1. Type in logout to exit the console.
  2. Highly recommend using FRONTAIL to view the logs which is accessed the same way as paperUI. If using Openhabian it can be installed using the configuartion tool. See…
    https://www.openhab.org/docs/installation/openhabian.html#openhabian-configuration-tool

If this binding does not work for you, there are other options to get cameras running in openhab. These options will require you to spend money on a server as motion detection takes CPU grunt. This will mean more power costs and heat generated in your server room. This binding uses the CPU power in your cameras to do the work. The alternatives are:

Shinobi = MAC, WIN and linux
Zoneminder = Linux Opensource
Motion = Linux Opensource
Blueiris = Windows server only and software costs.

Please post if you know of a camera brand not listed below that has a HTTP based API:

Amcrest: (Cameras have Digest auth)

Axis: Appear to have discontinued their V2 API and the newer V3 is too complex to implement at this stage. A similar amount of work would see ONVIF support added which then all brands would benefit from.
https://www.axis.com/en-au/support/developer-support/vapix

Dahua: (Partly implemented but need users to help test and provide feedback.)
ftp://ftp.wintel.fi/drivers/dahua/SDK-HTTP_ohjelmointi/DAHUA_IPC_HTTP_API_V1.00x.pdf

Foscam: (Cameras do not support Basic or Digest auth and instead use plain text for passwords in URL. Binding works with this method)

Hikvision: (Cameras have Digest auth)
HIKVISION API PDF
Onvif is disabled by default on these cameras, see below link. The CGI API needs to also be enabled and this is on the same page as the ONVIF.
How to get ONVIF enabled and working on HIKVISION cameras.

Instar: (Partly implemented but need users to help test and provide feedback.)
https://wikiold.instar.de/index.php/List_of_CGI_commands_(HD)
Onvif is disabled by default on these cameras, see below link.
How to enable ONVIF on Instar cameras.


Security Camera Recommendations
Generic IP Camera binding
Hikvision camera feed in sitemap
Setup Hikvision camera in OH2
Extracting webcam URL with RegEx
POE Advice
Hikvision Event
Amcrest IP Camera Motion Detect
Perfect IP Cam for OpenHAB2
Amcrest IP Camera Motion Detect
Use Ip Camera with HABpanel
(Mar Li) #2

I’m not able to read what function this binding will have? Rtsp mjpeg convert? Ptz control?


(Lucky) #3

Just create an ONVIF binding. Creating separate code for different cameras will be extremely hard to maintain as there are no standards, except ONVIF. I use BlueIris and it integrates beautifully with OH.

If you are indeed decided on making API BASED binding for cameras, you will need to implement something as massive as this


(Skinah) #4

@DubZ
First off the binding does not exist yet, only a concept and a few lines of code currently. I have spent a while looking into what is possible to ensure what I create will get what I need running.

It is my understanding in regards to mjpeg and other stream formats openHAB’s infrastructure does not support it in at least some of the user interfaces. Mjpeg is the only format currently to work in all the different user interfaces that openhab has to offer. My ideas are to offer two streams, one which is high res for internal network use and a second for off site storage and viewing. Snapshots also.

But please let’s not discuss how features willl work when they don’t exist. Instead I would love to hear from people what they currently have working and what they wished would work.


(namraccr) #5

Terrible start.
You should always discuss how features will work before they exist.


(Skinah) #6

I agree @luckymallari that onvif would be an excellent binding to have in openhab. I would like to see it added as well.

The bottom line is I don’t believe I woULD be able to get my
Cameras working with all features by using onvif without resorting to using a combination of both methods which is more work.

I will be happy if I can get four or more camera brands working, since I don’t get paid and won’t go buying loads of cameras to test with it will be limited to what other kind users contrIbute towards helping others out for free.


(SiHui) #7

Why not combining forces?:


(Skinah) #8

I have already sent an email to Thomas and also posted in that thread to see if it is possible to join forces.


(Mar Li) #9

First off the binding does not exist yet, only a concept and a few lines of code currently

Yes I got this. That’s why I used the word “will”

but please let’s not discuss how features willl work when they don’t exist

I was not just asking how it works, I was asking about what features you are talking. I don’t know what problem your probably future binding is going to solve? Maybe it’s just me who didn’t read that out of your text. But would be nice to explain it a bit more at least for me


(Skinah) #10

Since I am writing this to get my setup working The features will be the ones I need to implement a baby monitor and general alarm and security uses. My camera has the ability to do audio alarms and adjust the alarm threshold by its API so I will be able to get a message on my tv from openhab warning me the baby is crying and I can then view with night vision into the room with ptz controls and have two way audio.

Does that answer your questions? I could take your question as meaning a few things.

If you have a camera that is onvif. Find out what profile it is and look up what may or may not be supported in this document here.

What I am needing to do is not covered by the onvif standard yet my camera does support it by an api.


(Bogumil J.) #11

Foscam FI9826W + FI9826P v1/v2 + FI9821 v2
CGI User Guide contains all commands

typical address for getting MJPEG stream:
http://192.168.1.10:88/cgi-bin/CGIStream.cgi?cmd=GetMJStream&usr=someusername&pwd=somepassword


(Lucky) #12

For those interested, as I mentioned above, BlueIris does wonders. You can set triggers based on motion, time, audio, etc, and has already implemented APIs from TONS of manufacturers, of course, including ONVIF. BlueIris also integrates with OH well. You can run a command, call REST, trigger a GPIO, etc based on the triggers. Has an iOS, Android, and Windows apps also.


(Mar Li) #13

@matt sounds interesting. so did I understand it correct that I could also use it as door phone?! what I’m searching at the moment is the possibility to transfer not only video, also audio via webbrowser and I wanted to read more about webrtc which seems the only possible way (for tablet browser without flash, silverlight etc.)

@lucky blueiris costs sth. so if there is someone who wants to create a binding for free… perfect :slight_smile: but does blueiris also support webbrowser support including speaker/mic audio (without activex etc)?

ps: currently I’m using nexus cameras (in my case model 235fw). they support onvif. as streaming protocol only rtsp.
http://www.nexuscctv.de/nexus-235fw-8063.html


(Lucky) #14

cant beat free :slight_smile:


(Kevin Hawkins) #15

You can if it’s a lame implementation…


(Lucky) #16

you get the point


(Skinah) #17

@DubZ yes you could potentially use the binding with the right camera if I am successful for a doorbell with two way audio. You may be interested in this upcoming product on page 18 as it will support the same api that I will be using.
https://drive.google.com/file/d/0B3WvNuumy4pbUS1rRjNBMC1EcFE/view

But I would hold off until I get to play with my amcrest to see what is possible and what compatibility issues I may hit. Currently it sounds like you have more experience with ip cameras than I do so things like what you posted about getting 2 way audio in browsers is something I will need to look at it more depth before making a feature promise on what can be done with a binding that does not exist. I’ll look at the two way audio first then because if an issues arises then it may change how I tackle this.


(Christapher Hasher) #18

matt1, I have a Lorex LNR 1182, the Cameras are a mix of LNB4163-C and LNB4173-C … I’m not sure of the HTTP information you need. I have to use a program called FLIRCloudClient to be able to remotely view the cameras from a computer or android smart phone.


(Skinah) #19

I had a quick look and it appears the Lorex do not have an API (at least easily found) so you would be limited to what your camera has implemented in ONVIF or RTSP or other features it may or may not have. As my post above went into there are a number of ONVIF profiles and depending on which profile is implemented into your camera you may have only very limited controls available. Not all cameras are equal and just because it has ONVIF written on it does not mean it has everything available that the standard has defined.

The brands that I looked at that do have API’s are
Amcrest
Foscam
Axis
HIKvision (beware of chinese fakes/clones that will brick if you try to update firmware)

With the amcrest api it allows for a lot more in depth control over the camera .


(Christapher Hasher) #20

I did notice that I can log in locally with my web browser, if I type in the private IP address of the NVR and download and instal a plug-in “LOREX_webplugin version 3.1.0.5” I’m sure in order to see them outside of the network it would take some port forwarding rules in my DSL router. The sad thing about mt DSL router is that it gets its public IP dynamically, so if it reboots … it gets a new public IP.