miio.discovery module

class miio.discovery.Discovery[source]

Bases: object

mDNS discoverer for miIO based devices (_miio._udp.local).

Calling discover_mdns() will cause this to subscribe for updates on _miio._udp.local until any key is pressed, after which a dict of detected devices is returned.

static discover_mdns(*, timeout=5) Dict[str, Device][source]

Discover devices with mdns until any keyboard input.

class miio.discovery.Listener[source]

Bases: ServiceListener

mDNS listener creating Device objects based on detected devices.

add_service(zeroconf: Zeroconf, type_: str, name: str) None[source]

Callback for discovery responses.

check_and_create_device(info, addr) Optional[Device][source]

Create a corresponding Device implementation for a given info and address..

remove_service(zc: Zeroconf, type_: str, name: str) None
update_service(zc: Zeroconf, type_: str, name: str) None[source]

Callback for state updates, which we ignore for now.

miio.discovery.create_device(name: str, addr: str, device_cls: partial) Device[source]

Return a device object for a zeroconf entry.

miio.discovery.other_package_info(info, desc)[source]

Return information about another package supporting the device.


Return a pretty string presentation for a token.