natekspencer / hacs-vivint

Home Assistant integration for a Vivint home security system.
MIT License
66 stars 6 forks source link

Connection reset by peer. #6

Closed azafred closed 3 years ago

azafred commented 3 years ago

Getting a connection reset by peer more and more often these days. Would it be possible to add some retry logic for the login method?

`Logger: homeassistant.config_entries Source: custom_components/vivint/hub.py:65 Integration: Vivint (documentation, issues) First occurred: 3:50:23 PM (1 occurrences) Last logged: 3:50:23 PM

Error setting up entry blah@blah.com for vivint Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 969, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1050, in create_connection transport, protocol = await self._create_connection_transport( File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1080, in _create_connection_transport await waiter File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 910, in write n = self._sock.send(data) ConnectionResetError: [Errno 104] Connection reset by peer

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 293, in async_setup result = await component.async_setup_entry(hass, self) # type: ignore File "/config/custom_components/vivint/init.py", line 47, in async_setup_entry await hub.login(load_devices=True, subscribe_for_realtime_updates=True) File "/config/custom_components/vivint/hub.py", line 65, in login await self.account.connect( File "/usr/local/lib/python3.8/site-packages/vivintpy/account.py", line 60, in connect authuser_data = await self.vivintskyapi.connect() File "/usr/local/lib/python3.8/site-packages/vivintpy/vivintskyapi.py", line 48, in connect authuser_data = await self.get_vivintsky_session( File "/usr/local/lib/python3.8/site-packages/vivintpy/vivintskyapi.py", line 336, in get_vivintsky_session resp = await self.post( File "/usr/local/lib/python3.8/site-packages/vivintpy/vivintskyapi.py", line 374, in post return await self.call(self.client_session.post, path, data=data) File "/usr/local/lib/python3.8/site-packages/vivintpy/vivintskyapi.py", line 403, in __call return await method( File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 520, in _request conn = await self._connector.connect( File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 535, in connect proto = await self._create_connection(req, traces, timeout) File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 892, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection transp, proto = await self._wrap_create_connection( File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host www.vivintsky.com:443 ssl:default [Connection reset by peer] `

natekspencer commented 3 years ago

This should be handled in release 2021.7.0