TUYA integration - "Unknown error occurred"

Hi,

I’m new … first post …

I’ve setup HASS on a dedicated PC in my server rack. The details are thus:

Home Assistant 2023.10.3
Supervisor 2023.10.0
Operating System 11.0
Frontend 20231005.0 - latest

I have a ‘Zona’ home thermostat set up to run an UFH installation and am trying to connect it to HA. It seems that the thermostat needs to be connected via Tuya IoT platform, and I’ve been following the instructions here on how to do it:

The instructions are well laid out and nice and clear but when I come to the final step (i.e connecting the Tuya Cloud Project to HA) I am told “Unknown error occured”. Here’s a screenshot.

I’ve looked in the HA logs but there is nothing there that catches my eye. I am guessing that this is due to the integration having failed from the Tuya end rather than the HA end therefore there is nothing for HA to log. Here’s a copy of them:

> 2023-10-16 23:23:14.019 ERROR (MainThread) [metno] Access to https://aa015h6buqvih86i1.api.met.no/weatherapi/locationforecast/2.0/complete returned error 'ClientConnectorError'
> 
> 2023-10-16 23:23:14.020 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Home' for met integration not ready yet: Update failed: ; Retrying in background
> 
> 2023-10-16 23:24:04.406 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: radio_browser
> 
> 2023-10-16 23:24:24.428 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Radio Browser' for radio_browser integration not ready yet: Could not connect to Radio Browser API; Retrying in background
> 
> 2023-10-16 23:24:29.448 ERROR (MainThread) [homeassistant.components.homeassistant_alerts] Error requesting homeassistant_alerts data: Cannot connect to host alerts.home-assistant.io:443 ssl:default [Try again]
> 
> 2023-10-16 23:24:29.595 ERROR (MainThread) [metno] Access to https://aa015h6buqvih86i1.api.met.no/weatherapi/locationforecast/2.0/complete returned error 'ClientConnectorError'
> 
> 2023-10-16 23:24:32.445 ERROR (MainThread) [aiohttp.server] Error handling request
> 
> Traceback (most recent call last):
> 
> File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1155, in _create_direct_connection
> 
> hosts = await asyncio.shield(host_resolved)
> 
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 874, in _resolve_host
> 
> addrs = await self._resolver.resolve(host, port, family=self._family)
> 
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> File "/usr/local/lib/python3.11/site-packages/aiohttp/resolver.py", line 33, in resolve
> 
> infos = await self._loop.getaddrinfo(
> 
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> File "/usr/local/lib/python3.11/asyncio/base_events.py", line 867, in getaddrinfo
> 
> return await self.run_in_executor(
> 
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
> 
> result = self.fn(*self.args, **self.kwargs)
> 
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> File "/usr/local/lib/python3.11/socket.py", line 962, in getaddrinfo
> 
> for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
> 
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> socket.gaierror: [Errno -3] Try again
> 
> The above exception was the direct cause of the following exception:
> 
> Traceback (most recent call last):
> 
> File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
> 
> resp = await request_handler(request)
> 
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
> 
> resp = await handler(request)
> 
> ^^^^^^^^^^^^^^^^^^^^^^
> 
> File "/usr/local/lib/python3.11/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)

I’ve tried pretty much everything I can think of: deleting the project and re-making it; removing the (single) thermostat device from the account and re-adding it; changing the account login details and password (and this applies to both the App account and the Platform account, which I understand are different things.) Nothing has made any difference.

I have done some research on this forum and elsewhere (Reddit mainly) and it seems that errors like this crop up and sometimes go away after a time, with no real explanation. Can anyone offer any more advice other than to try it again tomorrow? (FWIW I’ve tried it yesterday and today.)

Thanks for your help.

I’m having this exact same problem. Any advise would be super helpful

Encountered the same Unknown error occured notice, even after trying all the basic troubleshooting. On reviewing the logs (Settings > System > Logs), it appeared that the HA container was unable to make contact with the internet, since all the Python errors were related to creating connections.

Logger: aiohttp.server
Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:421
First occurred: 1:08:08 PM (2 occurrences)
Last logged: 3:14:45 PM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/socket.py", line 962, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -3] Try again

During handling of the above exception, another exception occurred:

[...]

I checked, and sure enough, the DNS server was incorrectly configured. Not sure how, or why, but there you go! I simply updated /etc/resolv.conf with my the IP address of my router (I guess a public DNS server would also work), retried, and voilà!

Thanks for the answers. Sorry for the slow reply.

In the end I binned the Tuya controller and replaced it with a Zigbee temperature sensor and a Generic Thermostat incidence. It’s worked well ever since, and HA offers more control than the Tuya thing would have done.

I know this isn’t much help to others who may be battling with a similar device!