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
433 stars 144 forks source link

AttributeError: 'NoneType' object has no attribute 'PanTilt' #30

Open tengulre opened 5 years ago

tengulre commented 5 years ago

help me please.

jmiguel99 commented 5 years ago

I'm having the same issue with different cameras, I have been using it with onvif device manager and the camera responded well to continuous movement using the manager, but can't figure out how to do it using python.

jmiguel99 commented 5 years ago

Actually I just fixed it, the solution as I found it is:

status = self.ptz.GetStatus({'ProfileToken': self.media_profile.token}) status.Position.PanTilt.x = 0.0 status.Position.PanTilt.y = velocity self.requestc.Velocity = status.Position self.perform_move(timeout)

So basically, you need to get the ptz status from the camera, and change the parameters of the position, then add the status.position parameters to the velocity one, as it has created the objects, you can modify them and then add then to the request, or add the status.Position to the request and then modify them. This is working for me in a continuous movement, but also works for absolute movement if the camera is compatible with it.

JLee21 commented 5 years ago

Thank you for your reply @jmiguel99 Your revision worked for me in-real-life with one of our cameras.

PS (for future readers) You had a couple of typos. This should do it.

status = self.ptz.GetStatus({'ProfileToken': self.media_profile.token})
status.Position.PanTilt.x = 500
status.Position.PanTilt.y = -100
self.request.Position = status.Position
self.perform_move(timeout)
santhku commented 5 years ago

@JLee21 and @jmiguel99

Hi , could you please tell where to include this code . Is it to be added in continuous_move.py example . if so where exactly in the code?

Thanks in advance.

Regards, Santhosh.k

imihassan commented 3 years ago

@JLee21 I am trying to use the same library. First I got same problem with _token and I replaced it with your code but it gives error of none type

AttributeError: 'NoneType' object has no attribute 'PanTilt'

Status is status { 'Position': None, 'MoveStatus': None, 'Error': 'NO error', 'UtcTime': datetime.datetime(2010, 3, 22, 12, 11, tzinfo=<isodate.tzinfo.Utc object at 0x0000024C7E2B37F0>), '_value_1': None, '_attr_1': None }

Can you help me