Only report slowness warning once per entity (#4962)
This commit is contained in:
parent
50c8224365
commit
cc9e5de503
1 changed files with 5 additions and 1 deletions
|
@ -79,6 +79,9 @@ class Entity(object):
|
|||
# Owning hass instance. Will be set by EntityComponent
|
||||
hass = None # type: Optional[HomeAssistant]
|
||||
|
||||
# If we reported if this entity was slow
|
||||
_slow_reported = False
|
||||
|
||||
@property
|
||||
def should_poll(self) -> bool:
|
||||
"""Return True if entity has to be polled for state.
|
||||
|
@ -243,7 +246,8 @@ class Entity(object):
|
|||
|
||||
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. '
|
||||
'Please report platform to the developers at '
|
||||
'https://goo.gl/Nvioub', self.entity_id,
|
||||
|
|
Loading…
Add table
Reference in a new issue