IpCamera: New IP Camera Binding

camera
ip-cam
onvif
Tags: #<Tag:0x00007f014c72e918> #<Tag:0x00007f014c72e648> #<Tag:0x00007f014c72e3c8>

(_) #461

Hi matt1,

Thanks for clarificaiton, I will collect longer one trying more options avalible on camera (IVS, Face detecton zoom…)


(Michael Cumming) #462

Would this binding work with one the H264 DVRs?

Mike


(_) #463

@matt1

After settings checking i corrected issue with image.
In mean time i see in log very often:

> URL:/cgi-bin/configManager.cgi?action=getConfig&name=VideoMotion

if this is checking of motion detection status then this is wrong as proper request should be

/cgi-bin/eventManager.cgi?action=getEventIndexes&code=VideoMotion

to get answer:
if motion detected

channels[0]=0

and if no detection

Error: No Events

I do not see any log concerning zoom function, could you tell me how it’s realized?
This cam is not PTZ but varifocal.

after investigation: all below are working for varifocal cam

I found autofocus option:

/cgi-bin/devVideoInput.cgi?action=autoFocus

result:

OK

Zoom in max:

/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.990000&zoom=1.000000

Zoom out max

/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.090000&zoom=0.000000

Result always
OK


(Craig) #464

This is music to my ears.

I’m just starting out with my IP camera setup and Blue Iris was coming out on top (versus a Hikvision NVR and their own software).

What hardware are you using to run Blue Iris?


(Michael Ingraham) #465

@luckymallari

What model cameras are supported?

What Blue Iris software has to be acquired? Is there a “personal use” license or are the only options the LE (1 camera) and Full versions?

I don’t see an ONVIF openHAB binding specifically. What binding do you use in openHAB? Do you have examples of your declarations (Things, Items, Rules, etc.)?

Thank you for the information.

Mike


(Lucky) #466

I’m running a rig with i7-2600. Im using direct to disk recording, and my CPU averages at 40% only. This is with 16 cameras, 8 of which are 4K cameras. The rest are 1080P.

@Mike, you should lookup the BlueIris docs. There are literally HUNDREDS of cameras supported, and any camera with proper/correct ONVIF.

Current BlueIris supports MQTT and REST. BlueIRIS itself also has a REST API, which you can call from openHAB


(Michael Ingraham) #467

That’s what I needed. Thanks.

Now on to making a decision on camera equipment…


(Skinah) #468

@mjcumming
No idea, if it supports the API then it should work. Hikvision, dahua and amcrest have APIs that allow for use behind a NVR but potentially not all features will work behind the NVR and that is up to how well supported and bug free the company has written the firmware.

@Kristo
Your url links look more like AMCREST api so try setting the camera up as an Amcrest as they are made by Dahua and it is possible that will work. Dahua now appears to use an event stream for alarms and not the method you described.


(_) #469

@matt1

Thank’s for advise i will try Amcrest,
Links which i provided are comming form Dahua API version 1,67


(Skinah) #470

You need to connect to the camera with ONVIF for any of the Pan Tilt or Zoom features to work, some cameras have ONVIF disabled by default in their settings and you also need to work out what port number it will need to be set to.

As for the motion detection try this link in a browser. See if I made a mistake in its format and what needs to be changed to make it work…

http://ipaddresshere/cgi-bin/eventManager.cgi?action=attach&codes=[VideoMotion,MDResult,VideoBlind,VideoLoss,CrossLineDetection]&channel=[0]

This is described on page 62 under 6.10 Attach
The advantage of using this method is the camera only creates traffic when an alarm goes off as openhab/binding does not need to keep polling asking if the alarm has gone off. If your camera has advanced alarms like FaceDetection this allows the binding to be able to react.

I have checked and the Amcrest url is identical to what you were asking for, however the above method is far better if your camera supports it and if I did not get the url format wrong. I need someone with a Dahua camera to test and give feedback on a few things as I dont own one.


(_) #471

HI @matt1

I set Onvif port to 37777 in binding ,
other sw like Onvif device manager is connecting without issue to camera and zoom can be controlled

In Onvif DM i see 3 different mode to control

  1. Absolut move when zoom is 0 - 1 - is working ok
  2. Relative move - with this cam is not working
  3. Continous move - is working ok but you need to press button to move - for me not good for Bindng

mode 1 is looking best
Which mode you are using in binding?

Addtionally i tried manually to use

/cgi-bin/ptz.cgi?action=start&channel=0&code=ZoomTele&arg1=0&arg2=0&arg3=0

i get ok status but no movement

What i see also in Onvif DM that just few PTZ funciton are working for this cam

—Update:
After review of few forums i can confrim that with Vari-Focal cams PTZ will not work
Only solution is to:

/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0&zoom=1

after first run zoom will go to position
after second run without zoom value change focus will adjust automaticly
Run can be with small delay
Zoom have to be form 0 to 1

Addtionally to get status of Zoom and Focus:

/cgi-bin/devVideoInput.cgi?action=getFocusStatus

answer:

status.Focus=0.888506
status.FocusMotorSteps=3480
status.Status=Normal
status.Zoom=0.600000
status.ZoomMotorSteps=1350

Autofocus switch will be also useful:

/cgi-bin/devVideoInput.cgi?action=autoFocus


I will try alarm attach with proposed methode - results:

C:\curl>curl -v http://192.168.2.10/cgi-bin/eventManager.cgi?action=attach&codes=[VideoMotion,MDResult,VideoBlind,VideoLoss,CrossLineDetection]&channel=[0]

  • Trying 192.168.2.10…
  • TCP_NODELAY set
  • Connected to 192.168.2.10 (192.168.2.10) port 80 (#0)
  • Server auth using Basic with user ‘admin’

GET /cgi-bin/eventManager.cgi?action=attach HTTP/1.1
Host: 192.168.2.10
Authorization: Basic YWRtaW46UmVub3ZhdGlvMjM=
User-Agent: curl/7.53.1
Accept: /

< HTTP/1.1 401 Unauthorized
< WWW-Authenticate: Digest realm=“Login to 3L08221PAA35018”, qop=“auth”, nonce=“1937550505”, opaque=“0ad03079faa3a901586f69bd4837dc33cfadeeb1”
< Connection: close
< CONTENT-LENGTH: 0
<

  • Closing connection 0
    ‘codes’ is not recognized as an internal or external command,
    operable program or batch file.
    ‘channel’ is not recognized as an internal or external command,
    operable program or batch file.

My Cam have IVS(all detection on screen below) & Face detection

Concerning 6.10 Attach function - how camera know where to send information. I think it’s working simillar to 6.9 GetEventIndexes but you can get in one call all alarms.

So pooling have to be any way done, is’t it?

I found also nice function - Text overlay - to put custom text - like temperature

/cgi-bin/configManager.cgi?action=setConfig&VideoWidget[0].CustomTitle[1].Text=20.1°C


(andredts) #472

How can we get the latest .jar file of the binding? Thanks


(_) #473

http://www.pcmus.com/openhab/IpCameraBinding/


(Richard ) #474

Hi Matt,

Thanks for the binding. It works pretty well I must say!
I can confirm that the binding also works with Foscam 9821W V2 model.
I am using:

  • System firmware 1.4.1.10
  • Application firmware 2.11.1.119

I wanted to trigger Habot when a motion was detected and then watch the latest snapshot. It does this wonderfully. The only bump in the road is the incompatible SOAP version. Log says:

SAAJ0415: InputStream does not represent a valid SOAP 1.2 Message

Thanks again! Keep up the good work


(Kris K) #475

Hi Matt

great work on your binding! I’m considering moving my 10 x Dahua cameras (Armcrest) over to it all using digest auth

Few q’s

  • will this allow me to pull the substream via rtsp or http direct into a habpanel widget ? i have the substream on low bit rate but when i open the habpanel app I want live video, not 1sec screenshots

  • we currently proxy the cameras via nginx so I can access them remotely in openhab cloud, will the camera allow this function and the removal of nginx proxy function I currently use?

  • one of my armcrest units has 3 presets setup for PTZ, does the binding allow for this? so I can click a button to go to a certain preset

Cheers
Kris


(Skinah) #476
  1. No not yet I am playing with some code at the moment but it is not a priority for me. 1 sec snapshots is all that currently works and possibly not all cameras are capable of doing snapshots that fast or may require the keyframe setting to be changed before they can.

  2. If I understand correctly, yes it can do that if you are happy with 1 FPS. The image item that the binding uses is proxied via the openhab framework and will translate over the myopenhab cloud. Please do not abuse a community run server with big loads by leaving many cameras open and streaming.

3.No it does not support ONVIF presets as it was a waste of time as it supports ONVIF ABSOLUTE move. You can tell the camera to move to X, Y, Z location and the camera moves to the correct location. Kind of the same result just a different way of achieving it.


(Kris K) #477

Thanks Matt! Doesnt look to be suitable for my needs just yet :frowning:


(_) #478

Hello @matt1

I get another Dahua cam with Alarm inputs and Outputs and audion detection. I will check if status checking is working or same issue like in my 1st cam


(Crispin) #479

Hi,

My thing is stuck on Initialising. In the logs I can see it talking to the camera and then

2018-09-23 22:55:11.441 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - Following NPE occured when trying to connect to the camera with ONVIF.java.lang.NullPointerException

Full log

2018-09-23 22:54:48.047 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://10.10.30.15:8443
2018-09-23 22:54:52.270 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Fetching the number of Media Profiles this camera supports.
2018-09-23 22:54:57.876 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Checking the selected Media Profile is a valid number.
2018-09-23 22:54:57.881 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Fetching a Token for the selected Media Profile.
2018-09-23 22:54:57.886 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Auto fetching the snapshot URL for the selected Media Profile.
2018-09-23 22:55:01.391 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - About to fetch some information about the Media Profiles from the camera
2018-09-23 22:55:01.393 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - *********** Media Profile 0 details reported by camera at IP:10.10.32.50 ***********
2018-09-23 22:55:01.520 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Camera will use this Media Profile unless you change it in the bindings settings.
2018-09-23 22:55:01.524 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 is named:video_encoder_configuration
2018-09-23 22:55:01.527 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 uses video encoder	:H_264
2018-09-23 22:55:01.531 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 uses video quality	:0.0
2018-09-23 22:55:01.535 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 uses video resoltion	:1920 x 1080
2018-09-23 22:55:01.538 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 0 uses video bitrate	:5898
2018-09-23 22:55:01.542 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - *********** Media Profile 1 details reported by camera at IP:10.10.32.50 ***********
2018-09-23 22:55:01.545 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 is named:video_encoder
2018-09-23 22:55:01.549 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 uses video encoder	:H_264
2018-09-23 22:55:01.553 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 uses video quality	:0.0
2018-09-23 22:55:01.556 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 uses video resoltion	:704 x 576
2018-09-23 22:55:01.560 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Media Profile 1 uses video bitrate	:921
2018-09-23 22:55:01.563 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - About to interrogate the camera to see if it supports PTZ.
2018-09-23 22:55:08.278 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Camera is reporting that it supports PTZ control with Absolute movement via ONVIF
2018-09-23 22:55:08.280 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Checking Pan now.
2018-09-23 22:55:11.415 [ERROR] [l.internal.messaging.saaj.client.p2p] - SAAJ0008: Bad Response; Bad Request
2018-09-23 22:55:11.441 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - Following NPE occured when trying to connect to the camera with ONVIF.java.lang.NullPointerException

After that there is nothing in the logs. None of the items are updated either.

Thing

Thing ipcamera:ONVIF:001 "CCTV - Driwaye" [ 
                                                IPADDRESS="10.10.32.50", 
                                                PASSWORD="blabla", 
                                                USERNAME="openhab", 
                                                ONVIF_PORT=1018, 
                                                PORT=80
                                            ]

Items

Image CCTVDrivewayImage { channel="ipcamera:ONVIF:001:image" }

String  CCTVDrivewayImageURL { channel="ipcamera:ONVIF:001:imageurl" }

My camera is this https://www.amazon.co.uk/SV3C-Security-Ethernet-Waterproof-Detection-1080P-Bullet-POE-Camera/dp/B01G1U4MVA
SV3C poe camera
Options?

Cheers


(Crispin) #480

I see it thinks it has PTZ which it does not. I wonder if the crash is when it’s trying to test it.