How to get the list of all devices on the server in PyTango?

Feeling dumb not being able to find the answer to this question in the docs by myself, but how to get the list of all devices on the server in PyTango? Basically, I want to use DeviceProxy not with the devices which the paths I already know, but with all present devices.
Hi GTLeet

If I understand your question correctly, you want to query the Tango Database for all the devices available. The docs don't make it that obvious, so don't feel too dumb. For the running devices, this could be done using a method like this:

For example:

from tango import Database

db = tango.Database()
devices = db.get_device_exported("*")

Once you have the list of devices you still need to use a new DeviceProxy to communicate with each one. Or you could build a Group object to communicate with them simultaneously.

On a more general note, there are also lots of useful utilities in fandango, which can do this and more.
It is using PyTango, of course, and some of the implementation details can be seen here:
You can see from that code what to do if you are also interested in devices that aren't running (exported).

Register or login to create to post a reply.