home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.07k stars 29.73k forks source link

Roborock integration: euiot.roborock.com:443 Name has no usable address #122009

Closed alessio-pascolini closed 1 month ago

alessio-pascolini commented 1 month ago

The problem

Adding the email to configure the Roborock integration I have the following error:

Logger: homeassistant.components.roborock.config_flow
Source: components/roborock/config_flow.py:79
integration: Roborock ([documentation](https://www.home-assistant.io/integrations/roborock), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+roborock%22))
First occurred: 9:04:12 AM (1 occurrences)
Last logged: 9:04:12 AM
Unexpected exception

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1203, in _create_direct_connection
    hosts = await self._resolve_host(host, port, traces=traces)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 880, in _resolve_host
    return await asyncio.shield(resolved_host_task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 917, in _resolve_host_with_throttle
    addrs = await self._resolver.resolve(host, port, family=self._family)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/resolver.py", line 33, in resolve
    infos = await self._loop.getaddrinfo(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 901, in getaddrinfo
    return await self.run_in_executor(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/socket.py", line 964, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -5] Name has no usable address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/roborock/config_flow.py", line 79, in _request_code
    await self._client.request_code()
  File "/usr/local/lib/python3.12/site-packages/roborock/web_api.py", line 88, in request_code
    base_url = await self._get_base_url()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/roborock/web_api.py", line 42, in _get_base_url
    response = await url_request.request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/roborock/web_api.py", line 302, in request
    async with session.request(
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1197, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 581, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 544, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 944, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host euiot.roborock.com:443 ssl:default [Name has no usable address]

Checking with dig inside the container the hostname is resolved correctly:

/config # dig euiot.roborock.com

; <<>> DiG 9.18.27 <<>> euiot.roborock.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22754
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 13, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: c3755f7116752430 (echoed)
;; QUESTION SECTION:
;euiot.roborock.com.            IN      A

;; ANSWER SECTION:
euiot.roborock.com.     30      IN      CNAME   api-slb-219078777.eu-central-1.elb.amazonaws.com.
api-slb-219078777.eu-central-1.elb.amazonaws.com. 30 IN A 18.193.242.247
api-slb-219078777.eu-central-1.elb.amazonaws.com. 30 IN A 18.158.250.6
api-slb-219078777.eu-central-1.elb.amazonaws.com. 30 IN A 18.198.150.154

;; AUTHORITY SECTION:
.                       30      IN      NS      l.root-servers.net.
.                       30      IN      NS      m.root-servers.net.
.                       30      IN      NS      a.root-servers.net.
.                       30      IN      NS      b.root-servers.net.
.                       30      IN      NS      c.root-servers.net.
.                       30      IN      NS      d.root-servers.net.
.                       30      IN      NS      e.root-servers.net.
.                       30      IN      NS      f.root-servers.net.
.                       30      IN      NS      g.root-servers.net.
.                       30      IN      NS      h.root-servers.net.
.                       30      IN      NS      i.root-servers.net.
.                       30      IN      NS      j.root-servers.net.
.                       30      IN      NS      k.root-servers.net.

;; Query time: 59 msec
;; SERVER: 10.96.0.10#53(10.96.0.10) (UDP)
;; WHEN: Tue Jul 16 09:11:13 CEST 2024
;; MSG SIZE  rcvd: 734

What version of Home Assistant Core has the issue?

core-2024.7.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Roborock

Link to integration documentation on our website

https://www.home-assistant.io/integrations/roborock/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 month ago

Hey there @lash-l, mind taking a look at this issue as it has been labeled with an integration (roborock) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `roborock` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign roborock` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


roborock documentation roborock source (message by IssueLinks)

alessio-pascolini commented 1 month ago

Solved in 2024.8.0, probably with the update of aiohttp library. https://github.com/home-assistant/core/commit/73a2ad7304cd9d4b7d9b3b191dae64601e203bdc

Roborock integration does not work anyway, the error now is

Logger: homeassistant
Source: /usr/src/homeassistant/homeassistant/runner.py:148
First occurred: 8:49:58 PM (5 occurrences)
Last logged: 8:51:06 PM

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/roborock/api.py", line 108, in _wait_response
    raise RoborockTimeout(f"id={request_id} Timeout after {self.queue_timeout} seconds") from None
roborock.exceptions.RoborockTimeout: id=0 Timeout after 4 seconds