home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.94k stars 29.03k forks source link

Problem with the Solax integration #113696

Open tarrinho opened 3 months ago

tarrinho commented 3 months ago

The problem

I'm having an issue with the solax integration: I'm able to connect to solax (http://ip/api/realTimeData.htm - error code 200), but when I try to add the device in the Integration part (SolaX Power), I receive the note that it doesn't work (Unexpected error). So I decided to had a reverse proxy (Apache), and what I see is: "GET /api/realTimeData.htm HTTP/1.1" 503 506 "-" "Python/3.12 aiohttp/3.9.3"

What version of Home Assistant Core has the issue?

core-2024.3.1

What was the last working version of Home Assistant Core?

not sure, but 1 year ago, it was working

What type of installation are you running?

Home Assistant OS

Integration causing the issue

SolaX Power

Link to integration documentation on our website

https://www.home-assistant.io/integrations/solax

Diagnostics information

Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1120, in create_connection raise exceptions[0] File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1102, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1005, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 641, in sock_connect return await fut ^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 681, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') ConnectionRefusedError: [Errno 111] Connect call failed ('', 80)

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

Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/solax/inverter.py", line 61, in get_data data = await self.make_request() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/solax/inverter.py", line 75, in make_request raw_response = await self.http_client.request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/solax/inverter_http_client.py", line 56, in request return await self.get() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/solax/inverter_http_client.py", line 61, in get async with session.get(url, headers=self.headers) as req: File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1194, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ 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 _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1235, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1204, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1000, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host :80 ssl:default [Connect call failed ('192.168.2.5', 80)]

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

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/solax/config_flow.py", line 56, in async_step_user serial_number = await validate_api(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/solax/config_flow.py", line 38, in validate_api response = await api.get_data() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/solax/init.py", line 50, in get_data return await rt_request(self.inverter, 3) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/solax/init.py", line 26, in rt_request return await inv.get_data() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/solax/inverter.py", line 64, in get_data raise InverterError(msg, str(self.class.name)) from ex solax.inverter.InverterError: ('Could not connect to inverter endpoint', 'XHybrid')

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 3 months ago

Hey there @squishykid, mind taking a look at this issue as it has been labeled with an integration (solax) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `solax` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign solax` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


solax documentation solax source (message by IssueLinks)

tarrinho commented 2 months ago

Hello, any news? Is there any other information that I can supply that would help? Thanks

tarrinho commented 2 months ago

Hello Robin (@squishykid ),

did this integration stop working?

Thanks, Pedro

Darsstar commented 2 months ago

2024.5.0 has solax 3.1.0 which improves the discovery process by, among other things, consolidating identical requests.

The version of the library in your older HA instance could very well have spammed the inverter to the point it becomes unresponsive for a bit.

Consider updating, or creating a test instance with 2024.5.0 and see if that helps.

tarrinho commented 2 months ago

Did the upgrade: image

Same error: image

dretful commented 3 weeks ago

Same error as tarrinho. Would be grateful for a fix?

lstolcman commented 3 days ago

should be fixed with https://github.com/home-assistant/core/pull/115129