Skip to content

Commit

Permalink
Testing (#45)
Browse files Browse the repository at this point in the history
* Friendlier friendly names

* mdi icons for images to match sensors

* mdi icons for images to match sensors

* more icons

* last updated attribute

* semi-working animations

* semi-working animations

* working ish

* will need to test if this blocks when there's >1 core

* rearrange and test
  • Loading branch information
tcarwash authored Apr 18, 2024
1 parent b7f9735 commit 7849c24
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions custom_components/noaa_space_weather/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,23 @@ async def async_update(self):
image_bytes = await self.coordinator.api.async_get_first_frame(
self.image_data["product"]
)
self._cached_image = image_bytes
self.image_last_updated = datetime.now()
self._attr_image_last_updated = self.image_last_updated
_LOGGER.debug(f"Writing {self.name} state")
asyncio.run_coroutine_threadsafe(self.async_update(), self.hass.loop)
return image_bytes
else:
_LOGGER.debug(f"Returning still for {self.name}")
_LOGGER.debug(f"Updating animation for {self.name}")
image_bytes = await self.coordinator.api.async_load_animation(
self.image_data["product"]
)
_LOGGER.debug(f"Updated animation for {self.name}, caching image")
self._cached_image = image_bytes
self.image_last_updated = datetime.now()
self._attr_image_last_updated = self.image_last_updated
_LOGGER.debug(f"Writing {self.name} state")
return image_bytes
self._cached_image = image_bytes
self.image_last_updated = datetime.now()
self._attr_image_last_updated = self.image_last_updated
_LOGGER.debug(f"Writing {self.name} state")
return image_bytes

@callback
def _handle_coordinator_update(self):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/noaa_space_weather/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/tcarwash/home-assistant_noaa-space-weather/issues",
"requirements": ["swpclib==4.3.7"],
"version": "2.1.0-beta3"
"version": "2.1.0-beta5"
}

0 comments on commit 7849c24

Please sign in to comment.