siku2 / hass-weatherlink

Home Assistant integration for Davis Instruments' WeatherLink and AirLink
MIT License
27 stars 7 forks source link

Missing Weatherlink Live floods log with GB of text #26

Open RhizomaticNomad opened 2 years ago

RhizomaticNomad commented 2 years ago

I've recognized, that if the Weatherlink Live drops out, this integration floods the home-assistant.log in /config with a lot of lines and in the and a lot of GB. In fact the log file grew in 24h to something like 31GB of data ... and the load during that time got 8 times as high as it is "normally". Maybe I'll do an automation that triggers a relay to switch the Weatherlink Live off and on again by a relais if it becomes unavailable, so every data is written into my DB. But maybe this integration could also prevent consuming too much as well?

siku2 commented 2 years ago

Can you share what the log contains? I don't really understand what's going on yet.

RhizomaticNomad commented 2 years ago

Of course i can share the log, sorry I didn't before.

2022-09-21 00:22:57.017 WARNING (MainThread) [custom_components.weatherlink] failed to get current conditions in 3 attempt(s)
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1064, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1049, in create_connection
    sock = await self._connect_sock(
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 960, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 500, in sock_connect
    return await fut
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 505, in _sock_connect
    sock.connect(address)
OSError: [Errno 101] Network unreachable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/weatherlink/__init__.py", line 98, in __fetch_data
    conditions = await self.session.current_conditions()
  File "/config/custom_components/weatherlink/api/rest.py", line 73, in current_conditions
    return await self._request(CurrentConditions, EP_CURRENT_CONDITIONS)
  File "/config/custom_components/weatherlink/api/rest.py", line 68, in _request
    async with self.session.get(self.base_url + path, params=params) as resp:
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1138, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 535, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 542, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 907, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.xxx.xxx:80 ssl:default [Network unreachable]

This block of log gets written every ~ 7 ms