Closed hallonstedt closed 2 years ago
After some additional trolling on the Internet, I realized that the problem is that the code is using type hinting, which was introduced in python 3.9. The setup.cfg file incorrectly lists python >= 3.5 as requirements.
The workaround, if you would like to avoid upgrading python, is to use the typing library to avoid problems with generic typing. See example diff for configs/inverter.py;
PI:~# diff /usr/src/SungrowInverter/sungrowinverter/configs/inverter.py /usr/local/lib/python3.7/dist-packages/sungrowinverter/configs/inverter.py
12a13,14
> from typing import Tuple, List
18c20
< INVERTER_READ_REGISTERS: tuple[ModBusRegister, ...] = (
---
> INVERTER_READ_REGISTERS: Tuple[ModBusRegister, ...] = (
24c26
< INVERTER_HOLDING_REGISTERS: tuple[ModBusRegister, ...] = (
---
> INVERTER_HOLDING_REGISTERS: Tuple[ModBusRegister, ...] = (
30c32
< INVERTER_MODELS: list[SungrowInverterModel] = (
---
> INVERTER_MODELS: List[SungrowInverterModel] = (
Repeat procedure for hybrid.py and string.py and it will work like a charm!
I would like to get data out of my inverter but I seem unable to import the SungrowInverter library. pip3 successfully installed both SungrowModbusTcpClient-0.1.6 and SungrowInverter-0.1.7 but when I try to import the module I get a TypeError that I am unable to figure out the reason for.
`PI:~# python3 Python 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.