magico13 / ha-emporia-vue

Home Assistant Integration for Emporia Vue Energy Monitor
MIT License
475 stars 64 forks source link

Performance and Compatibility Issues with Emporia Vue Integration on Home Assistant Core 2024.8 #303

Open ifuchs opened 4 weeks ago

ifuchs commented 4 weeks ago

I am experiencing significant performance issues with the Emporia Vue integration on my Home Assistant setup, which appears to be contributing to high system load and instability. Below are the details of the issues observed: Home Assistant Core Version: 2024.8 Emporia Vue Integration Version: [Insert version from manifest.json] Installation Type: HA running under VirtualBox on Mac Database: SQLite

The integration is making blocking calls within the event loop, which is causing the system to become unresponsive. The logs show repeated warnings about blocking calls to open with args ('/usr/share/zoneinfo/America/New_York', 'rb') inside the event loop by the custom integration 'emporia_vue' at custom_components/emporia_vue/init.py, line 564: Detected blocking call to open with args ('/usr/share/zoneinfo/America/New_York', 'rb') inside the event loop by custom integration 'emporia_vue' at custom_components/emporia_vue/init.py, line 564 This blocking behavior severely impacts the responsiveness of the Home Assistant UI and other integrations. Client Unable to Keep Up with Pending Messages: The integration seems to be contributing to the high system load, resulting in clients being unable to keep up with the number of pending messages. The logs repeatedly show errors like: Client unable to keep up with pending messages. Reached 4096 pending messages. The system's load is too high or an integration is misbehaving. This affects the overall performance of my Home Assistant instance, leading to frequent reconnects and slow UI responsiveness. There are warnings about unused data found during updates: Unused data found during update. Unused data: {'40103-Balance-1MIN': <pyemvue.device.VueDeviceChannelUsage object at 0x7f86935befc0>} The integration is using deprecated methods that will stop working in future versions of Home Assistant. For example: Detected code that calls async_forward_entry_setup for integration emporia_vue with title: Customer 22563 and entry_id: e00389d188cff5f070aaa781b527d690, during setup without awaiting async_forward_entry_setup, which can cause the setup lock to be released before the setup is done. This will stop working in Home Assistant 2025.1.

magico13 commented 4 weeks ago

Would you mind grabbing the develop branch off of GitHub and manually overwriting the contents of your existing custom_components/emporia_vue folder? A number of those warnings have been fixed in that version and it may fix some of what you're seeing.

gdst4rp commented 2 weeks ago

I'm seeing the same issue. The integration took just over 252 seconds to load last time. I even tried to just reload this integration after everything was up and running. From the debug log, here's what I see:

2024-08-22 12:00:33.806 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: {('emporia_vue', 'REMOVED'): 24612.012550334} 2024-08-22 12:00:45.429 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open with args ('/usr/share/zoneinfo/America/REMOVED', 'rb') inside the event loop by custom integration 'emporia_vue' at custom_components/emporia_vue/__init__.py, line 564: tz_info = dateutil.tz.gettz(tz_string) (offender: /usr/local/lib/python3.12/site-packages/dateutil/tz/tz.py, line 464: fileobj = open(fileobj, 'rb')), please create a bug report at https://github.com/magico13/ha-emporia-vue/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open 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 223, in <module> 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 190, 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/emporia_vue/__init__.py", line 185, in async_setup_entry await coordinator_1min.async_config_entry_first_refresh() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 281, in async_config_entry_first_refresh await self._async_refresh( File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 271, in _async_update_data return await self.update_method() File "/config/custom_components/emporia_vue/__init__.py", line 126, in async_update_data_1min data = await update_sensors(vue, [Scale.MINUTE.value]) File "/config/custom_components/emporia_vue/__init__.py", line 373, in update_sensors await parse_flattened_usage_data( File "/config/custom_components/emporia_vue/__init__.py", line 420, in parse_flattened_usage_data local_time = change_time_to_local(data_time, info.time_zone) File "/config/custom_components/emporia_vue/__init__.py", line 564, in change_time_to_local tz_info = dateutil.tz.gettz(tz_string)