ha_tuya_ble: Error after updating to Home Assistant 2024.2.0 update
Description
After updating to the latest Home Assistant version, my Tuya BLE custom integration started throwing an import error on startup. Specifically, there is a failure importing CONF_ACCESS_ID
from homeassistant.components.tuya.const
.
Log details
Logger: homeassistant.setup
Source: setup.py:251
First occurred: 10:42:15 PM (1 occurrences)
Last logged: 10:42:15 PM
Setup failed for custom integration 'tuya_ble': Unable to import component: cannot import name 'CONF_ACCESS_ID' from 'homeassistant.components.tuya.const' (/usr/src/homeassistant/homeassistant/components/tuya/const.py)
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 827, in get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 994, in exec_module
File "<frozen importlib._bootstrap>", line 488, 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 18, in <module>
from homeassistant.components.tuya.const import (
ImportError: cannot import name 'CONF_ACCESS_ID' from 'homeassistant.components.tuya.const' (/usr/src/homeassistant/homeassistant/components/tuya/const.py)
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Reactions: 7
- Comments: 40
Commits related to this issue
- Home Assistant 2024.2.0 FIX https://github.com/PlusPlus-ua/ha_tuya_ble/issues/111 — committed to JanOstrowka/tuya-ble by JanOstrowka 5 months ago
- Home Assistant 2024.2.0 FIX https://github.com/PlusPlus-ua/ha_tuya_ble/issues/111 — committed to JanOstrowka/tuya-ble by JanOstrowka 5 months ago
- Home Assistant 2024.2.0 FIX https://github.com/PlusPlus-ua/ha_tuya_ble/issues/111 — committed to JanOstrowka/tuya-ble by JanOstrowka 5 months ago
Thank you everyone, especially @ppcsite & @Chreece , your suggestions revived my Fingerbot back from the dead!
For Anyone curious what’s the fix, this it it:
const.py
by adding thoseconfig_flow.py
by making sure those sections look like as followcloud.py
sections below to look the sameFixed it for me. You’re amazing!
Fantastic work. I have problem as follows: when installing I get:
Error Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble
logs: This error originated from a custom integration.
Logger: homeassistant Source: custom_components/tuya_ble/config_flow.py:134 Integration: Tuya BLE First occurred: 10:39:53 (1 occurrences) Last logged: 10:39:53
Error doing job: Task exception was never retrieved Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/discovery_flow.py”, line 96, in async_start await gather_with_limited_concurrency( File "/usr/src/homeassistant/homeassistant/util/async.py", line 188, in gather_with_limited_concurrency return await gather( ^^^^^^^^^^^^^ File “/usr/src/homeassistant/homeassistant/util/async_.py”, line 186, in sem_task return await task ^^^^^^^^^^ File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 945, in async_init flow, result = await task ^^^^^^^^^^ File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 973, in _async_init result = await self._async_handle_step(flow, flow.init_step, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 501, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/config/custom_components/tuya_ble/config_flow.py”, line 239, in async_step_bluetooth return await self.async_step_login() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/config/custom_components/tuya_ble/config_flow.py”, line 282, in async_step_login return _show_login_form(self, user_input, errors, placeholders) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/config/custom_components/tuya_ble/config_flow.py”, line 134, in _show_login_form [country.name for country in TUYA_COUNTRIES] ^^^^^^^^^^^^^^ NameError: name ‘TUYA_COUNTRIES’ is not defined
Good work, I still have problem installing with message:
Config flow could not be loaded: {"message":"Invalid handler specified"}
and logs:
`Logger: homeassistant.config_entries Source: config_entries.py:2247 First occurred: 05:03:10 (9 occurrences) Last logged: 09:42:50
Error occurred loading flow for integration tuya_ble: cannot import name ‘CONF_ACCESS_ID’ from ‘homeassistant.components.tuya.const’ (/usr/src/homeassistant/homeassistant/components/tuya/const.py) Error occurred loading flow for integration tuya_ble: cannot import name ‘CONF_COUNTRY_CODE’ from ‘homeassistant.components.tuya.const’ (/usr/src/homeassistant/homeassistant/components/tuya/const.py)`
That’s what I’m using. Any other version just errors with invalid config flow
Has anyone else been getting
no unconfigured devices found
?I have overcome this by removing integration and downloading it completely from: GITHUB REPO, It must have been other changes to other files previously.