gch1p / inverter-tools

advanced tools for voltronic inverters
BSD 3-Clause "New" or "Revised" License
18 stars 6 forks source link

error on command sudo ./inverterctl --device usb --verbose set-max-charge-voltage 54.2 54.0 #5

Open Maxym77 opened 1 year ago

Maxym77 commented 1 year ago

Hi my inverter is this: infinisolar https://www.solarpower24.it/negozio/inverter/inverter-hybrid/sp24-infinisolar-v-iv-twin-6kw-48v-inverter-solare-ibrido-off-grid-isola/

Have PI18 protocol.

I suppose the "," character for "^S015MCHGVmmm,nnn" have problem with CRC calculation.

sudo ./inverterctl --device usb --verbose set-max-charge-voltage 54.2 54.0 voltronic::Device::send(): writing 20 bytes 0x0000: 5e 53 30 31 35 4d 43 48 47 56 35 34 32 2c 35 34 ^S015MCHGV542,54 0x0010: 30 cd 48 0d 0.H. voltronic::USBDevice::write(): dataSize=20, writeSize=8 0x0000: 5e 53 30 31 35 4d 43 48 47 56 35 34 32 2c 35 34 ^S015MCHGV542,54 0x0010: 30 cd 48 0d 0.H. voltronic::Device::writeLoop(): bytesWritten=8 voltronic::USBDevice::write(): dataSize=12, writeSize=8 0x0000: 47 56 35 34 32 2c 35 34 30 cd 48 0d GV542,540.H. voltronic::Device::writeLoop(): bytesWritten=8 voltronic::USBDevice::write(): dataSize=4, writeSize=4 0x0000: 30 cd 48 0d 0.H. voltronic::Device::writeLoop(): bytesWritten=8 voltronic::Device::readLoop(): bytesRead=8 voltronic::Device::recv(): got 5 bytes 0x0000: 5e 30 1b e3 0d ^0... error

Other commands work fine, like this:

sudo ./inverterctl --device usb --verbose get-status voltronic::Device::send(): writing 10 bytes 0x0000: 5e 50 30 30 35 47 53 58 14 0d ^P005GSX.. voltronic::USBDevice::write(): dataSize=10, writeSize=8 0x0000: 5e 50 30 30 35 47 53 58 14 0d ^P005GSX.. voltronic::Device::writeLoop(): bytesWritten=8 voltronic::USBDevice::write(): dataSize=2, writeSize=2 0x0000: 14 0d .. voltronic::Device::writeLoop(): bytesWritten=8 voltronic::Device::readLoop(): bytesRead=8 voltronic::Device::readLoop(): bytesRead=8 voltronic::Device::readLoop(): bytesRead=8 voltronic::Device::readLoop(): bytesRead=8 voltronic::Device::readLoop(): bytesRead=8 voltronic::Device::readLoop(): bytesRead=8 voltronic::Device::readLoop(): bytesRead=8 voltronic::Device::readLoop(): bytesRead=8 voltronic::Device::readLoop(): bytesRead=8 voltronic::Device::readLoop(): bytesRead=8 voltronic::Device::readLoop(): bytesRead=8 voltronic::Device::readLoop(): bytesRead=8 voltronic::Device::readLoop(): bytesRead=8 voltronic::Device::readLoop(): bytesRead=8 voltronic::Device::recv(): got 111 bytes 0x0000: 5e 44 31 30 36 32 33 36 39 2c 35 30 30 2c 32 33 ^D1062369,500,23 0x0010: 30 30 2c 34 39 39 2c 30 36 34 34 2c 30 35 32 39 00,499,0644,0529 0x0020: 2c 30 31 30 2c 35 32 35 2c 30 30 30 2c 30 30 30 ,010,525,000,000 0x0030: 2c 30 31 31 2c 30 30 30 2c 30 34 33 2c 30 33 34 ,011,000,043,034 0x0040: 2c 30 30 30 2c 30 30 30 2c 30 30 30 31 2c 30 30 ,000,000,0001,00 0x0050: 30 30 2c 31 32 31 37 2c 30 30 30 30 2c 30 2c 32 00,1217,0000,0,2 0x0060: 2c 30 2c 31 2c 32 2c 32 2c 30 2c 30 a7 f2 0d ,0,1,2,2,0,0... Grid voltage: 236.9 V Grid frequency: 50 Hz AC output voltage: 230 V AC output frequency: 49.9 Hz AC output apparent power: 644 VA AC output active power: 529 Wh Output load percent: 10 % Battery voltage: 52.5 V Battery voltage from SCC: 0 V Battery voltage from SCC2: 0 V Battery discharge current: 11 A Battery charge current: 0 A Battery capacity: 43 % Inverter heat sink temperature: 34 °C MPPT1 charger temperature: 0 °C MPPT2 charger temperature: 0 °C PV1 input power: 1 Wh PV2 input power: 0 Wh PV1 input voltage: 121.7 V PV2 input voltage: 0 V Configuration state: Default MPPT1 charger status: Charging MPPT2 charger status: Abnormal Load connection: Connected Battery power direction: Discharge DC/AC power direction: DC/AC Line power direction: Do nothing Local parallel ID: 0

You can help me?

eliafino commented 1 year ago

Hi, in this case, the problem is in CRC.

So, if command in HEX is: 5e 53 30 31 35 4d 43 48 47 56 35 34 32 2c 35 34 30 CRC is: cd 48

CRC need to be: cd 49 (48 + 1)

gch1p commented 1 year ago

hi, i'll look into this

eliafino commented 1 year ago

hi, i'll look into this

Thanks! And so, there is a way to send raw HEX command with CRC included (not calculated)?

eliafino commented 1 year ago

Unfortunately, the CRC+1 doesn't seem to be the problem. If command is > 16 no way to send via USB

gch1p commented 1 year ago

I can't reproduce it. On my inverter (InfiniSolar V 5KW), it works.

# inverterctl  --device usb --verbose set-max-charge-voltage 54.2 54.0
voltronic::Device::send(): writing 20 bytes
0x0000: 5e 53 30 31 35 4d 43 48 47 56 35 34 32 2c 35 34  ^S015MCHGV542,54
0x0010: 30 cd 48 0d                                      0.H.
voltronic::USBDevice::write(): dataSize=20, writeSize=8
0x0000: 5e 53 30 31 35 4d 43 48 47 56 35 34 32 2c 35 34  ^S015MCHGV542,54
0x0010: 30 cd 48 0d                                      0.H.
voltronic::Device::writeLoop(): bytesWritten=8
voltronic::USBDevice::write(): dataSize=12, writeSize=8
0x0000: 47 56 35 34 32 2c 35 34 30 cd 48 0d              GV542,540.H.
voltronic::Device::writeLoop(): bytesWritten=8
voltronic::USBDevice::write(): dataSize=4, writeSize=4
0x0000: 30 cd 48 0d                                      0.H.
voltronic::Device::writeLoop(): bytesWritten=8
voltronic::Device::readLoop(): bytesRead=8
voltronic::Device::recv(): got 5 bytes
0x0000: 5e 31 0b c2 0d                                   ^1...
ok

Everything's fine with CRC calculation and command size > 16 is not a problem.

Are you sure that the voltages you're trying to set are allowed for your particular model and that this setting is even configurable on it?

Another thought, try changing battery type to "user" and then try again. I have it set to "user" on my inverter, maybe it's not allowed to change these voltages in other modes?..

eliafino commented 1 year ago

Really not understand, but with RJ45-RS232 cable and USB adapter, this command work good. USB directly, no.

gch1p commented 1 year ago

When using adapter, you're still using --device usb, right?

eliafino commented 1 year ago

With USB, --device usb, this long command not work. with serial, --device serial, work correctly.

gch1p commented 1 year ago

Understood. Then it's something USB and/or HIDAPI related. I'm sending the command in 8 bytes chunks, and as you can see, it works with my inverter, but obviously it's not as good as it should be because it doesn't work on yours. Needs more research and testing.

Is there any other software that works with USB and your inverter and supports long command and works correctly?