Never use availability workaround for certified Hue devices (#62676)

pull/62684/head
Marcel van der Veldt 2021-12-23 15:35:57 +01:00 committed by GitHub
parent dff9767da5
commit 430cc6194b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 6 deletions

View File

@ -142,18 +142,21 @@ class HueBaseEntity(Entity):
if self._ignore_availability is not None:
# already processed
return
cur_state = self.resource.on.on
if self._last_state is None:
self._last_state = cur_state
return
if self.device.product_data.certified:
# certified products report their state correctly
self._ignore_availability = False
# some (3th party) Hue lights report their connection status incorrectly
# causing the zigbee availability to report as disconnected while in fact
# it can be controlled. Although this is in fact something the device manufacturer
# should fix, we work around it here. If the light is reported unavailable
# by the zigbee connectivity but the state changesm its considered as a
# by the zigbee connectivity but the state changes its considered as a
# malfunctioning device and we report it.
# while the user should actually fix this issue instead of ignoring it, we
# ignore the availability for this light from this point.
cur_state = self.resource.on.on
if self._last_state is None:
self._last_state = cur_state
return
if zigbee := self.bridge.api.devices.get_zigbee_connectivity(self.device.id):
if (
self._last_state != cur_state
@ -163,7 +166,7 @@ class HueBaseEntity(Entity):
# while it was reported as not connected!
self.logger.warning(
"Light %s changed state while reported as disconnected. "
"This is an indicator that routing is not working properly for this device. "
"This might be an indicator that routing is not working for this device. "
"Home Assistant will ignore availability for this light from now on. "
"Device details: %s - %s (%s) fw: %s",
self.name,