PlusPlus-ua / ha_tuya_ble

Home Assistant support for Tuya BLE devices
MIT License
155 stars 98 forks source link

Tuya BLE integration import error after HA update 2024.1.0 #97

Closed JanOstrowka closed 5 months ago

JanOstrowka commented 5 months ago

Description

After updating Home Assistant recently, the Tuya BLE custom integration started throwing import errors on startup. Specifically, there is now an error importing CONF_COUNTRY_CODE from homeassistant.components.tuya.const.

Details

Component Version
Core 2024.1.0
Supervisor 2023.12.0
Operating System 11.2
Frontend 20231208.2

Log details:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 251, in _async_setup_component
    component = integration.get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 822, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_components/tuya_ble/__init__.py", line 17, in <module>
    from .cloud import HASSTuyaBLEDeviceManager
  File "/config/custom_components/tuya_ble/cloud.py", line 12, in <module>
    from homeassistant.components.tuya.const import (
ImportError: cannot import name 'CONF_COUNTRY_CODE' from 'homeassistant.components.tuya.const' (/usr/src/homeassistant/homeassistant/components/tuya/const.py)

Steps to reproduce

  1. Have Tuya BLE custom integration installed
  2. Update Home Assistant to 2024.1.0
  3. Restart and get import error on startup

Any troubleshooting help would be appreciated! Please let me know if any other details would be helpful for debugging this.

JanOstrowka commented 5 months ago

I've just noticed that it's a duplicate of the following issue https://github.com/PlusPlus-ua/ha_tuya_ble/issues/94 and a PR that resolves the issue https://github.com/PlusPlus-ua/ha_tuya_ble/pull/96