fustom / ariston-remotethermo-home-assistant-v3

Ariston NET remotethermo integration for Home Assistant based on API
MIT License
157 stars 37 forks source link

Crash if started when network is down #19

Closed vernazza closed 2 years ago

vernazza commented 2 years ago

If Home Assistant starts when the internet is not available, the integration throws an exception and dies. It is not even possible to reload it when the internet connection is available again, the only way is to restart the whole home assistant.

Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1154, in _create_direct_connection hosts = await asyncio.shield(host_resolved) File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 880, in _resolve_host addrs = await self._resolver.resolve(host, port, family=self._family) File "/usr/local/lib/python3.9/site-packages/aiohttp/resolver.py", line 33, in resolve infos = await self._loop.getaddrinfo( File "/usr/local/lib/python3.9/asyncio/base_events.py", line 856, in getaddrinfo return await self.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/socket.py", line 954, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -3] Try again

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 335, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/ariston/init.py", line 69, in async_setup_entry reponse = await api.async_connect() File "/config/custom_components/ariston/ariston.py", line 250, in async_connect response = await self.post( File "/config/custom_components/ariston/ariston.py", line 440, in post return await self.__request("POST", path, None, body) File "/config/custom_components/ariston/ariston.py", line 414, in __request response = await session.request( File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 535, in _request conn = await self._connector.connect( File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 542, in connect proto = await self._create_connection(req, traces, timeout) File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 907, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) File "/usr/local/lib/python3.9/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 www.ariston-net.remotethermo.com:443 ssl:default [Try again]

fustom commented 2 years ago

Wow! Thanks! That's an interesting problem. Sorry that I am reacting so slow. I will check it, just I am not sure when. Too many things to do.