Skip to content

Commit

Permalink
rearrange and test
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarwash committed Apr 18, 2024
1 parent 25ed2e3 commit 92ddea0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 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 @@ -7,6 +7,6 @@
"documentation": "https://github.com/tcarwash/home-assistant_noaa-space-weather",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/tcarwash/home-assistant_noaa-space-weather/issues",
"requirements": ["swpclib==4.3.6"],
"requirements": ["swpclib==4.3.7"],
"version": "2.0.1"
}
2 changes: 1 addition & 1 deletion requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
homeassistant
pre-commit==2.20.0
black==24.3.0
swpclib>=4.2.0
swpclib>=4.3.7

0 comments on commit 92ddea0

Please sign in to comment.