jblance / mpp-solar

Python package to communicate to MPP Solar PIP-4048MS inverters (and similar)

Repository from Github https://github.comjblance/mpp-solarRepository from Github https://github.comjblance/mpp-solar

Non-programmer here. I think something is amiss with paho-mqtt, mqttbrokerc.py and / or callbackapiversion. I'm flailing in the dark...

bobcov opened this issue · comments

sudo mpp-solar --getDeviceId
Exception ignored in: <function Client.del at 0x7fd951822ee0>
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/paho/mqtt/client.py", line 874, in del
self._reset_sockets()
File "/usr/local/lib/python3.8/dist-packages/paho/mqtt/client.py", line 1133, in _reset_sockets
self._sock_close()
File "/usr/local/lib/python3.8/dist-packages/paho/mqtt/client.py", line 1119, in _sock_close
if not self._sock:
AttributeError: 'Client' object has no attribute '_sock'
Traceback (most recent call last):
File "/usr/local/bin/mpp-solar", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.8/dist-packages/mppsolar/init.py", line 230, in main
mqtt_broker = MqttBroker(
File "/usr/local/lib/python3.8/dist-packages/mppsolar/libs/mqttbrokerc.py", line 44, in init
self.mqttc = mqtt_client.Client()
TypeError: init() missing 1 required positional argument: 'callback_api_version

Since posting, through trial and error, i have changed line 44 to this:
self.mqttc = mqtt_client.Client(mqtt_client.CallbackAPIVersion.VERSION2)

I don't get all those errors now, but what i do get, I am hoping is because I do not have an inverter attached to the end of the serial cable:

 sudo mpp-solar --getDeviceId
Command: Get Device ID - Generate a device id
--------------------------------------------------------------------------------
Parameter Value          	Unit
deviceid  Error: Response to short:Error: Response to short:Error: Response to short	    

It sure would be nice if there was a dummy file filled with values which could be fed into the serial device to emulate an inverter for testing everything including the graphing. I don"t have access to the inverter here. I will be quite shocked and pleased if this is the correct fix. I am not a programmer. Why are some of my comments in bold face large type?

the minimum python version is 3.10
the bold is to do with the markdown syntax (which is what is used for git issues check the docs
--getDeviceId is really only useful for a real inverter
for testing try
mppsolar -p test -c QPIGS etc
see the wiki for more info on usage

Thank you very much for your guidance. I just made a system snapshot in preparation to upgrade from 3.8.10 to 3.11. Should I return line 44 to it's original or leave the modification which got the mpp-solar commands to work?
Original line 44: self.mqttc = mqtt_client.Client()
Changed line 44: self.mqttc = mqtt_client.Client(mqtt_client.CallbackAPIVersion.VERSION2)
I got the errors shown in my first post before I changed the line (I have no idea if that was the right change, but it seems to work).

Will I need to install everything again after upgrading?
It seems that the inverter, Steca Solarix MPPT 5020 understands the default protocol, but some values are in the wrong place or not defined. There is a 12 volt 100amh battery attached for testing communications, nothing else is attached.
sudo` mpp-solar -p /dev/ttyUSB0 -c QPIGS
Command: QPIGS - General Status Parameters inquiry

Parameter Value Unit
ac_input_voltage 12.0 V {'icon': 'mdi:lightning'}
ac_input_frequency 12.49 Hz
ac_output_voltage 0.0 V
ac_output_frequency 0.0 Hz
ac_output_apparent_power 0 VA
ac_output_active_power 0 W
ac_output_load 19 %
bus_voltage 0 V
battery_voltage 0.0 V
battery_charging_current 0 A
battery_capacity 0 %
inverter_heat_sink_temperature 63 °C
pv_input_current_for_battery 0.0 A
pv_input_voltage 0.0 V
battery_voltage_from_scc 0 V

Here is the command you said to try:
mpp-solar -p test -c QPIGS
Command: QPIGS - General Status Parameters inquiry

Parameter Value Unit
ac_input_voltage 0.0 V {'icon': 'mdi:lightning'}
ac_input_frequency 0.0 Hz
ac_output_voltage 230.0 V
ac_output_frequency 49.9 Hz
ac_output_apparent_power 161 VA
ac_output_active_power 119 W
ac_output_load 3 %
bus_voltage 460 V
battery_voltage 57.5 V
battery_charging_current 12 A
battery_capacity 100 %
inverter_heat_sink_temperature 69 °C
pv_input_current_for_battery 14.0 A
pv_input_voltage 103.8 V
battery_voltage_from_scc 57.45 V
battery_discharge_current 0 A
is_sbu_priority_version_added 0 bool
is_configuration_changed 0 bool
is_scc_firmware_updated 1 bool
is_load_on 1 bool
is_battery_voltage_to_steady_while_charging 0 bool
is_charging_on 1 bool
is_scc_charging_on 1 bool
is_ac_charging_on 0 bool
rsv1 0 A
rsv2 0 A
pv_input_power 856 W
is_charging_to_float 0 bool
is_switched_on 1 bool
is_reserved 0 bool

Where can I find the instructions on how to use the test files? I would like to get all of the graphing functions working, but I don
t have any real data because the inverter is not attached to anything.

Thank you again for your help. I don't have PayPal but if you are in Europe, I can donate by bank transfer or credit card (but not PayPal processing) in appreciation of your work and time. And apparently, there is no way to turn off the "helpful" formatting, so I will just have to live with paragraphs deciding to bold themselves without me specifically asking for that. There are too many commands in the various docs pages for me to have time to look through. I thought I found a way to turn off formatting, but it did not work.

Update ... Rebuilding on a VM linux with the right version of python and no issues. I'll tear down my incorrect one and start again if things get strange after upgrading to later python.

This issue clearly (I think) came from me not having the latest version of Python so I will close it.