Files
core/homeassistant/components/deako/config_flow.py
Blake Bryant ef55a8e665 Bump pydeako to 0.6.0 (#132432)
feat: update deako integration to use improved version of pydeako

Some things of note:
- simplified errors
- pydeako has introduced some connection improvements

See here: https://github.com/DeakoLights/pydeako/releases/tag/0.6.0
2024-12-06 08:28:02 +01:00

27 lines
749 B
Python

"""Config flow for deako."""
from pydeako import DeakoDiscoverer, DevicesNotFoundException
from homeassistant.components import zeroconf
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_entry_flow
from .const import DOMAIN, NAME
async def _async_has_devices(hass: HomeAssistant) -> bool:
"""Return if there are devices that can be discovered."""
_zc = await zeroconf.async_get_instance(hass)
discoverer = DeakoDiscoverer(_zc)
try:
await discoverer.get_address()
except DevicesNotFoundException:
return False
else:
# address exists, there's at least one device
return True
config_entry_flow.register_discovery_flow(DOMAIN, NAME, _async_has_devices)