From 20799563505adb832088114cb4e8010f44f5e40b Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Fri, 10 Sep 2021 08:59:23 +0200 Subject: [PATCH] Suppress last_reset deprecation warning for energy cost sensor (#56037) --- homeassistant/components/sensor/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/homeassistant/components/sensor/__init__.py b/homeassistant/components/sensor/__init__.py index fafaabbd217..413d9d2152f 100644 --- a/homeassistant/components/sensor/__init__.py +++ b/homeassistant/components/sensor/__init__.py @@ -209,6 +209,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 "