_LOGGER.debug("Expecting %s gateways", len(gateways))
for k in range(discovery_retry):
_LOGGER.info("Discovering Xiaomi Gateways (Try %s)", k + 1)
hass.data[PY_XIAOMI_GATEWAY].discover_gateways()
if len(hass.data[PY_XIAOMI_GATEWAY].gateways) >= len(gateways):
break
After Change
if not xiaomi.gateways:
_LOGGER.error("No gateway discovered")
return False
xiaomi.listen()
_LOGGER.debug("Gateways discovered. Listening for broadcasts")
for component in ["binary_sensor", "sensor", "switch", "light", "cover"]:
discovery.load_platform(hass, component, DOMAIN, {}, config)