1 """Code to handle a Xiaomi Device."""
5 from construct.core
import ChecksumError
6 from miio
import Device, DeviceException
8 from .const
import AuthException, SetupException
10 _LOGGER = logging.getLogger(__name__)
14 """Class to async connect to a Xiaomi Device."""
17 """Initialize the entity."""
24 """Return the class containing all connections to the device."""
29 """Return the class containing device info."""
33 """Connect to the Xiaomi Device."""
34 _LOGGER.debug(
"Initializing with host %s (token %s...)", host, token[:5])
42 except DeviceException
as error:
43 if isinstance(error.__cause__, ChecksumError):
47 f
"DeviceException during setup of xiaomi device with host {host}"
def async_connect_device(self, host, token)