• Have you tried out dark mode?! Scroll to the bottom of any page to find a sun or moon icon to turn dark mode on or off!

diy solar

diy solar

Data collection options for EG4 Inverters

mondurr

New Member
Joined
Jul 13, 2024
Messages
236
Location
USA
My aim with this thread is to capture a list of ways / projects to collect data from EG4 inverters. For me personally I want to collect data from a 12000XP and shove it into InfluxDB for display with Grafana, but I'm not seeing a turnkey solution for that so I'll cobble together multiple projects with some of my own code to make this happen. Please chime in with projects / solutions and I'll add them to the list.

Projects:
  • PythonProtocolGateway
    • Connect to the inverter's INV485 port, but will not work concurrently with the EG4 wifi module.
    • Can dump data into Home Assistant via MQTT and direclty into InfluxDB.
    • High touch, but ideal solution for custom integrations.
  • Solar Assistant
    • Low touch turnkey solution.
    • Can dump into Home Assistant via MQTT.
    • Connects to the EG4 wifi module over your LAN and works concurrently with monitor.eg4electronics.com
    • Commercial software (~$56).
  • ESPHome based data logger
    • Replaces the EG4 wifi module with an ESP32 (your own ESP32, not EG4's data logger which is also ESP32 based)
    • Pushes data into Home Assistant via the ESPHome addon
    • Should be easy to add other databases like InfluxDB
  • lxp-bridge (I'm successfully using this one)
    • Simple solution to push EG4 data into both InfluxDB and HA via MQTT
    • Connects to the EG4 wifi module over your LAN and works concurrently with monitor.eg4electronics.com
    • Controls don't appear to properly support the 12000XP and maybe others as it was written for LuxPower inverters
    • HA Sensors work for building automations around the inverter
    • Note that lxp-bridge does not appear to function if you block the dongle from reaching the internet
  • eg4-inverter-api (python library)
Questions:
  • Anyone know of a project that scrapes data from monitor.eg4electronics.com?
  • What solutions allow you to still use monitor.eg4electronics.com while collecting data?
    • So far Solar Assistant and lxp-bridge
  • What self-hosted solutions offer a comprehensive replacement for monitor.eg4electronics.com, specifically in regards to changing settings?
    • lxp-bridge seems capable, but may need some modification to fully support the newer EG4 units
 
Last edited:
There is another set of terminals you can connect to (at least on the 18kpv) so may be on other models.

If you use those terminals PythonProtocal gateway works just fine while using the wifi adaptor.

Mine are down on a green terminal block and are labeled 485a/485b/gnd and run at 19200 baud instead of the 115200 the wifi provides.

I can get a complete sample of everything every 30 seconds using that connection vs eg4 website being 3-5 minutes per sample.
 
There is another set of terminals you can connect to (at least on the 18kpv) so may be on other models.

If you use those terminals PythonProtocal gateway works just fine while using the wifi adaptor.

Mine are down on a green terminal block and are labeled 485a/485b/gnd and run at 19200 baud instead of the 115200 the wifi provides.

I can get a complete sample of everything every 30 seconds using that connection vs eg4 website being 3-5 minutes per sample.
Interesting, I don't think the 6000XP and 12000XP have these contacts.
 
I got lxp-bridge working with HA and it's dumping data in to InfluxDB. It was really simple to get this working once I figured out I had to reboot the dongle. It also seems to work fine along side monitor.eg4electronics.com. It does not seem to properly support the controls for the 12000xp, however, so I would not use this to change inverter settings, but as a solution to get data into MQTT and InfluxDB it seems to work well.

All the sensors in HA also seem to work so this will be useful if I need to build any HA automations around the inverter, ie if no input power then turn off all unecessary smart plugs.
 
Last edited:
I got lxp-bridge working with HA and it's dumping data in to InfluxDB. It was really simple to get this working once I figured out I had to reboot the dongle. It also seems to work fine along side monitor.eg4electronics.com. It does not seem to properly support the controls for the 12000xp, however, so I would not use this to change inverter settings, but as a solution to get data into MQTT and InfluxDB it seems to work well.

All the sensors in HA also seem to work so this will be useful if I need to build any HA automations around the inverter, ie if no input power then turn off all unecessary smart plugs.
Hi. I'm looking into setting up the same thing. Got lxp-bridge installed and pushing data into MQTT. Installed Home Assistant, but since I've never used HA before, I'm a bit lost as to what to do next with it to get it to talk to the bridge. Is there a guide of sorts for HA newbs like myself?
Thanks in advance.
 
Hi. I'm looking into setting up the same thing. Got lxp-bridge installed and pushing data into MQTT. Installed Home Assistant, but since I've never used HA before, I'm a bit lost as to what to do next with it to get it to talk to the bridge. Is there a guide of sorts for HA newbs like myself?
Thanks in advance.

To configure the addon and see the logs, go to Settings->Add-ons->lxp-bridge, config and log tabs are at the top.

To see the data you should be able to go into Settings->Devices & Services->Devices Tab, then in the device list you'll find one prefixed with lxp_ (it'll be lxp_YOUR_DONGLE_SERIAL). Scroll down and you'll see all the metrics it's tracking which you could use to build automation triggers.
 
To configure the addon and see the logs, go to Settings->Add-ons->lxp-bridge, config and log tabs are at the top.

To see the data you should be able to go into Settings->Devices & Services->Devices Tab, then in the device list you'll find one prefixed with lxp_ (it'll be lxp_YOUR_DONGLE_SERIAL). Scroll down and you'll see all the metrics it's tracking which you could use to build automation triggers.
Thanks for your response. I missed the "Add Addon to repository" button on github. After that it went smoothly. And I don't have to run lxp-bridge in a separate container on a diff VM.
I however do see "lxp-bridge" under devices (w/o dongle SN) and when I click on it I do not see any metrics to be used in automations.
Did you install stable version or a dev version of lxp-bridge?
 
Thanks for your response. I missed the "Add Addon to repository" button on github. After that it went smoothly. And I don't have to run lxp-bridge in a separate container on a diff VM.
I however do see "lxp-bridge" under devices (w/o dongle SN) and when I click on it I do not see any metrics to be used in automations.
Did you install stable version or a dev version of lxp-bridge?

Ah yeah if you're not seeing lxp_your_dongle_serial then it's not talking to your inverter yet. Check the logs on the lxp-bridge addon settings. I couldn't get it to connect to mine (port 8000 was not open) until I pulled the dongle out and re-inserted into the inverter.

I'm using lxp-bridge v0.13.0
 
Ah yeah if you're not seeing lxp_your_dongle_serial then it's not talking to your inverter yet. Check the logs on the lxp-bridge addon settings. I couldn't get it to connect to mine (port 8000 was not open) until I pulled the dongle out and re-inserted into the inverter.

I'm using lxp-bridge v0.13.0
Hmm. Bridge is definitely connected to inverter because I can see message flowing via MQTT broker (using mqttx client for monitoring).
Devices:
1738018710880.png
Clicking on it:
1738018748308.png

What am I missing here?
Thanks in advance.
 
Are you using the HA mosquito broker addon or a separate mqtt instance?
A separate instance. I can see in lxp-bridge log it's connected to it and publishing.
Now that you mentioned it, I guess whatever is listening to the messages expects them on the localhost instance... I will try to install as addon and try again. Will update here.

-Max
 
Well, unfortunately after moving everything localhost to HA and reinstalling the bridge, the situation is the same as my prev screenshots. MQTT does work and I see messages in a third party client. Would you mind posting your screenshots (blur out sensitive data) so that I know what to look for?
Thanks.
 
To replicate my setup you would:
  • Install the Mosquitto broker addon v6.5.0 with the default config
  • Install the lxp-bridge addnon v0.13.0
Config lxp-bridge. Pay attention to the mqtt host setting, I have mine going to the external interface of HA, not localhost. This may matter depending on how you're running HA.

Inverters:
- enabled: true
host: eg412000xp.localdomain
port: 8000
serial: SDFKJ123123
datalog: D234234DF
heartbeats: false
publish_holdings_on_connect: false

mqtt:
enabled: true
host: homeassistant.localdomain
port: 1883
username: mqtt
password: somepassword
namespace: lxp

Make sure that when you go to Settings->Devices (default Integrations tab) that you see MQTT listed under Configured which should show at least one device (your inverter). If it's under Discovered then you might have to click the Add button. If you don't see MQTT at all then something is wrong, perhaps you need to add the MQTT integration: https://www.home-assistant.io/integrations/mqtt
 
Last edited:
To replicate my setup you would:
  • Install the Mosquitto broker addon v6.5.0 with the default config
  • Install the lxp-bridge addnon v0.13.0
Config lxp-bridge. Pay attention to the mqtt host setting, I have mine going to the external interface of HA, not localhost. This may matter depending on how you're running HA.

Inverters:


mqtt:


Make sure that when you go to Settings->Devices (default Integrations tab) that you see MQTT listed under Configured which should show at least one device (your inverter). If it's under Discovered then you might have to click the Add button. If you don't see MQTT at all then something is wrong, perhaps you need to add the MQTT integration: https://www.home-assistant.io/integrations/mqtt
Ahhh. Your last point did the trick. MQTT was under Discovered. Once I "added" it is working as it should. I now see lxp_SN under devices.
Just curious, have you taken it any further with custom scripts/automations?

Thanks for your patience and help.

-Max
 
Just curious, have you taken it any further with custom scripts/automations?
Not yet, I'm mainly using this to push the metrics into InfluxDB for display with Grafana (I'll publish a dashboard eventually). I do have a number of non-critical loads on smart plugs that I'll probably setup to turn off if the inverter doesn't have grid input (my setup is currently just a whole house UPS until I add PV).
 
Found that you can increase the rate at which data is returned by lxp-bridge if you're using MQTT. Just run the following and you'll get data every 20s instead of 120s.

Code:
sudo apt install mosquitto-clients
mosquitto_pub -h homeassistant.local -t lxp/cmd/all/set/param/0 -m 20 -u mqtt -P somepassword
 
  • Connect to the inverter's INV485 port, but will not work concurrently with the EG4 wifi module.

o.O

i know growatt's wifi module has modbus tcp running on it.
so in theory eg4's could also have modbus tcp running on it.

if someone wants to try that out, ppg's modbus tcp is working. if port 502 is open on the wifi module, you should be able to do it that way.
for those who don't have those alt rs485 ports.
 
o.O

i know growatt's wifi module has modbus tcp running on it.
so in theory eg4's could also have modbus tcp running on it.

if someone wants to try that out, ppg's modbus tcp is working. if port 502 is open on the wifi module, you should be able to do it that way.
for those who don't have those alt rs485 ports.

The wifi module exposes port 8000. Here's details about the protocol: https://github.com/celsworth/lxp-bridge/wiki/TCP-Packet-Spec
 
The wifi module exposes port 8000. Here's details about the protocol: https://github.com/celsworth/lxp-bridge/wiki/TCP-Packet-Spec
looks very similar to modbus tcp, but i think there are some differences. 502 should be regular modbus tcp; to my understanding it's a "newer" feature. old wifi sticks might need a firmware update for it.

the 0xc# function codes instead of 0x0# is probably for not accidentally interferring with modbus tcp devices.

the protocol ( transport ) could be added to ppg, and i think it would work...
i might try playing around with it in the future, but i'm very backlogged irl. i'll have to make a mental note for sure.
 
looks very similar to modbus tcp, but i think there are some differences. 502 should be regular modbus tcp; to my understanding it's a "newer" feature. old wifi sticks might need a firmware update for it.

the 0xc# function codes instead of 0x0# is probably for not accidentally interferring with modbus tcp devices.

the protocol ( transport ) could be added to ppg, and i think it would work...
i might try playing around with it in the future, but i'm very backlogged irl. i'll have to make a mental note for sure.
I have (by reading the discussion/issue on hotnoobs git protocol about writing parameters) got writing working on my PythonProtocol.

I now have a crude bash script that loops/sleeps and implements adjustments of on-grid percent including dropping on-grid % 20% just before 4pm so I don't buy expensive 4pm to 8pm power. More adjustments to the code for the 11am to 4pm range of it to get solar to charge loads when the target % is too low to survive the 4pm to 8pm expensive times. With luck I can avoid using AC charge.

I also propose to add a parameter to the conf file of something like "target_loop_time=20" and then will implement a variable sleep time in the main loop to attempt to maintain a constant sample time even when some commands are slow.
 
Ah yeah if you're not seeing lxp_your_dongle_serial then it's not talking to your inverter yet. Check the logs on the lxp-bridge addon settings. I couldn't get it to connect to mine (port 8000 was not open) until I pulled the dongle out and re-inserted into the inverter.

I'm using lxp-bridge v0.13.0
This also worked for me, thank you!
 
This thread on the HA community is frequented by an individual with a private Github project for self-hosted monitoring and control for Luxpower and EG4 inverters. Not sure of the exact models. I started my own self-hosting journey recently and it's been a serious learning endeavor.

At the risk of derailing this thread with another request for help:

I'm getting repeated connection errors after installing lxp-bridge. I was never actually able to log into the networking page (via datalogger IP) of the dongle. However, after some fiddling, I was able to get the lxp-bridge config to work in HA, bu then got this:

Code:
[2025-03-01T22:01:04.223 INFO lxp_bridge::lxp::inverter] connecting to inverter DJ42602888 at 192.168.88.192:8000
[2025-03-01T22:01:04.223 INFO lxp_bridge::lxp::inverter] connecting to inverter DJ42602888 at 192.168.88.192:8000
[2025-03-01T22:01:07.285 ERROR lxp_bridge::lxp::inverter] inverter DJ42602888: No route to host (os error 113)
[2025-03-01T22:01:07.285 INFO lxp_bridge::lxp::inverter] inverter DJ42602888: reconnecting in 5s

This error cycle repeats after the initial connection to MQTT is established and all entities show up under the lxp device recognized by the MQTT addon/integration. I've had LOTS of dongle issues (ha!) and am using a new one sent out by EG4. I'm hesitant to start reseting, turning on/off, unplugging and plugging back in this damned thing. Can anybody clarify why these errors are happening and if they've experienced something similar?
 
This thread on the HA community is frequented by an individual with a private Github project for self-hosted monitoring and control for Luxpower and EG4 inverters.

Why not make it public if he’s giving individuals access anyway?

No route to host would indicate it probably stopped responding to arp requests, ie it’s a network issue. Do you have a signal quality issue perhaps?
 

diy solar

diy solar
Back
Top