diff --git a/homeassistant/components/zha/entity.py b/homeassistant/components/zha/entity.py index 309691dd3df..96f005ba288 100644 --- a/homeassistant/components/zha/entity.py +++ b/homeassistant/components/zha/entity.py @@ -202,9 +202,13 @@ class ZhaEntity(BaseZhaEntity, RestoreEntity): async def async_update(self) -> None: """Retrieve latest state.""" - for channel in self.cluster_channels.values(): - if hasattr(channel, "async_update"): - await channel.async_update() + tasks = [ + channel.async_update() + for channel in self.cluster_channels.values() + if hasattr(channel, "async_update") + ] + if tasks: + await asyncio.gather(*tasks) class ZhaGroupEntity(BaseZhaEntity): diff --git a/homeassistant/components/zha/light.py b/homeassistant/components/zha/light.py index ff080562190..ba05d63df12 100644 --- a/homeassistant/components/zha/light.py +++ b/homeassistant/components/zha/light.py @@ -410,13 +410,10 @@ class Light(BaseLight, ZhaEntity): if "effect" in last_state.attributes: self._effect = last_state.attributes["effect"] - async def async_update(self): - """Attempt to retrieve on off state from the light.""" - await super().async_update() - await self.async_get_state() - async def async_get_state(self, from_cache=True): """Attempt to retrieve on off state from the light.""" + if not from_cache and not self.available: + return self.debug("polling current state - from cache: %s", from_cache) if self._on_off_channel: state = await self._on_off_channel.get_attribute_value( diff --git a/homeassistant/components/zha/sensor.py b/homeassistant/components/zha/sensor.py index 9f507275836..6e2878f371b 100644 --- a/homeassistant/components/zha/sensor.py +++ b/homeassistant/components/zha/sensor.py @@ -210,6 +210,12 @@ class ElectricalMeasurement(Sensor): return round(value, self._decimals) return round(value) + async def async_update(self) -> None: + """Retrieve latest state.""" + if not self.available: + return + await super().async_update() + @STRICT_MATCH(generic_ids=CHANNEL_ST_HUMIDITY_CLUSTER) @STRICT_MATCH(channel_names=CHANNEL_HUMIDITY)