2019-05-13 08:16:55 +00:00
|
|
|
"""Config flow flow LIFX."""
|
2019-10-21 08:09:14 +00:00
|
|
|
import aiolifx
|
|
|
|
|
2022-02-14 17:10:50 +00:00
|
|
|
from homeassistant.core import HomeAssistant
|
2019-10-21 08:09:14 +00:00
|
|
|
from homeassistant.helpers import config_entry_flow
|
|
|
|
|
2019-05-13 08:16:55 +00:00
|
|
|
from .const import DOMAIN
|
|
|
|
|
|
|
|
|
2022-02-14 17:10:50 +00:00
|
|
|
async def _async_has_devices(hass: HomeAssistant) -> bool:
|
2019-05-13 08:16:55 +00:00
|
|
|
"""Return if there are devices that can be discovered."""
|
|
|
|
lifx_ip_addresses = await aiolifx.LifxScan(hass.loop).scan()
|
|
|
|
return len(lifx_ip_addresses) > 0
|
|
|
|
|
|
|
|
|
2021-04-29 21:12:58 +00:00
|
|
|
config_entry_flow.register_discovery_flow(DOMAIN, "LIFX", _async_has_devices)
|