Skip unsupported LIFX Switches during discovery ()

Co-authored-by: J. Nick Koston <nick@koston.org>
pull/68310/head
Avi Miller 2022-03-18 05:13:08 +11:00 committed by GitHub
parent 8f69d31322
commit 9ea73e0d90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 6 deletions
homeassistant/components/lifx

View File

@ -74,6 +74,7 @@ MESSAGE_RETRIES = 8
UNAVAILABLE_GRACE = 90
FIX_MAC_FW = AwesomeVersion("3.70")
SWITCH_PRODUCT_IDS = [70, 71, 89]
SERVICE_LIFX_SET_STATE = "set_state"
@ -396,14 +397,18 @@ class LIFXManager:
# Read initial state
ack = AwaitAioLIFX().wait
# Used to populate sw_version
# no need to wait as we do not
# need it until later
bulb.get_hostfirmware()
# Get the product info first so that LIFX Switches
# can be ignored.
version_resp = await ack(bulb.get_version)
if version_resp and bulb.product in SWITCH_PRODUCT_IDS:
_LOGGER.warning(
"(Switch) action=skip_discovery, reason=unsupported, serial=%s, ip_addr=%s, type='LIFX Switch'",
str(bulb.mac_addr).replace(":", ""),
bulb.ip_addr,
)
return False
color_resp = await ack(bulb.get_color)
if color_resp:
version_resp = await ack(bulb.get_version)
if color_resp is None or version_resp is None:
_LOGGER.error("Failed to initialize %s", bulb.ip_addr)