1 """Config flow for izone."""
4 from contextlib
import suppress
11 from .const
import DISPATCH_CONTROLLER_DISCOVERED, IZONE, TIMEOUT_DISCOVERY
12 from .discovery
import async_start_discovery_service, async_stop_discovery_service
14 _LOGGER = logging.getLogger(__name__)
18 controller_ready = asyncio.Event()
21 def dispatch_discovered(_):
22 controller_ready.set()
28 with suppress(TimeoutError):
29 async
with asyncio.timeout(TIMEOUT_DISCOVERY):
30 await controller_ready.wait()
32 if not disco.pi_disco.controllers:
34 _LOGGER.debug(
"No controllers found")
37 _LOGGER.debug(
"Controllers %s", disco.pi_disco.controllers)
41 config_entry_flow.register_discovery_flow(IZONE,
"iZone Aircon", _async_has_devices)
None async_stop_discovery_service(HomeAssistant hass)
AbstractDiscoveryService async_start_discovery_service(HomeAssistant hass)
bool _async_has_devices(HomeAssistant hass)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)