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!

Some help please

Same problem! I can’t understand why. I tried both to change usb cable and check with MQTT explorer but nothing, i cant understand why i didnt get information from the device

Hello !

I have EASUN POWER 3Kw SMH II.
Can someone please tel me which values for QPIRI and QPIWS ?
Thanks !

root@ced214cde071:/opt/inverter-cli/bin# ./inverter_poller -d -1
Thu Nov 23 14:39:45 2023 INVERTER: Debug set
Thu Nov 23 14:39:45 2023 INVERTER: Current CRC: 49 C1
Thu Nov 23 14:39:45 2023 INVERTER: QMOD reply size (5 bytes)
Thu Nov 23 14:39:45 2023 INVERTER: QMOD: 5 bytes read: (L
Thu Nov 23 14:39:45 2023 INVERTER: QMOD query finished
Thu Nov 23 14:39:45 2023 INVERTER: Current CRC: B7 A9
Thu Nov 23 14:39:48 2023 INVERTER: QPIGS read timeout
Thu Nov 23 14:39:48 2023 INVERTER: QPIGS reply too short (0 bytes)
Thu Nov 23 14:39:48 2023 INVERTER: Current CRC: F8 54
Thu Nov 23 14:39:48 2023 INVERTER: QPIRI reply size (98 bytes)
Thu Nov 23 14:39:48 2023 INVERTER: QPIRI: 98 bytes read: (230.0 13.9 230.0 50.0 13.9 3200 3000 24.0 23.0 22.0 29.0 29.0 2 20 020 1 0 2 6 01 0 0 27.0 0 1
Thu Nov 23 14:39:48 2023 INVERTER: QPIRI query finished
Thu Nov 23 14:39:48 2023 INVERTER: Current CRC: B4 DA
Thu Nov 23 14:39:51 2023 INVERTER: QPIWS read timeout
Thu Nov 23 14:39:51 2023 INVERTER: QPIWS reply too short (0 bytes)
Thu Nov 23 14:39:56 2023 INVERTER: Current CRC: B7 A9
Thu Nov 23 14:39:56 2023 INVERTER: QPIGS reply size (110 bytes)
Thu Nov 23 14:39:56 2023 INVERTER: QPIGS: 110 bytes read: (240.0 49.9 240.0 49.9 0167 0049 005 457 29.00 001 100 0023 0000 000.0 00.00 00000 00010101 00 00 00001 110
Thu Nov 23 14:39:56 2023 INVERTER: QPIGS query finished
Thu Nov 23 14:39:56 2023 INVERTER: Current CRC: B4 DA
INVERTER: ampfactor from config is 1.00
INVERTER: wattfactor from config is 1.01
{
  "Inverter_mode":3,
  "AC_grid_voltage":240.0,
  "AC_grid_frequency":49.9,
  "AC_out_voltage":240.0,
  "AC_out_frequency":49.9,
  "PV_in_voltage":0.0,
  "PV_in_current":0.0,
  "PV_in_watts":0.0,
  "PV_in_watthour":0.0000,
  "SCC_voltage":0.0000,
  "Load_pct":5,
  "Load_watt":49,
  "Load_watthour":1.6333,
  "Load_va":167,
  "Bus_voltage":457,
  "Heatsink_temperature":23,
  "Battery_capacity":100,
  "Battery_voltage":29.00,
  "Battery_charge_current":1,
  "Battery_discharge_current":0,
  "Load_status_on":1,
  "SCC_charge_on":0,
  "AC_charge_on":1,
  "Battery_recharge_voltage":23.0,
  "Battery_under_voltage":22.0,
  "Battery_bulk_voltage":29.0,
  "Battery_float_voltage":29.0,
  "Max_grid_charge_current":20,
  "Max_charge_current":20,
  "Out_source_priority":0,
  "Charger_source_priority":2,
  "Battery_redischarge_voltage":2579850948650221782946201194201088.0,
  "Warnings":""
}
Thu Nov 23 14:39:56 2023 INVERTER: All queries complete, exiting loop.
root@ced214cde071:/opt/inverter-cli/bin#

with this :

# This allows you to modify the buffersize for the qpiri command
qpiri=98

# This allows you to modify the buffersize for the qpiws command
qpiws=40

# This allows you to modify the buffersize for the qmod command
qmod=5

# This allows you to modify the buffersize for the qpigs command
qpigs=110

I’ve been experimenting with this over the last few days. It seems on my inverter (Conversol Max 11kW) the QPIGS command only interrogates one MPPT, the one for PV1. I believe there may be a “QPIGS2” command for polling the inverter for MPPT2 from some other documentation I’ve read with updates on the protocol. I had a shot at forking and modifying the repo to see additional data, but didn’t have any joy. I added quite a lot into the C++ files but none of it seems to be executing. I’m not a programming expert and haven’t used C++ using classes etc before, so I don’t really have the technical skills to finish this. You can see also from the image that PV1 voltage and PV1 current are actually from the solar array not the battery and that PV1 watts are reported as a value. Hopefully it’s helpful to some other poor soul that’s more skilled than I am! Inverter main cpu version is 57.04.

I tried it and having an issue. This was exactly what I was looking for only it isn’t getting the results I expected. I just get (NAKss for a reply. I even tried adding a checksum like others suggested. I’m trying this project, GitHub - dj-nitehawk/Hybrid-Inverter-Monitor: Monitoring application for hybrid inverters using the Voltronic communication protocol & JK BMS via USB port., and it gets values from my inverter, a Vevor 3kv hybrid, but some of the values are wrong or missing. I was hoping to use your script to figure out the problem as I’m not familiar with .NET. Any suggestion on how to get a response?

My python script is only to test the serial port or if needed to enable it.
i never tryed the tool that you metioned.

The com port is working. I’m just trying to find out the command structure. I think I need to add a crc to the commands.

I got it working. Here is what I did in case anyone else needs it.

import serial
from struct import pack
from crc16 import crc16xmodem

serialport = serial.Serial("/dev/ttyUSB0", 2400, timeout=0.5)

text = "QPIGS"
value = '' 
encoded_cmd = text.encode() + value.encode()
checksum = crc16xmodem(encoded_cmd)
cmd = encoded_cmd + pack('>H', checksum) + b'\r'

print(cmd)

serialport.write(cmd)
response = serialport.readlines(None)
print(response)

I use a simple python script that polls the inverter, extract data and send them to an mqtt broker.

See my repo: https://github.com/andrea1388/solarinverter2mqtt.git

Hello. I have a solar inverter of the brand Effekta ax-p1. It has a usb 2.0 type b communication port: here is a picture:

How do I integrate it into esphome (and Home assitant) and what do I need for it. Thanks for every reply. (inverter works with WachPower app.)

For those who need it Inverter- Mecer Axpert 5.6K MKS IV 5600VA / 5600W 48V Pure Sine Wave MPPT Inverter charger:
via USB
Qpiri=103
Qpiws=40
qmod =5
qpigs=110

Got this up and running after 3 weeks of tinkering and playing around with it. Installing docker was the most annoying thing. HA amazing and must say working well. Just a few things if anyone can help. Looked through the thread and not sure where to go from here. My battery re discharge voltage is fooked. See below: If anyone can give some guidance on where to begin debugging this it would be great.

Does anyone have Welion hybrid inverter Eco series (4200w & 6200w)? I just got one and would like to get it into HA.
Welion hybrid inverter

It appears also to be the same as Anern hybrid inverter Evo series (4200w & 6200w). If you have integrated this also kindly post your config.

Both inverters have RJ45 rs232 and I am hoping a USB to RJ45 console cable will work. If you have a better way kindly let me know also.
image

Hi, I’m setting up this docker images for me. And I can get data from inverter and push it to mqtt by executing docker exec -it voltronic-mqtt bash -c '/opt/inverter-mqtt/mqtt-push.sh'

But I can’t make it to work automatically every 30 sec according to update interval. What I can be doing wrong?
Both docker images are running


Thanks

Back after a few years as I’ve changed environments and just wanted to share what I had to do to get this working again.

Moved off Rpi4 onto a more powerful x86 ProxMox environment and also moved away from USB>RS233 adaptor to straight Micro USB as my MPP7248 supports that.

Now on Debian 12 VM, latest docker/portainer but had to change inverter.conf to;

device=/dev/hidraw0

qpiri=104
qpiws=40
qmod=5
qpigs=110

For other people having issues, run the poller in debug mode with docker exec -it voltronic-mqtt bash -c '/opt/inverter-cli/bin/inverter_poller -d -1 and watch what the output is, if you’re getting reply too short or incorrect stop/start bits then keep reducing the buffer size of the query and run it again, you do not have to restart the container, the buffer changes are instant.

My original config for qpiri, for example, was 108 bytes, and I kept being told reply too short until I worked back by 1 - on USB it’s only 98. This is the same inverter so just test yours. If you are getting zero bytes the port is in use elsewhere or not communicating at all.

If you are using USB>RS232 then I would suggest using screen or minicom to open the port specirfically at 2400 or 9600 baud and sending a QPIGS and seeing if there’s any response. On my old Debian 11 box, the port speed/options were being reset and I had to run a script at boot time to set them each time.

That said, it’s much faster on USB, though stability remains to be seen, only been up a day. I didn’t realise the BMS USB port on the inverter control module could be used this way, I thought it was just for receiving data from a BMS (I use Bluetooth straight into HassOS for the BMS). I also need to test today if I can still push commands (I often change the max AC charging input for example).

The point of all this was;

  • Get the voltronic container/portainer away from HA so HA is fully supported, full HassOS deployment, and will update more easily.
  • Hopefully improve stability of HA as I’ve had issues with that on the Rpi4, HA drops, then Debian would refuse SSH until it was rebooted.
  • Allow me to run some other cool VMs (pi hole, plex etc).

Useful commands;

To confirm your USB/RS232 adaptor has been seen by the host.
dmesg | grep ttyUSB

To poll in debug mode.
docker exec -it voltronic-mqtt bash -c ‘/opt/inverter-cli/bin/inverter_poller -d -1’

To check USB/RS232 port settings
stty < /dev/ttyUSB0

To change port speed of USB/RS232
stty -F /dev/ttyUSB0 9600

To watch the port output, set the port speed, and attempt to send commands
screen /dev/ttyUSB -b 9600

To see what else might be using your USB/RS232 port so you can kill those processes
lsof /dev/ttyUSB0

Hope this helps someone.

​​

​​

Further to the above, I no longer appear to be able to send commands to the inverters, I have some buttons setup that publish to the parent topic that used to work fine so I know the commands are good it’s clearly an MQTT issue, but I’m unsure how to troubleshoot it, assistant appreciated.

Have just got an eco worthy 800w hybrid inverter 800W 12V Solar Panel Inverter All in One Hybrid with 50A PWM Controller Off-Grid | eBay which I believe is a clone of these. Have connected the included rj54- serial cable to one of these StarTech.com 17in (43cm) 1-Port USB to RS232 DB9 Serial Adapter Cable, USB to Serial Adapter Cable - M/M : Amazon.co.uk: Computers & Accessories have created the docker container and have the data being published into my emqx mqtt broker. However this data appears empty I have tried running sudo docker exec -it voltronic-mqtt bash -c ‘/opt/inverter-cli/bin/inverter_poller -d -1’ but it is coming back as QMOD/QPIGS/QPIRI/QPIWS reply too short (0 bytes) have tried stty -F /dev/ttyUSB0 9600 & 2400 raw with no change any further advise?
Many Thanks

So after playing now have this, now I feel that means im getting closer but no idea really :rofl: any ideas? Have connected it to a device running watchpower and am able to get live data so know inverter and cable are working
qpiri=97
qpiws=20
qmod=4
qpigs=110

marc@debian-server:~/docker/inverter$ sudo docker exec -it voltronic-mqtt bash -c ‘/opt/inverter-cli/bin/inverter_poller -d -1’
Sat Sep 28 21:02:14 2024 INVERTER: Debug set
Sat Sep 28 21:02:14 2024 INVERTER: Current CRC: 49 C1
Sat Sep 28 21:02:15 2024 INVERTER: QMOD reply size (4 bytes)
configuration options for the actual inverter polling process…es. Buffer: (B��I�

The device to read from…

Use: /dev/ttyS0 if you have a serial device,

/dev/ttyUSB0 if a USB<>Serial,

/dev/hidraw0 if you’re connecting via the USB port on the inverter.

device=/dev/ttyUSB0

How many times per hour is the program going to run…

This is used to calculate the PV & Load Watt Hours between runs…

If unsure, leave as default - it will run every minute…

(120 = every 30 seconds)…

run_interval=120

This allows you to modify the amperage in case the inverter is giving an incorrect

reading compared to measurement tools. Normally this will remain ‘1’

amperage_factor=1.0

This allows you to modify the wattage in case the inverter is giving an incorrect

reading compared to measurement tools. Normally this will remain ‘1’

watt_factor=1.01

The following settings allow you to modify runtime buffers.

N.B. These values may not be applicable to all inverter types, as such you will

need

Sat Sep 28 21:02:15 2024 INVERTER: Current CRC: B7 A9
Sat Sep 28 21:02:16 2024 INVERTER: QPIGS reply size (110 bytes)
Sat Sep 28 21:02:16 2024 INVERTER: QPIGS: 110 bytes read: (001.0 00.0 229.0 50.0 0156 0070 015 417 13.06 000 100 0558 0000 000.0 00.00 00009 10010000 10 08 00000 000
Sat Sep 28 21:02:16 2024 INVERTER: QPIGS query finished
Sat Sep 28 21:02:16 2024 INVERTER: Current CRC: F8 54
Sat Sep 28 21:02:19 2024 INVERTER: QPIRI read timeout
Sat Sep 28 21:02:19 2024 INVERTER: QPIRI reply too short (7 bytes)
Sat Sep 28 21:02:19 2024 INVERTER: Current CRC: B4 DA
Sat Sep 28 21:02:19 2024 INVERTER: QPIWS reply size (22 bytes)
Sat Sep 28 21:02:19 2024 INVERTER: QPIWS: incorrect start/stop bytes. Buffer: (. 04.4.3 0080012. 150 0156 0070 015 417 13.06 000 100 0558 0000 000.0 00.00 00009 10010000 10 08 00000 000
Sat Sep 28 21:02:24 2024 INVERTER: Current CRC: 49 C1
Sat Sep 28 21:02:25 2024 INVERTER: QMOD reply size (4 bytes)
.3 0080012. 150 0156 0070 015 417 13.06 000 100 0558 0000 000.0 00.00 00009 10010000 10 08 00000 000
Sat Sep 28 21:02:25 2024 INVERTER: Current CRC: F8 54
Sat Sep 28 21:02:26 2024 INVERTER: QPIRI reply size (97 bytes)
Sat Sep 28 21:02:26 2024 INVERTER: QPIRI: 97 bytes read: (230.0 04.3 230.0 50.0 04.3 1000 0800 12.0 11.5 10.5 14.5 13.5 2 20 50 0 0 0 - 01 1 0 13.5 0 0
Sat Sep 28 21:02:26 2024 INVERTER: QPIRI query finished
Sat Sep 28 21:02:26 2024 INVERTER: Current CRC: B4 DA
Sat Sep 28 21:02:28 2024 INVERTER: QPIWS reply size (22 bytes)
Sat Sep 28 21:02:28 2024 INVERTER: QPIWS: incorrect start/stop bytes. Buffer: (000000000000000000000 04.3 1000 0800 12.0 11.5 10.5 14.5 13.5 2 20 50 0 0 0 - 01 1 0 13.5 0 0
Sat Sep 28 21:02:33 2024 INVERTER: Current CRC: 49 C1
Sat Sep 28 21:02:34 2024 INVERTER: QMOD reply size (4 bytes)
000000000000000 04.3 1000 0800 12.0 11.5 10.5 14.5 13.5 2 20 50 0 0 0 - 01 1 0 13.5 0 0
Sat Sep 28 21:02:34 2024 INVERTER: Current CRC: B4 DA
Sat Sep 28 21:02:35 2024 INVERTER: QPIWS reply size (22 bytes)
Sat Sep 28 21:02:35 2024 INVERTER: QPIWS: incorrect start/stop bytes. Buffer: (000000000000000000000 04.3 1000 0800 12.0 11.5 10.5 14.5 13.5 2 20 50 0 0 0 - 01 1 0 13.5 0 0
Sat Sep 28 21:02:40 2024 INVERTER: Current CRC: 49 C1
Sat Sep 28 21:02:41 2024 INVERTER: QMOD reply size (4 bytes)
000000000000000 04.3 1000 0800 12.0 11.5 10.5 14.5 13.5 2 20 50 0 0 0 - 01 1 0 13.5 0 0
Sat Sep 28 21:02:41 2024 INVERTER: Current CRC: B4 DA
Sat Sep 28 21:02:42 2024 INVERTER: QPIWS reply size (22 bytes)
Sat Sep 28 21:02:42 2024 INVERTER: QPIWS: incorrect start/stop bytes. Buffer: (000000000000000000000 04.3 1000 0800 12.0 11.5 10.5 14.5 13.5 2 20 50 0 0 0 - 01 1 0 13.5 0 0
Sat Sep 28 21:02:47 2024 INVERTER: Current CRC: 49 C1
Sat Sep 28 21:02:49 2024 INVERTER: QMOD reply size (4 bytes)
000000000000000 04.3 1000 0800 12.0 11.5 10.5 14.5 13.5 2 20 50 0 0 0 - 01 1 0 13.5 0 0
Sat Sep 28 21:02:49 2024 INVERTER: Current CRC: B4 DA
Sat Sep 28 21:02:50 2024 INVERTER: QPIWS reply size (22 bytes)
Sat Sep 28 21:02:50 2024 INVERTER: QPIWS: incorrect start/stop bytes. Buffer: (000000000000000000000 04.3 1000 0800 12.0 11.5 10.5 14.5 13.5 2 20 50 0 0 0 - 01 1 0 13.5 0 0

So have data going into my MQTT broker, wont auto populate in home assistant. For anyone who need them,
qpiri=97
qpiws=40
qmod=5
qpigs=110

Now question one sensor that seems to be missing is grid power. Have booted up a copy of solarassistant to try and my inverter does provide this information just not showing in mqtt. Any way to edit this to gain that information?

Also feel there is an issue with mqtt device tag, rather than my device showing as one, then each entity under it, each one shows as a separate device as you can see from my mqtt explore

Thank you so much! now finally work perfectly!!!

1 Like

Hello! I have similar inverter model and wanna read raw data from it. Could you describe your setup and how you configured it? Can simple laptop with ubuntu read the data directly from inverter? I’m newbee so sorry for my dumb questions.