diy solar

diy solar

Is there an esphome for lifepower4

goldserve

Solar Enthusiast
Joined
Apr 26, 2022
Messages
428
My internet search is failing me but is there a way to get eg4 lifepower4 bms data into mqtt?
 
The parts are out there, not sure if there is a complete package yet though. Modbus registers are documented on EG4's website, and there is are Modbus components in esphome.
 
Bumping this thread to see if there are solutions for EG4 lifepower4 or PaceBMS used in Jakiper or SOK server rack batteries.
 
Have you looked into using Solar Assistant to connect between the 2 and be the primary broker?

I haven't used that functionality in SA, but it's being shown in the configuration dialog.
 
Personally I'm also interested in what @goldserve is asking for; I get and understand what SolarAssistant is great for, but as a supporter of OpenSource their license violating status makes them a non-starter for me.
 
I got the pace BMS reporting to MQTT through home assistant plugin using a TCP serial connection to the RS232 port. Now, I am looking for a script or something that will read the EG4 lifepower4 packs through another TCP RS485 port connection and can parse, send to Mosquitto server.
 
I got the pace BMS reporting to MQTT through home assistant plugin using a TCP serial connection to the RS232 port. Now, I am looking for a script or something that will read the EG4 lifepower4 packs through another TCP RS485 port connection and can parse, send to Mosquitto server.
Which HASS plugin?
 
@goldserve You made me look at the EG4 protocol description last night and killed my sleep. It isn't actually all that complex, but setting it up in ESPHome is beyond me. FWIW, it sounds like you would need an ESP32 rather than an ESP8266 if you went that route.

Pulling it over the serial-IP link might be marginally easier (with appropriate programming skills). What scares me most though is the debugging...
 
yes, I’ve looked at that manual but it seems that protocol is for can bus or something. It doesn’t line up with the rs485 data that is being sent and received. I’ve started modifying the Hass plugin to talk to the battery but no one has implemented the crc or checksum function. I don’t get how that is calculated. I could just ignore all of that like the victron lifepower4 plugin. Any clues?
 
That is nice work. I cannot get ESPhome to work properly in home assistant, the devices keep disappearing offline without a static IP and I'm just finding it a ginormous pain in my arse. A direct USB connection into my home assistant server would be perfect.
 
I don’t get how that is calculated.
Now I see that the document has been replaced with a more proper modbus document (same link). The calculation method was in the document I was originally reading, but not sure if I will be able to find it again.
 
It would be very good if you can find that document again because I am pulling my hair like the last person in the thread above. For now, I'm leaning towards just ignoring the CRC.
 
It would be very good if you can find that document again because I am pulling my hair like the last person in the thread above. For now, I'm leaning towards just ignoring the CRC.
This was what I was looking at before.
 

Attachments

  • EG4_LifePower4_Communication_Protocol.pdf
    366.8 KB · Views: 35
Seems like the CRC method in this doc is pretty standard for MODBUS but the serial protocol is a little different. From the thread above, the checksum bits only looks to be 1 byte and not 2-bytes. I'll try to use some ideas in the document to see if I can come up with their scheme for the RS485 serial checksum.
 
Yeah, I can't figure this one out. For example,

Function 1 - Read data 7e 01 01 00 fe 0d has a checksum of 0xFE and the sum of the numbers is 0x02
Function 67 - Read protection parameters 7e 01 43 00 fe 0d also has a checksum of 0xFE but the sum of the numbers is 0x44
 
Yeah, I can't figure this one out. For example,

Function 1 - Read data 7e 01 01 00 fe 0d has a checksum of 0xFE and the sum of the numbers is 0x02
Function 67 - Read protection parameters 7e 01 43 00 fe 0d also has a checksum of 0xFE but the sum of the numbers is 0x44
Are you doing the ASCII sums or hex sums? That is where they lost me.
 
Well, ascii can be represented in hex and there are some hex that can’t be printed like all the voltage values so everything is done in hex.
 
Well, ascii can be represented in hex and there are some hex that can’t be printed like all the voltage values so everything is done in hex.
Yeah, I get that... but as I read it I think you need to do math as ASCII values rather than just as Hex. Why the hell someone would think that is logical is beyond me.
 
My crude hack will do. Now I have to extend it to request from a number of packs and i'm set. It will talk over TCP serial port or directly connected (haven't tried) and also post to MQTT

Code:
Starting up...
Loading config.yaml
Connection Type: IP
MQTT connected with result code 0
Connecting to BMS...
trying to connect 192.168.10.218:8002
BMS socket connected
BMS Version: QT-YS00-16SV100A-V3.10
BMS Serial Number: 16778846
Cells:  16
V Cell1: 3331 mV
V Cell2: 3331 mV
V Cell3: 3331 mV
V Cell4: 3331 mV
V Cell5: 3331 mV
V Cell6: 3331 mV
V Cell7: 3331 mV
V Cell8: 3331 mV
V Cell9: 3331 mV
V Cell10: 3331 mV
V Cell11: 3331 mV
V Cell12: 3331 mV
V Cell13: 3331 mV
V Cell14: 3331 mV
V Cell15: 3331 mV
V Cell16: 3331 mV
I Pack: 0.0 A
I Remaining Capacity: 78.8 Ah
I Design Capacity: 97.8 Ah
Temp1: 20 C
Temp2: 20 C
Temp3: 19 C
Temp4: 19 C
MOS_Temp: 20 C
Ambient_Temp: 20 C
Pack 2, Cycles: 136
Pack 2, V Pack: 53.29 V
Pack 2, SOH: 97.8 %
SOC: 80.57 %
Script running....
HA Discovery Disabled
1684483703803.png
 
message me privately if someone wants to help test out the code. I updated it to support a list of pack IDs to get and they will all appear in MQTT.

1684565785651.png
 

diy solar

diy solar
Back
Top