RobertD502 / home-assistant-flair

Custom component for Home Assistant Core for Flair pucks, vents, rooms, structures, and minisplits
MIT License
87 stars 12 forks source link

Can't setup integration #81

Open snsiddiqui opened 2 days ago

snsiddiqui commented 2 days ago

Core 2024.6.4 Supervisor 2024.06.2 Operating System 12.4 Frontend 20240610.1

  1. Downloaded Flair component via HACS
  2. Restarted system
  3. Added Flair integration using oauth 2.0 credentials

Setup fails with error: Failed to setup, check the logs

Stack trace from logs: return importlib.import_module(f"{self.pkg_path}.{platform_name}")), please create a bug report at https://github.com/RobertD502/home-assistant-flair/issues 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 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 672, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1988, 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 742, in async_setup_locked await self.async_setup(hass, integration=integration) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/flair/init.py", line 20, in async_setup_entry await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

2024-07-01 16:49:33.888 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Flair for flair Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/flair/init.py", line 20, in async_setup_entry await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2031, in async_forward_entry_setups await integration.async_get_platforms(platforms) File "/usr/src/homeassistant/homeassistant/loader.py", line 1162, in async_get_platforms import_future.result() File "/usr/src/homeassistant/homeassistant/loader.py", line 1162, in async_get_platforms import_future.result() File "/usr/src/homeassistant/homeassistant/loader.py", line 1162, in async_get_platforms import_future.result() [Previous line repeated 5 more times] File "/usr/src/homeassistant/homeassistant/loader.py", line 1150, in async_get_platforms platforms.update(self._load_platforms(platform_names)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, in _load_platforms platform_name: self._load_platform(platform_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 1249, in _load_platform cache[full_name] = self._import_platform(platform_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 1281, in _import_platform return importlib.import_module(f"{self.pkg_path}.{platform_name}") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/util/loop.py", line 131, in protected_loop_func return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "/config/custom_components/flair/binary_sensor.py", line 7, in from flairaio.model import Bridge, Puck, Vent ImportError: cannot import name 'Bridge' from 'flairaio.model' (/config/deps/lib/python3.12/site-packages/flairaio/model.py) 2024-07-01 16:50:22.147 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: {('alarmdecoder', '460334b592752b0dcfa2a8c159a329bd'): 949658.577415389} 2024-07-01 16:51:22.216 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: {('alarmdecoder', '460334b592752b0dcfa2a8c159a329bd'): 949658.577415389} 2024-07-01 16:52:22.282 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: {('alarmdecoder', '460334b592752b0dcfa2a8c159a329bd'): 949658.577415389} 2024-07-01 16:53:22.345 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: {('alarmdecoder', '460334b592752b0dcfa2a8c159a329bd'): 949658.577415389} 2024-07-01 16:53:23.460 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry /dev/serial/by-id/usb-FTDI_FT230X_Basic_UART_DJ009BA8-if00-port0 for alarmdecoder Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/alarmdecoder/init.py", line 139, in async_setup_entry await controller.is_init() File "/usr/local/lib/python3.12/site-packages/adext/adext.py", line 29, in is_init return (await self._event.wait()) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/locks.py", line 212, in wait await fut asyncio.exceptions.CancelledError: Global task timeout

RobertD502 commented 2 days ago

Do you have the "SSH & Web Terminal" add-on by any chance? If so, enter into the homeassistant docker container (docker exec -ti homeassistant sh) and run: pip show flairaio and let me know what version it says flairaio is. I suspect something went wrong when Home Assistant installed the flairaio library.

snsiddiqui commented 1 day ago

here's the shell output:

➜ ~ docker exec -it homeassistant bash homeassistant:/config# pip show flairaio Name: flairaio Version: 0.2.0 Summary: Asynchronous Python library for Flair's API Home-page: https://github.com/RobertD502/flairaio Author: Robert Drinovac Author-email: @.*** License: Location: /usr/local/lib/python3.12/site-packages Requires: aiohttp Required-by: homeassistant:/config#

On Mon, Jul 1, 2024 at 5:26 PM Dr. Drinovac @.***> wrote:

Do you have the "SSH & Web Terminal" add-on by any chance? If so, enter into the homeassistant docker container and run: pip show flairaio and let me know what version it says flairaio is. I suspect something went wrong when Home Assistant installed the flairaio library.

— Reply to this email directly, view it on GitHub https://github.com/RobertD502/home-assistant-flair/issues/81#issuecomment-2201101873, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJP25PD5UEIYJDQMAMYGLLZKHCR7AVCNFSM6AAAAABKGJG636VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBRGEYDCOBXGM . You are receiving this because you authored the thread.Message ID: @.***>

-- Shahid Siddiqui

(Try not to become a man of success but rather to become a man of value)

RobertD502 commented 1 day ago

Do a pip uninstall flairaio, followed by pip install flairaio. Restart Home Assistant and attempt to set up the integration again.

snsiddiqui commented 1 day ago

Tried this and unfortunately didn't work. Here's the stack trace:

Logger: homeassistant.config_entries Source: config_entries.py:594 First occurred: 6:04:44 PM (1 occurrences) Last logged: 6:04:44 PM

Error setting up entry Flair for flair Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/flair/init.py", line 20, in async_setup_entry await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2031, in async_forward_entry_setups await integration.async_get_platforms(platforms) File "/usr/src/homeassistant/homeassistant/loader.py", line 1162, in async_get_platforms import_future.result() File "/usr/src/homeassistant/homeassistant/loader.py", line 1162, in async_get_platforms import_future.result() File "/usr/src/homeassistant/homeassistant/loader.py", line 1162, in async_get_platforms import_future.result() [Previous line repeated 5 more times] File "/usr/src/homeassistant/homeassistant/loader.py", line 1150, in async_get_platforms platforms.update(self._load_platforms(platform_names)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, in _load_platforms platform_name: self._load_platform(platform_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 1249, in _load_platform cache[full_name] = self._import_platform(platform_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 1281, in _import_platform return importlib.import_module(f"{self.pkg_path}.{platform_name}") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/util/loop.py", line 131, in protected_loop_func return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "/config/custom_components/flair/binary_sensor.py", line 7, in

from flairaio.model import Bridge, Puck, Vent ImportError: cannot import name 'Bridge' from 'flairaio.model' (/config/deps/lib/python3.12/site-packages/flairaio/model.py) On Tue, Jul 2, 2024, 3:33 PM Dr. Drinovac ***@***.***> wrote: > Do a pip uninstall flairaio, followed by pip install flairaio. Restart > Home Assistant and attempt to set up the integration again. > > — > Reply to this email directly, view it on GitHub > , > or unsubscribe > > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> >
RobertD502 commented 1 day ago

I see where you problem is. Home Assistant isn't looking for flairaio in the correct location. Notice that it is trying to import from:

/config/deps/lib/python3.12/site-packages/flairaio/model.py

That is not correct. The python dependencies are supposed to be installed at /usr/local/lib/python3.12/site-packages/. Something funky is going on with your Home Assistant setup.

Did you move from a different form of Home Assistant to Home Assistant OS or mess with the python path at any point?