miio.devicefactory module

class miio.devicefactory.DeviceFactory[source]

Bases: object

A helper class to construct devices based on their info responses.

This class keeps list of supported integrations and models to allow creating Device instances without knowing anything except the host and the token.

create() is the main entry point when using this module. Example:

from miio import DeviceFactory

dev = DeviceFactory.create("127.0.0.1", 32*"0")
classmethod class_for_model(model: str)[source]

Return implementation class for the given model, if available.

classmethod create(host: str, token: str, model: Optional[str] = None, *, force_generic_miot=False) Device[source]

Return instance for the given host and token, with optional model override.

The optional model parameter can be used to override the model detection.

classmethod integrations() List[Type[Device]][source]

Return the list of integration classes.

classmethod register(integration_cls: Type[Device])[source]

Register class for to the registry.

classmethod supported_models() Dict[str, Type[Device]][source]

Return a dictionary of models and their corresponding implementation classes.