class fluxclient.upnp.UpnpTask(uuid, client_key, ipaddr=None, device_metadata=None, remote_profile=None, backend_options={}, lookup_callback=None, lookup_timeout=inf)

UpnpTask provides some configuration methods for the device. When creating a UpnpTask instance, the argument uuid is required. If parameter device_metadata is not given, UpnpTask will use lookup_callback and lookup_timeout to create a UpnpDiscover instance and try to get metadata from network.

  • uuid (uuid.UUID) – Device uuid, set UUID(int=0) while trying to connect via ip address.
  • client_key (encrypt.KeyObject) – Client key to connect to device.
  • ipaddr (str) – IP Address of the machine.
  • device_metadata (dict) – This is an internal parameter, which is not recommended to provide because it may has different definitions in different versions.
  • backend_options (dict) – More configuration for UpnpTask.
  • lookup_callback (callable) – Invoke repeatedly while looking for device.
  • lookup_timeout (float) – Raise an error if the program can not find the device in a limited time.
  • UpnpError – For protocol or operation error.
  • socket.error – For system defined socket error.

Closes the upnp socket connection. After close(), any other method should not be called anymore.


Indicates whether the connection has been authorized with a correct password or RSA key. If the connection is not authorized, you must call authorize_with_password first to authorize.


Indicates whether the upnp connection is connected with the device


Authorizes via password, only use when the RSA key has not been trusted from device.

Parameters:password (str) – Device password
add_trust(label, key)

Adds a client_key to device trust list

  • label (str) – Key label will show for human only
  • key (object) – A vaild RSA key object or pem

Key hash

Return type:



Gets all trusted key in the device

Returns:((label, key hash), (label, key hash), ...)

Removes a trusted key

Parameters:access_id (str) – Key hash which will be removed

Renames the device

Parameters:new_name (str) – New device name
modify_password(old_password, new_password, reset_acl=True)

Changes the device password, if reset_acl set to True, all other authorized user will be deauthorized.

  • old_password (str) – Old device password
  • new_password (str) – New device password
  • reset_acl (bool) – Clear authorized user list in device

Modifies the device network, details will be revealed in future documentation.


Gets wifi lists discovered from the device