jblance / mpp-solar

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

Adding commands for LV5048. #11

Closed DMIINC closed 4 years ago

DMIINC commented 4 years ago

LV5048 5KW protocol-20190222 for customer.pdf Hello,

Thank you for your help last week. I was in touch with MPP Solar and they provided communication protocol for LV5048. See attached. Is there way to integrate some of these commands with what you have written so far?

DMIINC commented 4 years ago

Do you maybe want to do it with usb only? Instead usb to serial as is it now?

jblance commented 4 years ago

start with usb-serial

DMIINC commented 4 years ago

ok

DMIINC commented 4 years ago

!st command out of watch power

1st

jblance commented 4 years ago

can you upload the pcap so i can look too I'm looking for the commands and responses

DMIINC commented 4 years ago

LV5048 PCAP.zip

DMIINC commented 4 years ago

USB to Serial capture only

LV5048 PCAP USB-Serial Only.zip

cowpen commented 4 years ago

Was also interested to see if @cowpen got any actual data in response to commands that use a parallel ID

Really sorry guys. I've been up to my eyeballs in alligators trying to support 100+ work-from-home users with no company laptops. Nightmare. I haven't even had a chance to try to install the "mpp-solar" package yet.

DMIINC commented 4 years ago

@cowpen It is all good.

jblance commented 4 years ago

thanks So in the first PCAP, the commands (in order) we see are QPI at p 4684 with response (PI41 with CRC 0x13 0xbd at p 4690-4705 then

QPI
QPI
QPI
QPI
QPI
QPI
QPI
QPI
QPI
QPI
QMN 0xbb 0x64 response (NAK 0x73 0x73 which makes sense as it is an unknown command
QMN (NAK
QMN (NAK
QPI
QPI
QPI
QPI
QPIRI 0xf8 0x54 and response
QSID 0xbb 0x05 response 1492911906100045005535 0x9d 0x48
QPIRI
QSID
QVFW
QVFW2
QVFW3 with (NAK response
QVFW3 with (NAK response
QVFW3 with (NAK response
QPIGS and response
VERFW: (NAK
VERFW: (NAK
VERFW: (NAK
QPIRI
QBEQI and response
QPIRI
QPIGS
QMCHGCR
QMUCHGCR
QBEQI
QFLAG
QDI
QPIWS
QSID
QVFW
QVFW2
QVFW3 - (NAK
QVFW3 - (NAK
QVFW3 - (NAK
QPIGS
VERFW: (NAK
VERFW: (NAK
VERFW: (NAK
QPIRI
QBEQI
QPIRI
QPIWS
QPGS0 0x3f 0xda @ 8716 (1 92911906100045 L 00 123.4 59.98 123.4 59.98 0283 0213 011 56.1 05 095 000.0 005 01533 01274 008 01000010 6 0 060 220 40 00 000 0x92 0xa3 
QPG2S0 and a response
QP2GS0 and a response
QPGS1 and response
QP2GS1 and a response
QPIWS and a response
QP2GS1 and response
QSID
QVFW
QVFW2

(and still only at packet 10276)

But basically, same CRC, no resends and a response to parallel commands...

jblance commented 4 years ago

@cowpen yeah no stress just interested

DMIINC commented 4 years ago

So. There is a response to QP2GSn and QPGSn?

jblance commented 4 years ago

Also @cowpen do you know how to combine packets in wireshark?

jblance commented 4 years ago

Yep command sent and valid response received Maybe wireshark capture of mpp-solar sending QPGS0 and QP2GS0 ? Coz as far as I can tell we are sending the command and getting a response, but the response is (NAK

DMIINC commented 4 years ago

Would switching to USB help to see further?

jblance commented 4 years ago

it might (it really shouldn't but at this stage it is not making sense to me)

DMIINC commented 4 years ago

OK. Giving it a try now.

DMIINC commented 4 years ago

LV5048 PCAP USB.zip

jblance commented 4 years ago

is that using watchpower or mpp-solar?

DMIINC commented 4 years ago

Watch power windows

DMIINC commented 4 years ago

Oh man I failed at reading

DMIINC commented 4 years ago

Hold on. On raspberry pi, do you want all of them connected to raspberry pi or just one inverter?

jblance commented 4 years ago

just one i think The USB one is harder to decipher too (actually I think I've figured it out)

DMIINC commented 4 years ago

Soooo, LOL How do we go about wireshark on raspberry pi

DMIINC commented 4 years ago

Use something else

jblance commented 4 years ago

Does https://discussions.flightaware.com/t/monitoring-usb-utilization-on-raspberry-pi/16421 help?

DMIINC commented 4 years ago

Checking it out

jblance commented 4 years ago

tshark looks to be the command line version Does your Pi have the GUI installed?

DMIINC commented 4 years ago

Installed.

DMIINC commented 4 years ago

Gui

DMIINC commented 4 years ago

Usp listener

DMIINC commented 4 years ago

UDP

jblance commented 4 years ago

OK - should be similar I installed tshark only and did the 'mount usbmon' as per the link and seemed to get USB capture

$ sudo tshark -i usbmon1
Running as user "root" and group "root". This could be dangerous.
Capturing on 'usbmon1'
    1   0.000000         host → 1.1.0        USBHUB 64 GET_STATUS Request     [Port 1]
    2   0.000071        1.1.0 → host         USBHUB 68 GET_STATUS Response    [Port 1]
    3   0.000093         host → 1.1.1        USB 64 URB_INTERRUPT in
    4   0.000139         host → 1.1.0        USBHUB 64 GET_STATUS Request     [Port 1]
    5   0.000192        1.1.0 → host         USBHUB 68 GET_STATUS Response    [Port 1]
    6   0.000210         host → 1.1.0        USBHUB 64 CLEAR_FEATURE Request  [Port 1: PORT_SUSPEND]
    7   0.058755        1.1.0 → host         USBHUB 64 CLEAR_FEATURE Response [Port 1: PORT_SUSPEND]
    8   0.058761        1.1.1 → host         USB 65 URB_INTERRUPT in
    9   0.058777         host → 1.1.1        USB 64 URB_INTERRUPT in
   10   0.118699         host → 1.1.0        USBHUB 64 GET_STATUS Request     [Port 1]
   11   0.118749        1.1.0 → host         USBHUB 68 GET_STATUS Response    [Port 1]
   12   0.148691         host → 1.1.0        USBHUB 64 CLEAR_FEATURE Request  [Port 1: C_PORT_SUSPEND]
   13   0.148741        1.1.0 → host         USBHUB 64 CLEAR_FEATURE Response [Port 1: C_PORT_SUSPEND]
   14   0.148757         host → 1.2.0        USB 64 GET STATUS Request
   15   0.148902        1.2.0 → host         USB 66 GET STATUS Response
   16   0.148928         host → 1.2.0        USB 64 CLEAR FEATURE Request
   17   0.149231        1.2.0 → host         USB 64 CLEAR FEATURE Response
   18   0.149261         host → 1.2.0        USBHUB 64 GET_STATUS Request     [Port 1]
   19   0.149277         host → 1.1.0        USBHUB 64 GET_STATUS Request     [Port 1]
   20   0.149318        1.1.0 → host         USBHUB 68 GET_STATUS Response    [Port 1]
   21   0.149589        1.2.0 → host         USBHUB 68 GET_STATUS Response    [Port 1]
   22   0.149616         host → 1.2.0        USBHUB 64 GET_STATUS Request     [Port 2]

How did yours work out?

DMIINC commented 4 years ago

installing tshark now

jblance commented 4 years ago

with the Pi desktop installed, you could install wireshark and use the gui version for capture

DMIINC commented 4 years ago

I do have desktop installed too

DMIINC commented 4 years ago

this is what I see

Cisco remote capture: ciscodump Random packet generator: randpkt SSH remote capture: sshdump UDP Listener remote capture: udpdump

jblance commented 4 years ago

did you run

sudo mount -t debugfs none_debugs /sys/kernel/debug
sudo modprobe usbmon
sudo chmod 755 /sys/kernel/debug
sudo chmod 644 /sys/kernel/debug/usb/usbmon/*

?

DMIINC commented 4 years ago

How ever command line is working too. It is capturing my mouse movements \

jblance commented 4 years ago

lol - that will be useful...

DMIINC commented 4 years ago

I did execute what you wrote in previous post

DMIINC commented 4 years ago

pi@raspberrypi:~ $ sudo mount -t debugfs none_debugs /sys/kernel/debug mount: /sys/kernel/debug: none_debugs already mounted or mount point busy. pi@raspberrypi:~ $ sudo modprobe usbmon pi@raspberrypi:~ $ sudo chmod 755 /sys/kernel/debug pi@raspberrypi:~ $ sudo chmod 644 /sys/kernel/debug/usb/usbmon/* pi@raspberrypi:~ $

jblance commented 4 years ago

I dont have access to my pi that is connected to the inverter - but try lsusb to see if you can identify which usb to capture then try tshark -i usbmon1 (or usbmon2) in one window will running a command in another (e.g. mpp-solar -c QSID ....)

DMIINC commented 4 years ago

pi@raspberrypi:~ $ lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 004: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port Bus 001 Device 003: ID 046d:c534 Logitech, Inc. Unifying Receiver Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub pi@raspberrypi:~ $

DMIINC commented 4 years ago

when the capture window is open what is command to make it stop capturing

jblance commented 4 years ago

control+ c tshark -i usbmon1 -w capture.pcap to write it to a file too

DMIINC commented 4 years ago

pi@raspberrypi:~ $ sudo tshark -i usbmon1 -w capture.pcap Running as user "root" and group "root". This could be dangerous. Capturing on 'usbmon1' tshark: The file to which the capture would be saved ("capture.pcap") could not be opened: Permission denied.

pi@raspberrypi:~ $

jblance commented 4 years ago

try /tmp/capture.pcap as the file

DMIINC commented 4 years ago

OK captured file with QPGS0 and QP2GS0. How do you Zip it on raspberry pi

jblance commented 4 years ago

theres a command gzip or the GUI might have compress functionality??