mirror of
https://github.com/home-assistant/core.git
synced 2025-08-05 21:55:10 +02:00
Only report slowness warning once per entity (#4962)
This commit is contained in:
@@ -79,6 +79,9 @@ class Entity(object):
|
|||||||
# Owning hass instance. Will be set by EntityComponent
|
# Owning hass instance. Will be set by EntityComponent
|
||||||
hass = None # type: Optional[HomeAssistant]
|
hass = None # type: Optional[HomeAssistant]
|
||||||
|
|
||||||
|
# If we reported if this entity was slow
|
||||||
|
_slow_reported = False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_poll(self) -> bool:
|
def should_poll(self) -> bool:
|
||||||
"""Return True if entity has to be polled for state.
|
"""Return True if entity has to be polled for state.
|
||||||
@@ -243,7 +246,8 @@ class Entity(object):
|
|||||||
|
|
||||||
end = timer()
|
end = timer()
|
||||||
|
|
||||||
if end - start > 0.4:
|
if not self._slow_reported and end - start > 0.4:
|
||||||
|
self._slow_reported = True
|
||||||
_LOGGER.warning('Updating state for %s took %.3f seconds. '
|
_LOGGER.warning('Updating state for %s took %.3f seconds. '
|
||||||
'Please report platform to the developers at '
|
'Please report platform to the developers at '
|
||||||
'https://goo.gl/Nvioub', self.entity_id,
|
'https://goo.gl/Nvioub', self.entity_id,
|
||||||
|
Reference in New Issue
Block a user