Don't poll entities for unavailable ZHA devices (#39756)
* Don't poll entities for unavailable ZHA devices * Update homeassistant/components/zha/entity.py Co-authored-by: Bas Nijholt <basnijholt@gmail.com> * cleanup after accepting suggestion Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
This commit is contained in:
parent
36a1877cbd
commit
be8aa16170
3 changed files with 15 additions and 8 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue