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

This commit is contained in:
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

View File

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