core icon indicating copy to clipboard operation
core copied to clipboard

APSysttem integration - solar_max_output update fails with TimeoutError

Open alfwro13 opened this issue 1 year ago • 16 comments

The problem

This error is logged every 30 seconds at night when the inverter is offline:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1025, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1122, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1104, in create_connection
    sock = await self._connect_sock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1007, 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}')
OSError: [Errno 113] Connect call failed ('192.168.1.100', 8050)

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 944, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1296, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/apsystems/number.py", line 48, in async_update
    self._attr_native_value = await self._api.get_max_power()
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/APsystemsEZ1/__init__.py", line 239, in get_max_power
    response = await self._request("getMaxPower")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/APsystemsEZ1/__init__.py", line 86, in _request
    async with ses.get(url, timeout=self.timeout) as resp:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1197, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 581, 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 944, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1257, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1226, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1033, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.100:8050 ssl:default [Connect call failed ('192.168.1.100', 8050)]````

### What version of Home Assistant Core has the issue?

core-2024.7.1

### What was the last working version of Home Assistant Core?

core-2024.6.x

### What type of installation are you running?

Home Assistant OS

### Integration causing the issue

APSystems

### Link to integration documentation on our website

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

### Diagnostics information

_No response_

### Example YAML snippet

_No response_

### Anything in the logs that might be useful for us?

```txt
see above
```


### Additional information

_No response_

alfwro13 avatar Jul 07 '24 08:07 alfwro13

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

Code owner commands

Code owners of apsystems 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 apsystems 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)


apsystems documentation apsystems source (message by IssueLinks)

home-assistant[bot] avatar Jul 07 '24 08:07 home-assistant[bot]

That's strange as I can't replicate it in my setup

mawoka-myblock avatar Jul 07 '24 08:07 mawoka-myblock

My logs are flooded with that error after sunset and they stop at sunrise (so basically when the the inverter goes offline at night)

alfwro13 avatar Jul 07 '24 08:07 alfwro13

Hello, i have also problems with the max_output value: Since changing from HACS to main HA Plugin, i can not see or set the max_output anymore. The value and input field are missing. But i also have that errors in my logfile.

Regards Johannes

Logger: homeassistant.helpers.entity Quelle: helpers/entity.py:944 Erstmals aufgetreten: 9. Juli 2024 um 21:26:03 (8860 Vorkommnisse) Zuletzt protokolliert: 18:38:16

Update for number.ez1fassaderechts_maximale_leistung fails Update for number.ez1garagelinks_maximale_leistung fails Update for number.ez1mbalkonrechts_maximale_leistung fails Update for number.ez1mbalkonlinks_maximale_leistung fails Update for number.ez1fassadelinks_maximale_leistung fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 944, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1296, in async_device_update await self.async_update() File "/usr/src/homeassistant/homeassistant/components/apsystems/number.py", line 48, in async_update self._attr_native_value = await self._api.get_max_power() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/APsystemsEZ1/init.py", line 239, in get_max_power response = await self._request("getMaxPower") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/APsystemsEZ1/init.py", line 86, in _request async with ses.get(url, timeout=self.timeout) as resp: File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1197, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 608, in _request await resp.start(conn) File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 971, 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

casa-feuer avatar Jul 10 '24 16:07 casa-feuer

After installing the latest HA Update (7.2) the Input field ist available again. But still timeout Errors: Logger: homeassistant.helpers.entity Quelle: helpers/entity.py:944 Erstmals aufgetreten: 20:37:37 (1812 Vorkommnisse) Zuletzt protokolliert: 22:51:11

Update for number.ez1fassadelinks_maximale_leistung fails Update for number.ez1garagelinks_maximale_leistung fails Update for number.ez1fassaderechts_maximale_leistung fails Update for number.ez1mbalkonlinks_maximale_leistung fails Update for number.ez1mbalkonrechts_maximale_leistung fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 944, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1296, in async_device_update await self.async_update() File "/usr/src/homeassistant/homeassistant/components/apsystems/number.py", line 48, in async_update self._attr_native_value = await self._api.get_max_power() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/APsystemsEZ1/init.py", line 239, in get_max_power response = await self._request("getMaxPower") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/APsystemsEZ1/init.py", line 86, in _request async with ses.get(url, timeout=self.timeout) as resp: File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1197, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 507, in _request with timer: File "/usr/local/lib/python3.12/site-packages/aiohttp/helpers.py", line 735, in exit raise asyncio.TimeoutError from None TimeoutError

casa-feuer avatar Jul 10 '24 20:07 casa-feuer

The error is unhandled intentionally as it shouldn't occur, but it's produced by the inverter, not the integration. And as I've already mentioned, I can't replicate the issue and for me, the issue is closed. Sorry for that. I've just checked personally and the TimeoutError pops up ~5 times a day and that's nothing to worry about.

mawoka-myblock avatar Jul 10 '24 21:07 mawoka-myblock

@home-assistant close

mawoka-myblock avatar Jul 10 '24 21:07 mawoka-myblock

@home-assistant rename APSysttem integration - solar_max_output update fails with TimeoutError

mawoka-myblock avatar Jul 10 '24 21:07 mawoka-myblock

@home-assistant reopen

mawoka-myblock avatar Jul 23 '24 09:07 mawoka-myblock

I've got the logs as well now, so I'll have to do some testing as this now isn't a problem only with your setup, but a problem in general.

mawoka-myblock avatar Jul 23 '24 09:07 mawoka-myblock

Hi, I am seeing it also and have roughly 55k lines of logs per day - mainly containing this:


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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 944, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1296, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/apsystems/number.py", line 48, in async_update
    self._attr_native_value = await self._api.get_max_power()
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/APsystemsEZ1/__init__.py", line 239, in get_max_power
    response = await self._request("getMaxPower")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/APsystemsEZ1/__init__.py", line 86, in _request
    async with ses.get(url, timeout=self.timeout) as resp:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1197, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 581, 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 944, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1257, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1226, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1033, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 10.10.10.9:8050 ssl:default [Connect call failed ('10.10.10.9', 8050)]
2024-07-25 22:56:30.242 INFO (MainThread) [homeassistant.components.generic_hygrostat.humidifier] Turning off humidifier switch.tasmota
2024-07-25 22:56:45.401 ERROR (MainThread) [homeassistant.helpers.entity] Update for number.solar_max_output fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1025, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1122, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1104, in create_connection
    sock = await self._connect_sock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1007, 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}')
OSError: [Errno 113] Connect call failed ('10.10.10.9', 8050)

Core 2024.7.3 Supervisor 2024.06.2 Operating System 12.4 Frontend 20240710.0 Raspberry Pi 4

Let me know if I can help in any way.

Thanks!

flo269 avatar Jul 26 '24 20:07 flo269

Thanks for providing additional logs! This issue seems a bit over my head, as the integration trusts Home Assistant with handling failures and retries, so I'll have to investigate an will probably need support in this regard.

As far as I know the following is the problem:

A connection problem should make HA retry the update and if that fails again, the sensor should get unavailable or gets pulled an hour later or so. (That's my understanding)

But somehow, HA seems to just keep updating the sensor.

mawoka-myblock avatar Jul 26 '24 21:07 mawoka-myblock

I get the same error in the log (Update for number.apsystems_ez1_m_max_output_power fails) many thousand times overnight, but strangely not consistently every night.

The Shelly integration recently also started to throw connection errors after powering one of my Shelly Plus Plugs devices down. The logs look a little bit different though, so I'm not certain that the root cause is the same as with the APsystems integration.

I'm using the built-in integration for APsystems inverters on HA 2024.7.4 (docker core).

This is the log for the Shelly Plug connection. Just leaving this here in case it might shed some light on the issue that is discussed here.

Logger: homeassistant.components.shelly
Source: components/shelly/coordinator.py:171
integration: Shelly (documentation, issues)
First occurred: July 30, 2024 at 17:02:28 (3761 occurrences)
Last logged: 10:50:26

Error connecting to Shelly device Shelly Plug 2, error: DeviceConnectionError(DeviceConnectionError(ClientConnectorError(ConnectionKey(host='192.168.100.100', port=80, is_ssl=False, ssl=True, proxy=None, proxy_auth=None, proxy_headers_hash=-2202016839093191944), OSError(113, "Connect call failed ('192.168.100.100', 80)"))))

denwald avatar Aug 02 '24 16:08 denwald

For the time being until this is fixed and avoid tens of thousands of errors in my log file every day I use homeassistant.disable_entity in the evening and homeassistant.enable_entity in the morning to disable/enable the max_output entities on my inverters. Please not that those services are available after installing HACS "Spook your homie" integration.

alfwro13 avatar Aug 07 '24 13:08 alfwro13

Hi, I am getting constantly (during daytime with solar production) following error:

2024-09-16 12:38:55.712 ERROR (MainThread) [homeassistant.components.apsystems] Unexpected error fetching APSystems Data data Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/apsystems/coordinator.py", line 29, in _async_update_data return await self.api.get_output_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/APsystemsEZ1/__init__.py", line 191, in get_output_data response = await self._request("getOutputData") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/APsystemsEZ1/__init__.py", line 97, in _request return await self._request(endpoint, retry=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/APsystemsEZ1/__init__.py", line 98, in _request raise InverterReturnedError

the network connection seems not bad and I see no missing data.

any idea what the root cause is?

Core 2024.8.3 Supervisor 2024.09.1 Operating System 13.1 Frontend 20240809.0

MonsterD1 avatar Sep 16 '24 11:09 MonsterD1

This is not the same error and as the error already says: The inverter returned an error. That's all we know.

mawoka-myblock avatar Sep 16 '24 11:09 mawoka-myblock

Same happening here, log overloaded of timeout errors during the night:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1091, in _wrap_create_connection
    sock = await aiohappyeyeballs.start_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 104, in start_connection
    raise first_exception
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 82, in start_connection
    sock = await _connect_sock(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 174, in _connect_sock
    await loop.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}')
OSError: [Errno 113] Connect call failed ('192.168.XX.XX', 8050)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 944, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1302, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/apsystems/number.py", line 48, in async_update
    self._attr_native_value = await self._api.get_max_power()
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/APsystemsEZ1/__init__.py", line 236, in get_max_power
    response = await self._request("getMaxPower")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/APsystemsEZ1/__init__.py", line 85, in _request
    async with ses.get(url, timeout=self.timeout) as resp:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1359, in __aenter__
    self._resp: _RetType = await self._coro
                           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 663, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 563, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1032, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1366, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1335, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1106, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.XX.XX:8050 ssl:default [Connect call failed ('192.168.XX.XX', 8050)]

lorenzofattori avatar Nov 11 '24 19:11 lorenzofattori