Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/extractors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ def extract_soc_kwh(
charge_status: ChrgMgmtDataRespProcessingResult | None,
soc: float | None,
) -> float | None:
if (
charge_status is not None
and (raw_soc_kwh := charge_status.soc_kwh) is not None
and (soc_kwh := __validate_and_convert_soc_kwh(raw_soc_kwh)) is not None
):
if charge_status is None:
return None

if (raw_soc_kwh := charge_status.soc_kwh) is not None and (
soc_kwh := __validate_and_convert_soc_kwh(raw_soc_kwh)
) is not None:
LOG.debug("SoC kWh derived from realtimePower")
return soc_kwh

if (
soc is not None
and charge_status is not None
and (
capacity := __validate_and_convert_soc_kwh(
charge_status.real_total_battery_capacity
Expand Down