There was an error while loading. Please reload this page.
2 parents d806387 + 77c4581 commit d202027Copy full SHA for d202027
1 file changed
src/extractors/__init__.py
@@ -43,17 +43,17 @@ def extract_soc_kwh(
43
charge_status: ChrgMgmtDataRespProcessingResult | None,
44
soc: float | None,
45
) -> float | None:
46
- if (
47
- charge_status is not None
48
- and (raw_soc_kwh := charge_status.soc_kwh) is not None
49
- and (soc_kwh := __validate_and_convert_soc_kwh(raw_soc_kwh)) is not None
50
- ):
+ 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)
51
+ ) is not None:
52
LOG.debug("SoC kWh derived from realtimePower")
53
return soc_kwh
54
55
if (
56
soc is not None
- and charge_status is not None
57
and (
58
capacity := __validate_and_convert_soc_kwh(
59
charge_status.real_total_battery_capacity
0 commit comments