To find flux devices in the network, fluxclient.upnp.Discover class provide interface to discover and collect informations continuously.
Basic usage example:
from fluxclient.upnp import UpnpDiscover def my_callback(discover, device, **kw): print("Device '%s' found at %s" % (device.name, device.ipaddr)) # We find only one printer in this example discover.stop() d = UpnpDiscover() d.discover(my_callback)
In the example, my_callback will be called one a device is found or recive a device status update. A callback contains two positional arguments, first is UpnpDiscover instance and second is
fluxclient.upnp.device.Device instance which it found or been updated.
UpnpDiscover(uuid=None, device_ipaddr=None, mcst_ipaddr='220.127.116.11', mcst_port=1901)¶
The uuid and device_ipaddr param can limit UpnpDiscover to find device with specified uuid or IP address. These params usually be used when you want recive specified status continuously.
- uuid (uuid.UUID) – Discover specified uuid of device only
- device_ipaddr (string) – Discover device from specified IP address only.
There is a fast way to get a specific device object directlly