Python code to poll EG4 PowerPro batteries over RS485/Modbus.
Batteries have combined RS485/CAN ports, so you need to make up cables to split out the comms if you are using 'closed loop' CAN with EG4 inverters.
I use the https://www.amazon.com/dp/B0CSP7L277 4-port RS485/USB interfaces even when I think I only need one port, they are cheap, easy to use, pretty bulletproof, have selectable terminations, and isolation (between the RS485 and the USB, not between the four RS485 ports).
Since the Primary battery (ID=1) has a Secret Undocumented Combined Battery Protocol, I used some info from https://diysolarforum.com/members/fmeili1.45063/ to try to make sense of that particular battery. If you weren't doing closed loop comms with an inverter, I'd start my battery numbering at ID=2 and avoid the whole mess.
This gathers as much data as makes sense from all my batteries, posts the results to a Redis (in-memory) database for local use, and publishes to an MQTT broker on my LAN.
Enjoy, and feedback is always welcome, I know there are some ugly bits (port determination, etc), but #YouGetWHatYouPayFor
Batteries have combined RS485/CAN ports, so you need to make up cables to split out the comms if you are using 'closed loop' CAN with EG4 inverters.
I use the https://www.amazon.com/dp/B0CSP7L277 4-port RS485/USB interfaces even when I think I only need one port, they are cheap, easy to use, pretty bulletproof, have selectable terminations, and isolation (between the RS485 and the USB, not between the four RS485 ports).
Since the Primary battery (ID=1) has a Secret Undocumented Combined Battery Protocol, I used some info from https://diysolarforum.com/members/fmeili1.45063/ to try to make sense of that particular battery. If you weren't doing closed loop comms with an inverter, I'd start my battery numbering at ID=2 and avoid the whole mess.
This gathers as much data as makes sense from all my batteries, posts the results to a Redis (in-memory) database for local use, and publishes to an MQTT broker on my LAN.
Enjoy, and feedback is always welcome, I know there are some ugly bits (port determination, etc), but #YouGetWHatYouPayFor