Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update component in HACS: Startup blocking main thread issue. #86

Closed
mcattle opened this issue Dec 16, 2024 · 5 comments
Closed

Update component in HACS: Startup blocking main thread issue. #86

mcattle opened this issue Dec 16, 2024 · 5 comments

Comments

@mcattle
Copy link

mcattle commented Dec 16, 2024

Describe the Bug
The current version of the component is 0.4.8, but HACS only has 0.3.9. I'm hoping the error I'm getting with 0.3.9 startup has been addressed in 0.4.8.

The Error

2024-12-16 09:52:58.028 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to listdir with args ('/config/www/upcoming-media-card-images/plex/Plex_Recently_Added/',) inside the event loop by custom integration 'plex_recently_added' at custom_components/plex_recently_added/sensor.py, line 292: os.listdir(directory))) (offender: /config/custom_components/plex_recently_added/sensor.py, line 292: os.listdir(directory)))), please create a bug report at https://github.com/NemesisRE/sensor.plex_recently_added
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#listdir
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 227, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 213, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 154, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 708, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 679, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 2027, in _run_once
    handle._run()
  File "/usr/local/lib/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 737, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1318, in async_device_update
    await self.async_update()
  File "/config/custom_components/plex_recently_added/sensor.py", line 292, in async_update
    os.listdir(directory)))

Indicate if you followed all steps in the troubleshooting doc
Yes

What data does the sensor display if any?
All data is displayed, the startup error just indicates a blocking call on the main thread, which slows down startup.

Home Assistant Version
2024.12.3

@mcattle mcattle changed the title Update component in HACS. Update component in HACS: Startup blocking main thread issue. Dec 16, 2024
@mkanet
Copy link
Collaborator

mkanet commented Dec 16, 2024

Hi @mcattle, it sounds like there may be something stuck/broken in your Home Assistant instance interfering with this integration from operating normally. The easiest way prevent this issue would be to restore Home Assistant from backup prior to installing this integration and install the integration cleanly.

If that's not possible, please delete the integration from Home Assistant's GUI:
image

Then, manually delete /config/custom_components/plex_recently_added folder and all it's contents. After manually removing the integration files and respective folder, restart Home Assistant; and, install the integration again.

@mcattle
Copy link
Author

mcattle commented Dec 16, 2024

Following these steps, HACS is still only showing 0.3.9 as the only downloadable version.
image

@mcattle
Copy link
Author

mcattle commented Dec 16, 2024

Issue found. The version coming up in my HACS is an outdated fork at https://github.com/NemesisRE/sensor.plex_recently_added. Adding your repo to the HACS custom repos allowed me to download the correct version.

@mcattle
Copy link
Author

mcattle commented Dec 16, 2024

Following the install of the correct repository and version, I'm now only getting this message on startup (which I just set to ignore):

2024-12-16 15:57:56.080 WARNING (MainThread) [custom_components.hacs] You have 'custom-components/sensor.plex_recently_added' installed with HACS this repository has been removed from HACS, please consider removing it. Removal reason (Repository is archived)

@mkanet
Copy link
Collaborator

mkanet commented Dec 17, 2024

Glad you figured it out. I've been waiting nearly a year for the HACS moderators to approve the original UMC and its original integrations back to HACS. It's a bit hard to believe they are nearly 1 year behind!

It will be much easier once its all builtin to HACS again.

https://github.com/hacs/default/pulls/mkanet

Going to close this issue. Stay tuned!

@mkanet mkanet closed this as completed Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants