Skip to content

Commit

Permalink
Merge pull request #182 from craibo/thread-loop-issue
Browse files Browse the repository at this point in the history
2024.9.1
  • Loading branch information
craibo authored Sep 15, 2024
2 parents e3091b3 + baa81e6 commit 6055eab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion custom_components/ha_strava/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ def core_config_update_handler(event):
]

hass.async_create_task(
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
)

return True
Expand Down
10 changes: 4 additions & 6 deletions custom_components/ha_strava/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
)
async_add_entities(cameras)

def image_update_listener( # pylint: disable=inconsistent-return-statements
async def image_update_listener( # pylint: disable=inconsistent-return-statements
now,
): # pylint: disable=unused-argument
if len(ha_strava_config_entries) != 1:
return -1

for camera in cameras:
camera.rotate_img()
await camera.rotate_img()

ha_strava_config_entries = hass.config_entries.async_entries(domain=DOMAIN)
img_update_interval_seconds = int(
Expand Down Expand Up @@ -132,7 +132,7 @@ async def async_camera_image(
return await _return_default_img()
return await response.read()

def rotate_img(self): # pylint: disable=missing-function-docstring
async def rotate_img(self): # pylint: disable=missing-function-docstring
_LOGGER.debug(f"{self._device_id}: Strava Image Count: {len(self._urls)}")
if len(self._urls) == 0:
return
Expand Down Expand Up @@ -247,14 +247,12 @@ async def async_camera_image(
)
return await self._return_default_img()

def rotate_img(self): # pylint: disable=missing-function-docstring
async def rotate_img(self): # pylint: disable=missing-function-docstring
_LOGGER.debug(f"Number of images available from Strava: {len(self._urls)}")
if len(self._urls) == 0:
return
self._url_index = (self._url_index + 1) % len(self._urls)
self.async_write_ha_state()
return
# self.schedule_update_ha_state()

@property
def state(self): # pylint: disable=overridden-final-method
Expand Down
4 changes: 4 additions & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
homeassistant
aiohttp
aiofiles
numpy
voluptuous

black
flake8
Expand Down

0 comments on commit 6055eab

Please sign in to comment.