2019-06-03 10:06:53 -07:00
|
|
|
"""Config flow for Wemo."""
|
2019-09-22 20:46:32 -07:00
|
|
|
|
|
|
|
import pywemo
|
|
|
|
|
2021-12-19 16:09:30 -08:00
|
|
|
from homeassistant.core import HomeAssistant
|
2019-12-09 11:53:51 +01:00
|
|
|
from homeassistant.helpers import config_entry_flow
|
2019-09-22 20:46:32 -07:00
|
|
|
|
2019-06-03 10:06:53 -07:00
|
|
|
from . import DOMAIN
|
|
|
|
|
|
|
|
|
2021-12-19 16:09:30 -08:00
|
|
|
async def _async_has_devices(hass: HomeAssistant) -> bool:
|
2019-06-03 10:06:53 -07:00
|
|
|
"""Return if there are devices that can be discovered."""
|
2019-09-22 20:46:32 -07:00
|
|
|
return bool(await hass.async_add_executor_job(pywemo.discover_devices))
|
2019-06-03 10:06:53 -07:00
|
|
|
|
|
|
|
|
2021-04-29 23:12:58 +02:00
|
|
|
config_entry_flow.register_discovery_flow(DOMAIN, "Wemo", _async_has_devices)
|