I am using a BYD HVS setup with 5 modules (160 cells). I noticed that the balancing_status sensor only provides a 32-character hex string (128 bits), leaving the 5th module without balancing data.
Technical Detail:
To support 160 cells, the hex string needs to be 40 characters long. I've tested a fix by modifying the string assembly logic using the += operator to ensure the full payload is captured.
With this change, the sensor correctly returns all 160 bits, and I can confirm that balancing icons/states for cells 129–160 are now correctly displayed in Home Assistant.
Suggested Change:
Update the data parsing logic to allow for a 40-character hex string when 5 modules are present.
init.py
def _parse_packet12(self, data: bytes, tower_number: int = 0) -> None:
"""Parse packet 12 for systems with more than 128 cells."""
tower = self.tower_attributes[tower_number]
balancing_data = int.from_bytes(data[17:33], 'big')
tower['balancing_count'] = bin(balancing_data).count('1')
tower['cell_voltages'].extend([
self._buf2int16_si(data, 101 + i * 2) for i in range(16)
])
changed to:
def _parse_packet12(self, data: bytes, tower_number: int = 0) -> None:
"""Parse packet 12 for systems with more than 128 cells."""
tower = self.tower_attributes[tower_number]
extra_bits_hex = data[17:21].hex()
tower['balancing_status'] += extra_bits_hex
tower['balancing_count'] += bin(int(extra_bits_hex, 16)).count('1')
tower['cell_voltages'].extend([
self._buf2int16_si(data, 101 + i * 2) for i in range(16)
])
I am using a BYD HVS setup with 5 modules (160 cells). I noticed that the balancing_status sensor only provides a 32-character hex string (128 bits), leaving the 5th module without balancing data.
Technical Detail:
To support 160 cells, the hex string needs to be 40 characters long. I've tested a fix by modifying the string assembly logic using the += operator to ensure the full payload is captured.
With this change, the sensor correctly returns all 160 bits, and I can confirm that balancing icons/states for cells 129–160 are now correctly displayed in Home Assistant.
Suggested Change:
Update the data parsing logic to allow for a 40-character hex string when 5 modules are present.
init.py
changed to: