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

onvif-cli more samples with working parameters - looking for howto focus #117

Open jenswes opened 11 months ago

jenswes commented 11 months ago

Hello,

I'm trying to figure out howto translate the output of any onvif camera into a working onvif-cli commandline

so far i have: (if you have same more, please add here)

cmd devicemgmt GetCapabilities
cmd imaging GetImagingSettings {'VideoSourceToken': '000'}
cmd events GetEventProperties
cmd devicemgmt GetHostname
cmd devicemgmt GetWsdlUrl
cmd media GetProfiles

often i got a strange error like

cmd devicemgmt SetHostname {'Name': 'camo01', 'FromDHCP': True} False: Unknown error: The Token type doesn't accept collections as value

ONVIF >>> cmd devicemgmt SetHostname {'Name': 'camo01'} True: {}

ONVIF >>> cmd devicemgmt SetHostname {'FromDHCP': True} False: Unknown error: The Token type doesn't accept collections as value

ONVIF >>> cmd devicemgmt GetHostname True: OrderedDict([('FromDHCP', False), ('Name', 'camo01'), ('Extension', None), ('_attr_1', None)])

as the devicemgmt GetHostname has FromDHCP. i have an error setting this.

My goal would be adjusting zoom and fokus

From cmd media GetProfiles i have the profiles:

cmd imaging GetImagingSettings {'VideoSourceToken': '000'}

ONVIF >>> cmd imaging GetImagingSettings {'VideoSourceToken': '000'}
True: OrderedDict([('BacklightCompensation', OrderedDict([('Mode', 'OFF'), 
('Level', None)])), ('Brightness', 50.0), ('ColorSaturation', 50.0), ('Contrast', 50.0),
 ('Exposure', OrderedDict([('Mode', 'AUTO'), ('Priority', 'LowNoise'), 
('Window', OrderedDict([('bottom', 0.0), ('top', 0.0), ('right', 0.0), ('left', 0.0)])),
 ('MinExposureTime', 50.0), ('MaxExposureTime', 50.0), ('MinGain', 50.0),
 ('MaxGain', 50.0), ('MinIris', 50.0), ('MaxIris', 50.0), ('ExposureTime', 50.0),
 ('Gain', 50.0), ('Iris', 50.0)])), ('Focus', OrderedDict([('AutoFocusMode', 'AUTO'),
 ('DefaultSpeed', 5.0), ('NearLimit', 0.0), ('FarLimit', 100.0), ('Extension', None),
 ('_attr_1', None)])), ('IrCutFilter', 'AUTO'), ('Sharpness', 8.0), ('WideDynamicRange',

OrderedDict([('Mode', 'ON'), ('Level', 50.0)])), 
('WhiteBalance', OrderedDict([('Mode', 'AUTO'), ('CrGain', 50.0), ('CbGain',
 50.0), ('Extension', None), ('_attr_1', None)])), ('Extension', None), ('_attr_1', None)])

(offtopic, the output is ugly to read, any idea hot make it nicer?)

Here we have ('Focus', OrderedDict([('AutoFocusMode', 'AUTO'), ('DefaultSpeed', 5.0), ('NearLimit', 0.0), ('FarLimit', 100.0)

but how to construCt an onvif-cli

ONVIF >>> cmd imaging SetImagingSettings {'VideoSourceToken': '000'} False: Unknown error: Missing element ImagingSettings (SetImagingSettings.ImagingSettings)

ONVIF >>> cmd imaging SetImagingSettings {'AutoFocusMode': 'manual'} False: Unknown error: The ReferenceToken type doesn't accept collections as value

ONVIF >>> cmd imaging SetImagingSettings {'NearLimit': '30'} False: Unknown error: The ReferenceToken type doesn't accept collections as value

i would be happy if someone is able to shine some light on this thank you :-)

zoldaten commented 7 months ago
media = mycam.create_imaging_service()
media.SetImagingSettings({'VideoSourceToken': '000', 'ImagingSettings':{'Focus': {
        'AutoFocusMode': 'MANUAL',
        'DefaultSpeed': 0.3,
        'NearLimit': 1.0,
        'FarLimit': 10.0,
        'Extension': None,
        '_attr_1': None
    }}})