FalkTannhaeuser / python-onvif-zeep

ONVIF Client Implementation in Python 2+3 (using https://github.com/mvantellingen/python-zeep instead of suds as SOAP client)
MIT License
428 stars 140 forks source link

Single Command or Interactive Command not clear #12

Open delucaide opened 6 years ago

delucaide commented 6 years ago

Hi everybody, the script works very well and i'm able to change the host name to the camera ( as per instruction) but it's not clear on how to form the request for the ContinuousMove or other complex commands.

for example, in the Interactive Mode: $ onvif-cli -u 'admin' -a '1234' --host '192.168.0.1' --port 80 --wsdl /etc/onvif/wsdl/ ONVIF>> cmd ptz ContinuousMove { 'ProfileToken' : 'profilePrimary' , 'Velocity' (...then it's not clear how to form the tree for the current request...)

Please somebody help me because are now 2 weeks that i'm playing with it without any solution

FalkTannhaeuser commented 6 years ago

Does the document https://www.onvif.org/specs/srv/ptz/ONVIF-PTZ-Service-Spec-v221.pdf help you? I'm not an expert in this, but it seems the Velocity must be of type PTZSpeed, which contains the elements PanTilt (a Vector2D with two attributes x and y of type float and an optional space of type anyURI - possible values listed in said document, see sections 5.3.3 and 5.11.16 to 5.11.19) and Zoom (a Vector1D with one attribute x of type float and the optional space). Otherwise, did you try this with the upstream project https://github.com/quatanium/python-onvif too? (It will work with Python 2 only).

delucaide commented 6 years ago

Hi Falk, thanks for your reply, My really problem is that i don’t know how to write the right sintax for build the tree. For example:

Cmd Ptz ContinuousMove {‘TokenProfile’ : ‘primaryprofile’ , Velocity ( now how can i say to the script that i would insert the parameter inside the Velocity?) need i use the parenthesis? Could you please send me an example please Falk.

Davide De Luca E-mail: davidedelucakr@gmail.com

Il giorno 27 nov 2017, alle ore 03:36, Falk Tannhäuser notifications@github.com ha scritto:

Does the document https://www.onvif.org/specs/srv/ptz/ONVIF-PTZ-Service-Spec-v221.pdf help you? I'm not an expert in this, but it seems the Velocity must be of type PTZSpeed, which contains the elements PanTilt (a Vector2D with two attributes x and y of type float) and Zoom (a Vector1D with one attribute x of type float). Otherwise, did you try this with the upstream project https://github.com/quatanium/python-onvif too? (It will work with Python 2 only).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

jcolladoa commented 6 years ago

Hi, Falk (and hi everyone!) I'm also interested because I'm currently in the same tesiture, related to the sintax.

My example: cmd ptz RelativeMove {'ProfileToken' : 'profile_id_1', 'Traslation' : {'PanTilt' : {'x' : 0.0, 'y' : 0.0}}, 'Zoom':1.0}

The CLI answers "Unknown error: The ReferenceToken type doesn't accept collections as value". It's supposed that all params have to be passed as a collection (a Python dictionary). Isn't it? Falling that, what would be the correct sintax? I've been trying different ways of passing more than 1 parameter, without success.

Thank you in advance

Jose Luis

leviethung2103 commented 3 years ago

@jcolladoa Hi, have you solve the problem related to Reference Token ?

onkruid commented 2 years ago

I also had this error:

Unknown error: The ReferenceToken type doesn't accept collections as value

It turned out I had a TypeError in my request that was caught by https://github.com/FalkTannhaeuser/python-onvif-zeep/blob/d549eed77d9dd5fa23100db4090b89817d280d4c/onvif/client.py#L137-L140 the code catches the error, then assumes you have entered the params another way and tries calling the function again, which results in the above error.

I just commented out the try/except so I could see the TypeError and then fixed it.

ranggakd commented 4 months ago

@onkruid have you solve this error already? I get the same error right now.