rjpearce / sofar2mqtt-python

This project provides an integration between Sofar inverters over RS485 and MQTT using Python It allows you to read and write data to Sofar inverters using a prebuilt Docker image or Python script
3 stars 0 forks source link

Errors when lauching program #16

Closed micclfr closed 7 months ago

micclfr commented 7 months ago

hi,

using this command line : python3 sofar2mqtt-v2.py --broker 192.168.10.231 --config-file sofar-hyd-ep.json --device /dev/ttyUSB0 --retry 5 --daemon

i get the following result :

2024-03-12 15:31:51,718 - INFO - MQTT connecting to broker 192.168.10.231 port 1883 without auth 2024-03-12 15:31:51,728 - INFO - MQTT Connection Accepted. 2024-03-12 15:31:51,731 - INFO - Subscribing to homeassistant/status 2024-03-12 15:31:51,736 - INFO - Subscribing to sofar/rw/energy_storage_mode 2024-03-12 15:31:51,737 - INFO - Subscribing to sofar/rw/time_of_use_charge_soc 2024-03-12 15:31:51,738 - INFO - Subscribing to sofar/rw/desired_power Traceback (most recent call last): File "/home/pi/sofar2mqtt-python/sofar2mqtt-v2.py", line 580, in main() File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1130, in call return self.main(args, kwargs) File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 760, in invoke return __callback(args, **kwargs) File "/home/pi/sofar2mqtt-python/sofar2mqtt-v2.py", line 576, in main sofar.main() File "/home/pi/sofar2mqtt-python/sofar2mqtt-v2.py", line 364, in main self.read() File "/home/pi/sofar2mqtt-python/sofar2mqtt-v2.py", line 268, in read self.read_and_publish() File "/home/pi/sofar2mqtt-python/sofar2mqtt-v2.py", line 216, in read_and_publish value = self.read_value( File "/home/pi/sofar2mqtt-python/sofar2mqtt-v2.py", line 441, in read_value value = self.instrument.read_long( TypeError: read_long() got an unexpected keyword argument 'number_of_registers'

as a matter of fact, there is nothing created in mqtt.

could you guide me on a solution ?

Claude

rjpearce commented 7 months ago

Can you check what version of minimalmodbus you have installed?

If you have <2.1, please install minimalmodbus==2.1.1

As read_long with number_of_registers was introduced in version 2.1.

https://minimalmodbus.readthedocs.io/en/stable/apiminimalmodbus.html#minimalmodbus.Instrument.read_long

micclfr commented 7 months ago

thank you. my minimalmodbus was 2.01, and my inverter's Modbus adress was not 1. Still, no luck, same errors

rjpearce commented 7 months ago

Sorry I'm struggling to understand your last sentence.

Can you send me the output of pip3 list ?

Thanks

rjpearce commented 7 months ago

I have been unable to reproduce this issue. If you can provide me with the output from pip3 list that shows you minimalmodbus>=2.1.1 then I will gladly re-open.