ha_strava
ha_strava copied to clipboard
Camera not working
this is a follow on from #166
Unfortunately this is still not working for me. I've currently running: ha_strava: 3.2.38 home assistant: 2024.6.4
I'm still seeing these tracebacks in the logs and the camera images are not loading:
2024-07-07 11:24:54.920 WARNING (SyncWorker_25) [homeassistant.helpers.frame] Detected that custom integration 'ha_strava' calls async_write_ha_state from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#async_write_ha_state at custom_components/ha_strava/camera.py, line 138: self.async_write_ha_state(), please report it to the author of the 'ha_strava' custom integration
2024-07-07 11:24:54.921 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
Traceback (most recent call last):
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/ha_strava/camera.py", line 68, in image_update_listener
camera.rotate_img()
File "/config/custom_components/ha_strava/camera.py", line 138, in rotate_img
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 999, in async_write_ha_state
self.hass.verify_event_loop_thread("async_write_ha_state")
File "/usr/src/homeassistant/homeassistant/core.py", line 447, in verify_event_loop_thread
frame.report(
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 159, in report
_report_integration(what, integration_frame, level, error_if_integration)
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 197, in _report_integration
raise RuntimeError(
RuntimeError: Detected that custom integration 'ha_strava' calls async_write_ha_state from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#async_write_ha_state at custom_components/ha_strava/camera.py, line 138: self.async_write_ha_state(). Please report it to the author of the 'ha_strava' custom integration.
I restarted HA and found the following in the logs when the system was starting up
2024-07-07 11:23:24.860 INFO (MainThread) [homeassistant.components.camera] Setting up ha_strava.camera
2024-07-07 11:23:24.867 ERROR (MainThread) [custom_components.ha_strava.camera] Error reading from file: file must have 'read' and 'readline' attributes
2024-07-07 11:23:24.868 ERROR (MainThread) [homeassistant.components.camera] Error adding entity camera.strava_cam for domain camera with platform ha_strava
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 600, in _async_add_entities
await coro
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 914, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1354, in add_to_platform_finish
await self.async_added_to_hass()
File "/config/custom_components/ha_strava/camera.py", line 296, in async_added_to_hass
self.hass.bus.async_listen(CONF_IMG_UPDATE_EVENT, await self.img_update_handler)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object method can't be used in 'await' expression