Open chalupien opened 1 year ago
Hey @chalupien, I saw the same issue (albeit running on Linux not Windows but doubt it makes much difference at the Python level). The error seems to stem from the usage of Pymodbus and how that's changed in recent times, but I'll dump all I tried to get it working again.
Firstly try upgrading Pymodbus to the latest version (even better, pin to a known working version) but for me, I'm using Python 3.x so pip3 install pymodbus --upgrade
worked.
Force a re-install of growattRS232 via pip3 install --upgrade --force-reinstall growattRS232
(mainly for good measure but helped surface an error which maybe unique to my setup)
From the re-install, I noticed an error ERROR: launchpadlib 1.10.13 requires testresources, which is not installed
, so I sourced testresources too via sudo apt install python3-testresources
.
Once using the latest Pymodbus it's useful to note that this used to have an option .sync
and so from pymodbus.client.sync import ModbusSerialClient as ModbusClient
would be valid. However in (at least the current version, not sure when this changed) the documentation for Pymodbus shows .sync
has been removed so simply remove it to become from pymodbus.client import ModbusSerialClient as ModbusClient
. E.g edit line 9 on /usr/local/lib/python3.8/dist-packages/growattRS232/__init__.py
to remove .sync
.
Hope that helps! I would open a PR to help fix https://github.com/ArdescoConsulting/growattRS232/blob/master/growattRS232/__init__.py#L9 for others but it doesn't appear possible to create a branch @ArdescoConsulting?
Found out the Status array was missing my status code of 12. Which I fixed. But Now Im wondering why the temperature values are zero.
Sensors data: {'input_power': 4122214.4, 'input_energy_total': 0.0, 'output_power': 1704.0, 'output_energy_today': 1992309.9, 'output_energy_total': 35782656.0, 'output_reactive_power': 701.7, 'output_reactive_energy_today': 13.8, 'output_reactive_energy_total': 2849.1, 'input_1_voltage': 0.0, 'input_1_amperage': 1495.0, 'input_1_power': 0.0, 'input_1_energy_today': 13.4, 'input_1_energy_total': 2346.8, 'input_2_voltage': 26.8, 'input_2_amperage': 0.0, 'input_2_power': 1632.0, 'input_2_energy_today': 0.0, 'input_2_energy_total': 0.0, 'output_1_voltage': 0.0, 'output_1_amperage': 0.0, 'output_1_power': 546.0, 'output_2_voltage': 10.0, 'output_2_amperage': 0.0, 'output_2_power': 0.0, 'output_3_voltage': 239.9, 'output_3_amperage': 600.0, 'output_3_power': 32.0, 'operation_hours': 0.0, 'frequency': 0.0, 'temperature': 0.0, 'ipm_temperature': 0.0, 'p_bus_voltage': 0.0, 'n_bus_voltage': 0.0, 'derating_mode': 0, 'derating': 'No Deratring', 'status_code': 12, 'status': 'XXX', 'fault_code': 1, 'fault': 'Generic Error Code: 100', 'warning_code': 0, 'warning': 'None', 'warning_value': 0}
After I run the Example, I changed the Port to COM6, because im using Windows...
DEBUG:asyncio:Using proactor: IocpProactor DEBUG:growattRS232:GrowattRS232 initialized with usb port COM6 and modbus address 1. Error: TypeError("ReadHoldingRegistersRequest.init() got multiple values for argument 'unit'")