JurajNyiri / HomeAssistant-Tapo-Control

Control for Tapo cameras as a Home Assistant component
Apache License 2.0
947 stars 80 forks source link

Unexpected exception importing component custom_components.tapo_control after upgrading to 2024.6.2 #611

Closed sanist1 closed 2 weeks ago

sanist1 commented 2 weeks ago

Description

Unexpected exception importing component custom_components.tapo_control after upgrading to 2024.6.2

Reproduction Steps

was working prior to upgrade2024.6.2, now integration fails at startup

Expected behavior

functioning integration

If applicable, add error logs.

Detected blocking call to import_module with args ('custom_components.tapo_control',) in /usr/src/homeassistant/homeassistant/loader.py, line 1052: ComponentProtocol, importlib.import_module(self.pkg_path) inside the event loop 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/setup.py", line 165, in async_setup_component result = await _async_setup_component(hass, domain, config) File "/usr/src/homeassistant/homeassistant/setup.py", line 320, in _async_setup_component component = await integration.async_get_component() File "/usr/src/homeassistant/homeassistant/loader.py", line 1004, in async_get_component comp = self._get_component() File "/usr/src/homeassistant/homeassistant/loader.py", line 1052, in _get_component ComponentProtocol, importlib.import_module(self.pkg_path)

Logger: homeassistant.loader Source: loader.py:1052 First occurred: 07:01:50 (2 occurrences) Last logged: 07:01:50

Unexpected exception importing component custom_components.tapo_control Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/loader.py", line 1052, in _get_component ComponentProtocol, importlib.import_module(self.pkg_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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/tapo_control/init.py", line 50, in from .utils import ( File "/config/custom_components/tapo_control/utils.py", line 15, in from pytapo.media_stream.downloader import Downloader File "/usr/local/lib/python3.12/site-packages/pytapo/init.py", line 12, in from Crypto.Cipher import AES File "/usr/local/lib/python3.12/site-packages/Crypto/Cipher/init.py", line 27, in from Crypto.Cipher._mode_ecb import _create_ecb_cipher File "/usr/local/lib/python3.12/site-packages/Crypto/Cipher/_mode_ecb.py", line 29, in from Crypto.Util._raw_api import (load_pycryptodome_raw_lib, File "/usr/local/lib/python3.12/site-packages/Crypto/Util/_raw_api.py", line 87, in ffi = FFI() ^^^^^ File "/usr/local/lib/python3.12/site-packages/cffi/api.py", line 65, in init from . import cparser File "/usr/local/lib/python3.12/site-packages/cffi/cparser.py", line 2, in from .commontypes import COMMON_TYPES, resolve_common_type SyntaxError: source code string cannot contain null bytes

Device Firmware

1.3.11

Integration Version

5.4.18

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

Docker

Search for similar issues

Yes

Additional information

also added RPi Reporter MQTT2HA Daemon at the time of upgrade which required upgrade of git python3 python3-pip python3-tzlocal python3-sdnotify python3-colorama python3-unidecode python3-apt python3-paho-mqtt python3-requests

don't know if the upgrade of one of those might have contributed

JurajNyiri commented 2 weeks ago

This is an environment issue, you will need to solve the packages installed in your system. If that is an issue I recommend using a supported install method for HA, like the ha os.

2024.06.02 works as expected when dependencies are correctly installed (automatic on ha os).