vlebourl / custom_vesync

Custom VeSync component for Home Assistant
98 stars 75 forks source link

Error installing custom component #157

Closed ds7771 closed 1 year ago

ds7771 commented 1 year ago

The problem

Received this error when trying to add the custom component integration:

Screenshot 2023-08-22 at 10 47 28 AM

Error logs provide further detail:

What version of this integration has the issue?

1.0.2

What version of Home Assistant Core has the issue?

2023.8.3

Diagnostics

Diagnostics ```json Copy/paste diagnostics here between the starting and ending backticks. ```

Home Assistant log

Log ```py 2023-08-22 22:12:10.882 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration vesync: cannot import name 'model_features' from 'pyvesync.vesyncfan' (/usr/local/lib/python3.11/site-packages/pyvesync/vesyncfan.py) 2023-08-22 22:12:10.884 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2037, in _load_integration integration.get_platform("config_flow") File "/usr/src/homeassistant/homeassistant/loader.py", line 833, in get_platform cache[full_name] = self._import_platform(platform_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 850, in _import_platform return importlib.import_module(f"{self.pkg_path}.{platform_name}") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1204, in _gcd_import File "", line 1176, in _find_and_load File "", line 1126, in _find_and_load_unlocked File "", line 241, in _call_with_frames_removed File "", line 1204, in _gcd_import File "", line 1176, in _find_and_load File "", line 1147, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "/config/custom_components/vesync/__init__.py", line 13, in from .common import async_process_devices File "/config/custom_components/vesync/common.py", line 7, in from pyvesync.vesyncfan import model_features ImportError: cannot import name 'model_features' from 'pyvesync.vesyncfan' (/usr/local/lib/python3.11/site-packages/pyvesync/vesyncfan.py) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 847, in async_init flow, result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/config_entries.py", line 865, in _async_init flow = await self.async_create_flow(handler, context=context, data=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/config_entries.py", line 967, in async_create_flow await _load_integration(self.hass, handler_key, self._hass_config) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2044, in _load_integration raise data_entry_flow.UnknownHandler homeassistant.data_entry_flow.UnknownHandler 2023-08-22 22:12:12.518 INFO (MainThread) [backoff] Backing off async_request(...) for 0.9s ```

Additional information

In case it helps, please be aware that my HA instance is a docker container on RPI.

I have already tried purging the container and rebuilding the core from scratch. The container has the latest pyvesync 2.1.9 installed

For some reason the integration is not correctly pulling from the core pyvesync library. I was able to fix the error by installing a standalone version of pyvesync into the custom component folder, as described in issue #27.

vlebourl commented 1 year ago

Hi, sorry you're getting this problem... So far I haven't been able to reproduce it, which make fixing quite hard... My first idea would be a conflict between the requirements of the core integration vs the ones of the custom component sharing the same domain name. But I don't know how to go further for now...

ds7771 commented 1 year ago

Thanks. I got it working by installing pyvesync library manually into the custom component folder.

I did validate that HA core has python 3.11.4 installed.

But I noticed that the Pi OS is still running back level Python 3.9.2. I wonder if the vesync component is looking for Python in the docker host environment rather than inside the container, and it's finding 3.9.2 instead of 3.11 - throwing up an error. Just a suspicion. I will upgrade Python on the host and see if that resolves the issue.

ds7771 commented 1 year ago

SO, Im not really sure what I did; but in the process of trying to install and reinstall Python 3.11 libraries and vesync I must have repaired the dependency issue. The conflg workflow seems to work fine now, even on a fresh intall. Thanks the the assistance.

github-actions[bot] commented 1 year ago

'There hasn't been any activity on this issue recently. Is this issue still present? Please make sure to update to the latest Home Assistant version and version of this integration to see if that solves the issue. Let us know if that works for you by adding a comment 👍. This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.'