Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when lauching program #16

Closed
micclfr opened this issue Mar 12, 2024 · 4 comments
Closed

Errors when lauching program #16

micclfr opened this issue Mar 12, 2024 · 4 comments
Assignees

Comments

@micclfr
Copy link

micclfr commented Mar 12, 2024

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
Copy link
Owner

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
Copy link
Author

micclfr commented Mar 13, 2024

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

@rjpearce
Copy link
Owner

Sorry I'm struggling to understand your last sentence.

Can you send me the output of pip3 list ?

Thanks

@rjpearce rjpearce self-assigned this Mar 13, 2024
@rjpearce
Copy link
Owner

rjpearce commented Apr 2, 2024

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.

@rjpearce rjpearce closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants