Nest Integration Setup Failing Reauthentication

Hi Folks, I’m having an issue getting the Nest Integration set up. It is failing after I enter the project ID.
image

Here is some related log content:

Logger: homeassistant.config_entries
Source: components/nest/__init__.py:188
First occurred: 2:29:06 PM (2 occurrences)
Last logged: 4:57:51 PM

Error setting up entry OAuth for Web for nest

...

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 335, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/nest/__init__.py", line 188, in async_setup_entry
    await subscriber.start_async()
  File "/usr/local/lib/python3.9/site-packages/google_nest_sdm/google_nest_subscriber.py", line 416, in start_async
    await self._subscriber_factory.async_new_subscriber(
  File "/usr/local/lib/python3.9/site-packages/google_nest_sdm/google_nest_subscriber.py", line 261, in async_new_subscriber
    return await loop.run_in_executor(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/google_nest_sdm/google_nest_subscriber.py", line 284, in _new_subscriber
    creds = self._refresh_creds(creds)
  File "/usr/local/lib/python3.9/site-packages/google_nest_sdm/google_nest_subscriber.py", line 272, in _refresh_creds
    creds.refresh(Request())
  File "/usr/local/lib/python3.9/site-packages/google/oauth2/credentials.py", line 302, in refresh
    ) = reauth.refresh_grant(
  File "/usr/local/lib/python3.9/site-packages/google/oauth2/reauth.py", line 322, in refresh_grant
    response_status_ok, response_data = _client._token_endpoint_request_no_throw(
  File "/usr/local/lib/python3.9/site-packages/google/oauth2/_client.py", line 115, in _token_endpoint_request_no_throw
    response = request(method="POST", url=token_uri, headers=headers, body=body)
  File "/usr/local/lib/python3.9/site-packages/google/auth/transport/requests.py", line 199, in __call__
    six.raise_from(new_exc, caught_exc)
  File "<string>", line 3, in raise_from
google.auth.exceptions.TransportError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

I looked at traffic using Wireshark and it appears that Google is terminating the TCP connection after it receives the TLS Client Hello from Home Assistant.

I have read many posts regarding Nest Integration issues, but have not made progress. Has anyone come across a similar issue and/or be able to help?

Thanks in advance!

I’ve tried both Desktop App and Web App setups. Both fail in the same way.

I’m getting similar issue, any suggestions?

My Nest integration was working fine but then got this error after a reboot

Logger: homeassistant.config_entries
Source: helpers/config_entry_oauth2_flow.py:192
First occurred: 7:13:26 PM (1 occurrences)
Last logged: 7:13:26 PM

Error setting up entry Dooley’s Home for nest
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 335, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/nest/__init__.py", line 204, in async_setup_entry
    await subscriber.async_get_device_manager()
  File "/usr/local/lib/python3.9/site-packages/google_nest_sdm/google_nest_subscriber.py", line 485, in async_get_device_manager
    return await self._device_manager_task
  File "/usr/local/lib/python3.9/site-packages/google_nest_sdm/google_nest_subscriber.py", line 490, in _async_create_device_manager
    structures = await self._api.async_get_structures()
  File "/usr/local/lib/python3.9/site-packages/google_nest_sdm/google_nest_api.py", line 27, in async_get_structures
    response_data = await self._auth.get_json(self._structures_url)
  File "/usr/local/lib/python3.9/site-packages/google_nest_sdm/auth.py", line 78, in get_json
    resp = await self.get(url, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/google_nest_sdm/auth.py", line 71, in get
    resp = await self.request("get", url, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/google_nest_sdm/auth.py", line 55, in request
    access_token = await self.async_get_access_token()
  File "/usr/src/homeassistant/homeassistant/components/nest/api.py", line 51, in async_get_access_token
    await self._oauth_session.async_ensure_token_valid()
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 452, in async_ensure_token_valid
    new_token = await self.implementation.async_refresh_token(self.token)
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 87, in async_refresh_token
    new_token = await self._async_refresh_token(token)
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 174, in _async_refresh_token
    new_token = await self._token_request(
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 192, in _token_request
    resp = await session.post(self.token_url, data=data)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 634, in _request
    break
  File "/usr/local/lib/python3.9/site-packages/aiohttp/helpers.py", line 721, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError

@_Cal , it looks like my issue was networking-related. In my case I have HA running an VMware Workstation VM. The host OS is Windows 10. I believe something in the Windows 10 host was causing duplicate packets to appear to be sent by the HA virtual machine, causing all kinds of strange things, including the failure of the Nest setup. Do you also have HA in a virtual machine on a Windows host?

Yeah same thing, VM on Windows 10 Machine, What did you do to fix?

@_Cal , I fiddled around with VMware networking and nothing I did there made any difference. I googled and found this: VMWare Workstation – DUP! packet issue resolved…sort of. At the bottom of this short blog the author says they enabled, then disabled the Routing and Remote Access Service. The author of the blog said they theorized that doing so configured something that resulted in fixing their problem. It sounded dubious, but benign, so I tried it. On my system it was disabled initially, so I set to to Manual startup, started it manually, stopped it, then returned it to disabled. This was about a day ago and it’s been working since then. I also stopped seeing duplicate packets in Wireshark captures.

Also check if you have PiHole in your network. If so, try to deactivate it for the time.