1
mirror of https://github.com/home-assistant/core synced 2024-10-01 05:30:36 +02:00
ha-core/homeassistant/components/gree/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

17 lines
513 B
Python

"""Config flow for Gree."""
from greeclimate.discovery import Discovery
from homeassistant.helpers import config_entry_flow
from .const import DISCOVERY_TIMEOUT, DOMAIN
async def _async_has_devices(hass) -> bool:
"""Return if there are devices that can be discovered."""
gree_discovery = Discovery(DISCOVERY_TIMEOUT)
devices = await gree_discovery.scan(wait_for=DISCOVERY_TIMEOUT)
return len(devices) > 0
config_entry_flow.register_discovery_flow(DOMAIN, "Gree Climate", _async_has_devices)