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

pull/56116/head
Erik Montnemery 2021-09-10 08:59:23 +02:00 committed by Paulus Schoutsen
parent c424f99aab
commit 2079956350
1 changed files with 3 additions and 0 deletions

View File

@ -209,6 +209,9 @@ class SensorEntity(Entity):
and not self._last_reset_reported and not self._last_reset_reported
): ):
self._last_reset_reported = True 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() report_issue = self._suggest_report_issue()
_LOGGER.warning( _LOGGER.warning(
"Entity %s (%s) with state_class %s has set last_reset. Setting " "Entity %s (%s) with state_class %s has set last_reset. Setting "