• New: My equipment. Track products mentioned on the forum and build your own system. Go to Equipment > My equipment, search for a product and press "I own this", or press Watch on any product page to get an alert when a new thread tags it. Read more
sungold december paid

Using Home Assistant (Modbus) to read the inverters (12kXP's) and EG4 LL-S (in closed loop)

Products in this thread: EG4 12000XP (US)
each battery can be drilled down into further entities per battery
Nice :)

A couple of questions:
1) Are you able to see the individual cell voltages on each battery?
2) Are you connected locally only (not via the EG4 web monitoring site)? Name of integration and some of the verbiage on the Github readme are a bit confusing. It does imply that local only should work....

Thanks
 
Anyway, you gave me 2 cents, and I gave you back a dollars' worth of change..
LOL. Regarding the cooling fans, there's a forum thread( here or in the eg4 forum ) discussing the cooling fans and the solution others have implemented, which doesn't void the warranty, is putting quiet PC case vans across the top and IIRC are controlled by ESPHome/ESP32 looking at the inverter Radiator Temp(Trad2). https://diysolarforum.com/threads/eg4-flexboss-overheating-solved.110690/post-1598954
 
LOL. Regarding the cooling fans, there's a forum thread( here or in the eg4 forum ) discussing the cooling fans and the solution others have implemented, which doesn't void the warranty, is putting quiet PC case vans across the top and IIRC are controlled by ESPHome/ESP32 looking at the inverter Radiator Temp(Trad2). https://diysolarforum.com/threads/eg4-flexboss-overheating-solved.110690/post-1598954
Yes, I have seen that thread...it leads to the question - do i spend $$ on an external cooling system while under warranty on a system that has plenty of cooling capacity or just wait till the warranty runs out and then pop the case open and run my controls to the system at no real cost (I already have the ESP32 in the area, just need a few wires and a few HA automations.....
 
Yes, I have seen that thread...it leads to the question - do i spend $$ on an external cooling system while under warranty on a system that has plenty of cooling capacity or just wait till the warranty runs out and then pop the case open and run my controls to the system at no real cost (I already have the ESP32 in the area, just need a few wires and a few HA automations.....
Yes, that's always the juggling act. FYI, firmware FAAB-2727 looks like it has an update to the fan controls which might help keeping it cool and /or quieter. Not sure they use the same numbering for your units.
 
Nice :)

A couple of questions:
1) Are you able to see the individual cell voltages on each battery?
2) Are you connected locally only (not via the EG4 web monitoring site)? Name of integration and some of the verbiage on the Github readme are a bit confusing. It does imply that local only should work....

Thanks

Looks like it gives highest and lowest cell and the delta. I do not see access to individual cell voltages.

Yes, my connection is local. When I kill internet access to this subnet the EG4 app cannot connect while HA is unaffected.
 
I can confirm rev114's post and YAML above gives individual cell voltages; here is everything it is pulling for my EG4 280AH batteries. This works on all batteries except #1, and all stay in closed-loop with the inverter.

Tested and implemented on an ESP12e with a MAX485 board powered on the 12e dev boards 3.3V. Works great.

Thanks again for Rev's post above: https://diysolarforum.com/threads/u...d-eg4-ll-s-in-closed-loop.125618/post-1830841

# PER BATTERY INFO RETRIEVED ON EG4 280AH BATTERIES
Bat. 2 Avg Temp: 79 °F
Bat. 2 Cell Delta: 0.003 V
Bat. 2 Cell V 01: 3.327 V
Bat. 2 Cell V 02: 3.329 V
Bat. 2 Cell V 03: 3.328 V
Bat. 2 Cell V 04: 3.329 V
Bat. 2 Cell V 05: 3.330 V
Bat. 2 Cell V 06: 3.330 V
Bat. 2 Cell V 07: 3.329 V
Bat. 2 Cell V 08: 3.330 V
Bat. 2 Cell V 09: 3.329 V
Bat. 2 Cell V 10: 3.330 V
Bat. 2 Cell V 11: 3.328 V
Bat. 2 Cell V 12: 3.330 V
Bat. 2 Cell V 13: 3.328 V
Bat. 2 Cell V 14: 3.330 V
Bat. 2 Cell V 15: 3.329 V
Bat. 2 Cell V 16: 3.328 V
Bat. 2 Charging: On
Bat. 2 Chg Power: 516.62 W
Bat. 2 Current: 9.70 A
Bat. 2 Cycles: 51
Bat. 2 Discharging: On
Bat. 2 Dischg Power: 0.00 W
Bat. 2 Error: None
Bat. 2 Firmware: Z02T13
Bat. 2 Heating: Off
Bat. 2 Max Cell V: 3.330 V
Bat. 2 Max Temp: 77 °F
Bat. 2 Min Cell V: 3.327 V
Bat. 2 Model: Unknown
Bat. 2 Online: On
Bat. 2 PCB Temp: 77 °F
Bat. 2 Power: 516.62 W
Bat. 2 Protection: None
Bat. 2 Rem. Cap.: 212.00 Ah
Bat. 2 Serial: A
Bat. 2 SOC: 76%
Bat. 2 SOH: 100%
Bat. 2 Status: Charging
Bat. 2 Temp 1: 77 °F
Bat. 2 Temp 2: 77 °F
Bat. 2 Temp 3: 77 °F
Bat. 2 Temp 4: 77 °F
Bat. 2 Temp 5: 32 °F
Bat. 2 Temp 6: 32 °F
Bat. 2 Voltage: 53.26 V
Bat. 2 Warnings: None

# INFO REPEATS PER BATTERY
Bat. 3 Avg Temp: 79 °F
Bat. 3 Cell Delta: 0.003 V
Bat. 3 Cell V 01: 3.329 V
Bat. 3 Cell V 02: 3.330 V
Bat. 3 Cell V 03: 3.330 V
Bat. 3 Cell V 04: 3.331 V
Bat. 3 Cell V 05: 3.330 V
Bat. 3 Cell V 06: 3.331 V
Bat. 3 Cell V 07: 3.331 V
Bat. 3 Cell V 08: 3.332 V
Bat. 3 Cell V 09: 3.329 V
Bat. 3 Cell V 10: 3.330 V
Bat. 3 Cell V 11: 3.330 V
Bat. 3 Cell V 12: 3.332 V
Bat. 3 Cell V 13: 3.330 V
Bat. 3 Cell V 14: 3.329 V
Bat. 3 Cell V 15: 3.329 V
Bat. 3 Cell V 16: 3.332 V
Bat. 3 Charging: On
Bat. 3 Chg Power: 575.42 W
Bat. 3 Current: 10.80 A
Bat. 3 Cycles: 50
Bat. 3 Discharging: On
Bat. 3 Dischg Power: 0.00 W
Bat. 3 Error: None
Bat. 3 Firmware: Z02T13
Bat. 3 Heating: Off
Bat. 3 Max Cell V: 3.332 V
Bat. 3 Max Temp: 77 °F
Bat. 3 Min Cell V: 3.329 V
Bat. 3 Model: Unknown
Bat. 3 Online: On
Bat. 3 PCB Temp: 77 °F
Bat. 3 Power: 575.42 W
Bat. 3 Protection: None
Bat. 3 Rem. Cap.: 144.00 Ah
Bat. 3 Serial: A
Bat. 3 SOC: 52%
Bat. 3 SOH: 100%
Bat. 3 Status: Charging
Bat. 3 Temp 1: 77 °F
Bat. 3 Temp 2: 77 °F
Bat. 3 Temp 3: 77 °F
Bat. 3 Temp 4: 77 °F
Bat. 3 Temp 5: 32 °F
Bat. 3 Temp 6: 32 °F
Bat. 3 Voltage: 53.28 V
Bat. 3 Warnings: None
 
EG4 EG4 EC-WM-LL-AW equipment · US 7.64 kg / 16.84 lb weight Charged Reviews ↗ DetailsHide
EG4SP1WMBCNDTBXV2
7.64 kg / 16.84 lbWeight
See this product on Charged Reviews, including the documents and certificates on file. Open ↗
More info
Published claims and calculations, not independent test results.
  • Weight7.64 kg / 16.84 lb
  • Compatible seriesEG4 WallMount 280Ah and 314Ah AW batteries with the FlexBOSS21, FlexBOSS18, 12kPV or 18kPV hybrid inverters
  • Included equipmentKnockout plugs (M63x1.5 qty 4, M50x1.5 qty 1, G1 qty 2, PG21 qty 2), side screws x4, keys
2 documents on file 0 certificates on file
No recalls or legal notices on file; this is not a complete recall or court search.
Product information from Charged Reviews. The Evidence score compares published documents. It is not a test result or a product endorsement.
Last edited:
I believe SA requires that the first battery start at 2 and then up from there. Can you start your dip switch settings at 2?
 
I wonder if there is a way to solve that last, remaining issue?
And just to be clear, I am reading Battery 1 info (at modbus 5000 from the master 12000XP dongle). I just can't get each cells data.
 
EG4 12000XP inverters · US 12 kW output · 500 V maximum pv voltage · UL 1741 manufacturer claim Image from EG4 Electronics Charged Reviews ↗ 30 DetailsHide
EG4 12000XP
Image from EG4 Electronics
IV-12000-XP-IN-01
12 kWContinuous output power
500 VMaximum PV voltage
46.4 to 60 VBattery operating voltage
UL 1741 · manufacturer claim
Evidence score 30/100 30/100 Missing details
See this product on Charged Reviews, including the documents and certificates on file. Open ↗
All 49 specs and limits
Published claims and calculations, not independent test results.
Operating limits
250 ABattery charging
250 ABattery discharge current
100 AGrid pass-through
46.4 to 60 VBattery operating voltage
120 to 385 VMPPT voltage range
35 APV input current / MPPT
500 VMaximum PV voltage
100 VPV startup voltage
44 APV short-circuit current limit
  • AC configuration120/240V split phase
  • Total harmonic distortion3 %
  • Peak output15,360 W for about 10 s (battery only)
  • AC voltage120/240 VAC; 208 VAC
  • Battery charging250 A
  • Power factor0.99
  • Efficiency93.5 %
  • AC frequency60 Hz default; 50 Hz configurable
  • Battery discharge current250 A
  • AC output120/240VAC; 208VAC (output voltage)
  • Surge duration10 s
  • Transfer time10 ms
  • Battery-only output12 kW
  • Battery voltage48 V
  • Surge AC output15,360 W
  • Grid pass-through100 A
  • Idle consumption70 W
  • Continuous output12 kW
  • Nominal AC voltage120/240VAC; 120/208VAC (L1/L2/N required) (grid | generator)
  • Maximum output per leg6000W (L1-N or L2-N)
  • Total charging power12 kW
  • Battery conversion efficiency90.2 %
  • Battery operating voltage46.4 to 60 V
  • MPPT trackers2
  • MPPT voltage range120 to 385 V
  • PV string inputsNot documented
  • PV array limit28 kW
  • PV input limit24 kW
  • PV input current / MPPT35 A
  • Maximum PV voltage500 V
  • Usable PV power limit24 kW
  • PV conversion efficiency93.5 %
  • PV startup voltage100 V
  • String inputs per MPPT2
  • PV short-circuit current limit44 A
  • Weight47.5 kg / 104.72 lb
  • PV conductors (manual)10–6 AWG
  • Dimensions150 D × 530 W × 870 H mm
  • PV disconnect (manual)600V/40A (min. PV disconnect/isolator spec)
  • CommunicationsRS485 / CAN / Wi-Fi
  • EnclosureIP20
  • Battery cable size (manual)2 × 2/0 AWG or 1 × 4/0 AWG
  • Generator supportRecommended generator capacity 6000W - 15000W
  • AC input conductors (manual)3 AWG minimum (grid)
  • Battery fuse or breaker (manual)Integrated breaker 300A
  • Parallel units16
  • PV terminal torque (manual)10.6 in-lb
  • AC output conductors (manual)3 AWG minimum (load); 6 AWG (smart load)
  • Mounting orientation (manual)Install the inverter upright on a vertical surface.
No recalls or legal notices on file; this is not a complete recall or court search.
Product information from Charged Reviews. The Evidence score compares published documents. It is not a test result or a product endorsement.
And just to be clear, I am reading Battery 1 info (at modbus 5000 from the master 12000XP dongle). I just can't get each cells data.
It may be in there somewhere, but they aren't telling because if that deep dark proprietary trade secret ever got out, it would be like the formula for Coke escaping, and the company would go out of business overnight. Or sales would increase because integrations would be easier, one or the other. 🤷‍♂️
 
I can confirm rev114's post and YAML above gives individual cell voltages; here is everything it is pulling for my EG4 280AH batteries. This works on all batteries except #1, and all stay in closed-loop with the inverter.

Tested and implemented on an ESP12e with a MAX485 board powered on the 12e dev boards 3.3V. Works great.

Thanks again for Rev's post above: https://diysolarforum.com/threads/u...d-eg4-ll-s-in-closed-loop.125618/post-1830841

# PER BATTERY INFO RETRIEVED ON EG4 280AH BATTERIES
Bat. 2 Avg Temp: 79 °F
Bat. 2 Cell Delta: 0.003 V
Bat. 2 Cell V 01: 3.327 V
Bat. 2 Cell V 02: 3.329 V
Bat. 2 Cell V 03: 3.328 V
Bat. 2 Cell V 04: 3.329 V
Bat. 2 Cell V 05: 3.330 V
Bat. 2 Cell V 06: 3.330 V
Bat. 2 Cell V 07: 3.329 V
Bat. 2 Cell V 08: 3.330 V
Bat. 2 Cell V 09: 3.329 V
Bat. 2 Cell V 10: 3.330 V
Bat. 2 Cell V 11: 3.328 V
Bat. 2 Cell V 12: 3.330 V
Bat. 2 Cell V 13: 3.328 V
Bat. 2 Cell V 14: 3.330 V
Bat. 2 Cell V 15: 3.329 V
Bat. 2 Cell V 16: 3.328 V
Bat. 2 Charging: On
Bat. 2 Chg Power: 516.62 W
Bat. 2 Current: 9.70 A
Bat. 2 Cycles: 51
Bat. 2 Discharging: On
Bat. 2 Dischg Power: 0.00 W
Bat. 2 Error: None
Bat. 2 Firmware: Z02T13
Bat. 2 Heating: Off
Bat. 2 Max Cell V: 3.330 V
Bat. 2 Max Temp: 77 °F
Bat. 2 Min Cell V: 3.327 V
Bat. 2 Model: Unknown
Bat. 2 Online: On
Bat. 2 PCB Temp: 77 °F
Bat. 2 Power: 516.62 W
Bat. 2 Protection: None
Bat. 2 Rem. Cap.: 212.00 Ah
Bat. 2 Serial: A
Bat. 2 SOC: 76%
Bat. 2 SOH: 100%
Bat. 2 Status: Charging
Bat. 2 Temp 1: 77 °F
Bat. 2 Temp 2: 77 °F
Bat. 2 Temp 3: 77 °F
Bat. 2 Temp 4: 77 °F
Bat. 2 Temp 5: 32 °F
Bat. 2 Temp 6: 32 °F
Bat. 2 Voltage: 53.26 V
Bat. 2 Warnings: None

# INFO REPEATS PER BATTERY
Bat. 3 Avg Temp: 79 °F
Bat. 3 Cell Delta: 0.003 V
Bat. 3 Cell V 01: 3.329 V
Bat. 3 Cell V 02: 3.330 V
Bat. 3 Cell V 03: 3.330 V
Bat. 3 Cell V 04: 3.331 V
Bat. 3 Cell V 05: 3.330 V
Bat. 3 Cell V 06: 3.331 V
Bat. 3 Cell V 07: 3.331 V
Bat. 3 Cell V 08: 3.332 V
Bat. 3 Cell V 09: 3.329 V
Bat. 3 Cell V 10: 3.330 V
Bat. 3 Cell V 11: 3.330 V
Bat. 3 Cell V 12: 3.332 V
Bat. 3 Cell V 13: 3.330 V
Bat. 3 Cell V 14: 3.329 V
Bat. 3 Cell V 15: 3.329 V
Bat. 3 Cell V 16: 3.332 V
Bat. 3 Charging: On
Bat. 3 Chg Power: 575.42 W
Bat. 3 Current: 10.80 A
Bat. 3 Cycles: 50
Bat. 3 Discharging: On
Bat. 3 Dischg Power: 0.00 W
Bat. 3 Error: None
Bat. 3 Firmware: Z02T13
Bat. 3 Heating: Off
Bat. 3 Max Cell V: 3.332 V
Bat. 3 Max Temp: 77 °F
Bat. 3 Min Cell V: 3.329 V
Bat. 3 Model: Unknown
Bat. 3 Online: On
Bat. 3 PCB Temp: 77 °F
Bat. 3 Power: 575.42 W
Bat. 3 Protection: None
Bat. 3 Rem. Cap.: 144.00 Ah
Bat. 3 Serial: A
Bat. 3 SOC: 52%
Bat. 3 SOH: 100%
Bat. 3 Status: Charging
Bat. 3 Temp 1: 77 °F
Bat. 3 Temp 2: 77 °F
Bat. 3 Temp 3: 77 °F
Bat. 3 Temp 4: 77 °F
Bat. 3 Temp 5: 32 °F
Bat. 3 Temp 6: 32 °F
Bat. 3 Voltage: 53.28 V
Bat. 3 Warnings: None
I notice you have no temps for 5 and 6 (I don't ether), but you have Firmware (I only have firmware in batteries 6 and 8...others are unknown) as well as serial numbers (looks like build date maybe) and Model (this is correct where it is not unknown)
Screenshot_6-6-2026_81450_192.168.68.103.jpeg
 
I just wanted to throw a post out to let folks know that using bits and baling wire from lots of different peoples posts I am currently set up as follows:
Parallel EG4 12000XP's V1 (2 of them)
9 EG4 LL-S rack mounted batteries running closed loop
2 EG4 wired/wifi dongles reprogrammed using ESPHome to read using Modbus data directly from the inverters and not letting my data go out of my house (I still have my original wifi dongles if I need to download software from EG4)
1 generic ESP8266 programmed using ESPHome hooked to the RS-485 port on each of my LL-S batteries using Modbus to pull data from 8 of the 9 batteries (still trying to figure out battery 1). I am pulling everything out of the batteries down to the individual cell voltages (35 variables per battery I think)

All of this goes directly into Home Assistant (without using MQTT!) and it is running without any issues (except battery 1, I am getting its data from the inverter - not down to the individual cell, but most of the important stuff.

I just wanted to thank the folks that posted stuff that got me here, and let others know that it can be done!
Thank you for this!
 
Yes, but then you can't do Closed Loop to the inverter, as that only talks to Battery One.

SOC control isn't always needed or wanted. My current system is only in SOC control because the inverters don't seem to obey voltage based charge parameters.

Point being, for people not interested in SOC system feedback, you could use SA to monitor battery parameters by setting batt 1 to dip switch setting 2 and go up from there. This was my intent on one of my systems and it had to be undone only when as I said, the inverter either would not charge, or would not stop charging the damn batteries based on voltage.

I have another system however that has happily been in voltage mode for a couple of years now. I have experienced zero "drift" in that battery bank in that time, lol.
 
Yes, but then you can't do Closed Loop to the inverter, as that only talks to Battery One.
Has anyone tried using something like YamBMS to solve this? The architecture I have in mind is setting all your batteries to non-1 addresses, monitoring them with esphome, aggregating the data, and then connecting another ESP32 to the inverter to stand in for what the inverter thinks is battery one, and feed it the aggregated data. Presumably this would use one of the documented protocols instead of the EG4 secret one.

Alternatively, how much of a benefit is it really to use closed loop comms with the inverter, if you've got another source for the battery data? I'm looking into using EMHASS to optimize my inverter, which seems like it would work just fine with the inverter only having its self-measured voltage data.
 
My current system is only in SOC control because the inverters don't seem to obey voltage based charge parameters.
Oops, missed your message when responding. What issues have you observed? I find that my Flexboss18 sometimes respects the voltage parameters, and sometimes doesn't. I suspect this has something to do with logic designed to compensate for the fact that the voltage "bounces back" once charging/discharging stops, so it's taking into consideration something like "if the voltage passes through this transition". I just haven't figured out the details of when that actually happens, or how it responds to changes in the setpoint.

I've mostly been charging in pv priority mode and tweaking the voltage to start/stop sending all the AC-coupled solar into the battery vs just avoiding exports.
 
EG4 FlexBOSS18 inverters · US 13 kW output · 600 V maximum pv voltage · UL 1741 manufacturer claim Image from EG4 Electronics Charged Reviews ↗ 22 DetailsHide
EG4 FlexBOSS18
Image from EG4 Electronics
EG4INVFLXBOSS18V1
13 kWContinuous output power
600 VMaximum PV voltage
UL 1741 · manufacturer claim
Evidence score 22/100 22/100 Missing details
See this product on Charged Reviews, including the documents and certificates on file. Open ↗
All 20 specs and limits
Published claims and calculations, not independent test results.
Operating limits
208 ABattery charging
90 AGrid pass-through
600 VMaximum PV voltage
  • AC configuration120/240V split phase
  • Peak output20,000 W for 0.5 s; 15,000 W for 1 s; 13,500 W for 1 min; 12,500 W for 6 min; 11,000 W for 12 min
  • Battery charging208 A
  • Efficiency97 %
  • AC output120/240 V AC or 208 V AC (L1/L2/N required)
  • Battery-only output10 kW
  • Battery voltage51.2 V
  • Grid pass-through90 A
  • Continuous output13 kW
  • MPPT trackers2
  • PV input limit18 kW
  • Maximum PV voltage600 V
  • Weight52 kg / 114.64 lb
  • Dimensions285 D × 566 W × 773 H mm
  • EnclosureNEMA 4X
  • Battery cable size (manual)2 cables per pole: 1/0 AWG up to 16 ft, 2/0 AWG up to 21 ft, 3/0 AWG up to 26 ft or 4/0 AWG up to 33 ft; integrated 250 A battery breaker
  • AC input conductors (manual)2 AWG (50 mm²) max. (Grid, 90 A breaker)
  • Parallel units16
  • Terminal torque (manual)26 N·m
  • AC output conductors (manual)2 AWG (50 mm²) max. (Load, 90 A breaker)
No recalls or legal notices on file; this is not a complete recall or court search.
Product information from Charged Reviews. The Evidence score compares published documents. It is not a test result or a product endorsement.
Oops, missed your message when responding. What issues have you observed? I find that my Flexboss18 sometimes respects the voltage parameters, and sometimes doesn't. I suspect this has something to do with logic designed to compensate for the fact that the voltage "bounces back" once charging/discharging stops, so it's taking into consideration something like "if the voltage passes through this transition". I just haven't figured out the details of when that actually happens, or how it responds to changes in the setpoint.

I've mostly been charging in pv priority mode and tweaking the voltage to start/stop sending all the AC-coupled solar into the battery vs just avoiding exports.

It would in no way pay any attention to the "start" and "stop" charging voltage values when in voltage mode. I had 2 options..... either "float" 24/7 at the float voltage, with no way to A, ever get a top balance without B, beating the crap out of the battery bank because that is the "float" value, hence if you set it high...er.... it will never CHILL OUT. The "stop ac charge" value was seemingly invisible. The "start ac charge" value..... also invisible. If I lowered the "float" value below "start ac charge", the system simply disabled ALL charging. Would run until it kicked off on low voltage. I never actually waited for it to do it but with "start ac charge" at say 53v and system voltage at 49.... it's not starting. Ac charge was enabled.

All settings the same, just switched to SOC and suddenly start and stop work exactly as the English language would suggest....

I gave up. For now it doesn't matter. The bank is cycling daily from 100 to 40, 30, 20 or so and back again so SOC stays accurate. After the peak TOU months pass I think by running the inverter idle consumption out of the batteries, the SOC will fall quickly enough that they will trip the "start" SOC value before too many days have passed and keep the SOC value from getting out of whack anyway.
 
I had a bit of an issue with my setup because it was a bit more "unique" that most people. I have a mix of battery types, and BAUD rates. I was forced to set up a second instance of Home Assistant (could have also been done with an EPS32 I suppose but I had a spare Pi handy) and anything on the slower 9600 baud rate (EG4 batteries) was fed via an MQTT bridge into my main HA setup.

In case someone else runs into a similar situation here is a quick AI generated synopsis as well as code which may help you further.

Master Engineering Blueprint & Deployment Documentation​

Ingesting, Isolating, and Synchronizing Multi-Pack Parallel Arrays: EG4 (9,600 Baud Modbus RTU) and JK BMS (115,200 Baud Inter-BMS Parallel Sniffing via Seplos USB Adapter)

1. Project Lineage & Reference Ecosystems​

This production-grade energy management architecture integrates hardware drivers, serial communications timing loops, and state synchronization layers into a reliable multi-node pipeline. The implementation parameters are grounded in and verified by the following engineering resources:

2. Core Architecture & System Synopsis​

Why a Dual-Instance Topology is Required​

Interfacing industrial lithium battery storage arrays from different manufacturers onto a single computer node forces a fundamental hardware bottleneck: Serial Bus Baud Rate Contention. Running multiple aggressive serial communication routines into a single Home Assistant OS stack triggers internal kernel resource scheduling lockups, leading to corrupted data frames, packet tearing, and persistent integration dropouts.


1781036620282.png



The Serial Port Bottleneck Breakdown​

The communications buses of your two battery systems utilize fundamentally conflicting electrical profiles, logical frameworks, and bus timings:

  • JK BMS Clustered Array (115,200 Baud): Operates at an asynchronous speed of 115,200 bps using an RS485 network topology. Rather than processing structured master-slave request packets, this system relies on the high-speed parallel sharing of status registers. The monitoring node must intercept this traffic rapidly to prevent driver input buffer overflow or packet truncation.
  • EG4 Clustered Array (9,600 Baud): Operates at a standard clock index of 9,600 bps over Modbus RTU. This bus uses a half-duplex layout requiring explicit request and echo pause windows. To initialize communications cleanly and safeguard parallel expansion boundaries, the primary battery module on this loop must be assigned Modbus ID 2.

Mechanism of Single-Instance System Failure​

When a single host operating system tries to manage both interfaces on the same physical USB driver controller, serial port buffer contention happens immediately. While the system's core processing loop halts for several milliseconds waiting for the slow 9600 baud EG4 master-slave echo routine to resolve over Wires 1 and 2, the high-speed 115200 baud JK BMS hardware stream continues to flood the serial port driver input array. This results in immediate input buffer overruns, corrupting data frames, causing CRC validation failures, and causing both battery clusters to stop responding.

The Split-Processing Remedy & MQTT Bridging​

By offloading the low-speed 9600 baud EG4 Modbus bus to an isolated secondary host machine (HA2), hardware resource lockups are completely resolved. HA2 focuses its execution loops on the steady Modbus queries. It parses the binary arrays, formats the telemetry into clean network payloads, and streams it across an ethernet bridge to your network's centralized MQTT broker.

This layout completely protects the primary hardware on the MAIN instance, allowing it to apply 100% of its native serial resources to capture the high-velocity 115,200 bps data from the JK BMS without dropping single frames.

Overcoming "MQTT Statestream Amnesia"​

The native Home Assistant mqtt_statestream engine only issues updates over the network broker when an entity state explicitly shifts value. While effective for dynamic values like power or voltage, it remains totally silent for stable metrics like Cycle Counts, State of Health, Warnings, or slow-moving inner temperatures.

If the central server reboots, these lines default to an empty Unknown state. To fix this, HA2 implements a forced brute-force sync routine: every 30 seconds, it explicitly triggers a new read across every Modbus register path and force-publishes it across the network bridge with a persistent retain: true flag, guaranteeing immediate restoration upon central node initialization.

3. Physical Layer Wiring, Addressing, & Port Maps​

EG4 Modbus Physical Wiring & Multi-Pack DIP Scaling​

  • Port Selection: Connection must be made directly into the twin Parallel RS485 Communication Ports located on the far right of the battery's front interface board (as highlighted in red on the master board diagram).
  • Wiring Pin Array Mapping: The RJ45 communication path must wire exclusively into Wires 1 and 2:
    • Pin 1 (Orange/White wire): Connects to differential RS485-B (Negative signal input terminal).
    • Pin 2 (Orange wire): Connects to differential RS485-A (Positive signal input terminal).
    • Pins 4 and 5 must be omitted. These lines do not carry serial traffic on this interface and will introduce line distortion if connected to the Modbus adapter.
  • The Slave ID to DIP Switch Mapping Law: In the Home Assistant Modbus configuration block, the slave: 2 assignment correlates directly to the physical binary positions of DIP Switch #2 set on the battery's hardware switch block.
  • Multi-Battery Parallel Scaling: To scale the system with multiple parallel EG4 batteries, every single pack added to the array requires a unique battery ID. This requires a strict, sequential DIP switch increase on the front face of each subsequent battery pack. Pack 1 is addressed to Modbus ID 2, Pack 2 climbs sequentially to ID 3, Pack 3 to ID 4, Pack 4 to ID 5, and so on.
  • The Collision Overlap Penalty: Failing to step these parameters sequentially causes an immediate data collision on the shared Modbus line. The devices will cross-talk, jam the serial bus, scramble entity states, and force frame rejections inside the host kernel driver.

JK BMS Parallel Sniffing Setup (SolarAssistant Option 1 Layout)​

  • Hardware Profile: Deployed utilizing an industrial Seplos USB-to-RS485 adapter combined with a standard RJ45 networking patch cable.
  • Port Configuration: Wired strictly according to BMS Port - Option 1 specifications. On this sniffing hardware node, Wires 1 and 2 are NOT used.
  • Functional Methodology: Instead of acting as an active polling master on the loop, the Seplos adapter utilizes its custom pin alignment to tap the active communication lines flowing between the parallel-linked JK BMS modules. By passively snooping on the inter-BMS chatter, it intercepts the live 115,200 baud telemetry frames.
  • Multi-Battery Parallel Scaling: Just like the Modbus array, when managing a clustered multi-pack JK BMS network, every single battery pack requires a unique battery ID assignment within its internal software firmware settings screen. This keeps the snooped data segments neatly divided by array index. If IDs overlap, the sniffing script cannot resolve individual cell matrices, causing the telemetry fields to overwrite each other continuously.

4. Host OS Port Isolation (Persistent Device Bindings)​

To eliminate USB connection path shifting during system updates or hardware reboots, virtual port names (like /dev/ttyUSB0) must be abandoned. Both systems must map their physical serial chips via immutable hardware device paths.

Identifying Persistent Hardware Serial Paths​

On both your MAIN and HA2 system layers, locate your paths by navigating to:

Settings --> System --> Hardware --> Click the three dots (Top Right) --> Select All Hardware.

Locate and expand the serial tree branch. Isolate the specific identifier paths associated with each physical chipset type (such as FTDI, CH341, or CP210x):

In the example below the following USB to RS485 adapters were found (but yours may be different). Assign as intended for use so they get uniquely assigned.
  • EG4 Modbus Adapter Link (HA2 Node Port): /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
  • JK BMS Seplos Adapter Link (MAIN Node Port): /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A10KV8X4-if00-port0

5. HA2 Node (The Poller): Master​

Apply this structural configuration file to your dedicated HA2 poller machine. This file establishes the network link to the MQTT broker hosted on the central server (MAIN) and configures the native Home Assistant Modbus register ingestion mappings matching the EG4 communication specification.

⚠️ MULTI-BATTERY PARALLEL SCALING CALLOUT​

If you expand your power array with a second or third EG4 battery pack, you must duplicate the sensor configuration block under the identical modbus hub instance. Each additional physical pack requires an incremented, unique slave ID matching its front panel DIP switch configuration. >

Below, the sensor stack for the primary battery pack (slave: 2) is active. Directly following it is a prototype block for a subsequent battery configured for a third battery setup (slave: 4). It has been commented out (REM'd out) with # notation. To deploy additional batteries, copy this structure, adjust the slave ID sequentially (3, 4, 5...), modify the name / unique_id hooks to preserve entity isolation, and uncomment the lines.

Code:
# Loads default set of integrations. Do not remove.
default_config:

# ==============================================================================
# MQTT CLIENT LINK: Network Bridge connection to MAIN Instance Broker
# ==============================================================================
mqtt:
  broker: 192.168.1.100  # CHANGE THIS to the exact physical IP address of your MAIN instance
  port: 1883
  username: your_mqtt_broker_username  # Configured in MAIN Mosquitto MQTT Add-on
  password: your_mqtt_broker_password

# ==============================================================================
# NATIVE MODBUS RTU CONFIGURATION: Direct Register Reading from slave address 2
# ==============================================================================
modbus:
  - name: eg4
    type: serial
    method: rtu
    port: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0   # LOCKED PATH
    baudrate: 9600
    bytesize: 8
    stopbits: 1
    parity: N
    sensors:
      # ------------------------------------------------------------------------
      # PACK #1: ACTIVE CONFIGURATION (Slave 2 / DIP Switch #2)
      # ------------------------------------------------------------------------
      - name: "EG4 Battery Voltage"
        unique_id: eg4_battery_voltage_raw
        slave: 2  # Matches physical DIP switch position 2
        address: 0
        input_type: holding
        data_type: uint16
        scale: 0.01
        precision: 2
        unit_of_measurement: "V"
        device_class: voltage

      - name: "EG4 Battery Current"
        unique_id: eg4_battery_current_raw
        slave: 2
        address: 1
        input_type: holding
        data_type: int16
        scale: 0.01
        precision: 2
        unit_of_measurement: "A"
        device_class: current

      - name: "EG4 Remaining Capacity"
        unique_id: eg4_remaining_capacity_raw
        slave: 2
        address: 21
        input_type: holding
        data_type: uint16
        unit_of_measurement: "Ah"

      - name: "EG4 State of Health"
        unique_id: eg4_state_of_health_raw
        slave: 2
        address: 23
        input_type: holding
        data_type: uint16
        unit_of_measurement: "%"

      - name: "EG4 State of Charge"
        unique_id: eg4_state_of_charge_raw
        slave: 2
        address: 24
        input_type: holding
        data_type: uint16
        unit_of_measurement: "%"
        device_class: battery

      - name: "EG4 Status"
        unique_id: eg4_status_raw
        slave: 2
        address: 25
        input_type: holding
        data_type: uint16

      - name: "EG4 Warnings"
        unique_id: eg4_warnings_raw
        slave: 2
        address: 26
        input_type: holding
        data_type: uint16

      - name: "EG4 Protections"
        unique_id: eg4_protections_raw
        slave: 2
        address: 27
        input_type: holding
        data_type: uint16

      - name: "EG4 Errors"
        unique_id: eg4_errors_raw
        slave: 2
        address: 28
        input_type: holding
        data_type: uint16

      - name: "EG4 Cycle Count"
        unique_id: eg4_cycle_count_raw
        slave: 2
        address: 29
        input_type: holding
        data_type: uint32

      - name: "EG4 PCB Temp"
        unique_id: eg4_pcb_temp_raw
        slave: 2
        address: 18
        input_type: holding
        data_type: int16
        unit_of_measurement: "°C"
        device_class: temperature

      - name: "EG4 Average Cell Temp"
        unique_id: eg4_average_cell_temp_raw
        slave: 2
        address: 19
        input_type: holding
        data_type: int16
        unit_of_measurement: "°C"
        device_class: temperature

      - name: "EG4 Max Cell Temp"
        unique_id: eg4_max_cell_temp_raw
        slave: 2
        address: 20
        input_type: holding
        data_type: int16
        unit_of_measurement: "°C"
        device_class: temperature

      # --- 16S Individual Cell Voltage Mappings ---
      - name: "EG4 Battery Cell 1 Voltage"
        slave: 2
        address: 2
        input_type: holding
        data_type: uint16
        scale: 0.001
        unit_of_measurement: "V"
      - name: "EG4 Battery Cell 2 Voltage"
        slave: 2
        address: 3
        input_type: holding
        data_type: uint16
        scale: 0.001
        unit_of_measurement: "V"
      - name: "EG4 Battery Cell 3 Voltage"
        slave: 2
        address: 4
        input_type: holding
        data_type: uint16
        scale: 0.001
        unit_of_measurement: "V"
      - name: "EG4 Battery Cell 4 Voltage"
        slave: 2
        address: 5
        input_type: holding
        data_type: uint16
        scale: 0.001
        unit_of_measurement: "V"
      - name: "EG4 Battery Cell 5 Voltage"
        slave: 2
        address: 6
        input_type: holding
        data_type: uint16
        scale: 0.001
        unit_of_measurement: "V"
      - name: "EG4 Battery Cell 6 Voltage"
        slave: 2
        address: 7
        input_type: holding
        data_type: uint16
        scale: 0.001
        unit_of_measurement: "V"
      - name: "EG4 Battery Cell 7 Voltage"
        slave: 2
        address: 8
        input_type: holding
        data_type: uint16
        scale: 0.001
        unit_of_measurement: "V"
      - name: "EG4 Battery Cell 8 Voltage"
        slave: 2
        address: 9
        input_type: holding
        data_type: uint16
        scale: 0.001
        unit_of_measurement: "V"
      - name: "EG4 Battery Cell 9 Voltage"
        slave: 2
        address: 10
        input_type: holding
        data_type: uint16
        scale: 0.001
        unit_of_measurement: "V"
      - name: "EG4 Battery Cell 10 Voltage"
        slave: 2
        address: 11
        input_type: holding
        data_type: uint16
        scale: 0.001
        unit_of_measurement: "V"
      - name: "EG4 Battery Cell 11 Voltage"
        slave: 2
        address: 12
        input_type: holding
        data_type: uint16
        scale: 0.001
        unit_of_measurement: "V"
      - name: "EG4 Battery Cell 12 Voltage"
        slave: 2
        address: 13
        input_type: holding
        data_type: uint16
        scale: 0.001
        unit_of_measurement: "V"
      - name: "EG4 Battery Cell 13 Voltage"
        slave: 2
        address: 14
        input_type: holding
        data_type: uint16
        scale: 0.001
        unit_of_measurement: "V"
      - name: "EG4 Battery Cell 14 Voltage"
        slave: 2
        address: 15
        input_type: holding
        data_type: uint16
        scale: 0.001
        unit_of_measurement: "V"
      - name: "EG4 Battery Cell 15 Voltage"
        slave: 2
        address: 16
        input_type: holding
        data_type: uint16
        scale: 0.001
        unit_of_measurement: "V"
      - name: "EG4 Battery Cell 16 Voltage"
        slave: 2
        address: 17
        input_type: holding
        data_type: uint16
        scale: 0.001
        unit_of_measurement: "V"

      # --- Hardcoded/Static Device Configurations ---
      - name: "EG4 Model"
        slave: 2
        address: 105
        input_type: holding
        data_type: custom
        structure: "24s"
      - name: "EG4 Firmware"
        slave: 2
        address: 117
        input_type: holding
        data_type: custom
        structure: "6s"
      - name: "EG4 Serial Number"
        slave: 2
        address: 120
        input_type: holding
        data_type: custom
        structure: "16s"

      # ------------------------------------------------------------------------
      # PACK #3 EXAMPLE: COMMENTED PROTOTYPE ARRAY (Slave 4 / DIP Switch #4)
      # To use a 3rd battery pack, uncomment the block below (#) and add variables to MQTT sync
      # ------------------------------------------------------------------------
      # - name: "EG4 Battery P3 Voltage"
      #   unique_id: eg4_battery_p3_voltage_raw
      #   slave: 4  # Sequential shift to match 3rd battery configuration boundaries
      #   address: 0
      #   input_type: holding
      #   data_type: uint16
      #   scale: 0.01
      #   precision: 2
      #   unit_of_measurement: "V"
      #   device_class: voltage
      #
      # - name: "EG4 Battery P3 Current"
      #   unique_id: eg4_battery_p3_current_raw
      #   slave: 4
      #   address: 1
      #   input_type: holding
      #   data_type: int16
      #   scale: 0.01
      #   precision: 2
      #   unit_of_measurement: "A"
      #   device_class: current
      #
      # - name: "EG4 P3 Remaining Capacity"
      #   unique_id: eg4_p3_remaining_capacity_raw
      #   slave: 4
      #   address: 21
      #   input_type: holding
      #   data_type: uint16
      #   unit_of_measurement: "Ah"
      #
      # - name: "EG4 P3 State of Charge"
      #   unique_id: eg4_p3_state_of_charge_raw
      #   slave: 4
      #   address: 24
      #   input_type: holding
      #   data_type: uint16
      #   unit_of_measurement: "%"
      #   device_class: battery
      #
      # - name: "EG4 P3 Cycle Count"
      #   unique_id: eg4_p3_cycle_count_raw
      #   slave: 4
      #   address: 29
      #   input_type: holding
      #   data_type: uint32

6. HA2 Node (The Poller): Master​

Deploy this automation configuration directly within the automations.yaml file of your dedicated poller machine (HA2). This script drives the for_each processing block to update the Modbus registers and execute persistent network data broadcasts.

automations.yaml​


Code:
alias: Force EG4 ALL Data MQTT Sync
description: "Brute-force updates and publishes every EG4 Modbus value to MQTT every 30 seconds"
id: force_eg4_mqtt_sync
triggers:
  - event: start
    trigger: homeassistant
  - seconds: /30
    trigger: time_pattern
actions:
  - repeat:
      for_each:
        # --- Overview & Power ---
        - sensor.eg4_status
        - sensor.eg4_state_of_charge
        - sensor.eg4_battery_power
        - sensor.eg4_battery_voltage
        - sensor.eg4_battery_current
        - sensor.eg4_remaining_capacity
        - sensor.eg4_state_of_health
        - sensor.eg4_cycle_count
        - sensor.eg4_pack_current_enhanced
     
        # --- Health & Temperatures ---
        - sensor.eg4_cell_delta
        - sensor.eg4_min_cell_voltage
        - sensor.eg4_max_cell_voltage
        - sensor.eg4_average_cell_temp
        - sensor.eg4_max_cell_temp
        - sensor.eg4_pcb_temp
        - sensor.eg4_heating_status
        - sensor.eg4_battery_temp_1
        - sensor.eg4_battery_temp_2
        - sensor.eg4_battery_temp_3
        - sensor.eg4_battery_temp_4
     
        # --- Diagnostics ---
        - sensor.eg4_errors
        - sensor.eg4_warnings
        - sensor.eg4_protections
        - sensor.eg4_firmware
        - sensor.eg4_model
        - sensor.eg4_serial_number
     
        # --- Individual Cells ---
        - sensor.eg4_battery_cell_01_voltage
        - sensor.eg4_battery_cell_02_voltage
        - sensor.eg4_battery_cell_03_voltage
        - sensor.eg4_battery_cell_04_voltage
        - sensor.eg4_battery_cell_05_voltage
        - sensor.eg4_battery_cell_06_voltage
        - sensor.eg4_battery_cell_07_voltage
        - sensor.eg4_battery_cell_08_voltage
        - sensor.eg4_battery_cell_09_voltage
        - sensor.eg4_battery_cell_10_voltage
        - sensor.eg4_battery_cell_11_voltage
        - sensor.eg4_battery_cell_12_voltage
        - sensor.eg4_battery_cell_13_voltage
        - sensor.eg4_battery_cell_14_voltage
        - sensor.eg4_battery_cell_15_voltage
        - sensor.eg4_battery_cell_16_voltage
     
        # --- Limits ---
        - sensor.eg4_max_discharge_limit
        - sensor.eg4_max_charge_limit
     
        # ----------------------------------------------------------------------
        # PROTOTYPE PACK #3 EXTENSION PATH:
        # If deploying a 3rd battery pack, uncomment the variables below to pull them into the loop
        # ----------------------------------------------------------------------
        # - sensor.eg4_battery_p3_voltage
        # - sensor.eg4_battery_p3_current
        # - sensor.eg4_p3_remaining_capacity
        # - sensor.eg4_p3_state_of_charge
        # - sensor.eg4_p3_cycle_count
     
      sequence:
        # 1. Force the Modbus integration to execute an immediate serial bus query
        - action: homeassistant.update_entity
          target:
            entity_id: "{{ repeat.item }}"
         
        # 2. Extract state payload and force-publish over network with retain active
        - action: mqtt.publish
          data:
            topic: "ha2/{{ repeat.item | replace('.', '/') }}/state"
            payload: "{{ states(repeat.item) }}"
            retain: true


7. MAIN Node: System-Level Ingestion File (Fully Commented Architecture)​

Apply this master layout block directly into the configuration.yaml file of your primary central hub machine (MAIN). Every module, mathematical string parser, and network listener contains thorough inline documentation detailing its operational rationale.

configuration.yaml​


Code:
# ==============================================================================
# CORE SYSTEM INITIALIZATION
# ==============================================================================
# Loads default set of core Home Assistant integrations. Do not alter or remove.
default_config:

# Mount frontend theme structures from the local configuration subfolder directory
frontend:
  themes: !include_dir_merge_named themes

# Establish mapping links for standard component configurations split into external files
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

# ==============================================================================
# LONG-TERM STATISTICS PLATFORM: 24-Hour Rolling Peaks Evaluation
# ==============================================================================
# These tracking entities run historical scans across the local state database.
# They monitor dynamic current readings over a rolling window to calculate charge/discharge peaks.
sensor:
  # --- JK BMS: Max Charging Peak Tracking ---
  - platform: statistics
    name: "BMS 1 24h Max Charge Current"
    entity_id: sensor.bms_1_courant_total
    state_characteristic: value_max  # Evaluates the highest positive numeric value recorded
    max_age:
      hours: 24                      # Sliding history calculation duration limits

  # --- JK BMS: Max Discharging Peak Tracking ---
  - platform: statistics
    name: "BMS 1 24h Max Discharge Current Raw"
    entity_id: sensor.bms_1_courant_total
    state_characteristic: value_min  # Evaluates the lowest negative numeric value recorded
    max_age:
      hours: 24

  # --- EG4 Module: Max Charging Peak Tracking ---
  - platform: statistics
    name: "EG4 24h Max Charge Current"
    entity_id: sensor.eg4_battery_current
    state_characteristic: value_max  # Captures maximum charging amperage inflow
    max_age:
      hours: 24

  # --- EG4 Module: Max Discharging Peak Tracking ---
  - platform: statistics
    name: "EG4 24h Max Discharge Current Raw"
    entity_id: sensor.eg4_battery_current
    state_characteristic: value_min  # Captures lowest discharging amperage outflow
    max_age:
      hours: 24

# ==============================================================================
# UNIFIED STATE TEMPLATES: Data Conversions, Filtering Math, and Cleanups
# ==============================================================================
# This layer executes continuous calculations, state safety filters,
# and metrics standardization (such as metric to imperial thermal conversions).
template:
  - sensor:
      # --- JK BMS: Native Percent Pass-Through ---
      - name: "BMS 1 SOC"
        unique_id: bms_1_soc
        state: "{{ states('sensor.bms_1_soc_pourcentage') }}"
        unit_of_measurement: "%"

      # --- JK BMS: Polarity Inversion Power Adjuster ---
      # Certain driver frameworks present discharging watts as unsigned positives.
      # This template cross-references current directions to output true negative values during load.
      - name: "BMS 1 Power"
        unique_id: bms_1_power
        device_class: power
        state_class: measurement
        unit_of_measurement: "W"
        state: >
          {% set power = states('sensor.bms_1_puissance_totale') | float(0) %}
          {% set current = states('sensor.bms_1_courant_total') | float(0) %}
          {% if current < 0 %}
            {{ (power * -1) | round(2) }}  # Forces negative integer formatting on load demand
          {% else %}
            {{ power | round(2) }}         # Preserves positive value during solar charge inputs
          {% endif %}

      - name: "BMS 1 Total Voltage"
        unique_id: bms_1_total_voltage
        state: "{{ states('sensor.bms_1_tension_totale_volt') }}"
        unit_of_measurement: "V"

      - name: "BMS 1 Current"
        unique_id: bms_1_current
        state: "{{ states('sensor.bms_1_courant_total') }}"
        unit_of_measurement: "A"

      # --- JK BMS: Enhanced Visual Status Formatting String ---
      # Processes numeric flow characteristics to output user-friendly text descriptions.
      - name: "BMS 1 Current Enhanced"
        unique_id: bms_1_current_enhanced
        icon: >
          {% set current = states('sensor.bms_1_courant_total') | float(0) %}
          {% if current > 0 %}
            mdi:battery-charging
          {% elif current < 0 %}
            mdi:battery-arrow-down
          {% else %}
            mdi:battery
          {% endif %}
        state: >
          {% set current = states('sensor.bms_1_courant_total') | float(0) %}
          {% if current > 0 %}
            Charging (+{{ current | abs | round(2) }} A)
          {% elif current < 0 %}
            Discharging (-{{ current | abs | round(2) }} A)
          {% else %}
            Idle
          {% endif %}

      # --- JK BMS: Charge Peak Rounding Filter ---
      - name: "BMS 1 24h Peak Charge"
        unique_id: bms_1_24h_peak_charge
        unit_of_measurement: "A"
        device_class: current
        state: >
          {% set peak = states('sensor.bms_1_24h_max_charge_current') | float(0) %}
          {{ peak | round(1) if peak > 0 else 0 }}

      # --- JK BMS: Discharge Peak Absolute Math Absolute Mask ---
      # Inverts raw negative minimum values into clean positive scalars for UI display layouts.
      - name: "BMS 1 24h Peak Discharge"
        unique_id: bms_1_24h_peak_discharge
        unit_of_measurement: "A"
        device_class: current
        state: >
          {% set peak = states('sensor.bms_1_24h_max_discharge_current_raw') | float(0) %}
          {{ (peak | abs) | round(1) if peak < 0 else 0 }}

      - name: "BMS 1 Capacity Remaining"
        unique_id: bms_1_capacity_remaining
        state: "{{ states('sensor.bms_1_capacite_restante_ah') }}"
        unit_of_measurement: "Ah"

      - name: "BMS 1 Actual Battery Capacity"
        unique_id: bms_1_actual_battery_capacity
        state: "{{ states('sensor.bms_1_capacite_batterie_ah') }}"
        unit_of_measurement: "Ah"

      - name: "BMS 1 Charging Cycles"
        unique_id: bms_1_charging_cycles
        state: "{{ states('sensor.bms_1_nombre_cycle') }}"

      - name: "BMS 1 Cycle Capacity"
        unique_id: bms_1_cycle_capacity
        state: "{{ states('sensor.bms_1_cycle_capacite_ah') }}"
        unit_of_measurement: "Ah"

      - name: "BMS 1 Balancing Current"
        unique_id: bms_1_balancing_current
        state: "{{ states('sensor.bms_1_balance_courant') }}"
        unit_of_measurement: "A"

      - name: "BMS 1 Power Tube Temperature"
        unique_id: bms_1_power_tube_temperature
        state: "{{ states('sensor.bms_1_mos_temp') }}"
        unit_of_measurement: "°C"

      - name: "BMS 1 Hardware Version"
        unique_id: bms_1_hardware_version
        state: "{{ states('sensor.bms_1_bms_fw') }}"

      - name: "BMS 1 Software Version"
        unique_id: bms_1_software_version
        state: "{{ states('sensor.bms_1_bms_sw') }}"

      - name: "BMS 1 Delta Cell Voltage"
        unique_id: bms_1_delta_cell_voltage
        state: "{{ states('sensor.bms_1_cell_voltage_delta') }}"
        unit_of_measurement: "V"

      - name: "BMS 1 Average Cell Voltage"
        unique_id: bms_1_average_cell_voltage
        state: "{{ states('sensor.bms_1_cell_voltage_average') }}"
        unit_of_measurement: "V"
     
      # --- JK BMS: 16S Individual Cell Raw Entity Trackers ---
      - name: "BMS 1 Cell Voltage 1"
        unique_id: bms_1_cell_voltage_1
        state: "{{ states('sensor.bms_1_cell_1_volt') }}"
        unit_of_measurement: "V"
      - name: "BMS 1 Cell Voltage 2"
        unique_id: bms_1_cell_voltage_2
        state: "{{ states('sensor.bms_1_cell_2_volt') }}"
        unit_of_measurement: "V"
      - name: "BMS 1 Cell Voltage 3"
        unique_id: bms_1_cell_voltage_3
        state: "{{ states('sensor.bms_1_cell_3_volt') }}"
        unit_of_measurement: "V"
      - name: "BMS 1 Cell Voltage 4"
        unique_id: bms_1_cell_voltage_4
        state: "{{ states('sensor.bms_1_cell_4_volt') }}"
        unit_of_measurement: "V"
      - name: "BMS 1 Cell Voltage 5"
        unique_id: bms_1_cell_voltage_5
        state: "{{ states('sensor.bms_1_cell_5_volt') }}"
        unit_of_measurement: "V"
      - name: "BMS 1 Cell Voltage 6"
        unique_id: bms_1_cell_voltage_6
        state: "{{ states('sensor.bms_1_cell_6_volt') }}"
        unit_of_measurement: "V"
      - name: "BMS 1 Cell Voltage 7"
        unique_id: bms_1_cell_voltage_7
        state: "{{ states('sensor.bms_1_cell_7_volt') }}"
        unit_of_measurement: "V"
      - name: "BMS 1 Cell Voltage 8"
        unique_id: bms_1_cell_voltage_8
        state: "{{ states('sensor.bms_1_cell_8_volt') }}"
        unit_of_measurement: "V"
      - name: "BMS 1 Cell Voltage 9"
        unique_id: bms_1_cell_voltage_9
        state: "{{ states('sensor.bms_1_cell_9_volt') }}"
        unit_of_measurement: "V"
      - name: "BMS 1 Cell Voltage 10"
        unique_id: bms_1_cell_voltage_10
        state: "{{ states('sensor.bms_1_cell_10_volt') }}"
        unit_of_measurement: "V"
      - name: "BMS 1 Cell Voltage 11"
        unique_id: bms_1_cell_voltage_11
        state: "{{ states('sensor.bms_1_cell_11_volt') }}"
        unit_of_measurement: "V"
      - name: "BMS 1 Cell Voltage 12"
        unique_id: bms_1_cell_voltage_12
        state: "{{ states('sensor.bms_1_cell_12_volt') }}"
        unit_of_measurement: "V"
      - name: "BMS 1 Cell Voltage 13"
        unique_id: bms_1_cell_voltage_13
        state: "{{ states('sensor.bms_1_cell_13_volt') }}"
        unit_of_measurement: "V"
      - name: "BMS 1 Cell Voltage 14"
        unique_id: bms_1_cell_voltage_14
        state: "{{ states('sensor.bms_1_cell_14_volt') }}"
        unit_of_measurement: "V"
      - name: "BMS 1 Cell Voltage 15"
        unique_id: bms_1_cell_voltage_15
        state: "{{ states('sensor.bms_1_cell_15_volt') }}"
        unit_of_measurement: "V"
      - name: "BMS 1 Cell Voltage 16"
        unique_id: bms_1_cell_voltage_16
        state: "{{ states('sensor.bms_1_cell_16_volt') }}"
        unit_of_measurement: "V"

      # --- JK BMS: Thermal Probes Fahrenheit Standardizers ---
      # Multiplies Celsius register metrics by 1.8 and sums 32 to format for imperial UI dashboards.
      - name: "BMS 1 Probe 1 Temp F"
        unique_id: bms_1_probe_1_temp_f
        unit_of_measurement: "°F"
        device_class: temperature
        state: "{{ (states('sensor.bms_1_sonde_1_temp') | float(0) * 1.8 + 32) | round(1) }}"
      - name: "BMS 1 Probe 2 Temp F"
        unique_id: bms_1_probe_2_temp_f
        unit_of_measurement: "°F"
        device_class: temperature
        state: "{{ (states('sensor.bms_1_sonde_2_temp') | float(0) * 1.8 + 32) | round(1) }}"
      - name: "BMS 1 Probe 3 Temp F"
        unique_id: bms_1_probe_3_temp_f
        unit_of_measurement: "°F"
        device_class: temperature
        state: "{{ (states('sensor.bms_1_sonde_3_temp') | float(0) * 1.8 + 32) | round(1) }}"
      - name: "BMS 1 Probe 4 Temp F"
        unique_id: bms_1_probe_4_temp_f
        unit_of_measurement: "°F"
        device_class: temperature
        state: "{{ (states('sensor.bms_1_sonde_4_temp') | float(0) * 1.8 + 32) | round(1) }}"

      # --- EG4 Module: Constant Base Capacity Value Assignment ---
      - name: "EG4 Total Capacity Calculated"
        unique_id: eg4_total_capacity_calculated
        unit_of_measurement: "Ah"
        state: "{{ 280.0 | float }}"

      # --- EG4 Module: Enhanced Status Formatting String ---
      - name: "EG4 Current Enhanced"
        unique_id: eg4_current_enhanced
        icon: >
          {% set current = states('sensor.eg4_battery_current') | float(0) %}
          {% if current > 0 %}
            mdi:battery-charging
          {% elif current < 0 %}
            mdi:battery-arrow-down
          {% else %}
            mdi:battery
          {% endif %}
        state: >
          {% set current = states('sensor.eg4_battery_current') | float(0) %}
          {% if current > 0 %}
            Charging (+{{ current | abs | round(2) }} A)
          {% elif current < 0 %}
            Discharging (-{{ current | abs | round(2) }} A)
          {% else %}
            Idle
          {% endif %}

      # --- EG4 Module: Charge Peak Rounding Filter ---
      - name: "EG4 24h Peak Charge"
        unique_id: eg4_24h_peak_charge
        unit_of_measurement: "A"
        device_class: current
        state: >
          {% set peak = states('sensor.eg4_24h_max_charge_current') | float(0) %}
          {{ peak | round(1) if peak > 0 else 0 }}

      # --- EG4 Module: Discharge Peak Absolute Math Mask ---
      - name: "EG4 24h Peak Discharge"
        unique_id: eg4_24h_peak_discharge
        unit_of_measurement: "A"
        device_class: current
        state: >
          {% set peak = states('sensor.eg4_24h_max_discharge_current_raw') | float(0) %}
          {{ (peak | abs) | round(1) if peak < 0 else 0 }}

      # --- EG4 Module: 16S Average Cell Voltage Matrix Ingestion ---
      # Dynamically iterates through the 16 cell entities coming from HA2.
      # It strips out 'unknown' or 'unavailable' data flags to calculate an accurate string average.
      - name: "EG4 Battery Average Cell Voltage"
        unique_id: eg4_battery_average_cell_voltage
        unit_of_measurement: "V"
        device_class: voltage
        state_class: measurement
        state: >
          {% set cells = [
            states('sensor.eg4_battery_cell_1_voltage'), states('sensor.eg4_battery_cell_2_voltage'),
            states('sensor.eg4_battery_cell_3_voltage'), states('sensor.eg4_battery_cell_4_voltage'),
            states('sensor.eg4_battery_cell_5_voltage'), states('sensor.eg4_battery_cell_6_voltage'),
            states('sensor.eg4_battery_cell_7_voltage'), states('sensor.eg4_battery_cell_8_voltage'),
            states('sensor.eg4_battery_cell_9_voltage'), states('sensor.eg4_battery_cell_10_voltage'),
            states('sensor.eg4_battery_cell_11_voltage'), states('sensor.eg4_battery_cell_12_voltage'),
            states('sensor.eg4_battery_cell_13_voltage'), states('sensor.eg4_battery_cell_14_voltage'),
            states('sensor.eg4_battery_cell_15_voltage'), states('sensor.eg4_battery_cell_16_voltage')
          ] %}
          {% set valid = cells | reject('in', ['unknown', 'unavailable']) | map('float', -1) | reject('eq', -1) | list %}
          {{ (valid | sum / valid | count) | round(3) if valid | count > 0 else 'unknown' }}

      # --- EG4 Module: Clean Power Mathematical Generator ---
      # Raw Modbus power registers can exhibit calculation delay.
      # Multiplying real-time volts by real-time amps provides instant power calculations.
      - name: "EG4 Battery Power Clean"
        unique_id: eg4_battery_power_clean
        unit_of_measurement: "W"
        device_class: power
        state_class: measurement
        state: >
          {% set volts = states('sensor.eg4_battery_voltage') | float(0) %}
          {% set amps = states('sensor.eg4_battery_current') | float(0) %}
          {{ (volts * amps) | round(2) }}

      # --- TOTAL SYSTEM ARRAYS: Luxpower Inverter Pack Isolation Formula ---
      # Subtracts the clean EG4 battery wattage from the inverter's total battery sensor.
      # This isolates and calculates the power flow of the JK BMS pack when they run in parallel.
      - name: "Luxpower Battery 1 Power Isolated"
        unique_id: luxpower_battery1_power_isolated
        unit_of_measurement: "W"
        device_class: power
        state_class: measurement
        state: >
          {% set total_power = states('sensor.luxpower_lxp_battery_power') | float(0) %}
          {% set batt2_power = states('sensor.eg4_battery_power_clean') | float(0) %}
          {{ (total_power - batt2_power) | round(2) }}

# ==============================================================================
# MQTT ENDPOINTS: Remote Ingestion Subscriptions Linked to HA2 Poller
# ==============================================================================
# Subscribes to the network broker topics populated by the HA2 brute-force script.
# This assigns proper device and measurement classes for Home Assistant's long-term engine.
mqtt:
  sensor:
    - name: "EG4 Battery Voltage"
      state_topic: "ha2/sensor/eg4_battery_voltage/state"
      unit_of_measurement: "V"
      device_class: voltage

    - name: "EG4 Battery Current"
      state_topic: "ha2/sensor/eg4_battery_current/state"
      unit_of_measurement: "A"
      device_class: current

    - name: "EG4 Battery Power"
      state_topic: "ha2/sensor/eg4_battery_power/state"
      unit_of_measurement: "W"
      device_class: power

    - name: "EG4 State of Charge"
      state_topic: "ha2/sensor/eg4_state_of_charge/state"
      unit_of_measurement: "%"
      device_class: battery

    - name: "EG4 State of Health"
      state_topic: "ha2/sensor/eg4_state_of_health/state"
      unit_of_measurement: "%"

    - name: "EG4 Remaining Capacity"
      state_topic: "ha2/sensor/eg4_remaining_capacity/state"
      unit_of_measurement: "Ah"

    - name: "EG4 Cycle Count"
      state_topic: "ha2/sensor/eg4_cycle_count/state"

    - name: "EG4 Firmware"
      state_topic: "ha2/sensor/eg4_firmware/state"

    - name: "EG4 Model"
      state_topic: "ha2/sensor/eg4_model/state"

    - name: "EG4 Serial Number"
      state_topic: "ha2/sensor/eg4_serial_number/state"

    - name: "EG4 Status"
      state_topic: "ha2/sensor/eg4_status/state"

    - name: "EG4 Heating Status"
      state_topic: "ha2/sensor/eg4_heating_status/state"

    - name: "EG4 Warnings"
      state_topic: "ha2/sensor/eg4_warnings/state"

    - name: "EG4 Protections"
      state_topic: "ha2/sensor/eg4_protections/state"

    - name: "EG4 Errors"
      state_topic: "ha2/sensor/eg4_errors/state"

    - name: "EG4 PCB Temp"
      state_topic: "ha2/sensor/eg4_pcb_temp/state"
      unit_of_measurement: "°F"
      device_class: temperature

    - name: "EG4 Max Cell Temp"
      state_topic: "ha2/sensor/eg4_max_cell_temp/state"
      unit_of_measurement: "°F"
      device_class: temperature

    - name: "EG4 Average Cell Temp"
      state_topic: "ha2/sensor/eg4_average_cell_temp/state"
      unit_of_measurement: "°F"
      device_class: temperature

    - name: "EG4 Battery Temp 1"
      state_topic: "ha2/sensor/eg4_battery_temp_1/state"
      unit_of_measurement: "°F"
      device_class: temperature

    - name: "EG4 Battery Temp 2"
      state_topic: "ha2/sensor/eg4_battery_temp_2/state"
      unit_of_measurement: "°F"
      device_class: temperature

    - name: "EG4 Battery Temp 3"
      state_topic: "ha2/sensor/eg4_battery_temp_3/state"
      unit_of_measurement: "°F"
      device_class: temperature

    - name: "EG4 Battery Temp 4"
      state_topic: "ha2/sensor/eg4_battery_temp_4/state"
      unit_of_measurement: "°F"
      device_class: temperature

    # --- 16S Individual Cell Voltages via Remote Network Ingestion ---
    - name: "EG4 Battery Cell 1 Voltage"
      state_topic: "ha2/sensor/eg4_battery_cell_01_voltage/state"
      unit_of_measurement: "V"
    - name: "EG4 Battery Cell 2 Voltage"
      state_topic: "ha2/sensor/eg4_battery_cell_02_voltage/state"
      unit_of_measurement: "V"
    - name: "EG4 Battery Cell 3 Voltage"
      state_topic: "ha2/sensor/eg4_battery_cell_03_voltage/state"
      unit_of_measurement: "V"
    - name: "EG4 Battery Cell 4 Voltage"
      state_topic: "ha2/sensor/eg4_battery_cell_04_voltage/state"
      unit_of_measurement: "V"
    - name: "EG4 Battery Cell 5 Voltage"
      state_topic: "ha2/sensor/eg4_battery_cell_05_voltage/state"
      unit_of_measurement: "V"
    - name: "EG4 Battery Cell 6 Voltage"
      state_topic: "ha2/sensor/eg4_battery_cell_06_voltage/state"
      unit_of_measurement: "V"
    - name: "EG4 Battery Cell 7 Voltage"
      state_topic: "ha2/sensor/eg4_battery_cell_07_voltage/state"
      unit_of_measurement: "V"
    - name: "EG4 Battery Cell 8 Voltage"
      state_topic: "ha2/sensor/eg4_battery_cell_08_voltage/state"
      unit_of_measurement: "V"
    - name: "EG4 Battery Cell 9 Voltage"
      state_topic: "ha2/sensor/eg4_battery_cell_09_voltage/state"
      unit_of_measurement: "V"
    - name: "EG4 Battery Cell 10 Voltage"
      state_topic: "ha2/sensor/eg4_battery_cell_10_voltage/state"
      unit_of_measurement: "V"
    - name: "EG4 Battery Cell 11 Voltage"
      state_topic: "ha2/sensor/eg4_battery_cell_11_voltage/state"
      unit_of_measurement: "V"
    - name: "EG4 Battery Cell 12 Voltage"
      state_topic: "ha2/sensor/eg4_battery_cell_12_voltage/state"
      unit_of_measurement: "V"
    - name: "EG4 Battery Cell 13 Voltage"
      state_topic: "ha2/sensor/eg4_battery_cell_13_voltage/state"
      unit_of_measurement: "V"
    - name: "EG4 Battery Cell 14 Voltage"
      state_topic: "ha2/sensor/eg4_battery_cell_14_voltage/state"
      unit_of_measurement: "V"
    - name: "EG4 Battery Cell 15 Voltage"
      state_topic: "ha2/sensor/eg4_battery_cell_15_voltage/state"
      unit_of_measurement: "V"
    - name: "EG4 Battery Cell 16 Voltage"
      state_topic: "ha2/sensor/eg4_battery_cell_16_voltage/state"
      unit_of_measurement: "V"

    - name: "EG4 Battery Max Cell Voltage"
      state_topic: "ha2/sensor/eg4_max_cell_voltage/state"
      unit_of_measurement: "V"

    - name: "EG4 Battery Min Cell Voltage"
      state_topic: "ha2/sensor/eg4_min_cell_voltage/state"
      unit_of_measurement: "V"

    - name: "EG4 Battery Cell Delta"
      state_topic: "ha2/sensor/eg4_cell_delta/state"
      unit_of_measurement: "V"

8. Dashboard Frontend Configuration​

Paste this complete code directly into the UI dashboard card config on your central server to draw the telemetry column windows.

Code:
type: grid
columns: 2
square: false
cards:
  # ============================================================================
  # COLUMN 1: JK BMS 300A
  # ============================================================================
  - type: vertical-stack
    cards:
      - type: grid
        title: JK BMS 300A - Power & State
        columns: 2
        square: false
        cards:
          - type: gauge
            entity: sensor.bms_1_soc_pourcentage
            name: State of Charge (SOC)
            needle: true
            severity:
              green: 60
              yellow: 20
              red: 0
          - type: entities
            entities:
              - entity: sensor.bms_1_charge_status_text
                name: Operational Status
                icon: mdi:information-outline
              - entity: sensor.bms_1_power
                name: Battery Power
                icon: mdi:flash
              - entity: sensor.bms_1_tension_totale_volt
                name: Total Voltage
                icon: mdi:sine-wave
              - entity: sensor.bms_1_current_enhanced
                name: Total Amperage
              - entity: sensor.bms_1_24h_peak_discharge
                name: Max 24h Discharge
                icon: mdi:speedometer

      - type: history-graph
        title: Charge / Discharge History (24h)
        hours_to_show: 24
        entities:
          - entity: sensor.bms_1_power
            name: Battery Power (W)

      - type: entities
        title: Battery Metrics & Health
        show_header_toggle: false
        entities:
          - entity: sensor.bms_1_capacite_restante_ah
            name: Remaining Capacity
            icon: mdi:battery-charging-60
          - entity: sensor.bms_1_soh_pourcentage
            name: State of Health
            icon: mdi:heart-pulse
          - entity: sensor.bms_1_nombre_cycle
            name: Completed Cycles
            icon: mdi:battery-sync
          - entity: sensor.bms_1_capacite_batterie_ah
            name: Full Design Capacity
            icon: mdi:battery
          - type: divider
          - entity: sensor.bms_1_cell_voltage_average
            name: Average Cell Voltage
            icon: mdi:calculator
          - entity: sensor.bms_1_cell_voltage_delta
            name: Cell Voltage Delta
            icon: mdi:vector-difference
          - entity: sensor.bms_1_cell_voltage_max_value
            name: Highest Cell Voltage
            icon: mdi:arrow-up-bold-circle-outline
          - entity: sensor.bms_1_cell_voltage_min_value
            name: Lowest Cell Voltage
            icon: mdi:arrow-down-bold-circle-outline

      - type: entities
        title: Thermal Management
        show_header_toggle: false
        entities:
          - entity: sensor.bms_1_mos_temp
            name: BMS Board (MOSFET) Temp
            icon: mdi:developer-board
          - type: divider
          - entity: sensor.bms_1_probe_1_temp_f
            name: Battery Temp Sensor 1
            icon: mdi:thermometer
          - entity: sensor.bms_1_probe_2_temp_f
            name: Battery Temp Sensor 2
            icon: mdi:thermometer
          - entity: sensor.bms_1_probe_3_temp_f
            name: Battery Temp Sensor 3
            icon: mdi:thermometer
          - entity: sensor.bms_1_probe_4_temp_f
            name: Battery Temp Sensor 4
            icon: mdi:thermometer
          - type: divider
          - entity: sensor.bms_1_heating
            name: Internal Heater Status
            icon: mdi:fire

      - type: glance
        title: Individual Cell Voltages (16S)
        columns: 4
        entities:
          - entity: sensor.bms_1_cell_1_volt
            name: Cell 1
            icon: mdi:sine-wave
          - entity: sensor.bms_1_cell_2_volt
            name: Cell 2
            icon: mdi:sine-wave
          - entity: sensor.bms_1_cell_3_volt
            name: Cell 3
            icon: mdi:sine-wave
          - entity: sensor.bms_1_cell_4_volt
            name: Cell 4
            icon: mdi:sine-wave
          - entity: sensor.bms_1_cell_5_volt
            name: Cell 5
            icon: mdi:sine-wave
          - entity: sensor.bms_1_cell_6_volt
            name: Cell 6
            icon: mdi:sine-wave
          - entity: sensor.bms_1_cell_7_volt
            name: Cell 7
            icon: mdi:sine-wave
          - entity: sensor.bms_1_cell_8_volt
            name: Cell 8
            icon: mdi:sine-wave
          - entity: sensor.bms_1_cell_9_volt
            name: Cell 9
            icon: mdi:sine-wave
          - entity: sensor.bms_1_cell_10_volt
            name: Cell 10
            icon: mdi:sine-wave
          - entity: sensor.bms_1_cell_11_volt
            name: Cell 11
            icon: mdi:sine-wave
          - entity: sensor.bms_1_cell_12_volt
            name: Cell 12
            icon: mdi:sine-wave
          - entity: sensor.bms_1_cell_13_volt
            name: Cell 13
            icon: mdi:sine-wave
          - entity: sensor.bms_1_cell_14_volt
            name: Cell 14
            icon: mdi:sine-wave
          - entity: sensor.bms_1_cell_15_volt
            name: Cell 15
            icon: mdi:sine-wave
          - entity: sensor.bms_1_cell_16_volt
            name: Cell 16
            icon: mdi:sine-wave

      - type: entities
        title: Diagnostics & Hardware
        show_header_toggle: false
        entities:
          - entity: sensor.bms_1_hardware_version
            name: Hardware Version
            icon: mdi:chip
          - entity: sensor.bms_1_software_version
            name: Software Version
            icon: mdi:cellphone-cog
          - entity: sensor.bms_1_total_runtime_formatted
            name: Total Uptime
            icon: mdi:clock-outline
          - type: divider
          - entity: sensor.bms_1_visual_status
            name: Visual Status
            icon: mdi:check-circle-outline
          - entity: sensor.bms_1_alarm_status
            name: Active Alarms / Errors
            icon: mdi:alert-circle

  # ============================================================================
  # COLUMN 2: EG4 280AH
  # ============================================================================
  - type: vertical-stack
    cards:
      - type: grid
        title: EG4 280AH - Power & State
        columns: 2
        square: false
        cards:
          - type: gauge
            entity: sensor.eg4_state_of_charge
            name: State of Charge (SOC)
            needle: true
            severity:
              green: 60
              yellow: 20
              red: 0
          - type: entities
            entities:
              - entity: sensor.eg4_status
                name: Operational Status
                icon: mdi:information-outline
              - entity: sensor.eg4_battery_power
                name: Battery Power
                icon: mdi:flash
              - entity: sensor.eg4_battery_voltage
                name: Total Voltage
                icon: mdi:sine-wave
              - entity: sensor.eg4_current_enhanced
                name: Total Amperage
              - entity: sensor.eg4_24h_peak_charge
                name: 24h Peak Charge
                icon: mdi:speedometer
              - entity: sensor.eg4_24h_peak_discharge
                name: 24h Peak Discharge
                icon: mdi:speedometer

      - type: history-graph
        title: Charge / Discharge History (24h)
        hours_to_show: 24
        entities:
          - entity: sensor.eg4_battery_power
            name: Battery Power (W)

      - type: entities
        title: Battery Metrics & Health
        show_header_toggle: false
        entities:
          - entity: sensor.eg4_state_of_health
            name: State of Health
            icon: mdi:heart-pulse
          - entity: sensor.eg4_cycle_count
            name: Completed Cycles
            icon: mdi:battery-sync
          - entity: sensor.eg4_remaining_capacity
            name: Remaining Capacity (Native)
            icon: mdi:battery-charging-60
          - entity: sensor.eg4_total_capacity_calculated
            name: Full Design Capacity
            icon: mdi:shield-check
          - type: divider
          - entity: sensor.eg4_battery_average_cell_voltage
            name: Average Cell Voltage
            icon: mdi:chart-bell-curve-cumulative
          - entity: sensor.eg4_battery_cell_delta
            name: Cell Voltage Delta
            icon: mdi:vector-difference
          - entity: sensor.eg4_battery_max_cell_voltage
            name: Highest Cell Voltage
            icon: mdi:arrow-up-bold-circle-outline
          - entity: sensor.eg4_battery_min_cell_voltage
            name: Lowest Cell Voltage
            icon: mdi:arrow-down-bold-circle-outline

      - type: entities
        title: Thermal Management
        show_header_toggle: false
        entities:
          - entity: sensor.eg4_pcb_temp
            name: BMS Board (PCB) Temp
            icon: mdi:developer-board
          - entity: sensor.eg4_max_cell_temp
            name: Maximum Cell Temp
            icon: mdi:thermometer-high
          - entity: sensor.eg4_average_cell_temp
            name: Average Cell Temp
            icon: mdi:thermometer
          - type: divider
          - entity: sensor.eg4_battery_temp_1
            name: Battery Temp Sensor 1
          - entity: sensor.eg4_battery_temp_2
            name: Battery Temp Sensor 2
          - entity: sensor.eg4_battery_temp_3
            name: Battery Temp Sensor 3
          - entity: sensor.eg4_battery_temp_4
            name: Battery Temp Sensor 4
          - type: divider
          - entity: sensor.eg4_heating_status
            name: Internal Heater Status
            icon: mdi:fire

      - type: glance
        title: Individual Cell Voltages (16S)
        columns: 4
        entities:
          - entity: sensor.eg4_battery_cell_1_voltage
            name: Cell 1
            icon: mdi:sine-wave
          - entity: sensor.eg4_battery_cell_2_voltage
            name: Cell 2
            icon: mdi:sine-wave
          - entity: sensor.eg4_battery_cell_3_voltage
            name: Cell 3
            icon: mdi:sine-wave
          - entity: sensor.eg4_battery_cell_4_voltage
            name: Cell 4
            icon: mdi:sine-wave
          - entity: sensor.eg4_battery_cell_5_voltage
            name: Cell 5
            icon: mdi:sine-wave
          - entity: sensor.eg4_battery_cell_6_voltage
            name: Cell 6
            icon: mdi:sine-wave
          - entity: sensor.eg4_battery_cell_7_voltage
            name: Cell 7
            icon: mdi:sine-wave
          - entity: sensor.eg4_battery_cell_8_voltage
            name: Cell 8
            icon: mdi:sine-wave
          - entity: sensor.eg4_battery_cell_9_voltage
            name: Cell 9
            icon: mdi:sine-wave
          - entity: sensor.eg4_battery_cell_10_voltage
            name: Cell 10
            icon: mdi:sine-wave
          - entity: sensor.eg4_battery_cell_11_voltage
            name: Cell 11
            icon: mdi:sine-wave
          - entity: sensor.eg4_battery_cell_12_voltage
            name: Cell 12
            icon: mdi:sine-wave
          - entity: sensor.eg4_battery_cell_13_voltage
            name: Cell 13
            icon: mdi:sine-wave
          - entity: sensor.eg4_battery_cell_14_voltage
            name: Cell 14
            icon: mdi:sine-wave
          - entity: sensor.eg4_battery_cell_15_voltage
            name: Cell 15
            icon: mdi:sine-wave
          - entity: sensor.eg4_battery_cell_16_voltage
            name: Cell 16
            icon: mdi:sine-wave

      - type: entities
        title: Diagnostics & Hardware
        show_header_toggle: false
        entities:
          - entity: sensor.eg4_model
            name: Model
            icon: mdi:car-battery
          - entity: sensor.eg4_firmware
            name: Firmware Version
            icon: mdi:chip
          - entity: sensor.eg4_serial_number
            name: Factory Date / Serial
            icon: mdi:barcode
          - type: divider
          - entity: sensor.eg4_warnings
            name: Active Warnings
            icon: mdi:alert-outline
          - entity: sensor.eg4_protections
            name: Active Protections
            icon: mdi:shield-alert-outline
          - entity: sensor.eg4_errors
            name: Active Errors
            icon: mdi:alert-circle



=============================

I noticed that the JKBMS integration from Home Assistant that I linked earlier is natively in french, and some (several) of the sensors are also native in french.

I ended up using the .yaml linked above to parse out a clean english translation as well as force Fahrenheit vs Celsius for temps.

I hope this is helpful for anyone else going forward, as it it's working as intended now that I'm forcing a polling every 30 seconds regardless of status or state since some of these never (or rarely) change.

1781051210611.png
 
Last edited:
That would be nice, but that's the Secret Battery One protocol, which apparently starts with modbus registers 5000 and up.
I notice you have no temps for 5 and 6 (I don't ether), but you have Firmware (I only have firmware in batteries 6 and 8...others are unknown) as well as serial numbers (looks like build date maybe) and Model (this is correct where it is not unknown)

If anyone is interested, IF the inverters get the information from the batteries, it is probably possible to sniff it with an RJ45 splitter and just decode. That would keep closed-loop to the inverter, and we'd get every peice of battery information the inverter gets. That's on my project list, but I won't have time until after summer.

I am using that setup to sniff everything going between Solar Assistant and the batteries, just a dumb $1 RJ45 splitter on the cable SA uses to talk to the inverters; works great. Everything SA requests, I get on a read-only ESP12e ESPHome. Works the same as the battery reader, just listens to the registers SA pulls from the inverters. The biggest limitation with this setup is SA actually only requests 30 registers from the inverter, not everything; so I get only what it asks for. And its just a hack right now until SA exposes the rest of its inverter data, which they claim the new beta version might do.
 
sungold december paid
Back
Top