Adjust entity slow warning for custom component (#31711)

This commit is contained in:
Paulus Schoutsen 2020-02-10 16:32:47 -08:00 committed by GitHub
parent 2db6246244
commit 5a0f21cbe3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 6 deletions

View file

@ -365,17 +365,25 @@ class Entity(ABC):
if end - start > 0.4 and not self._slow_reported:
self._slow_reported = True
url = "https://github.com/home-assistant/home-assistant/issues?q=is%3Aopen+is%3Aissue"
if self.platform:
url += f"+label%3A%22integration%3A+{self.platform.platform_name}%22"
extra = ""
if "custom_components" in type(self).__module__:
extra = "Please report it to the custom component author."
else:
extra = (
"Please create a bug report at "
"https://github.com/home-assistant/home-assistant/issues?q=is%3Aopen+is%3Aissue"
)
if self.platform:
extra += (
f"+label%3A%22integration%3A+{self.platform.platform_name}%22"
)
_LOGGER.warning(
"Updating state for %s (%s) took %.3f seconds. "
"Please create a bug report at %s",
"Updating state for %s (%s) took %.3f seconds. %s",
self.entity_id,
type(self),
end - start,
url,
extra,
)
# Overwrite properties that have been set in the config file.