EOS_connect icon indicating copy to clipboard operation
EOS_connect copied to clipboard

Connection problem

Open Maggi0r opened this issue 1 year ago • 11 comments

I have the following problem. I use Home Assistant, which includes both EOS and EOS Connect. However, I can't connect. See here: "No processing possible - connection to EOS server timed out." Regardless of whether I use the IP from my HA or set it to 127.0.0.1 or 0.0.0.0, the problem is always the same. I hope you have a solution. In my EOS config.json, the host IP is 0.0.0.0. As soon as I change it via the EOS interface, it doesn't change in the json. After restarting EOS, it's always 0.0.0.0.

Best regards, Magi

Maggi0r avatar Jun 27 '25 18:06 Maggi0r

I do not have Home Assistant running but changing the timeout in the config.yaml helped me a lot. see https://github.com/ohAnd/EOS_connect/discussions/30

HolBaum5 avatar Jun 27 '25 19:06 HolBaum5

Ok Thanks but where is the Config.yaml from EOS Connect. I cant found this?

Greets Maggi

Maggi0r avatar Jun 27 '25 19:06 Maggi0r

@HolBaum5 thanks for supporting

@Maggi0r the config.yaml in the HA addon is the "configuration tab" at the addon: and the parameter is called 'Refresh Time' default with 3 min - and if the machine were EOS is running needs more time, then the error message above apears

plain view inner the config:

refresh_time: 3

So start maybe with 15 min

ohAnd avatar Jun 27 '25 20:06 ohAnd

I found the refresh time issue. But unfortunately, that doesn't help. The problem still persists. I can't connect.

Maggi0r avatar Jun 28 '25 10:06 Maggi0r

revert my recent post --- was too late ;-)

@HolBaum5 thanks for supporting

@Maggi0r the config.yaml in the HA addon is the "configuration tab" at the addon: and the parameter is called 'Refresh Time' default with 3 min - and if the machine were EOS is running needs more time, then the error message above apears

plain view inner the config:

refresh_time: 3 So start maybe with 15 min

as @HolBaum5 already mentioned correctly ... please adapt the timeout at eos settings:

server: 192.168.1.94
port: 8503
timeout: 240 # this maybe to 900 sec (= 15 min)

AND adapt the refresh time accordingly ... means 'timeout' has to be smaller then the 'refrest_time'

my recent comment only brought a longer cycle time between the optimizatioin rounds

[EDIT] and to check if eos is reachable with your assumed IP - please check with 'http://<your_ip_of_eos>:8503/docs#/' if the API documenation is shown here - if not then there is a problem with the eos installation

ohAnd avatar Jun 28 '25 11:06 ohAnd

@Maggi0r is the problem still given?

ohAnd avatar Jul 22 '25 19:07 ohAnd

I'm having the same Problem. To make sure, that the api is working I tried to connect to http://<ha_ip>:8503/docs#/ with a browser. If I'm understanding this correcly, this should display some kind of documentation or swaggerui. Unfortunately I only get a connection refused response. Do I have to install a seperate instance of EOS or is this bundeled with the existing eos_connect addon?

Xexanos avatar Sep 26 '25 16:09 Xexanos

Not sure if it helps, but I activated debug logging and here is my log output from where the error happens:

2025-09-26 17:53:06 INFO [EOS] OPTIMIZE request optimization with: http://localhost:8503/optimize?start_hour=17 - and with timeout: 900
Exception in thread Thread-5 (_update_state_loop):
Traceback (most recent call last):
  File "/opt/venv/lib/python3.12/site-packages/urllib3/connection.py", line 198, in _new_conn
    sock = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/urllib3/util/connection.py", line 85, in create_connection
    raise err
  File "/opt/venv/lib/python3.12/site-packages/urllib3/util/connection.py", line 73, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/opt/venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 493, in _make_request
    conn.request(
  File "/opt/venv/lib/python3.12/site-packages/urllib3/connection.py", line 494, in request
    self.endheaders()
  File "/usr/lib/python3.12/http/client.py", line 1333, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.12/http/client.py", line 1093, in _send_output
    self.send(msg)
  File "/usr/lib/python3.12/http/client.py", line 1037, in send
    self.connect()
  File "/opt/venv/lib/python3.12/site-packages/urllib3/connection.py", line 325, in connect
    self.sock = self._new_conn()
                ^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/urllib3/connection.py", line 213, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f98aac710>: Failed to establish a new connection: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/opt/venv/lib/python3.12/site-packages/requests/adapters.py", line 644, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 841, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/urllib3/util/retry.py", line 519, in increment
    raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8503): Max retries exceeded with url: /optimize?start_hour=17 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f98aac710>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/src/interfaces/eos_interface.py", line 137, in eos_set_optimize_request
    response = requests.post(
               ^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/requests/api.py", line 115, in post
    return request("post", url, data=data, json=json, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/requests/adapters.py", line 677, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8503): Max retries exceeded with url: /optimize?start_hour=17 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f98aac710>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.12/threading.py", line 1012, in run
    self._target(*self._args, **self._kwargs)
  File "/app/src/eos_connect.py", line 522, in _update_state_loop
    self.run_optimization()
  File "/app/src/eos_connect.py", line 575, in run_optimization
    optimized_response = eos_interface.eos_set_optimize_request(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/src/interfaces/eos_interface.py", line 155, in eos_set_optimize_request
    "[EOS] OPTIMIZE Request failed: %s - response: %s", e, response
                                                           ^^^^^^^^
UnboundLocalError: cannot access local variable 'response' where it is not associated with a value
2025-09-26 17:53:07 DEBUG [EVCC] fetching evcc state with url: http://192.168.178.27:7070/api/state```

Xexanos avatar Sep 26 '25 16:09 Xexanos

I'm having the same Problem. To make sure, that the api is working I tried to connect to http://<ha_ip>:8503/docs#/ with a browser. If I'm understanding this correcly, this should display some kind of documentation or swaggerui. Unfortunately I only get a connection refused response. Do I have to install a seperate instance of EOS or is this bundeled with the existing eos_connect addon?

Hi, yes, you need an already running instance of EOS. Check https://github.com/ohAnd/EOS_connect?tab=readme-ov-file#1-requirements

btw: The basic error that you see have to be checked/ catched to log a more useful and understandable error message, for this I will use this issue and close with the fix.

ohAnd avatar Sep 26 '25 21:09 ohAnd

Ok. I was not sure, if that was the case, since the addon repository did not provide a way to let it run within home assistant. Any tips on how to install it? As far as I know it is not possible to use the official docker image in HAOS. Or would you recommend running it on a different device. I have a truenas instance in my home, but I would prefer it to run this software on a single device to decrease the risk of something going wrong because my nas is down...

Xexanos avatar Sep 26 '25 21:09 Xexanos

My bad. After a little bit more reading I found the part, where you linked to Duettings repository for the eos-addon.

Xexanos avatar Sep 26 '25 21:09 Xexanos