sebcaps / atmofrance

About Home assistant component to get air quality for french cities
MIT License
7 stars 3 forks source link

Probleme au démarrage #19

Open bentouspam opened 7 months ago

bentouspam commented 7 months ago

Bonjour,

Souvent, lors du reboot (propre) de HomeAssistant, le service Atmo France n'est pas démarré.

2024-03-25 16:51:20.493 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Atmo France - Boulogne-Billancourt for atmofrance
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1173, in _create_direct_connection
    hosts = await asyncio.shield(host_resolved)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 884, in _resolve_host
    addrs = await self._resolver.resolve(host, port, family=self._family)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/resolver.py", line 33, in resolve
    infos = await self._loop.getaddrinfo(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 899, in getaddrinfo
    return await self.run_in_executor(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/socket.py", line 963, 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 504, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/atmofrance/__init__.py", line 37, in async_setup_entry
    databycity = await api.get_data(entry.data[CONF_INSEE_CODE])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/atmofrance/api.py", line 58, in get_data
    await self.async_get_token()  # Always called to be sure to have a valid token
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/atmofrance/api.py", line 39, in async_get_token
    request = await self._session.post(
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 578, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 544, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 911, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1187, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host admindata.atmo-france.org:443 ssl:default [Try again]

Je désactive l'intégration avec les 3 points dans http://homeassistant.local:8123/config/integrations/integration/atmofrance , je la réactive et à chaque fois ca démarre correctement. (que ce soit directement après le boot ou au bout de plusieurs heures).

peut être un timeout un poil court ou une couche réseau pas bien réveillée ???

ma config : Raspberry-4, 4Go ram, SSD + USB adapter, Home Assistant OS 12.1 core-2024.3.3

une fois que c'est lancé, c'est toujours parfait. Merci pour cette belle intégration.