jblance / mpp-solar

Python package to communicate to MPP Solar PIP-4048MS inverters (and similar)
MIT License
355 stars 149 forks source link

Voltronic InfiniSolar E 5.5KW #33

Closed eliafino closed 4 years ago

eliafino commented 4 years ago

Hi, thanks for this project!

I receive only NAK response... which setting for "-M"?

Regards, Elia

jblance commented 4 years ago

What command are you running? Please supply the output after adding '-D' to the command (this provides a lot of debug messages) Also can you run the 'QPI' command and let me know the result

eliafino commented 4 years ago

This is debug for QPI: log.txt

And this working good: inv.py.txt

jblance commented 4 years ago

Are you saying your working good gives a good response? (As there is not crc in the command you send) what response do you get? What do you get if you send QPI instead of QPIGS?

eliafino commented 4 years ago

QPIGS response is ['217.4', '101543', '49.9', '0006.6', '220.6', '01500', '49.9', '006.7', '027', '411.1', '411.1', '054.2', '---.-', '078', '00000', '00000', '-----', '000.0', '000.0', '---.-', '032.0', 'D---100201']

QPI response is ['PI16']

eliafino commented 4 years ago

I found info on the PI15 / PI16 protocol here and here

jblance commented 4 years ago

Ok, so a new protocol. The master node base doesnt deal with alternative protocols very well, but I have started a branch to specifically deal with different protocols (branch is called refactor)

Next week I'll try adding pi16 protocol handler Do you know how to checkout a branch and use that code? What do you need that the linked tool doesnt provide?

Cheers

eliafino commented 4 years ago

I see branch refactor, ok. The links I sent are part of a software that manages UPS, I reported it only to understand the protocol. I haven't found anything else.

No problem to send directly command QPIGS to serial or USB port. I can query QBSDV but I can't set "BSDV44.5 46.5"

+QBSDV+:: Query device for battery-discharging limits

+BSDVa b+:: Set cut-off battery-discharging voltage:

I can't send over 8 characters

UPDATE: Ok I send first 8 characters and after send another characters: First send "BSDV44.5" and after " 46.5"

jblance commented 4 years ago

I have added the first cut at PI16 (QPIGS and QPI only so far) Can you try it against your inverter to see if it gives the correct response

eliafino commented 4 years ago

root@raspberrypi:~# mpp-solar -c QPIGS -P PI16 -p /dev/hidraw0 Traceback (most recent call last): File "/usr/local/bin/mpp-solar", line 11, in load_entry_point('mpp-solar==0.6.1', 'console_scripts', 'mpp-solar')() File "/usr/local/lib/python3.7/dist-packages/mpp_solar-0.6.1-py3.7.egg/mppsolar/init.py", line 145, in main results = device.run_command(command=args.command, show_raw=args.showraw) File "/usr/local/lib/python3.7/dist-packages/mpp_solar-0.6.1-py3.7.egg/mppsolar/devices/mppsolar.py", line 40, in run_command response = self._port.send_and_receive(command, show_raw, self._protocol) File "/usr/local/lib/python3.7/dist-packages/mpp_solar-0.6.1-py3.7.egg/mppsolar/io/hidrawio.py", line 71, in send_and_receive decoded_response = protocol.decode(response_line) File "/usr/local/lib/python3.7/dist-packages/mpp_solar-0.6.1-py3.7.egg/mppsolar/protocols/protocol.py", line 106, in decode result = result.decode('utf-8') UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 10: invalid start byte

eliafino commented 4 years ago

root@raspberrypi:~# mpp-solar -R -c QPIGS -P PI16 -p /dev/hidraw0 Parameter Value Unit Traceback (most recent call last): File "/usr/local/bin/mpp-solar", line 11, in load_entry_point('mpp-solar==0.6.1', 'console_scripts', 'mpp-solar')() File "/usr/local/lib/python3.7/dist-packages/mpp_solar-0.6.1-py3.7.egg/mppsolar/init.py", line 154, in main op.output(data=results, tag=tag, mqtt_broker=args.mqttbroker) File "/usr/local/lib/python3.7/dist-packages/mpp_solar-0.6.1-py3.7.egg/mppsolar/outputs/screen.py", line 18, in output print(f'{key:<30}\t{value:<15}\t{unit:<4}') TypeError: unsupported format string passed to bytes.format

jblance commented 4 years ago

Can you post the full debug response (add -D) to the command

eliafino commented 4 years ago

debug.txt

update

jblance commented 4 years ago

Weird it seems null padded at the start and there IS a crc on the return. Can you also do a debug of QPI command so I can see what that gives

eliafino commented 4 years ago

debugQPIGS.txt debugQPI.txt

jblance commented 4 years ago

OK they both have crc, I wonder if all responses do. Maybe set commands responses have no crc? No nulls at the start of these 2 responses though.... I'll update to remove the crc of the responses tomorrow and try to add some more commands

eliafino commented 4 years ago

Ok, thank you very much!

jblance commented 4 years ago

made some changes - so hopefully the response is correctly parsed now also added QPIBI command can you try with version 0.6.2

jblance commented 4 years ago

also let me know which commands you need the most (start with queries)

eliafino commented 4 years ago

root@raspberrypi:/usr/src/mpp-solar# mpp-solar -c QPIGS -P PI16 -p /dev/hidraw0 Parameter Value Unit grid_voltage 221.8 V output_power 0 W grid_frequency 50.0 Hz output_current 1.8 A ac_output_voltage_r 233.4 V ac_output_power_r 349 W ac_output_frequency 50.1 Hz ac_output_current_r 1.4 A output_load_percent 7 % pbus_voltage 409.1 V sbus_voltage 409.1 V positive_battery_voltage 56.7 V negative_battery_voltage 0.0 V battery_capacity 93 % pv1_input_power 0 W pv2_input_power 0 W pv3_input_power 0 W pv1_input_voltage 0.0 V pv2_input_voltage 0.0 V pv3_input_voltage 0.0 V max_temperature 33.0 °C status_todo D---110001

Perfect my friend!

eliafino commented 4 years ago

If you can, I need QMOD and QED

jblance commented 4 years ago

Great, also next will be testing the output modules What are you going to do with the data?

eliafino commented 4 years ago

Internet page, MySQL and grafana

jblance commented 4 years ago

how do you plan to get it to those places? mqtt? direct? QMOD added

eliafino commented 4 years ago

Directly to my MySQL server. Thanks for QMOD

jblance commented 4 years ago

Did QMOD give a reasonable response? added attempt at QED...

jblance commented 4 years ago

so i have the idea of output modules. if you have python code for the mysql updates, it is possible that an output module could be created (probably with a config file somewhere for the specific details etc) then the command becomes mpp-solar -p /dev/hidraw0 -P PI16 -c QED19900101 -o mysql or similar

eliafino commented 4 years ago

Interesting... but for now QED -> "NAK", no way to have production for today: QED20200721

Not finished jet, here

jblance commented 4 years ago

try QED now not sure 'checksum' is the same as the CRC though, do you have an example that works from your python script?

eliafino commented 4 years ago

I was unable to obtain the reading with any script, not even sending the command directly to the serial port. Only "NAK"

jblance commented 4 years ago

can you try QED with version 0.6.4

jblance commented 4 years ago

and post a debug log if it fails again

jblance commented 4 years ago

oh, missed padding the checksum, fixed in 0.6.5

eliafino commented 4 years ago

Now I see "0000000", in the next days I can connect solar panels and try to read production.Thanks very much for now!

jblance commented 4 years ago

Great