quatanium / python-onvif

ONVIF Client Implementation in Python
MIT License
474 stars 321 forks source link

IP Camera works with ONVIF in Zoneminder not in Python-Onvif library #50

Open Morketh opened 7 years ago

Morketh commented 7 years ago

From #4:

continuous_move.py is just an EXAMPLE. It works well ONLY with MY CAMERA. you should use onvif-cli or ONVFIService of this lib to test your camera.

Might i suggest adding those file names to a .gitignore so that we (the public) do not get your private test scripts or as a much better alternative set up a generic framework that can be setup for a broader spectrum of ONVIF compatible devices.

Traceback (most recent call last):
  File "./probe.py", line 89, in <module>
    mycam = ONVIFCamera('192.168.0.22', 80, 'admin', 'admin', '/etc/onvif/wsdl/')
  File "/usr/local/lib/python2.7/dist-packages/onvif/client.py", line 227, in __init__
    self.update_xaddrs()
  File "/usr/local/lib/python2.7/dist-packages/onvif/client.py", line 237, in update_xaddrs
    services = self.devicemgmt.GetServices({'IncludeCapability': False})
  File "/usr/local/lib/python2.7/dist-packages/onvif/client.py", line 31, in wrapped
    raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: <urlopen error timed out>

as it stands im not sure if this is a problem with my python programming or if this is a problem with the library. My OS is Kali (Debian based 4.9.0-kali4-amd64 #1 SMP Debian 4.9.30-1kali1 (2017-06-06) x86_64 GNU/Linux) after running the install using pip install onvif I fired up the python console and imported the library. however once running the Example on the README.md provided with the project it failed telling me that several WSDL documents were in fact missing. I found them all in the repository under wsdl and copied them to etc. now it seems to load up an instance fine however i still cannot interface with the camera. I have over 150 cameras that i would like to manage all were purchased at the same time from the same manufacture (Zhejiang Dahua Technology Co., Ltd.) I'm running Zoneminder for CCTV recording and picks up ONVIF compatible devices i would rather not have to walk through every camera with the zoneminder install wizard. Providing i can communicate with the camera using this library i should be able to obtain all of the needed information and build the Zoneminder database with Python. Once the MySQL database has been built with the camera information i also have to change Static IP Address assignments from the Camera Web-Interface as well as System Clock settings and administrative logon. Asking to do this manually on that number of devices is a big task i would like to solve this using a python application to automate the mind numbing task.

Park0 commented 7 years ago

I just tried this lib because my zoneminder did not want to control my camera. As fas as the WSDL i agree. The lib should use the shipped WSDL as default unless override by the user.

As for your use-case. I would configure one camera in Zoneminder using the interface than copy the settings from mysql. Given all the camera's are the same. All the settings except for IP:port user/pass (PTZ Control Address) are the same. So copy them in mysql wouldn't be to hard.

Morketh commented 7 years ago

After inventing a creative solution I have fixed all of my issues and settled on a design for the program. Copy paste using MySQL is still a lot of work by hand. So I will be using the db connector to change all those settings. For the ONVIF side of things I've also engineered a way to combine your library to create a CLI version of the ONVIF device manager with added feature of copping settings between devices as long as the settings are non conflicting I.E. static IP addresses.

Park0 commented 7 years ago

For reference: what onvif version of zoneminder did u use? As the one called "Onvif" is no onvif at all.

Morketh commented 7 years ago

Version number for zoneminder is v1.30.4 installed using the ppa:iconner/zoneminder

Morketh commented 7 years ago

Correction: ppa:iconnor/zoneminder. Apologies on spelling phone keyboard and all that :)

Park0 commented 7 years ago

What control script did u use in zoneminder