1
0
mirror of https://github.com/natekspencer/hacs-oasis_mini.git synced 2025-11-17 09:33:41 -05:00

Merge pull request #51 from natekspencer/image-update
Some checks failed
Validate repo / Validate with hassfest (push) Has been cancelled
Validate repo / Validate with HACS (push) Has been cancelled

Don't update image unless playing or image hasn't been cached yet
This commit is contained in:
Nathan Spencer
2025-01-10 15:20:41 -07:00
committed by GitHub

View File

@@ -42,9 +42,10 @@ class OasisMiniImageEntity(OasisMiniEntity, ImageEntity):
@callback
def _handle_coordinator_update(self) -> None:
"""Handle updated data from the coordinator."""
if self._track_id != self.device.track_id or (
self._progress != self.device.progress and self.device.access_token
):
if (
self._track_id != self.device.track_id
or (self._progress != self.device.progress and self.device.access_token)
) and (self.device.status == "playing" or self._cached_image is None):
self._attr_image_last_updated = self.coordinator.last_updated
self._track_id = self.device.track_id
self._progress = self.device.progress