1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00

Add guard in Hue availability check (#64062)

This commit is contained in:
Marcel van der Veldt 2022-01-13 18:18:34 +01:00 committed by GitHub
parent c8043eccc9
commit ab0d512a5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -142,8 +142,9 @@ class HueBaseEntity(Entity):
# return if we already processed this entity
if self._ignore_availability is not None:
return
# only do the availability check for entities connected to a device
if self.device is None:
# only do the availability check for entities connected to a device (with `on` feature)
if self.device is None or not hasattr(self.resource, "on"):
self._ignore_availability = False
return
# ignore availability if user added device to ignore list
if self.device.id in self.bridge.config_entry.options.get(
@ -190,6 +191,7 @@ class HueBaseEntity(Entity):
self.device.product_data.model_id,
self.device.product_data.software_version,
)
# do we want to store this in some persistent storage?
self._ignore_availability = True
# set attribute to false because we only want to log once per light/device.
# a user must opt-in to ignore availability through integration options
self._ignore_availability = False
self._last_state = cur_state