Fix flux_led discovery with older models (#61413)

This commit is contained in:
J. Nick Koston 2021-12-09 21:29:27 -10:00 committed by GitHub
parent 8383da6a5e
commit 8d483e2206
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 71 additions and 24 deletions

View file

@ -238,7 +238,14 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
) -> FluxLEDDiscovery:
"""Try to connect."""
self._async_abort_entries_match({CONF_HOST: host})
if device := await async_discover_device(self.hass, host):
if (device := await async_discover_device(self.hass, host)) and device[
ATTR_MODEL_DESCRIPTION
]:
# Older models do not return enough information
# to build the model description via UDP so we have
# to fallback to making a tcp connection to avoid
# identifying the device as the chip model number
# AKA `HF-LPB100-ZJ200`
return device
bulb = async_wifi_bulb_for_host(host)
try: