#!/usr/bin/env python3 """ this script demonstrates how to access the __SubDevices property of e.g. VmExecutor motors. This way one can identify the Oms motors involved amd make ZMX checks. """ import PyTango import HasyUtils def main(): p = PyTango.DeviceProxy( "p09/vmexecutor/eh.04") lst = p.get_property('__SubDevices')[ '__SubDevices'] for mot in lst: print( "%s" % mot) db = PyTango.Database() prop = db.get_device_property( 'p09/vmexecutor/eh.04', '__SubDevices') # # {'__SubDevices': []} # {'__SubDevices': ['p09/motor/eh.01', 'p09/motor/eh.02', 'p09/vmexecutor/eh.04']} # print( "%s" % repr( prop)) print( "len %d " % len( prop[ '__SubDevices'])) for mot in prop[ '__SubDevices']: print( "%s" % repr( mot)) # # use HasyUtils # lst = HasyUtils.getDeviceProperty( "p09/vmexecutor/eh.04", "__SubDevices") for elm in lst: print( "%s" % elm) return if __name__ == "__main__": main() """ output: p09/motor/eh.01 p09/motor/eh.02 p09/vmexecutor/eh.04 {'__SubDevices': ['p09/motor/eh.01', 'p09/motor/eh.02', 'p09/vmexecutor/eh.04']} len 3 'p09/motor/eh.01' 'p09/motor/eh.02' 'p09/vmexecutor/eh.04' p09/motor/eh.01 p09/motor/eh.02 p09/vmexecutor/eh.04 """ #!/usr/bin/env python3 """ this script demonstrates how to access the __SubDevices property of e.g. VmExecutor motors. This way one can identify the Oms motors involved amd make ZMX checks. """ import PyTango def main(): # # via proxy # p = PyTango.DeviceProxy( "p09/vmexecutor/eh.04") lst = p.get_property('__SubDevices')[ '__SubDevices'] for mot in lst: print( "%s" % mot) # # reading DB # db = PyTango.Database() prop = db.get_device_property( 'p09/vmexecutor/eh.04', '__SubDevices') # # {'__SubDevices': []} # {'__SubDevices': ['p09/motor/eh.01', 'p09/motor/eh.02', 'p09/vmexecutor/eh.04']} # print( "%s" % repr( prop)) print( "len %d " % len( prop[ '__SubDevices'])) for mot in prop[ '__SubDevices']: print( "%s" % repr( mot)) return if __name__ == "__main__": main() """ output: p09/motor/eh.01 p09/motor/eh.02 p09/vmexecutor/eh.04 {'__SubDevices': ['p09/motor/eh.01', 'p09/motor/eh.02', 'p09/vmexecutor/eh.04']} len 3 'p09/motor/eh.01' 'p09/motor/eh.02' 'p09/vmexecutor/eh.04' """