Programmatically read data from your Solar Inverter (Voltronic, Axpert, Mppsolar PIP, Voltacon, Effekta etc) and interface with Home Assistant via MQTT - Works with RS232 & USB!

Hello @catalinbordan,

After several months working fine with your fork, suddenly the communication with the inverter stopped.
This is the debug data:

Thu Dec 8 09:57:28 2022 INVERTER: Debug set
Thu Dec 8 09:57:32 2022 DEBUG: Current CRC: 49 C1
Thu Dec 8 09:57:32 2022 DEBUG: Send buffer hex bytes: ( 51 4d 4f 44 49 c1 0d )
Thu Dec 8 09:57:32 2022 DEBUG: 7 bytes written, 7 bytes sent, 0 bytes remaining
Thu Dec 8 09:57:32 2022 DEBUG: 4 bytes read, 4 total bytes: 41 10 00 00 28 4c 06 07
Thu Dec 8 09:57:32 2022 DEBUG: 1 bytes read, 5 total bytes: 10 00 00 28 4c 06 07 0d
Thu Dec 8 09:57:33 2022 DEBUG: Found reply at byte: 5
Thu Dec 8 09:57:33 2022 DEBUG: QMOD: 5 bytes read: (L
Thu Dec 8 09:57:33 2022 DEBUG: QMOD query finished
Thu Dec 8 09:57:33 2022 DEBUG: Current CRC: B7 A9
Thu Dec 8 09:57:33 2022 DEBUG: Send buffer hex bytes: ( 51 50 49 47 53 b7 a9 0d )
Thu Dec 8 09:57:33 2022 DEBUG: 8 bytes written, 8 bytes sent, 0 bytes remaining
Thu Dec 8 09:57:33 2022 DEBUG: 3 bytes read, 3 total bytes: 00 41 10 00 00 28 32 33
Thu Dec 8 09:57:33 2022 DEBUG: 12 bytes read, 15 total bytes: 35 30 2e 30 20 32 33 36
Thu Dec 8 09:57:33 2022 DEBUG: 12 bytes read, 27 total bytes: 30 2e 30 20 30 32 33 36
Thu Dec 8 09:57:33 2022 DEBUG: 12 bytes read, 39 total bytes: 35 20 30 30 34 20 33 37
Thu Dec 8 09:57:33 2022 DEBUG: 12 bytes read, 51 total bytes: 2e 35 30 20 30 30 30 20
Thu Dec 8 09:57:33 2022 DEBUG: 1 bytes read, 52 total bytes: 35 30 20 30 30 30 20 30
Thu Dec 8 09:57:33 2022 DEBUG: 12 bytes read, 64 total bytes: 30 33 33 20 30 30 2e 34
Thu Dec 8 09:57:33 2022 DEBUG: 12 bytes read, 76 total bytes: 2e 30 20 30 30 2e 30 30
Thu Dec 8 09:57:33 2022 DEBUG: 12 bytes read, 88 total bytes: 30 30 20 30 30 30 31 30
Thu Dec 8 09:57:33 2022 DEBUG: 12 bytes read, 100 total bytes: 30 30 20 30 30 20 30 30
Thu Dec 8 09:57:33 2022 DEBUG: 10 bytes read, 110 total bytes: 38 20 30 31 30 42 74 0d
Thu Dec 8 09:57:34 2022 DEBUG: Found reply at byte: 110
Thu Dec 8 09:57:34 2022 DEBUG: QPIGS: 110 bytes read: (236.8 50.0 236.8 50.0 0236 0175 004 375 51.50 000 033 0033 00.4 120.0 00.00 00000 00010111 00 00 00048 010
Thu Dec 8 09:57:34 2022 DEBUG: QPIGS query finished
Thu Dec 8 09:57:34 2022 DEBUG: Current CRC: F8 54
Thu Dec 8 09:57:34 2022 DEBUG: Send buffer hex bytes: ( 51 50 49 52 49 f8 54 0d )
Thu Dec 8 09:57:34 2022 DEBUG: 8 bytes written, 8 bytes sent, 0 bytes remaining
Thu Dec 8 09:57:34 2022 DEBUG: 3 bytes read, 3 total bytes: 00 41 10 00 00 28 32 33
Thu Dec 8 09:57:35 2022 DEBUG: 12 bytes read, 15 total bytes: 32 34 2e 33 20 32 33 30
Thu Dec 8 09:57:35 2022 DEBUG: 12 bytes read, 27 total bytes: 30 2e 30 20 32 34 2e 33
Thu Dec 8 09:57:35 2022 DEBUG: 12 bytes read, 39 total bytes: 30 20 35 36 30 30 20 34
Thu Dec 8 09:57:35 2022 DEBUG: 12 bytes read, 51 total bytes: 35 30 2e 30 20 34 38 2e
Thu Dec 8 09:57:35 2022 DEBUG: 1 bytes read, 52 total bytes: 30 2e 30 20 34 38 2e 30
Thu Dec 8 09:57:35 2022 DEBUG: 12 bytes read, 64 total bytes: 32 20 35 33 2e 38 20 32
Thu Dec 8 09:57:35 2022 DEBUG: 12 bytes read, 76 total bytes: 20 30 36 30 20 30 20 32
Thu Dec 8 09:57:35 2022 DEBUG: 12 bytes read, 88 total bytes: 20 30 30 20 30 20 30 20
Thu Dec 8 09:57:35 2022 DEBUG: 12 bytes read, 100 total bytes: 20 30 20 31 20 30 32 30
Thu Dec 8 09:57:35 2022 DEBUG: 3 bytes read, 103 total bytes: 31 20 30 32 30 b6 00 0d
Thu Dec 8 09:57:40 2022 DEBUG: QPIRI read timeout
Thu Dec 8 09:57:41 2022 DEBUG: Found reply at byte: -5423367

What could causing this situation (QPIRI read timeout)? The RPi seems to be working well as the rs232 cable.

Thanks

Hi, I don’t know.
Try to shutdown inverter, try to shutdown rpi + take out the cables from it.
Mine also have issues sometimes with PIP 6048MT with microsub->usb cable connected (provide power also with this cable to rpi, so restart of rpi do not help with this cable connected.
Also try to set the baund rate of serial connection before starting the docker. Here I saw people who managed to get a script to set baund rate at startup.

Thanks for your reply @catalinbordan

Unfortunately I already did all the shutdowns/restarts you mention.
Every time I restart the RPi I run this commands sequence and normally works, but not anymore.

sudo reboot
cd /opt/ha-inverter-mqtt-agent
sudo stty -F /dev/ttyUSB0 sane
sudo stty -F /dev/ttyUSB0 2400 raw -echo
cat /dev/ttyUSB0
sudo docker-compose build
sudo docker-compose up -d
sudo docker ps

I will do a RPi clean install and see how it goes.

Did you solve it? yesterday I also lost connection with inverter.
Mine also qpiri timeout… :frowning: yeah I don’t have time for this…
What could be, me and you in the same time…

I have not done it yet the RPi clean install, but I’m not sure that will solve the problem.

I will change my setup, I order a rs232 module to use with a ESPboard and ESPhome.

@catalinbordan Meanwhile if you found a solution, please let me know

1 Like

How can I refresh quickly inverter parameters in Home Assistant?
Now all inverter sensors are refreshed every 20/30sec…
Thank you :blush:

Hi,
I did not have time for this now, but… :grin:
Mean while in this mornings I was playing with WiFi app, trying to see why my Inverter is charging the battery even if I set to charge only from solar… I set the Inverter from Ups to appliance and then HA started to receive data from rpi… Strange.
I don’t like the new Inverter battery less or bad firmware. I must find new firmware, but from where?
I also considered project from esphome, but I don’t have adapter. Can you share the link for adapter?
On rpi I also have a Bluetooth phyton script to monitor the ant bms for battery, if I can move both on them on HA it will be great.
I also seen on FB people who installed serial to tcp/wifi adapter or directly flashed tasmota on WiFi chip card.

Hi,
In order to have faster response time, you need to change a lot of code to make optimisations. You can look/try my fork to see this changes. I have a 7-8 seconds time interval

Hello @catalinbordan,

Thanks for the tip, it actually also works for me, I just changed a parameter in the App and it start immediately to receive data from the inverter.

I’m also struggling with the inverter from starting to charge the battery from the grid after the Battery Cut-Off Voltage is reached, what I did was to limit the Max. AC Charging Current to 2.0A.
Another situation that I have is when the Back to Grid Voltage is reached, there is a little drain of 2A continuously from the battery.

You can find firmware information here

I have 2 invertes one Hybrid V 4kw (gren mmpsolar ) the second Hybrid V2 5kw (yellow mmpsolar) both P18 protocol

I bought this two adapters:

Great!
“I’m also struggling with the inverter from starting to charge the battery from the grid after the Battery Cut-Off Voltage is reached” - why you would like to charge from grid? ideally for me it is do nothing(turn of and no drain from battery) because I was having an China ATS( now defective) to switch automatically on grid. Now I’m thinking of an contactor 2NC +2NO.
“Another situation that I have is when the Back to Grid Voltage is reached, there is a little drain of 2A continuously from the battery.” This also drive me nuts, because my new inverter PIP 6048MT do not want to charge to 2A on appliance/ups mode when it see voltage on PV, or it charge from grid even if I say to not do that. Yesterday I put it in UPS mode and back to grid 51Volts and 52 V back to battery as a temporary solution until I will put contactor to switch to grid and turn off inverter.
On that forum I did not find my model 6048MT, probably I will send an email to MPP solar to provide it, if they want.

I think I did not express myself in the best way, what I intended to say was when the battery reached the Battery Cut-Off Voltage the inverter it starts to charge from the grid, and this is the behavior that I don’t want.

I will ask in the foruns (AEVA and diysolarforum) if that continuous little drain from the battery if it is normal.

Hi, can you tell me how you managed to read the POWMR?
Thank you

1 Like

hi, what procedure did you follow to get all the inverter data?
Thank you

Hi everyone,
Regarding the problem of sending commands larger than 8 bytes, is there any modification to install to solve it?
I’ve seen that each has made their own modifications or implemented separate code…, but with the current integration it doesn’t work. Or maybe I haven’t seen it. Thanks.

1 Like

Hi Dan.
I have the same issue as you, before the new cable. I bought a serial Rj45 ->USB cable from AliExpress and I get zero bytes from the inverter.

Which cable did you get eventually?
Do you happen to have a link?

Debug below, in case you spot anything I missed.
Many thanks!

inverter_poller -d 1
Fri Jan 20 14:32:15 2023 INVERTER: Debug set
Fri Jan 20 14:32:15 2023 INVERTER: Current CRC: 49 C1
Fri Jan 20 14:32:18 2023 INVERTER: QMOD read timeout
Fri Jan 20 14:32:50 2023 INVERTER: QMOD reply too short (0 bytes)
Fri Jan 20 14:32:50 2023 INVERTER: Current CRC: B7 A9
Fri Jan 20 14:32:53 2023 INVERTER: QPIGS read timeout
Fri Jan 20 14:33:25 2023 INVERTER: QPIGS reply too short (0 bytes)
Fri Jan 20 14:33:25 2023 INVERTER: Current CRC: F8 54
Fri Jan 20 14:33:28 2023 INVERTER: QPIRI read timeout
Fri Jan 20 14:34:00 2023 INVERTER: QPIRI reply too short (0 bytes)
Fri Jan 20 14:34:00 2023 INVERTER: Current CRC: B4 DA
Fri Jan 20 14:34:03 2023 INVERTER: QPIWS read timeout
Fri Jan 20 14:34:35 2023 INVERTER: QPIWS reply too short (0 bytes)
Fri Jan 20 14:34:40 2023 INVERTER: Current CRC: 49 C1

Which integration in home assistant is used with Inverex inverters?

Hi I have the ESPhome connected and working, i can see the comms between ESPhome and the inverter, i get good responses on the QPIRI commands, but the QPIGS command times out as per logs here:

[12:25:59][D][pipsolar:838]: Sending polling command : QPIGS with length 5
[12:26:04][D][pipsolar:755]: timeout command to poll: QPIGS
[12:26:04][D][pipsolar:838]: Sending polling command : QMOD with length 4
[12:26:04][D][pipsolar:772]: checking crc on incoming message
[12:26:04][D][pipsolar:775]: CRC OK
[12:26:04][D][pipsolar:471]: Decode QMOD
[12:26:04][V][text_sensor:016]: 'pipsolar device_mode': Received new state B
[12:26:04][D][text_sensor:067]: 'pipsolar device_mode': Sending state 'B'
[12:26:05][D][pipsolar:838]: Sending polling command : QFLAG with length 5
[12:26:05][D][pipsolar:772]: checking crc on incoming message
[12:26:05][D][pipsolar:775]: CRC OK
[12:26:05][D][pipsolar:479]: Decode QFLAG
[12:26:06][D][pipsolar:838]: Sending polling command : QPIRI with length 5
[12:26:07][D][pipsolar:772]: checking crc on incoming message
[12:26:07][D][pipsolar:775]: CRC OK
[12:26:07][D][pipsolar:429]: Decode QPIRI
[12:26:07][V][sensor:076]: 'pipsolar battery_recharge_voltage': Received new state 46.000000
[12:26:07][D][sensor:127]: 'pipsolar battery_recharge_voltage': Sending state 46.00000 V with 1 decimals of accuracy
[12:26:07][V][sensor:076]: 'pipsolar battery_under_voltage': Received new state 42.000000
[12:26:07][D][sensor:127]: 'pipsolar battery_under_voltage': Sending state 42.00000 V with 1 decimals of accuracy
[12:26:07][V][sensor:076]: 'pipsolar battery_bulk_voltage': Received new state 58.400002
[12:26:07][D][sensor:127]: 'pipsolar battery_bulk_voltage': Sending state 58.40000 V with 1 decimals of accuracy
[12:26:07][V][sensor:076]: 'pipsolar battery_float_voltage': Received new state 58.400002
[12:26:07][D][sensor:127]: 'pipsolar battery_float_voltage': Sending state 58.40000 V with 1 decimals of accuracy
[12:26:07][V][sensor:076]: 'pipsolar battery_type': Received new state 2.000000
[12:26:07][D][sensor:127]: 'pipsolar battery_type': Sending state 2.00000  with 1 decimals of accuracy
[12:26:07][V][sensor:076]: 'pipsolar current_max_ac_charging_current': Received new state 10.000000
[12:26:07][D][sensor:127]: 'pipsolar current_max_ac_charging_current': Sending state 10.00000 A with 1 decimals of accuracy
[12:26:07][V][sensor:076]: 'pipsolar current_max_charging_current': Received new state 80.000000
[12:26:07][D][sensor:127]: 'pipsolar current_max_charging_current': Sending state 80.00000 A with 1 decimals of accuracy
[12:26:07][V][sensor:076]: 'pipsolar topology': Received new state 0.000000
[12:26:07][D][sensor:127]: 'pipsolar topology': Sending state 0.00000  with 1 decimals of accuracy
[12:26:07][V][sensor:076]: 'pipsolar output_mode': Received new state 1.000000
[12:26:07][D][sensor:127]: 'pipsolar output_mode': Sending state 1.00000  with 1 decimals of accuracy
[12:26:07][V][sensor:076]: 'pipsolar pv_ok_condition_for_parallel': Received new state 0.000000
[12:26:07][D][sensor:127]: 'pipsolar pv_ok_condition_for_parallel': Sending state 0.00000  with 1 decimals of accuracy
[12:26:07][V][sensor:076]: 'pipsolar pv_power_balance': Received new state 1.000000
[12:26:07][D][sensor:127]: 'pipsolar pv_power_balance': Sending state 1.00000  with 1 decimals of accuracy
[12:26:07][V][component:200]: Component esphome.coroutine took a long time for an operation (0.20 s).
[12:26:07][V][component:201]: Components should block for at most 20-30ms.
[12:26:07][D][pipsolar:838]: Sending polling command : QPIGS with length 5
[12:26:12][D][pipsolar:755]: timeout command to poll: QPIGS

I read in one of the MPP solar manuals that 48v versions use the QPIGS2 command, I have tried to modify my copy of pipsolar.cpp and pipsolar.h and added the “2” after every QPIGS statement in there, but when I send the code to the ESPhome using the install feature, it compiles the files and still no change, when i go back and check my files, they all say QPIGS not QPIGS2, how can i modify to test this command please?