Home Assistant Unofficial Reference 2024.12.1
config_flow.py
Go to the documentation of this file.
1 """Config Flow for Refoss integration."""
2 
3 from __future__ import annotations
4 
5 from homeassistant.core import HomeAssistant
6 from homeassistant.helpers import config_entry_flow
7 
8 from .const import DISCOVERY_TIMEOUT, DOMAIN
9 from .util import refoss_discovery_server
10 
11 
12 async def _async_has_devices(hass: HomeAssistant) -> bool:
13  """Return if there are devices that can be discovered."""
14 
15  refoss_discovery = await refoss_discovery_server(hass)
16  devices = await refoss_discovery.broadcast_msg(wait_for=DISCOVERY_TIMEOUT)
17  return len(devices) > 0
18 
19 
20 config_entry_flow.register_discovery_flow(DOMAIN, "Refoss", _async_has_devices)
bool _async_has_devices(HomeAssistant hass)
Definition: config_flow.py:12
Discovery refoss_discovery_server(HomeAssistant hass)
Definition: util.py:12