Skip to content

Commit

Permalink
last updated attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarwash committed Apr 14, 2024
1 parent daf5d9b commit 3882854
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 1 addition & 0 deletions custom_components/noaa_space_weather/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}


Expand Down
5 changes: 1 addition & 4 deletions custom_components/noaa_space_weather/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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()

0 comments on commit 3882854

Please sign in to comment.