Skip to content

Commit

Permalink
Ensure all battery cell voltages are reported (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdpuk authored Mar 7, 2023
1 parent 209936f commit 205f782
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/givenergy_local/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,4 +590,7 @@ class BatteryCellsVoltageSensor(BatteryBasicSensor):
@property
def extra_state_attributes(self) -> Mapping[str, Any] | None:
"""Expose individual cell voltages."""
return self.data.dict(include={f"v_battery_cell_{i:02d}" for i in range(1, 16)}) # type: ignore[no-any-return]
num_cells = self.data.battery_num_cells
return self.data.dict( # type: ignore[no-any-return]
include={f"v_battery_cell_{i:02d}" for i in range(1, num_cells + 1)}
)

0 comments on commit 205f782

Please sign in to comment.