Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solax Power Integration Regularly Fails to Start-Up on HAOS Startup #109968

Closed
LoznOz opened this issue Feb 8, 2024 · 15 comments · Fixed by #117767 · May be fixed by #115580
Closed

Solax Power Integration Regularly Fails to Start-Up on HAOS Startup #109968

LoznOz opened this issue Feb 8, 2024 · 15 comments · Fixed by #117767 · May be fixed by #115580

Comments

@LoznOz
Copy link

LoznOz commented Feb 8, 2024

The problem

By way of background. I'm doing a lot of work in setting up energy monitoring. Accordingly I've been restarting HA multiple times a day and mostly but not every time I see that the 'Solax Power' Integration failed to start-up, resulting in me having to manually restart it after which it works fine. This issue for me is unique to this integration i.e. all other integrations start normally. I am months new to HA, this is my first report hopefully i get it rihjt.

What version of Home Assistant Core has the issue?

core-2024.2.0

What was the last working version of Home Assistant Core?

No response

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

home-assistant_solax_2024-02-08T09-16-29.206Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

024-02-08 19:55:46.636 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback DiscoveryState._task_handler(<Task finishe...imeoutError()>)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 57, in _task_handler
    result = task.result()
             ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 69, in _discovery_task
    await i.get_data()
  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 55, in request
    return await self.post()
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/inverter_http_client.py", line 70, in post
    async with session.post(url, headers=self.headers, data=data) 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 605, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 961, in start
    with self._timer:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/helpers.py", line 735, in __exit__
    raise asyncio.TimeoutError from None
TimeoutError
2024-02-08 19:55:46.652 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback DiscoveryState._task_handler(<Task finishe...imeoutError()>)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 57, in _task_handler
    result = task.result()
             ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 69, in _discovery_task
    await i.get_data()
  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 55, in request
    return await self.post()
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/inverter_http_client.py", line 70, in post
    async with session.post(url, headers=self.headers, data=data) 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 605, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 961, in start
    with self._timer:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/helpers.py", line 735, in __exit__
    raise asyncio.TimeoutError from None
TimeoutError

Additional information

It 'feels' like a timeout error watching the boot process on screen but that's a wild guess.
No sure what else I can add here to be more specific - open to assist any way I can?

@home-assistant
Copy link

home-assistant bot commented Feb 8, 2024

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)

@thetastate1
Copy link

This has been happening since 2023.11.0. For me it fails to load every time on HA restart. Works every time after deleting and reconfiguring. It can take a few minutes to load. I have static IP for the Solax inverter and now know its IP without checking.

@LoznOz
Copy link
Author

LoznOz commented Feb 8, 2024

Yes I should have mentioned I have static ip too, and I'm Wifi connected to the Inverter which is model Solax Hybrid Inverter SK-TL5000E

@LoznOz
Copy link
Author

LoznOz commented Feb 8, 2024

This has been happening since 2023.11.0. For me it fails to load every time on HA restart. Works every time after deleting and reconfiguring. It can take a few minutes to load. I have static IP for the Solax inverter and now know its IP without checking.

If you just restart integration does it start like mine does? (ie I don't need to delete & reconfigure)

@thetastate1
Copy link

thetastate1 commented Feb 9, 2024

This has been happening since 2023.11.0. For me it fails to load every time on HA restart. Works every time after deleting and reconfiguring. It can take a few minutes to load. I have static IP for the Solax inverter and now know its IP without checking.

If you just restart integration does it start like mine does? (ie I don't need to delete & reconfigure)

I retested by restarting several times and yes, it does reload rather than deleting and reconfiguring. It seems to take much longer to reload than deleting and re-adding.

Doubt it's relevant but I'm docker core not HASOS.

@LoznOz
Copy link
Author

LoznOz commented Feb 10, 2024

Understood thanks for checking - was seeking info primarily to verify and assist symptom definition for code owner to hopefully debug and resolve. In my case mostly (est 90%) it restarts within seconds very occasionally it takes a while. Whenever I restart HA go check if Solax integration has started it so regular - rare to find it has. (Again stating this for clarity as this is not occasional it’s almost all the time).

@LoznOz
Copy link
Author

LoznOz commented Feb 12, 2024

This may assist - I see these errors over and over in my logs (Log Viewer)
2024-02-12 18:01:57.008 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/solax/sensor.py", line 155, in async_refresh
sensor.async_schedule_update_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1224, in async_schedule_update_ha_state
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 966, in async_write_ha_state
raise RuntimeError(f"Attribute hass is None for {self}")
RuntimeError: Attribute hass is None for
2024-02-12 18:02:27.013 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/solax/sensor.py", line 155, in async_refresh
sensor.async_schedule_update_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1224, in async_schedule_update_ha_state
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 966, in async_write_ha_state
raise RuntimeError(f"Attribute hass is None for {self}")
RuntimeError: Attribute hass is None for
2024-02-12 18:02:43.018 ERROR (SyncWorker_19) [pynetgear.router] 404 service 'AdvancedQoS:1', method 'GetQoSEnableStatus', service not found
2024-02-12 18:02:56.983 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/solax/sensor.py", line 155, in async_refresh
sensor.async_schedule_update_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1224, in async_schedule_update_ha_state
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 966, in async_write_ha_state
raise RuntimeError(f"Attribute hass is None for {self}")
RuntimeError: Attribute hass is None for

@thetastate1
Copy link

Same error log here:

2024-02-12 18:03:42.669 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry ***9812C for solax
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 444, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/solax/__init__.py", line 18, in async_setup_entry
    api = await real_time_api(
          ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/__init__.py", line 35, in real_time_api
    i = await discover(ip_address, port, pwd)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 102, in discover
    await discover_state.discover(host, port, pwd)
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 81, in discover
    await asyncio.sleep(0.5)
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 665, in sleep
    return await future
           ^^^^^^^^^^^^
asyncio.exceptions.CancelledError: Global task timeout
2024-02-12 18:03:42.676 WARNING (MainThread) [homeassistant.bootstrap] Setup timed out for stage 2 - moving forward

2024-02-12 18:03:48.410 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback DiscoveryState._task_handler(<Task finishe...imeoutError()>)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 57, in _task_handler
    result = task.result()
             ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 69, in _discovery_task
    await i.get_data()
  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 55, in request
    return await self.post()
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/inverter_http_client.py", line 70, in post
    async with session.post(url, headers=self.headers, data=data) 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 605, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 961, in start
    with self._timer:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/helpers.py", line 735, in __exit__
    raise asyncio.TimeoutError from None
TimeoutError
2024-02-12 18:03:48.421 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback DiscoveryState._task_handler(<Task finishe...imeoutError()>)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 57, in _task_handler
    result = task.result()
             ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 69, in _discovery_task
    await i.get_data()
  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 605, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 961, in start
    with self._timer:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/helpers.py", line 735, in __exit__
    raise asyncio.TimeoutError from None
TimeoutError
2024-02-12 18:03:48.429 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback DiscoveryState._task_handler(<Task finishe...imeoutError()>)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 57, in _task_handler
    result = task.result()
             ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 69, in _discovery_task
    await i.get_data()
  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 55, in request
    return await self.post()
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/inverter_http_client.py", line 70, in post
    async with session.post(url, headers=self.headers, data=data) 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 605, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 961, in start
    with self._timer:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/helpers.py", line 735, in __exit__
    raise asyncio.TimeoutError from None
TimeoutError
2024-02-12 18:03:48.437 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback DiscoveryState._task_handler(<Task finishe...imeoutError()>)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 57, in _task_handler
    result = task.result()
             ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 69, in _discovery_task
    await i.get_data()
  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 55, in request
    return await self.post()
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/inverter_http_client.py", line 70, in post
    async with session.post(url, headers=self.headers, data=data) 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 605, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 961, in start
    with self._timer:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/helpers.py", line 735, in __exit__
    raise asyncio.TimeoutError from None
TimeoutError
2024-02-12 18:03:48.444 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback DiscoveryState._task_handler(<Task finishe...imeoutError()>)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 57, in _task_handler
    result = task.result()
             ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 69, in _discovery_task
    await i.get_data()
  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 55, in request
    return await self.post()
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/inverter_http_client.py", line 70, in post
    async with session.post(url, headers=self.headers, data=data) 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 605, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 961, in start
    with self._timer:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/helpers.py", line 735, in __exit__
    raise asyncio.TimeoutError from None
TimeoutError
2024-02-12 18:03:48.452 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback DiscoveryState._task_handler(<Task finishe...imeoutError()>)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 57, in _task_handler
    result = task.result()
             ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 69, in _discovery_task
    await i.get_data()
  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 55, in request
    return await self.post()
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/inverter_http_client.py", line 70, in post
    async with session.post(url, headers=self.headers, data=data) 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 605, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 961, in start
    with self._timer:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/helpers.py", line 735, in __exit__
    raise asyncio.TimeoutError from None
TimeoutError
2024-02-12 18:03:48.460 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback DiscoveryState._task_handler(<Task finishe...imeoutError()>)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 57, in _task_handler
    result = task.result()
             ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/discovery.py", line 69, in _discovery_task
    await i.get_data()
  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 55, in request
    return await self.post()
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/solax/inverter_http_client.py", line 70, in post
    async with session.post(url, headers=self.headers, data=data) 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 605, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 961, in start
    with self._timer:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/helpers.py", line 735, in __exit__
    raise asyncio.TimeoutError from None
TimeoutError

@QuickSwitchLK
Copy link

I can confirm this, I too have had this issue for a very long time. I just reload the integration once it has timed out trying to load on restart and everything else has started.

@rnovacek
Copy link

rnovacek commented Mar 5, 2024

I think I've found a culprit of this problem:

The X3HybridG4 inverter in the solax python library has sensor with ID 19 listed twice - line 71 and 72.

The way the integration works is that it takes the inverter serial number and sensor ID to create a HomeAssistant sensor:

uid = f"{serial}-{idx}"

source

But with two IDs we'll get two sensors with the same ID and it breaks the integration.

I tried a simple workaround:

+uuids = set()
 for sensor, (idx, measurement) in api.inverter.sensor_map().items():
     description = SENSOR_DESCRIPTIONS[(measurement.unit, measurement.is_monotonic)]

     uid = f"{serial}-{idx}"
+    while uid in uuids:
+        uid = f"{uid}x"
+    uuids.add(uid)
     devices.append(...)

It's not the nicest (basically it just appends xs until there is no UUID collision), but it seems to resolve the problem for me.

I can submit a PR if needed.

@LoznOz
Copy link
Author

LoznOz commented Mar 10, 2024

I think I've found a culprit of this problem:
The X3HybridG4 inverter in the solax python library has sensor with ID 19 listed twice - [line 71 and 72]
I can submit a PR if needed.

Hi thanks & sorry for my slow reply. Your comments sound encouraging, I’m not enough of a programmer to make informed comment. My Inverter which is a Solax Hybrid Inverter SK-TL5000E, is exhibiting the problem described. Not clear (to me) if your investigation & suggestion may fix problem for all inverters or the model X3HybridG4 only? Hopefully all, and assuming so I’d be most appreciative if you are able to have your suggested solution implemented or put out for others to test etc. (or can we do that ourselves? - again my inexperience on this process) but as it appears source code owner may not be available / around at the moment any and all help is appreciated.
thanks

rnovacek pushed a commit to rnovacek/homeassistant that referenced this issue Apr 14, 2024
Some inverters (X3HybridG4 for example) in the solax python library has muliple sensors with the same ID which breaks the library loading.

This change adds a workaround for this - it will apply a suffix to the ID to make it unique.

Fixes home-assistant#109968
rnovacek added a commit to rnovacek/homeassistant that referenced this issue Apr 14, 2024
Some inverters (X3HybridG4 for example) in the solax python library has muliple sensors with the same ID which breaks the library loading.

This change adds a workaround for this - it will apply a suffix to the ID to make it unique.

Fixes home-assistant#109968
@rnovacek
Copy link

rnovacek commented Apr 14, 2024

I have created a PR #115580 to (hopefully) fix this.

@LoznOz
Copy link
Author

LoznOz commented Apr 15, 2024

Excellent thank you for doing so 🤞

rnovacek added a commit to rnovacek/homeassistant that referenced this issue May 19, 2024
Some inverters (X3HybridG4 for example) in the solax python library has muliple sensors with the same ID which breaks the library loading.

This change adds a workaround for this - it will apply a suffix to the ID to make it unique.

Fixes home-assistant#109968
bdraco added a commit that referenced this issue May 20, 2024
fixes #109968

I do not have this integration and cannot test this change.
@bdraco
Copy link
Member

bdraco commented May 20, 2024

It pretty clear there is a race here where the background task finishes before the entities can be added.

If someone wants to test #117767 it should fix the problem

@LoznOz
Copy link
Author

LoznOz commented May 21, 2024

Confirming I appears to be working for me fine now - thanks to all for your efforts in fixing this.
Appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants