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
420 stars 137 forks source link

Focus control ReferenceToken type doesnt accept collections as value #125

Open RichRickett opened 3 weeks ago

RichRickett commented 3 weeks ago

Hi all, I'm successfully using the zoom function in ONVIF using the same mycam details, but can't get the Imaging Focus Move function to work. I set up a request as follows:

from onvif import ONVIFCamera mycam = ONVIFCamera('192.168.1.108', 8080, 'admin', 'admin', 'C:/Users/richr/Downloads/python-onvif-zeep-zeep/python-onvif-zeep-zeep/wsdl/') media = mycam.create_media_service() imaging = mycam.create_imaging_service() video_sources=media.GetVideoSources()

requestMove = imaging.create_type('Move') requestMove.VideoSourceToken = video_sources[0].token requestMove.Move = 'Focus' requestMove.Focus = 'Continuous' requestMove.Speed = 0.5

When I print(requestMove) to check it's all in there, I get; { 'VideoSourceToken': 'VideoSource0', 'Focus': 'Continuous', 'Move': 'Focus', 'Speed': 0.5 }

But when I try the Move command using imaging.Move(requestMove)

I get error messages galore culminating in : File "c:\Users\richr\PythonCode\ZoomF\ONVIF Focus Test.py", line 27, in imaging.Move(requestMove) File "c:\Users\richr\AppData\Local\Programs\Python\Python311\Lib\site-packages\onvif\client.py", line 26, in wrapped raise ONVIFError(err) onvif.exceptions.ONVIFError: Unknown error: The ReferenceToken type doesn't accept collections as value

I've checked and the camera does support all the functions: { 'Absolute': None, 'Relative': None, 'Continuous': { 'Speed': { 'Min': -1.0, 'Max': 1.0 } } }

I feel like I'm very close to getting it to work, could anyone steer me as to what I'm missing ? cheers