Suppress last_reset deprecation warning for energy cost sensor (#56037)

This commit is contained in:
Erik Montnemery 2021-09-10 08:59:23 +02:00 committed by GitHub
parent c27ad3078a
commit e990ef249d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -216,6 +216,9 @@ class SensorEntity(Entity):
and not self._last_reset_reported
):
self._last_reset_reported = True
if self.platform and self.platform.platform_name == "energy":
return {ATTR_LAST_RESET: last_reset.isoformat()}
report_issue = self._suggest_report_issue()
_LOGGER.warning(
"Entity %s (%s) with state_class %s has set last_reset. Setting "