Open westpirate opened 4 years ago
You can download the ONVIF WSDL files from this page.
For example, try saving devicemgmt.wsdl
into a folder named wsdl/
in your project folder: https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl (right-click > Save Link Target As...)
Then change the '/etc/onvif/wsdl/'
parameter in the ONVIFCamera()
constructor to 'wsdl'
(if your main script is located just above the wsdl/
folder). The code sample should work once you do this.
Thank-you Hugo for the reply, still was unable to get this to work, I wget'd the file, put it in a directory 'wsdl' below where my py file is stored and to no avail. I'm trying to understand how this works, so I have a local devicemgmt.wsdl file, the constructor connects to the IP camera's address and then populates the wsdl file somehow?
My end goal is to have the IP camera move to pre-set locations and take still images and then upload them to a server. My Camera says it is ONVIF compatible, and has the onvif settings enabled on 8080.
Any light you can shed on this would be greatly appreciated!
Hi @westpirate , after reading through the issues dozens of times, I tried pasting the above devicemgmt.wsdl file into the following directory -
/home/usr/.virtualenvs/env1/lib/python3.5/site-packages/onvif/wsdl
I think you should be able to get it up and running. The other issues that might arise are already discussed. I could PTZ control my IP cam.
Note: I am using a virtual environment called 'env1' on Ubuntu 16.04
Cheers, Abhilash
Hi Abhilash, thanks for the reply, I'm running MAC OS and have the following folder: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/onvif/wsdl
which seems to be populated with all the *.wsdl files.
My code below still throws the following error: from onvif import ONVIFCamera mycam = ONVIFCamera('192.168.1.101', '8080' , 'admin','admin','/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/onvif/wsdl')
resp = mycam.devicemgmt.GetHostname() print ('My camera`s hostname: ' + str(resp.Name))
ERROR:
Traceback (most recent call last):
File "/Users/system1/Desktop/winter_code/ptz/test.py", line 10, in
I can't seem to figure this one out. I'm wondering if its not something else entirely, if you have any ideas I'm all ears!!!
Hi @westpirate , I still believe that you haven't put the entire path in the arguments.
"/Users/system1/Desktop/winter_code/ptz/test.py" This is what is expected. You need to start from your very basic directory.
Try again with the full path (like home/usr/.......)
Suggestion : Try to work with virtual environments. It makes things easier.
Abhilash
Thanks Abhilash, I have tried this before and I have the *.wsdl files in that directory also but that didn't seem to work either.
In Example: mycam = ONVIFCamera('192.168.1.101', '4444', 'admin', 'admin', '/Users/system1/Desktop/winter_code/ptz/') I also put all the *.wsdl files in the /wsdl directory and tried that but no dice!
IE: mycam = ONVIFCamera('192.168.1.101', '4444', 'admin', 'admin', '/Users/system1/Desktop/winter_code/ptz/wsdl')
I looked up working with virtual environments and this looks like the route to go seeing as I developing this app in MAC os but it's final home will be on a raspberry pi, thanks for this advice.
It seems to me however that I am missing something obvious, maybe i should re-install the library?
Yes, I would suggest you to use virtual environment. Let's see if you still face the problem. Believe me, I am a beginner myself. While troubleshooting these issues, you need to be clear about every small thing (like the working directory and path) otherwise you will just waste time on it.
In short, try it with venv and let me know what happens.
Ok will try this tonight! Thanks!
On Apr 2, 2020, at 8:38 AM, Curious_Techie notifications@github.com wrote:
Yes, I would suggest you to use virtual environment. Let's see if you still face the problem. Believe me, I am a beginner myself. While troubleshooting these issues, you need to be clear about every small thing (like the working directory and path) otherwise you will just waste time on it.
In short, try it with venv and let me know what happens.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/FalkTannhaeuser/python-onvif-zeep/issues/63#issuecomment-607922183, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF57FM4B4TZ676TLP4UWOZDRKSWQVANCNFSM4LFW7MQA.
Abhilash, I got it working with venv, thanks for this!! Much appreciated, one question however, it started looking for files in /ver10/schema/onvif.xsd which I had to create outside my project folder and wget the files onvif.xsd and common.xsd, I was under the impression it would only look for files inside the venv root folder?
The downloaded devicemgmt.wsdl
has this:
<xs:import namespace="http://www.onvif.org/ver10/schema" schemaLocation="../../../ver10/schema/onvif.xsd"/>
I just changed that to "onvif.xsd" and ran
curl https://www.onvif.org/ver10/schema/onvif.xsd > wsdl/onvif.xsdto put it in the wsdl directory next to the wsdl file. That raised another complaint about common.xsd, which required a
curl https://www.onvif.org/ver10/schema/common.xsd > wsdl/common.xsd`
There's probably a better way. But this seems sufficiently straightforward with local files. 🤷
I've not worked with onvif nor wsdl files before, trying to control a onvif compatible Tonton PTZ camera. Seems I just can't seem to get any of the object attributes from the camera, any assistance would be greatly appreciated, also, how do I know where in the camera the wsdl file is actually stored as I'm using the default /etc/onvif/wsdl path?
from onvif import ONVIFCamera mycam = ONVIFCamera('192.168.1.101', 80, 'admin', 'admin', '/etc/onvif/wsdl/') resp = mycam.devicemgmt.GetHostname() print ('My camera`s hostname: ' + str(resp.Name))
AttributeError: 'ONVIFCamera' object has no attribute 'devicemgmt'