• 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

EG4 6000XP - ESPHome

The ability going down the road on in gas station to connect directly to the ip on my eg4 and make sure everything is … unless you catch all the data, archive it and all exporting, there is going to be a need for something that is not currently configured … also upgrades for the inverter, and support or the ability to have them review what is wrong with my equipment… I’m sure their are a few more …

I assume you can get this data without disconnecting it from the world and making it the only way in/out… otherwise how did SA would not work. So I prefer the find a method that does not disrupt the existing data.
It's all a balancing act. I have a VPN for remote access, and prefer to avoid cloud services where possible both for security and reliability. With the dongle you give up some of that for convienence.

Does the 6000XP let you split out CAN and RS485 at the battery port on the inverter?
 
It's all a balancing act. I have a VPN for remote access, and prefer to avoid cloud services where possible both for security and reliability. With the dongle you give up some of that for convienence.
Honestly same here, I've been burned before by IoT devices getting dropped once the profit was gone. Not saying I get that impression from EG4/Signature Solar, but its a matter of principle for me.

Does the 6000XP let you split out CAN and RS485 at the battery port on the inverter?
Ya know, I have yet to try this, I have been on the v1 LP4 batteries up until recently, so I never had the option of batteries over CAN and the Inverter over RS485, definitely something I will have to mess with...
 
Ya know, I have yet to try this, I have been on the v1 LP4 batteries up until recently, so I never had the option of batteries over CAN and the Inverter over RS485, definitely something I will have to mess with...
Checked the manual; pin 1 and 2 are RS485 and pin 5 and 6 are CAN.
 
This is an entire replacement for the dongle itself, I removed the HDMI interface board and hooked the ESP up to the inverter with the 4pin connector that connected to that interface card. On that connector is the Modbus pins as well as 5V that I'm using to power the ESP. Ultimately I didn't want to use wifi to get this data off my inverters, and Ethernet was my preferred method.

When I'm out there tomorrow I'll see if I can pull pictures of how I have everything hooked up....
@adamksmith1234 This connector on the 6000xp I circle in red?

1729538508953.png
 
I'm doing something very similar to the original post with data logging on my EG4 6000XP, so I thought I'd share.
  • picked up a JST-XA-SMT connector and unplugged the wifi from the board
  • mapped pins to an RS485 USB dongle
  • I loaded up the latest raspberry pi lite OS (old raspberry pi laying around)
  • Installed https://github.com/HotNoob/PythonProtocolGateway
  • Pointed the output to my MQTT node and data immediately started flowing to Home Assistant
I might move to an ESP32 down the road, but this was a good fit for what I had (I did purchase the dongle and connector), but now I don't have to worry about the wifi issues (I always prefer hard wiring data loggers when reasonable). I used an RJ45 jack to stay inside the inverter as I didn't have a permeant placement for my pi and thought it was a bit cleaner having the jack inside. I haven't worked on any two-way communications as I haven't had the need. I'm operating in a completely off-grid configuration.

This is my second system as I've been running a larger Victron / Electrodacus / Home Assistant configuration for years in my house (we are off grid), but I wanted to try out EG4 for my second building.
 

Attachments

  • PXL_20241024_200141279.MP.jpg
    PXL_20241024_200141279.MP.jpg
    87.9 KB · Views: 28
  • PXL_20241024_200122729.MP.jpg
    PXL_20241024_200122729.MP.jpg
    131.8 KB · Views: 29
@adamksmith1234 This is great. I've wanted a direct ESP to Home Assistant connection for the 6000xp since I got it.

You said you're using the MAX485 for this. How exactly does that work with the ESPHome UART/Modbus components? Doesn't the MAX485 require a direction control GPIO pin? I don't see that setup in your YAML.
 
@adamksmith1234 This is great. I've wanted a direct ESP to Home Assistant connection for the 6000xp since I got it.

You said you're using the MAX485 for this. How exactly does that work with the ESPHome UART/Modbus components? Doesn't the MAX485 require a direction control GPIO pin? I don't see that setup in your YAML.

I just setup a ESP32-Poe with this and yes you are right. For the MAX485 you need a flow control bit. I added this under the modbus item:

modbus:
- uart_id: uart_modbus_inverter_1
id: modbus_inverter_1
flow_control_pin: GPIO033
 
Hey all, it was a fat minute cause of life stuff. I see there are some more questions that might have been answered... but I'll add my own answer in as well....
@adamksmith1234 This connector on the 6000xp I circle in red?

View attachment 251315
Yes that is the connector I'm Using, I just unplugged the HDMI connector daughter board thing... put my stuff on that, it makes it easier for me to float between the EG4 dongle and mine for firmware updates.
I just setup a ESP32-Poe with this and yes you are right. For the MAX485 you need a flow control bit. I added this under the modbus item:

modbus:
- uart_id: uart_modbus_inverter_1
id: modbus_inverter_1
flow_control_pin: GPIO033
I am not using flow control on my implementation, cause the boards I'm using don't expose it to the ESP, in hindsight I should have found a board that exposed the flow control pin cause I created some fun bugs to chase down on my inverters.

That bug was mostly caused from the time keeping stuff I had implemented on the ESP, it was basically DoS-ing the controller and causing the inverter to fault out... I will post the updated code to the git repo, but needless to say after I got past that point, I had to shelve some of the other stuff I was working on due to Holiday stuffs.

I am hoping to get battery status at some point working so I can keep tabs on the batteries in my bank and see how they are holding up. I would also at some point like to take another stab at messing with the chargeverter stuff I have on my system so I can also control that rather than having to use relays on the power in side of the charger.

I'm doing something very similar to the original post with data logging on my EG4 6000XP, so I thought I'd share.
  • picked up a JST-XA-SMT connector and unplugged the wifi from the board
  • mapped pins to an RS485 USB dongle
  • I loaded up the latest raspberry pi lite OS (old raspberry pi laying around)
  • Installed https://github.com/HotNoob/PythonProtocolGateway
  • Pointed the output to my MQTT node and data immediately started flowing to Home Assistant
I might move to an ESP32 down the road, but this was a good fit for what I had (I did purchase the dongle and connector), but now I don't have to worry about the wifi issues (I always prefer hard wiring data loggers when reasonable). I used an RJ45 jack to stay inside the inverter as I didn't have a permeant placement for my pi and thought it was a bit cleaner having the jack inside. I haven't worked on any two-way communications as I haven't had the need. I'm operating in a completely off-grid configuration.

This is my second system as I've been running a larger Victron / Electrodacus / Home Assistant configuration for years in my house (we are off grid), but I wanted to try out EG4 for my second building.
I did try this at one point in time, but I wanted something that I could mount to the side of the inverter and just drop an ethernet cable to each inverter, rather than dealing with a Pi. I did end up caving and Using a Pi for my Tigo stuff, but the inverters are fortunately all ESP based.
 
I took your code and made it work with the Lilygo T-CAN485 and added a few features that you didnt have:

I also ran into the issue where the 6000xp crashes when overloading the RS485 bus. The latest code in the github seems pretty stable but I did remove lots of variables I dont care for. Currently I am polling every 10 seconds. The fix for me was when reading the registers, too make sure that ESPHome reads as much as possible in 1 go (using register_count: 4 - for example).
 
I took your code and made it work with the Lilygo T-CAN485 and added a few features that you didnt have:

I also ran into the issue where the 6000xp crashes when overloading the RS485 bus. The latest code in the github seems pretty stable but I did remove lots of variables I dont care for. Currently I am polling every 10 seconds. The fix for me was when reading the registers, too make sure that ESPHome reads as much as possible in 1 go (using register_count: 4 - for example).
Looks great dude! I’m scrolling through this and I’m probably gonna steal some stuff from your build. Appreciate that you commented out the unused variables rather than deleting them entirely. I’m also going to steal the Neo-pixel stuff for mine so I can get more status indication over just RJ-45 lights on the Wireless-Tag ESP I’m using.
 
So I ended up with an extra EG4 WIFI dongle that had a bad remote server set on it. Turns out they use an ESP32-C3-mini in them which is quite convenient. I was able to extract their firmware and replace it with ESPHome. I updated your existing ESPHome config to account for the different GPIO pins. I still need to modify the modbus locations a hair to match my inverter (FlexBoss21) but its functioning for most values and delivers them realtime to home assistant.

The pins to re-flash all appear to be accessible on the HDMI connector, so you don't even need to open the thing up - you just need an HDMI breakout and a serial adapter for the first flash.

If you're looking for an OEM look and ability to use the data the way you'd like w/o the sketchy OEM firmware leaving itself wide open, this is a pretty good option. I'll do a write up soon.
 
The pins to re-flash all appear to be accessible on the HDMI connector, so you don't even need to open the thing up - you just need an HDMI breakout and a serial adapter for the first flash.
Great work! Can you confirm the pins for us?
So far people have identified Rs485A and B but there are 2 or 3 more wires and im sure 2 are power.
Therein lies the question
 
Yes, I can grab a factory fresh copy off another dongle if you need it. This one has my WiFi info all over it. :LOL:
I guess the simple thing to know would be:

How do I get firmware off an ESP 32?

I am somewhat experienced with yaml, programing, home assistant, but I never learned how to rip a firmware
 
I can get you the full commands I used. esptool has the ability to dump to bin file. You do it with the same uart setup as programming. To put the esp32 in the correct boot mode you have to ground a pin.

You can use the bin to reflash the dongle, but their code is not only compiled but is also likely encrypted. It’ll take a bit of work to get much useful out of it.
 
Alright, the pins/gpios are:

Code:
## MODBUS
# GPIO0: Transmit
# GPIO2: Receive

## MISC
# GPIO4: BUTTON
# GPIO5: LED1
# GPIO6: LED3
# GPIO7: LED2

## HDMI PORT PINS
# PIN18: 5V
# PIN16: Ground
# PIN09: UART TX
# PIN10: UART RX
# PIN13: GPIO 8 (GROUND ON STARTUP TO CHANGE BOOT MODE)

To drop the correct boot mode you ground ping 7 as you apply power, then remove the ground a few seconds later, then you should be able to communicate with it:

Code:
esptool  --port /dev/ttyUSB0 chip_id
esptool.py v4.7.0
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP32-C3
Chip is ESP32-C3 (QFN32) (revision v0.4)
Features: WiFi, BLE, Embedded Flash 4MB (XMC)
Crystal is 40MHz
MAC: f0:9e:9e:92:18:b8
Uploading stub...
Running stub...
Stub running...
Warning: ESP32-C3 has no Chip ID. Reading MAC instead.
MAC: f0:9e:9e:92:18:b8
Hard resetting via RTS pin...

Read all to bin:

Code:
esptool  --port /dev/ttyUSB0 -b 460800 read_flash 0 ALL eg4_contents_ALL.bin

Write ESPHome:

Code:
esptool  --port /dev/ttyUSB0 -b 460800 write_flash 0x0 /path/too/bin/yourbin.bin
 
Last edited:
The breakout is a hair easier than my initial attempts at locating the pins.

Only real issue I have at the moment is they put a collar around the port on the dongle so this breakout doesn’t go deep enough on a fully assembled one. Looking for an extension or different breakout to get around that issue.
 

Attachments

  • IMG_2154.jpeg
    IMG_2154.jpeg
    488.9 KB · Views: 18
  • IMG_2106.jpeg
    IMG_2106.jpeg
    339.3 KB · Views: 18
  • IMG_2124.jpeg
    IMG_2124.jpeg
    248.2 KB · Views: 18
The breakout is a hair easier than my initial attempts at locating the pins.

Only real issue I have at the moment is they put a collar around the port on the dongle so this breakout doesn’t go deep enough on a fully assembled one. Looking for an extension or different breakout to get around that issue.
Awesome work! Thanks.
 
Checked the manual; pin 1 and 2 are RS485 and pin 5 and 6 are CAN.
Yes this was posted in another thread. This is what I'm going to try. Found some old keystone jacks I had stashed away. Going to see if these rs485 pins are separate from the wifi bus and will allow the battery to continue to comm on CAN and SA to use the rs485 while eg4 mon can continue to use the dongle without data clashing or maybe try a rs485 splitter on the wifi bus.
Screenshot 2025-03-12 220713.jpg
 
Last edited:

diy solar

diy solar
Back
Top