mirror of
https://github.com/home-assistant/core.git
synced 2025-11-12 20:40:18 +00:00
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
27 lines
749 B
Python
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)
|