SonnenladenGmbH / APsystems-EZ1-API

The APsystems EZ1 Python library offers a streamlined interface for interacting with the local API of APsystems EZ1 Microinverters.
MIT License
54 stars 7 forks source link

[Bug]: Client Session not closed on timeout #21

Closed ccMatrix closed 2 months ago

ccMatrix commented 2 months ago

What happened?

Over night, when the inverter is offline the requesta are running into timeout. This leads to an error in Home Assistant:

Logger: homeassistant
Source: runner.py:146
First occurred: 21:55:29 (39 occurrences)
Last logged: 22:00:19

Error doing job: Unclosed client session

There probably needs to be a try/except call around the actual request to capture timeouts and close the session.

The python error

File "/usr/local/lib/python3.12/site-packages/APsystemsEZ1/__init__.py", line 229, in get_max_power
    response = await self._request("getMaxPower")
  File "/usr/local/lib/python3.12/site-packages/APsystemsEZ1/__init__.py", line 76, in _request
    ses = ClientSession()

Your python version

3.12

Your OS inlcuding your version

Ubuntu 22.04 Home Assistant 2024.4.1 in docker

mawoka-myblock commented 2 months ago

HA 2004.4.1 sounds interesting ;)

Yea, I'm aware of the issue and will address it soon.

mawoka-myblock commented 2 months ago

Fixed in https://github.com/SonnenladenGmbH/APsystems-EZ1-API/releases/tag/1.3.1