async def _setup_logger(hass: HomeAssistant):
    if (not hasattr(_LOGGER, 'defaul_level')):
        _LOGGER.defaul_level = _LOGGER.level
    entries = hass.config_entries.async_entries(DOMAIN)
    web_logs = any((e.options.get('debug') for e in entries))
    if (_LOGGER.defaul_level == logging.NOTSET):
        _LOGGER.propagate = (web_logs is False)
        _LOGGER.setLevel((logging.DEBUG if web_logs else logging.NOTSET))
    if web_logs:
        if any((isinstance(h, XiaomiGateway3Debug) for h in _LOGGER.handlers)):
            return
        handler = XiaomiGateway3Debug(hass)
        _LOGGER.addHandler(handler)
        if (_LOGGER.defaul_level == logging.NOTSET):
            info = (await hass.helpers.system_info.async_get_system_info())
            _LOGGER.debug(f'SysInfo: {info}')
async def _setup_logger(hass: HomeAssistant):
    if (not hasattr(_LOGGER, 'defaul_level')):
        _LOGGER.defaul_level = _LOGGER.level
    entries = hass.config_entries.async_entries(DOMAIN)
    web_logs = any((e.options.get('debug') for e in entries))
    if (_LOGGER.defaul_level == logging.NOTSET):
        _LOGGER.propagate = (web_logs is False)
        _LOGGER.setLevel((logging.DEBUG if web_logs else logging.NOTSET))
    if web_logs:
        if any((isinstance(h, XiaomiGateway3Debug) for h in _LOGGER.handlers)):
            return
        handler = XiaomiGateway3Debug(hass)
        _LOGGER.addHandler(handler)
        if (_LOGGER.defaul_level == logging.NOTSET):
            info = (await hass.helpers.system_info.async_get_system_info())
            _LOGGER.debug(f'SysInfo: {info}')