mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Prevent CoordinatorEntity from requesting updates on disabled entities (#39452)
This commit is contained in:
parent
17734d54ab
commit
8b893173fd
@ -221,4 +221,9 @@ class CoordinatorEntity(entity.Entity):
|
|||||||
|
|
||||||
Only used by the generic entity update service.
|
Only used by the generic entity update service.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Ignore manual update requests if the entity is disabled
|
||||||
|
if not self.enabled:
|
||||||
|
return
|
||||||
|
|
||||||
await self.coordinator.async_request_refresh()
|
await self.coordinator.async_request_refresh()
|
||||||
|
@ -244,3 +244,9 @@ async def test_coordinator_entity(crd):
|
|||||||
await entity.async_added_to_hass()
|
await entity.async_added_to_hass()
|
||||||
|
|
||||||
assert mock_async_on_remove.called
|
assert mock_async_on_remove.called
|
||||||
|
|
||||||
|
# Verify we do not update if the entity is disabled
|
||||||
|
crd.last_update_success = False
|
||||||
|
with patch("homeassistant.helpers.entity.Entity.enabled", False):
|
||||||
|
await entity.async_update()
|
||||||
|
assert entity.available is False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user