core: Hangouts Stops Working With Session Closed

Home Assistant release with the issue:

0.80.3

Last working Home Assistant release (if known): All

Operating environment (Hass.io/Docker/Windows/etc.):

virtual environment

Component/platform:

hangouts: https://www.home-assistant.io/components/hangouts/ Description of problem:

As reported in #16593 the hangouts component stops working randomly with a session is closed error and requires a Home Assistant restart to resolve. There was an attempted fix #17518 that was released in 0.80.3 but it seems like the fix is still not working.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

configured via config entry

Traceback (if applicable):

2018-10-19 09:13:20 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall hangouts.send_message (c:284e26ee0dd74401a6af87e78fe9f767): target=[OrderedDict([('id', 'SECRET')])], message=[OrderedDict([('text', "Welcome home! Do you need help? Type 'help' or 'yes' if yes.")])]>
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1177, in _event_to_service_call
    await service_handler.func(service_call)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/hangouts/hangouts_bot.py", line 310, in async_handle_send_message
    service.data.get(ATTR_DATA, {}))
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/hangouts/hangouts_bot.py", line 284, in _async_send_message
    await conv.send_message(messages, image_file)
  File "/srv/homeassistant/lib/python3.6/site-packages/hangups/conversation.py", line 439, in send_message
    await self._client.send_chat_message(request)
  File "/srv/homeassistant/lib/python3.6/site-packages/hangups/client.py", line 591, in send_chat_message
    send_chat_message_request, response)
  File "/srv/homeassistant/lib/python3.6/site-packages/hangups/client.py", line 417, in _pb_request
    request_pb.SerializeToString()
  File "/srv/homeassistant/lib/python3.6/site-packages/hangups/client.py", line 470, in _base_request
    'post', url, headers=headers, params=params, data=data,
  File "/srv/homeassistant/lib/python3.6/site-packages/hangups/http_utils.py", line 64, in fetch
    headers=headers, data=data) as res:
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/client.py", line 855, in __aenter__
    self._resp = await self._coro
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/client.py", line 254, in _request
    raise RuntimeError('Session is closed')
RuntimeError: Session is closed

Additional information: cc: @hobbypunk90

If we decide to reopen #16593 we can close this if not we should keep this open

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 37 (15 by maintainers)

Most upvoted comments

There hasn’t been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@PedroLamas it does not automatically reconnect so the service hangouts.reconnect was created to help with the session being closed. This still happens today as well. There are multiple reasons for it to happen, I notice it happens most often when internet goes down but sometimes it just looses the session for no reason and the service has to be called to reconnect since the internal logic does not do it.

Yup this is definitely still an issue I just got hit by it yesterday. Had to call the hangouts.reconnect service

Thanks for the hangouts.reconnect service trick. Could there be a way to automate this? Say check the service somehow every hour and call the service?

Mine doesn’t seem to disconnect very often, is there any harm in setting up an automation to call the service every x time? Say once a day or something?

Yup this is definitely still an issue I just got hit by it yesterday. Had to call the hangouts.reconnect service