hass-core/homeassistant/components/zerproc/config_flow.py
Franck Nijhof c68b259bd3
Cleanup of unused connection_class logic (#49865)
Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
2021-04-29 23:12:58 +02:00

23 lines
602 B
Python

"""Config flow for Zerproc."""
import logging
import pyzerproc
from homeassistant.helpers import config_entry_flow
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
async def _async_has_devices(hass) -> bool:
"""Return if there are devices that can be discovered."""
try:
devices = await pyzerproc.discover()
return len(devices) > 0
except pyzerproc.ZerprocException:
_LOGGER.error("Unable to discover nearby Zerproc devices", exc_info=True)
return False
config_entry_flow.register_discovery_flow(DOMAIN, "Zerproc", _async_has_devices)