xZetsubou / hass-localtuya

🔹 A Home Assistant integration to handle Tuya devices locally "fork from localtuya"
https://xzetsubou.github.io/hass-localtuya/
GNU General Public License v3.0
366 stars 40 forks source link

[Bug]: Cannot connect to Cloud API #340

Closed Tony763 closed 2 weeks ago

Tony763 commented 2 weeks ago

LocalTuya Version

2024.7.0 (master)

Home Assistant Version

2024.8.2

Environment

What happened?

Sending form with credentials for Cloud API show Unknown error occurred.

Steps to reproduce.

  1. Add localTuya integration
  2. Fill form with credentials
  3. Hit Send button

Relevant log output

2024-08-23 23:12:52.395 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 456, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 537, in _handle
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
return await func(self, request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
return await super().post(request, flow_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
return await method(view, request, data, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
result = await self._flow_mgr.async_configure(flow_id, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 366, in async_configure
result = await self._async_configure(flow_id, user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 413, in _async_configure
result = await self._async_handle_step(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 516, in _async_handle_step
result: _FlowResultT = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/localtuya/config_flow.py", line 200, in async_step_user
if "1106" in res["msg"]:
^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

Diagnostics information.

No response

xZetsubou commented 2 weeks ago

Don't use master version for now, install the latest release and ensure the Client ID, Secret and User ID are all correct

There is a bug in master version that has been fixed in #325

Tony763 commented 2 weeks ago

325 fixed problem :slightly_smiling_face: Connection to Cloud API now works. Thanks

Tony763 commented 2 weeks ago

Another one:

2024-08-24 20:06:21.381 ERROR (SyncWorker_11) [homeassistant.util.logging] Exception in _update_handler when dispatching 'localtuya_bf72453274xxxxxxxxxxxxxx': ({'3': 220, '4': False, '7': 'opened', '9': 'closed', '14': 54, '104': 75},)
Traceback (most recent call last):
File "/config/custom_components/localtuya/entity.py", line 176, in _update_handler
self.status_updated()
File "/config/custom_components/localtuya/climate.py", line 467, in status_updated
self.dp_value(CONF_TARGET_TEMPERATURE_DP) * self._precision_target
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'
xZetsubou commented 2 weeks ago

This is a different issue. You may need to post your device diagnostic to check what configuration you made incorrectly. You can download device diagnostic from the device page in Homeassistant