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

Minor refactoring and better handling for inverters that are offline #6

Closed CM000n closed 6 months ago

CM000n commented 6 months ago

Hello, I took a look at the code for APsystems-EZ1-API today and have a few minor suggestions for refactoring and code simplification.

I have also implemented better handling of inverters that are offline. Instead of errors, none values are now returned in these cases. This may also fix https://github.com/SonnenladenGmbH/APsystems-EZ1-API-HomeAssistant/issues/8

I also noticed that there are currently no unit tests or anything similar. If there is interest, I could take care of this in another PR.

mawoka-myblock commented 6 months ago

Did you test it thoroughly?

CM000n commented 6 months ago

Did you test it thoroughly?

I checked it against my inverter and with the help of some unit tests. Everything "should" work as before.

⚠️ BUT we are now using type hints folowing PEP 604 like dict | None. This is only supported with python >= 3.10. So using the package with a python version < 3.10 will now lead to errors. According to the pyproject.toml the minimum supported Python version is 3.11. So no problem?

mawoka-myblock commented 6 months ago

Did you test it thoroughly?

I checked it against my inverter and with the help of some unit tests. Everything "should" work as before.

⚠️ BUT we are now using type hints folowing PEP 604 like dict | None. This is only supported with python >= 3.10. So using the package with a python version < 3.10 will now lead to errors. According to the pyproject.toml the minimum supported Python version is 3.11. So no problem?

No problem for me.

mawoka-myblock commented 6 months ago

I'm gonna take a close look at your awesome work next week, since I'm gonna be busy the next few days.

CM000n commented 6 months ago

Hello @mawoka-myblock, have you already had a chance to take a look at the changes? I don't want to rush, but I'll probably be out next week and won't have time to make any changes. So if you have change requests, I could do them this week. Otherwise it would take a while from my side as well.

Best regards and have a relaxed and happy Christmas time for you and your family. 😊 🎄 🎅🏻

mawoka-myblock commented 6 months ago

hey, sorry for the late reply, and, merry Christmas 🎄 ! I'm gonna check this week. Sorry again!