Failed to setup - old setup stopped working, cannot setup again
whereizben opened this issue · comments
Describe the bug
Wyze integration "Failed to setup".
Prior to this evening, I have had ~30 devices setup with the Wyze integration, but this evening I noticed that they had all become Unavailable. So, I tried to reload the integration and now I get "Failed to setup".
I did update to Home Assistant 2023.7.2 tonight - I tried to rollback to a backup from last night, and have the same issue. After re-upgrading to 2023.7.2, it prompted me to reauthenticate using my username, password and MFA code, and told me “reauthentication successful”.
I also tried removing the integration and adding it back again, and get the same "Failed to setup".
Note that today (although I do NOT think the timing coincides) I setup my PiHole (it had stopped working and needed to be wiped and setup again). To help test this, I tried all the steps with my PiHole disabled, as well as doing dig (below) with both the default DNS as well as CloudFlare.
To Reproduce
When I try to add the integration, it lets me put in my username, password and then MFA code.
Expected behavior
Should setup and let me control Wyze devices.
System configuration
System: Bare Metal - Home Assistant Blue
HA Version: 2023.7.2 as well as 2023.7.1
WyzeApi Version: 0.1.19
Based on this line from logs, below: Cannot connect to host api.wyzecam.com:443 ssl:default [Name has no usable address]
I went to terminal on my Home Assistant and tried dig api.wyzecam.com and then tried dig @1.1.1.1 api.wyzecam.com, and see no substantial difference. I also tried dig api.wyzecam.com from another machine (my Mac) on the same network, with different results (third dig entry, below). Note that from my Mac terminal, I get IP addresses returned. Both devices are on the same network, using a Pihole for DNS, and I can see in the query logs of my Pihole that the query is not blocked. I also tested all the above steps with the Pihole disabled, with the same result.
; <<>> DiG 9.18.13 <<>> api.wyzecam.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52137
;; flags: qr aa cd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 8b3d43e31267b2ee (echoed)
;; QUESTION SECTION:
;api.wyzecam.com. IN A
;; ANSWER SECTION:
api.wyzecam.com. 34 IN CNAME core-prod-cloud-gateway-1340290424.us-west-2.elb.amazonaws.com.
;; Query time: 4 msec
;; SERVER: 127.0.0.11#53(127.0.0.11) (UDP)
;; WHEN: Wed Jul 19 23:18:09 PDT 2023
;; MSG SIZE rcvd: 129
; <<>> DiG 9.18.13 <<>> @1.1.1.1 api.wyzecam.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7719
;; flags: qr aa cd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;api.wyzecam.com. IN A
;; ANSWER SECTION:
api.wyzecam.com. 50 IN CNAME core-prod-cloud-gateway-1340290424.us-west-2.elb.amazonaws.com.
;; Query time: 0 msec
;; SERVER: 1.1.1.1#53(1.1.1.1) (UDP)
;; WHEN: Wed Jul 19 23:17:53 PDT 2023
;; MSG SIZE rcvd: 106
THIS IS FROM ANOTHER MACHINE ON THE SAME NETWORK
; <<>> DiG 9.10.6 <<>> api.wyzecam.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17935
;; flags: qr rd ra; QUERY: 1, ANSWER: 9, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;api.wyzecam.com. IN A
;; ANSWER SECTION:
api.wyzecam.com. 40 IN CNAME core-prod-cloud-gateway-1340290424.us-west-2.elb.amazonaws.com.
core-prod-cloud-gateway-1340290424.us-west-2.elb.amazonaws.com. 29 IN A 52.43.91.177
core-prod-cloud-gateway-1340290424.us-west-2.elb.amazonaws.com. 29 IN A 52.36.56.169
core-prod-cloud-gateway-1340290424.us-west-2.elb.amazonaws.com. 29 IN A 52.33.140.63
core-prod-cloud-gateway-1340290424.us-west-2.elb.amazonaws.com. 29 IN A 44.235.207.152
core-prod-cloud-gateway-1340290424.us-west-2.elb.amazonaws.com. 29 IN A 52.24.102.221
core-prod-cloud-gateway-1340290424.us-west-2.elb.amazonaws.com. 29 IN A 54.187.37.80
core-prod-cloud-gateway-1340290424.us-west-2.elb.amazonaws.com. 29 IN A 35.165.58.190
core-prod-cloud-gateway-1340290424.us-west-2.elb.amazonaws.com. 29 IN A 54.186.226.18
;; Query time: 15 msec
;; SERVER: 10.0.1.20#53(10.0.1.20)
;; WHEN: Wed Jul 19 23:45:03 PDT 2023
;; MSG SIZE rcvd: 248
home-assistant.log
Logger: homeassistant.config_entries
Source: custom_components/wyzeapi/init.py:121
Integration: Wyze Home Assistant Integration (documentation, issues)
First occurred: 23:03:34 (2 occurrences)
Last logged: 23:09:16
Error setting up entry for wyzeapi
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1152, 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 -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/config_entries.py", line 390, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/wyzeapi/init.py", line 121, in async_setup_entry
mac_addresses = await client.unique_device_ids
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/wyzeapy/init.py", line 138, in unique_device_ids
devices = await self._service.get_object_list()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/wyzeapy/services/base_service.py", line 119, in get_object_list
response_json = await self._auth_lib.post("https://api.wyzecam.com/app/v2/home_page/get_object_list",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/wyzeapy/wyze_auth_lib.py", line 219, in post
response = await _session.post(url, json=json, headers=headers, data=data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 536, in _request
conn = await self._connector.connect(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect
proto = await self._create_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 901, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1166, in _create_direct_connection
raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.wyzecam.com:443 ssl:default [Name has no usable address]
Seems related to running unbound locally and/or using DNSSEC - if I change my pihole to using cloudflare directly without DNSSEC (I’ll sort out later which is the issue), then I am able to get this to load.
Sorry about that!