Have to re login Hangouts ever reboot/restart

Is there a fix or a known issue to my problem? everytime i restart home assistant i get kicked out of hangouts. I have to remove the integration and re login with the oath_code to get it resolved

20-09-09 12:10:35 ERROR (MainThread) [homeassistant.util.logging] Exception in async_handle_update_users_and_conversations when dispatching 'hangouts_connected': ()
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/hangouts/hangouts_bot.py", line 341, in async_handle_update_users_and_conversations
    await self._async_list_conversations()
  File "/usr/src/homeassistant/homeassistant/components/hangouts/hangouts_bot.py", line 310, in _async_list_conversations
    ) = await hangups.build_user_conversation_list(self._client)
  File "/usr/local/lib/python3.8/site-packages/hangups/conversation.py", line 30, in build_user_conversation_list
    conv_states, sync_timestamp = await _sync_all_conversations(client)
  File "/usr/local/lib/python3.8/site-packages/hangups/conversation.py", line 110, in _sync_all_conversations
    response = await client.sync_recent_conversations(request)
  File "/usr/local/lib/python3.8/site-packages/hangups/client.py", line 672, in sync_recent_conversations
    await self._pb_request('conversations/syncrecentconversations',
  File "/usr/local/lib/python3.8/site-packages/hangups/client.py", line 413, in _pb_request
    res = await self._base_request(
  File "/usr/local/lib/python3.8/site-packages/hangups/client.py", line 469, in _base_request
    res = await self._session.fetch(
  File "/usr/local/lib/python3.8/site-packages/hangups/http_utils.py", line 86, in fetch
    raise exceptions.NetworkError(
hangups.exceptions.NetworkError: Request return unexpected status: 401: Unauthorized

The same for me

And for me as well. But I have found workaround: looks like it is not really necessary to re-login, it is possible to just call service hangouts.reconnect from developer panel. It does not always work from the first time but usually does after a couple attempts.

yes thanks !!


I also have this issue and from what I read from the Hangups github (used by the Hangouts integration) is that google is testing a new api for hangouts which does not work well with quotes in the authentication cookie.
Requests are probably randomly routed to the new (broken) or old (working) api.
The hangups library has a workaround in version 0.4.11, but home assitant is using 0.4.9 right now.
See this issue in the hangups github: https://github.com/tdryer/hangups/issues/498.

I installed hangups 0.4.11 and things seems to work nicely now.

I am using home assistant container on linux:

  1. SSH to your home assistant host machine.
  2. Find the home assistant container name (in my case it is hass): Docker ps
  3. connect to the container instance: docker exec -it hass bash
  4. go to the hangouts integration folder: cd /usr/src/homeassistant/homeassistant/components/hangouts/
  5. edit the manifest file: vi manifest.json
  6. Change the current hangups version from 0.4.10 (if you are on latest) to 0.4.11: follow sections 5 and 7 to edit and save the version: https://staff.washington.edu/rells/R110/
  7. Restart home assistant (not the container!)
  8. Home assistant will install the new version at bootup. If you restart the container, those changes will be lost. Using the restart button in home assistant web page is fine.
1 Like

This fixed it for me. Is there a FR open for a Hangups version bump?

I only see this one for 0.4.10: https://github.com/home-assistant/core/pull/39312

Updating it to 0.4.11 also fixed it for me. Thanks!

They opened a PR for us https://github.com/home-assistant/core/pull/40258 it will come in the .2 release based off of what I read