batpred icon indicating copy to clipboard operation
batpred copied to clipboard

Predbat keeps stalling.

Open philicibine opened this issue 7 months ago • 10 comments

Describe the bug It keeps stalling and restarting. I keep seeing this in the logs when it happens Warn: Failed to decode response from http://192.168.0.59:8123/addons/self/info Although i have setup the ha_url and ha_key parameters. Looking at the log, it doesnt seem to complete a run. It's in some sort of loop.

Predbat version 8.18.0

Environment details Hassos on RPi 4 2gb

  • Inverter and battery setup - Solax modbus with Solis hybrid inverter and Dowell 10kw battery
  • Standard HAOS installer - Standard

Log file predbat.log

Predbat debug yaml file predbat_debug.yaml.txt predbat_debug_11_30_00.yaml.txt

Relevant part of the logs..

2025-04-05 07:24:16.640402: Info: Start socket for url http://192.168.0.59:8123/api/websocket
2025-04-05 07:24:16.645919: Error: Web Socket exception in startup: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]
2025-04-05 07:24:16.691051: Error: Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1076, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1060, in create_connection
    sock = await self._connect_sock(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 969, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
    return await fut
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.0.59', 8123)

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

Traceback (most recent call last):
  File "/config/ha.py", line 199, in socketLoop
    async with session.ws_connect(url) as websocket:
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 1167, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 805, in _ws_connect
    resp = await self.request(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 562, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 901, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1178, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]

2025-04-05 07:24:16.691821: Warn: Web Socket closed, will try to reconnect in 5 seconds - error count 1
2025-04-05 07:24:21.700312: Info: Start socket for url http://192.168.0.59:8123/api/websocket
2025-04-05 07:24:21.704715: Error: Web Socket exception in startup: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]
2025-04-05 07:24:21.706798: Error: Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1076, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1060, in create_connection
    sock = await self._connect_sock(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 969, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
    return await fut
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.0.59', 8123)

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

Traceback (most recent call last):
  File "/config/ha.py", line 199, in socketLoop
    async with session.ws_connect(url) as websocket:
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 1167, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 805, in _ws_connect
    resp = await self.request(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 562, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 901, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1178, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]

2025-04-05 07:24:21.707609: Warn: Web Socket closed, will try to reconnect in 5 seconds - error count 2
2025-04-05 07:24:26.716008: Info: Start socket for url http://192.168.0.59:8123/api/websocket
2025-04-05 07:24:26.721616: Error: Web Socket exception in startup: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]
2025-04-05 07:24:26.723650: Error: Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1076, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1060, in create_connection
    sock = await self._connect_sock(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 969, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
    return await fut
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.0.59', 8123)

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

Traceback (most recent call last):
  File "/config/ha.py", line 199, in socketLoop
    async with session.ws_connect(url) as websocket:
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 1167, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 805, in _ws_connect
    resp = await self.request(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 562, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 901, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1178, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]

2025-04-05 07:24:26.724424: Warn: Web Socket closed, will try to reconnect in 5 seconds - error count 3
2025-04-05 07:24:31.728324: Info: Start socket for url http://192.168.0.59:8123/api/websocket
2025-04-05 07:24:31.733439: Error: Web Socket exception in startup: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]
2025-04-05 07:24:31.735305: Error: Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1076, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1060, in create_connection
    sock = await self._connect_sock(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 969, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
    return await fut
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.0.59', 8123)

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

Traceback (most recent call last):
  File "/config/ha.py", line 199, in socketLoop
    async with session.ws_connect(url) as websocket:
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 1167, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 805, in _ws_connect
    resp = await self.request(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 562, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 901, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1178, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]

2025-04-05 07:24:31.735885: Warn: Web Socket closed, will try to reconnect in 5 seconds - error count 4
2025-04-05 07:24:36.740459: Info: Start socket for url http://192.168.0.59:8123/api/websocket
2025-04-05 07:24:36.745230: Error: Web Socket exception in startup: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]
2025-04-05 07:24:36.747361: Error: Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1076, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1060, in create_connection
    sock = await self._connect_sock(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 969, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
    return await fut
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.0.59', 8123)

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

Traceback (most recent call last):
  File "/config/ha.py", line 199, in socketLoop
    async with session.ws_connect(url) as websocket:
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 1167, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 805, in _ws_connect
    resp = await self.request(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 562, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 901, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1178, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]

2025-04-05 07:24:36.748147: Warn: Web Socket closed, will try to reconnect in 5 seconds - error count 5
2025-04-05 07:24:41.752307: Info: Start socket for url http://192.168.0.59:8123/api/websocket
2025-04-05 07:24:41.756802: Error: Web Socket exception in startup: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]
2025-04-05 07:24:41.758564: Error: Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1076, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1060, in create_connection
    sock = await self._connect_sock(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 969, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
    return await fut
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.0.59', 8123)

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

Traceback (most recent call last):
  File "/config/ha.py", line 199, in socketLoop
    async with session.ws_connect(url) as websocket:
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 1167, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 805, in _ws_connect
    resp = await self.request(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 562, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 901, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1178, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]

2025-04-05 07:24:41.759140: Warn: Web Socket closed, will try to reconnect in 5 seconds - error count 6
2025-04-05 07:24:46.765230: Info: Start socket for url http://192.168.0.59:8123/api/websocket
2025-04-05 07:24:46.769943: Error: Web Socket exception in startup: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]
2025-04-05 07:24:46.771615: Error: Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1076, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1060, in create_connection
    sock = await self._connect_sock(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 969, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
    return await fut
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.0.59', 8123)

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

Traceback (most recent call last):
  File "/config/ha.py", line 199, in socketLoop
    async with session.ws_connect(url) as websocket:
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 1167, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 805, in _ws_connect
    resp = await self.request(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 562, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 901, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1178, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]

2025-04-05 07:24:46.772185: Warn: Web Socket closed, will try to reconnect in 5 seconds - error count 7
2025-04-05 07:24:51.776379: Info: Start socket for url http://192.168.0.59:8123/api/websocket
2025-04-05 07:24:51.781041: Error: Web Socket exception in startup: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]
2025-04-05 07:24:51.782678: Error: Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1076, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1060, in create_connection
    sock = await self._connect_sock(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 969, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
    return await fut
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.0.59', 8123)

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

Traceback (most recent call last):
  File "/config/ha.py", line 199, in socketLoop
    async with session.ws_connect(url) as websocket:
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 1167, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 805, in _ws_connect
    resp = await self.request(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 562, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 901, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1178, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]

2025-04-05 07:24:51.783231: Warn: Web Socket closed, will try to reconnect in 5 seconds - error count 8
2025-04-05 07:24:56.788891: Info: Start socket for url http://192.168.0.59:8123/api/websocket
2025-04-05 07:24:56.797503: Error: Web Socket exception in startup: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]
2025-04-05 07:24:56.799647: Error: Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1076, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1060, in create_connection
    sock = await self._connect_sock(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 969, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
    return await fut
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.0.59', 8123)

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

Traceback (most recent call last):
  File "/config/ha.py", line 199, in socketLoop
    async with session.ws_connect(url) as websocket:
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 1167, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 805, in _ws_connect
    resp = await self.request(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 562, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 901, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1178, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]

2025-04-05 07:24:56.803661: Warn: Web Socket closed, will try to reconnect in 5 seconds - error count 9
2025-04-05 07:25:00.448853: Error: HTTPConnectionPool(host='192.168.0.59', port=8123): Max retries exceeded with url: /api/states (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb6469120>: Failed to establish a new connection: [Errno 111] Connection refused'))
2025-04-05 07:25:01.812337: Info: Start socket for url http://192.168.0.59:8123/api/websocket
2025-04-05 07:25:01.818587: Error: Web Socket exception in startup: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]
2025-04-05 07:25:01.820372: Error: Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1076, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1060, in create_connection
    sock = await self._connect_sock(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 969, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
    return await fut
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.0.59', 8123)

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

Traceback (most recent call last):
  File "/config/ha.py", line 199, in socketLoop
    async with session.ws_connect(url) as websocket:
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 1167, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 805, in _ws_connect
    resp = await self.request(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 562, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 901, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 1178, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.0.59:8123 ssl:default [Connect call failed ('192.168.0.59', 8123)]

2025-04-05 07:25:01.820987: Warn: Web Socket closed, will try to reconnect in 5 seconds - error count 10
2025-04-05 07:25:06.824703: Error: Web socket failed 10 times, stopping
2025-04-05 07:25:06.825046: Error: Web Socket failed to reconnect, stopping....
2025-04-05 07:25:16.518891: Error: HA interface not active and db_primary is False
2025-04-05 07:25:16.519219: Error: HA interface not active
2025-04-05 07:25:16.521676: Stopping Predbat
2025-04-05 07:25:16.521878: Predbat terminating
2025-04-05 07:25:17.524557: Predbat terminated

philicibine avatar Apr 13 '25 10:04 philicibine

I have a fix for this in PR #2220

You can either pull ha.py from my PR, or comment ha_url and ha_key out in apps.yaml and it should stop this happening.

The problem is that when you set ha_url the call to the HA supervisor doesn't work and it will error. Strange that its just started looping your predbat, mine is OK.

gcoan avatar Apr 13 '25 11:04 gcoan

I put the PR onto main earlier today for testing

springfall2008 avatar Apr 13 '25 18:04 springfall2008

Thanks. Will test and if anything is wrong will let you know.

philicibine avatar Apr 13 '25 18:04 philicibine

Hi, I did still get a couple of occurrences of stalling overnight. Will comment out ha_key and ha_url for now.

philicibine avatar Apr 14 '25 06:04 philicibine

Hi, I did still get a couple of occurrences of stalling overnight. Will comment out ha_key and ha_url for now.

looking again at the errors you are getting (assume they are the same), its that the web socket connection to HA can't be made, that the connection is closed.

I'm wondering whether the issue is the 2Gb memory on your Pi4 and whether you are just running out of memory running Predbat, Solax modbus, plus whatever else you are running?

Are there any addons that you could stop or integrations you could disable to see if this reduces the errors you get?

Is there any errors in the supervisor or host logs?

gcoan avatar Apr 14 '25 06:04 gcoan

I just caught it when it error'd and i see this in the supervisor logs ERROR (MainThread) [supervisor.api.ingress] Ingress error: Cannot connect to host 172.30.33.4:5052 ssl:default [Connect call failed ('172.30.33.4', 5052)]

Seeing this in the host logs

2025-04-14 15:29:32.608 homeassistant kernel: hassio: port 10(veth064c2f7) entered disabled state
2025-04-14 15:29:32.609 homeassistant kernel: veth064c2f7: entered allmulticast mode
2025-04-14 15:29:32.612 homeassistant kernel: veth064c2f7: entered promiscuous mode
2025-04-14 15:29:32.612 homeassistant kernel: hassio: port 10(veth064c2f7) entered blocking state
2025-04-14 15:29:32.612 homeassistant kernel: hassio: port 10(veth064c2f7) entered forwarding state
2025-04-14 15:29:32.612 homeassistant NetworkManager[507]: <info>  [1744644572.6114] manager: (veth064c2f7): new Veth device (/org/freedesktop/NetworkManager/Devices/41)
2025-04-14 15:29:32.688 homeassistant kernel: eth0: renamed from veth8354981
2025-04-14 15:29:32.703 homeassistant NetworkManager[507]: <info>  [1744644572.7035] device (veth064c2f7): carrier: link connected```

philicibine avatar Apr 14 '25 15:04 philicibine

Also.. i stand corrected about the hardware i am running hassos on.. its an rpi4 with 4gb of ram. checking htop.. i am not even using half of the available ram.

philicibine avatar Apr 14 '25 18:04 philicibine

a pi4 with 4gb should be absolutely fine, so that's not the issue.

The host and supervisor log don't really give much of a clue, other than the connection has failed

gcoan avatar Apr 14 '25 20:04 gcoan

Does Predbat restart correctly after this error and connect again?

springfall2008 avatar Apr 15 '25 18:04 springfall2008

It seems to connect again.. but then loses connection again after a short time. Like I said, it seems to get stuck in a loop

philicibine avatar Apr 15 '25 19:04 philicibine