2019-05-13 08:16:55 +00:00
|
|
|
"""Config flow flow LIFX."""
|
2019-10-21 08:09:14 +00:00
|
|
|
import aiolifx
|
|
|
|
|
2019-05-13 08:16:55 +00:00
|
|
|
from homeassistant import config_entries
|
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
|
|
|
|
|
|
|
|
|
|
|
|
async def _async_has_devices(hass):
|
|
|
|
"""Return if there are devices that can be discovered."""
|
|
|
|
lifx_ip_addresses = await aiolifx.LifxScan(hass.loop).scan()
|
|
|
|
return len(lifx_ip_addresses) > 0
|
|
|
|
|
|
|
|
|
|
|
|
config_entry_flow.register_discovery_flow(
|
2019-07-31 19:25:30 +00:00
|
|
|
DOMAIN, "LIFX", _async_has_devices, config_entries.CONN_CLASS_LOCAL_POLL
|
|
|
|
)
|