asantaga / wiserHomeAssistantPlatform

Platform and related climate/sensors to support the Drayton Wiser Home Heating System
MIT License
238 stars 44 forks source link

Frontend __init__ : Deprecated code in 2025.7 #495

Closed LGO44 closed 5 days ago

LGO44 commented 2 months ago

I have created an issue for that, number 485 but it contains 2 issues. Sorry for not being precise enough and generating 2 different issues. This is the issue on the 3.4.8 of the Wiser platform. I propose a fix in the joined file in wiser\frontend_init__.py

init.zip

logs: 2024-09-07 15:49:44.620 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'wiser' calls hass.http.register_static_path which is deprecated because it does blocking I/O in the event loop, instead call await hass.http.async_register_static_paths([StaticPathConfig("/wiser", "/config/custom_components/wiser/frontend", False)]); This function will be removed in 2025.7 at custom_components/wiser/frontend/init.py, line 24: self.hass.http.register_static_path(, please create a bug report at https://github.com/asantaga/wiserHomeAssistantPlatform/issues 2024-09-07 15:49:44.654 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to listdir with args ('/config/custom_components/wiser/frontend',) inside the event loop by custom integration 'wiser' at custom_components/wiser/frontend/init.py, line 123: filename for filename in os.listdir(path) if filename.endswith(".gz") (offender: /config/custom_components/wiser/frontend/init.py, line 123: filename for filename in os.listdir(path) if filename.endswith(".gz")), please create a bug report at https://github.com/asantaga/wiserHomeAssistantPlatform/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#listdir Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in sys.exit(main()) File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 189, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 752, in async_setup_locked await self.async_setup(hass, integration=integration) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/wiser/init.py", line 65, in async_setup_entry await cards.async_register() File "/config/custom_components/wiser/frontend/init.py", line 19, in async_register await self.async_wait_for_lovelace_resources() File "/config/custom_components/wiser/frontend/init.py", line 40, in async_wait_for_lovelace_resources await check_lovelace_resources_loaded(0) File "/config/custom_components/wiser/frontend/init.py", line 33, in check_lovelace_resources_loaded await self.async_register_wiser_cards() File "/config/custom_components/wiser/frontend/init.py", line 76, in async_register_wiser_cards await self.async_remove_gzip_files() File "/config/custom_components/wiser/frontend/init.py", line 123, in async_remove_gzip_files filename for filename in os.listdir(path) if filename.endswith(".gz")

LGO44 commented 2 months ago

Same as issue 494

LGO44 commented 2 months ago

the proposed fix solved both 2 issue 494 and 493

msp1974 commented 1 month ago

Thanks Christian. I have already fixed in dev. So will be in next release.

msp1974 commented 5 days ago

Fixed in v3.4.9 - just released