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!

im not a linux wizz kid, im just helping out a guy the way i figured out to do it myself, the githib is not very clear on how to do it step by step

if you are connecting to the inverter via usb only (not using a usb to serial adapter) then you need to change the setting to hidraw0 in the inverter.conf

also what inverter are you using?

You need to set up home-assistant and mqtt.

Go to

http://192.168.0.125:8123

I am assuming 192.168.0.125 is your pi.

Thanks a lot. The procedure from git is incomplete…
Missing more steps and more informations to be clear. Unfortunattely in the present this topic was not completed with necessary informations for all users.

Inverter is Effekta AX-P 3 KVA / 24V and use USB cable directly to the Pi.

So, in my case problem no 1 in the present is that main interface do not working. Address http://192.168.0.125:8123 do not show in my browser…
The Pi 4 address is 192.168.0.125 and working very well with SSH client.

There can be some problems with incorrect installation of HA in docker ?
Last days when I installed first time only HA with Balena (directly on sd card but not in docker), worked ok. After that I erased all data from sdcard and put Raspbian and the rest…inclussive HA in docker.

The problem no 2 is that I can not access now inverter.conf to make necessary changes and set the correct parameters for communication.

When I sent the command
cd / opt / ha-inverter-mqtt-agent
the reply is
-bash: cd: too many arguments

If I sent the command
sudo nano config / inverter.conf

I can see the blank screen and inverter.conf have 0 lines…

Yesterday before stand-up container with command docker-compose up -d
I saw 42 lines in inverter.conf

So, what can I do for repair both problems in this regard?

Problem 2 solved. The command needed is:

docker-compose down -d
cd /opt/ha-inverter-mqtt-agent
sudo nano config/inverter.conf

and the rest…

After that I checked
vi config/mqtt.json

and I saw there some possible problems
default server is 10.16.10.4 so IP class A.

I have IP class C 192.168.0.xxx from router.
I think that this is a problem no 1, unsolved until now.

I tried to change IP from 10.16.10.4 to my 192.168.0.125. but I can not make this or I do not know how…

Maybe some one solved the same problem.

1 Like

I changed IP class for ethernet and give for Pi exactly 10.16.10.4. but do not show me anything in browser…
I write here MQTT config to see if there is a problem or in another place…
“server”: “10.16.10.4”,
“port”: “1883”,
“topic”: “homeassistant”,
“devicename”: “voltronic”,
“username”: “”,
“password”: “”

Adress http://10.16.10.4:1883/ do not work in browser…

sounds to me you havent even got home assistant installed?

Hello @ned-kelly,

What is the reasoning for calculating the PV input watts versus taking the reading from the inverter?

Also would be interested to hear if anyone here has Lithium batteries running and if they have got the readings from the battery control systems integrated into your systems?

Also did you use MySQL or Influxdb for your Grafana?

Why?

No, change it to the address of your mqtt server!

MQTT is not accessible via a browser. MQTT is not a web server. It is a MQTT server.

It is an EXAMPLE to be EDITED with your own settings!

In the list of requirements is this

Home Assistant running with a MQTT Server

Concentrate on doing that THEN move on to your inverter!

i have diybmsv4 leaf v1 on my 40kw battery bank, it sends mqtt commands into home assistant, i can monitor all 14 cell banks and run automations based on that, but dont use homeassistant as a BMS, let the BMS handle the discharging/top/bottom levels, you can use it for when the cells get to a certain voltage then turn on the chargers ect…

Thanks for the feedback @gazzaman2k . The reason for asking is that I am finding that the battery and inverter just do not seem to be liking each other. Probably the setup on the inverter or it is the BMS unit that is in there that is not reporting the correct information to the inverter.

I will have to chat with my friend that installed it and get them to check out the installation when lockdown is over.

I think some of the problem is also not having sufficient solar energy. Only have 9x265W panels and they are not facing the optimum direction. Need to build a frame to better angle them and add another 3x265W panels. I have a 10.2 kWh battery setup with the Mecer SOL-i-AX-5M. At least the BMS unit is now saying it is full and not giving an error. But the inverter is detecting the battery level at below 50%.

I have an RS232 to RS485 converter which I am thinking of connecting to the computer that is running the Hass supervised and the Voltronic docker and creating a script in a docker container for reading the information from the BMS. Even if it is just reporting. I have two Revov LiFe ES2-8 25.6V 200ah batteries connected to some generic BMS unit with RS485 comms to which nothing is connected.

I my friends python MQtt script he has for his inverter he gets the actual PV input Watt reading instead of calculation it.

Hi @Waz-Cpt - To further @gazzaman2k’s comments about the BMS (Which is totally correct and for anyone else reading you should even consider some cheapie(s) from aliexpress if you’re using VLRA setup (like I am)) - Waz, you will probably want to flash your inverter’s firmware with the special lithium builds here: http://forums.aeva.asn.au/viewtopic.php?t=4332

In terms of readings with your BMS system - I’m guessing you mean voltages from each Cell?

I’ve actually ended up building 16x a ESPHome sensors that just run an esp8266 and a cheap $2 voltage sensor and connected it to each battery in my array … that way I know if any of the voltages are not properly balanced from my cheap Chinese battery balancers (They all just feed back into Home Assistant) - Here’s the sensor I used in conjunction with my esp8266 (If you want to also do a similar build): https://esphome.io/components/sensor/ina219.html - If your BMS does not have some sort of serial/usb interface it may be worth doing something like this also

Lastly - the reason the KWhrs are calculated - is because in order to assume the actual KW generated we need to calculate the difference between each ‘poll’ - then add up each calculation… If we just pass the raw data through to MQTT we would need to poll every 1 second rather than every 30 seconds for example, which unfortunately I’ve found the PIP Inverters seem to bug out after a few weeks if you query them every second unless you’ve upgraded your firmware.

Note that the actual W and A from the PV is just passed through on each query, and NOT calculated - it’s only the total KWhr’s that are calculated - I realise you could also do this directly in HA, however the actual C app that does the polling was originally built to be standalone which is why the functionality to calculate the KWhrs is in the actual daemon.

Lastly, as a rule of thumb - you need to always “put back in” to your batteries what you “pull out” - So I’d grab a multi meter and check the voltage for each cell and make sure they are the correct voltage for a fully charged cell (If you’re unsure) - Lithium setups are expensive, you want to make sure you look after them! You may also find that the inverter detecting the battery level is incorrect is due to the firmware not yet being upgraded to support Lithium setups.

@ned-kelly, thank you for the feedback. I will have to get hold of a USB-serial interface to do a firmware upgrade.

When looking through your code I do see that you have the calculations for the kWh in there, but looking further I do see that you are not reading the PV_input_watts from the PIGS, you are doing a calculation

pv_input_watts = (scc_voltage * pv_input_current) * wattfactor;

you are not actually reading the pv_input_watts from your reply1 statement.

The battery system I have is a system purchased from an installer.

As I said the BMS does have an RS485 interface. I just have to get a docker container and MQTT pubsub setup to supply HA with the information. Need to get the data table information for the BMS unit.

Ideally I need to try keep my battery pack floating between 35% and 75% to minimize the charge cycles from what I understand of Lithium battery systems.

Thank you very much for advices gazzaman2k & nickrout.
In this morning I resolved the problems with HA and it seems that docker working ok but with 2 MQTT agents…

  1. Watchtower running ok
  2. Voltronic running unhealthy.

Is necessary both MQTT agents, or can work only with Watchtower?
If is necessary Voltronic MQTT please give me advices to make…healthy…:slight_smile:

You have a docker stack called ha-inverter-mqtt-agent, made up of watchtower and voltronic-mqtt. A docker stack is a group of docker containers working together.

watchtower seems to be working, voltronic-mqtt is “unhealthy”.

You do not seem to have a mqtt container, although it doesn’t have to run via docker.

Maybe you are not completely sure what mqtt is.

mqtt is a protocol where you have a server (also called a broker) and a number of clients. All the clients publish to topics on the broker and/or subscribe to topics on the broker.

Being more concrete, the voltronic-mqtt subscribes to mqtt topics and publishes to topics. Home assistant subscribes to topics and publishes to them. In that way voltronic-mqtt and home assistant talk to each other. Any other software, eg another home control package like openhab or domoticz, can also communicate with voltronic-mqtt.

So to cut a long story short you need a mqtt broker to act as a middleman between voltronic-mqtt and home assistant.

An mqtt broker essentially has a few things that identify it:

  1. the host it runs on
  2. the port it runs on (1883 by default)
  3. the username to access it
  4. the password to access it

These are the things you define in mqtt.json in the voltronic-mqtt software, once you have a mqtt broker set up.

1 Like

Dear nickrout, last week I didn’t know anything about these…trust me that I learned very much in these days…so please let me know step by step.

Be sure that I do not understand yet all working mechanisms in these systems. Please explain to me what processes must to be up in each portainer systems from users, to make functional these systems.

After that we will see what we can resolve these processes to be up. Portainer is an interface that helps us, to see the status of these components and unfortunately we did not find this informations about that, here on this forum.

Expect advices inclussive from another users who have functional this system and can install portainer, to see what components is active in their systems.

Portainer can be installed in your raspberry Pi from here: https://www.portainer.io/installation/

1 Like

Hi Gry2000,

Appreciate your hard work. I was also tried 2 months back to setup a raspberry pi to monitor my axpert inverter but due to lack of programming skills, I left the project in mid. Day before yesterday I start using ICC software to monitor the inverter power. The software is 7 days trial period. That have a very smart view and data statics.

Thanks to Nickrout, who helped me a lot earlier.

Do you also have same kind of inverter ?

Thanks.

@Waz-Cpt Glad to see some one else has actually gone through the code :slight_smile: - and good question!

From what I recall when we originally tested on my 24v 3kw inverter (running on the original firmware before upgrading to a newer 5kw inverter) the watts displayed on the query you’re referring to is actually (at least in the firmware i’m running) influenced from the current that is going OUT to your batteries, not the actual PV voltage (This is why when you look at the raw value returned, it won’t exactly match the number displayed on your inverter’s LCD that is calculated by the firmware).

Additionally, if you grab a DC CT Clamp Multimeter and clamp it over one of your cables from the PV array, you’ll notice that the current that the inverter reports is actually off slightly what’s actually going through the cables - this is why there’s an option in the inverter config to set the wattfactor and ampfactor - The default watt_factor=1.01 seems to be a sweet spot for me (I’m running about 25M of cable from my PV Array to my Inverter) if you really want 100% accurate readings you’ll need to do a measurement also and adjust accordingly - Chances are if you’re a similar size setup you can leave it as the default.

Hope this helps shed some light!

PS Your Lithium rackmount battery looks sexy! I wish I could afford a bunch of them, I’m running 3,000 AH of VLRA (My Plex library draws a lot of power :wink: ) so it would cost a fortune if I had 3k AH of Lithium unfortunately :frowning:

@gry2000 & @amansingh - This project was never intended to be a “turnkey” replacement solution for watchpower but rather an integration to HA for those who have a Smart Home setup (So I’m expecting that you will have experience on how to setup and configure Home Assistant before using this solution).

It’s clearly obvious that there’s a few of you out there that just want the interface that’s in the screenshot’s in Github without having to worry about the whole Home Assistant setup - Perhaps you (or someone else who fits this use-case and is competent with Linux) should look at making some sort of simple Raspberry Pi “Image” for these users with plain Grafana, InfluxDB, and the voltronic-mqtt once you’ve mastered how to set it up) - At this stage, I’m not prepared (or interested) in maintaining such an image as I have no use for it myself - and frankly, if anything in my HA architecture is not running within Docker, I won’t use it as it’s to hard to backup and restore in the event of hardware failures (with exception of course to my esp8266’s / other IoT Hardware).

Reading through your initial comments I see you’ve not read/followed/understood the Prerequisites & Configuration & Standing Up section of the readme which states that you need to set your “MQTT server’s IP/Host Name, Port, Credentials, HA topic, and name of the Inverter that you want displayed in Home Assistant” - So for anyone else with issues, please carefully read the readme before posting questions on the forum/github issues that are already covered in the readme.

Best of luck with your setup, at this stage I’d suggest you look at your logs in your failed container in Portainer and go from there, chances are you’ll need to double check your configuration and also that the image you’re pulling supports the architecture if your device (There’s multiple architectures that have been built on docker hub).

Lastly, if you’re using Portainer you won’t need watchtower since Portainer has the ability to ‘auto update’ containers when new releases are pushed to docker-hub… The docker-compose file that’s included on github is “lightweight & simple” so it can be easily deployed onto “lightweight” SBC devices in the field … I’d advise any users running this solution on “slow/low-end” devices to do without a container orchestration tool (Such as Swarm, Portainer, Kubernetes etc) since you’re probably only going to be a handful of containers on the device, and all these extra ‘tools’ will just slow down the SBC.

Note that if you’re plugging a regular computer into the inverter then you’ll probably be fine running everything with some sort of container orchestration tool - but this goes beyond the context of the setup guidelines outlined on the project’s github page.

Best of luck :slight_smile:

1 Like

Dear all,
I would like to share with you correct buffers setup for PIP5048MK.
Inverter made by MPP Solar:

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

I'm also using Raspberry pi1 Model B+ with custom build suggested by wax911 using arm32v6/alpine
- many thanks for that.

log - just for the record:

root@raspberrypi:/opt/ha-inverter-mqtt-agent# docker exec -it voltronic-mqtt bash -c '/opt/inverter-cli/bin/inverter_poller -d -1'
Wed Apr 29 23:24:44 2020 INVERTER: Debug set
Wed Apr 29 23:24:44 2020 INVERTER: Current CRC: 49 C1
Wed Apr 29 23:24:44 2020 INVERTER: QMOD reply size (5 bytes)
Wed Apr 29 23:24:44 2020 INVERTER: QMOD: 5 bytes read: (B
Wed Apr 29 23:24:44 2020 INVERTER: QMOD query finished
Wed Apr 29 23:24:44 2020 INVERTER: Current CRC: B7 A9
Wed Apr 29 23:24:45 2020 INVERTER: QPIGS reply size (110 bytes)
Wed Apr 29 23:24:45 2020 INVERTER: QPIGS: 110 bytes read: (000.0 00.0 229.9 50.0 0413 0199 008 390 56.00 000 068 0028 0000 000.0 00.00 00003 00010000 00 00 00000 010
Wed Apr 29 23:24:45 2020 INVERTER: QPIGS query finished
Wed Apr 29 23:24:45 2020 INVERTER: Current CRC: F8 54
Wed Apr 29 23:24:45 2020 INVERTER: QPIRI reply size (104 bytes)
Wed Apr 29 23:24:45 2020 INVERTER: QPIRI: 104 bytes read: (230.0 21.7 230.0 50.0 21.7 5000 5000 48.0 50.0 49.0 57.2 57.2 2 60 090 1 2 3 9 01 0 0 51.0 0 1 000 1
Wed Apr 29 23:24:45 2020 INVERTER: QPIRI query finished
Wed Apr 29 23:24:45 2020 INVERTER: Current CRC: B4 DA
Wed Apr 29 23:24:45 2020 INVERTER: QPIWS reply size (40 bytes)
Wed Apr 29 23:24:45 2020 INVERTER: QPIWS: 40 bytes read: (100001000000000000000000000000000000
Wed Apr 29 23:24:45 2020 INVERTER: QPIWS query finished
INVERTER: ampfactor from config is 1.00
INVERTER: wattfactor from config is 1.01
{
  "Inverter_mode":4,
  "AC_grid_voltage":0.0,
  "AC_grid_frequency":0.0,
  "AC_out_voltage":229.9,
  "AC_out_frequency":50.0,
  "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":8,
  "Load_watt":199,
  "Load_watthour":6.6333,
  "Load_va":413,
  "Bus_voltage":390,
  "Heatsink_temperature":28,
  "Battery_capacity":68,
  "Battery_voltage":56.00,
  "Battery_charge_current":0,
  "Battery_discharge_current":3,
  "Load_status_on":1,
  "SCC_charge_on":0,
  "AC_charge_on":0,
  "Battery_recharge_voltage":50.0,
  "Battery_under_voltage":49.0,
  "Battery_bulk_voltage":57.2,
  "Battery_float_voltage":57.2,
  "Max_grid_charge_current":60,
  "Max_charge_current":90,
  "Out_source_priority":2,
  "Charger_source_priority":3,
  "Battery_redischarge_voltage":0.0,
  "Warnings":"100001000000000000000000000000000000"
}
Wed Apr 29 23:24:46 2020 INVERTER: All queries complete, exiting loop.
1 Like