hass-core/homeassistant/components/kulersky/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

24 lines
687 B
Python

"""Config flow for Kuler Sky."""
import logging
import pykulersky
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."""
# Check if there are any devices that can be discovered in the network.
try:
devices = await pykulersky.discover()
except pykulersky.PykulerskyException as exc:
_LOGGER.error("Unable to discover nearby Kuler Sky devices: %s", exc)
return False
return len(devices) > 0
config_entry_flow.register_discovery_flow(DOMAIN, "Kuler Sky", _async_has_devices)