ha_tuya_ble: 500 internal server error

Hi, when I try to add the integration in HA I have this message image

HA version 2023.4.6

In the logs:

Questo errore ha avuto origine da un'integrazione personalizzata.

Logger: aiohttp.server
Source: custom_components/tuya_ble/cloud.py:171
Integration: Tuya BLE
First occurred: 15:46:40 (3 occurrences)
Last logged: 16:30:16

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 146, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 148, in post
    return await super().post(request)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 71, in post
    result = await self._flow_mgr.async_init(
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 840, in async_init
    flow, result = await task
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 868, in _async_init
    result = await self._async_handle_step(flow, flow.init_step, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/tuya_ble/config_flow.py", line 237, in async_step_user
    await self._manager.build_cache()
  File "/config/custom_components/tuya_ble/cloud.py", line 215, in build_cache
    await self._fill_cache_item(item)
  File "/config/custom_components/tuya_ble/cloud.py", line 171, in _fill_cache_item
    await self._hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/tuya_iot/device.py", line 252, in update_device_list_in_smart_home
    self.update_device_function_cache()
  File "/usr/local/lib/python3.10/site-packages/tuya_iot/device.py", line 300, in update_device_function_cache
    for function in result["functions"]:
KeyError: 'functions'

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17 (9 by maintainers)

Commits related to this issue

Most upvoted comments

My generic Bluetooth adapter (not Tuya gateway) is attached to my Home Assistant server which is in the other room.

BTW, Integration can work via “Bluetooth proxy”, I’ve tested one of my devices with ESP32 based one - https://esphome.github.io/bluetooth-proxies/ However there are hard limitations.

I’ve changed and simplifying a way in which integration obtains device credentials from Tuya IOT cloud.

Please try new version.