From 3882854fad269267599be8e581472cfebed0094b Mon Sep 17 00:00:00 2001 From: "Tyler F. Carr" Date: Sat, 13 Apr 2024 20:16:11 -0700 Subject: [PATCH] last updated attribute --- custom_components/noaa_space_weather/entity.py | 1 + custom_components/noaa_space_weather/image.py | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/custom_components/noaa_space_weather/entity.py b/custom_components/noaa_space_weather/entity.py index 88e0e42..cb8d873 100644 --- a/custom_components/noaa_space_weather/entity.py +++ b/custom_components/noaa_space_weather/entity.py @@ -23,6 +23,7 @@ def extra_state_attributes(self): "attribution": ATTRIBUTION, "id": str(self.coordinator.data.get("id")), "integration": DOMAIN, + "last_updated": self.image_last_updated, } diff --git a/custom_components/noaa_space_weather/image.py b/custom_components/noaa_space_weather/image.py index 032ce61..be5fbb3 100644 --- a/custom_components/noaa_space_weather/image.py +++ b/custom_components/noaa_space_weather/image.py @@ -77,10 +77,6 @@ def device_class(self): """Return the device class of the image.""" return f"noaa_space_weather__{self.image_data.get('device_class', 'image')}" - @property - def last_update(self): - return self.image_last_updated() - @property def icon(self): """Return the icon of the image.""" @@ -93,5 +89,6 @@ def icon(self): @callback def _handle_coordinator_update(self): self.image_last_updated = datetime.now() + self._attr_image_last_updated = self.image_last_updated self._cached_image = None self.async_write_ha_state()