Skip to content

Commit 72d8cd0

Browse files
fix(car-charging): car charging limit logs showed a kWh value labelled as %
car_charging_limit and car_charging_soc are converted from the user's configured percent into kWh internally, but three debug log lines still labelled the (by-then kWh) limit value with a "%" suffix - a cosmetic mislabel, not a functional bug (spotted while investigating #4416). Now logs the limit as both a percent (recomputed from the kWh value and battery size, matching how users actually think about a charge target) and the underlying kWh figure, e.g. "limit 80% (61.6kWh)". Related to #4416
1 parent f2d87f5 commit 72d8cd0

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

apps/predbat/fetch.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,13 +1122,15 @@ def fetch_sensor_data_car_planning(self):
11221122
else:
11231123
self.log("Car {} on Octopus Intelligent, no active plan".format(car_n))
11241124
elif self.car_charging_planned[car_n] or self.car_charging_now[car_n]:
1125+
limit_percent = dp1(self.car_charging_limit[car_n] / self.car_charging_battery_size[car_n] * 100) if self.car_charging_battery_size[car_n] else 0
11251126
self.log(
1126-
"Car {} plan charging from {} to {}, with slots {} from SoC {}% to {}%, ready by {}".format(
1127+
"Car {} plan charging from {} to {}, with slots {} from SoC {}kWh to {}% ({}kWh), ready by {}".format(
11271128
car_n,
11281129
self.car_charging_soc[car_n],
11291130
self.car_charging_limit[car_n],
11301131
self.low_rates,
11311132
self.car_charging_soc[car_n],
1133+
limit_percent,
11321134
self.car_charging_limit[car_n],
11331135
self.car_charging_plan_time[car_n],
11341136
)
@@ -1286,7 +1288,8 @@ def fetch_sensor_data_cars(self):
12861288

12871289
# Log final car SoC (initialised before the IOG loop, updated per-car after Octopus battery_size is read)
12881290
if self.num_cars:
1289-
self.log("Cars: SoC: {}kWh, Charge limit {}%, plan time {}, battery size {}kWh".format(self.car_charging_soc, self.car_charging_limit, self.car_charging_plan_time, self.car_charging_battery_size))
1291+
car_charging_limit_percent = [dp1(limit / size * 100) if size else 0 for limit, size in zip(self.car_charging_limit, self.car_charging_battery_size)]
1292+
self.log("Cars: SoC: {}kWh, Charge limit {}% ({}kWh), plan time {}, battery size {}kWh".format(self.car_charging_soc, car_charging_limit_percent, self.car_charging_limit, self.car_charging_plan_time, self.car_charging_battery_size))
12901293

12911294
def fetch_pv_forecast(self):
12921295
"""
@@ -1979,8 +1982,9 @@ def get_car_charging_planned(self):
19791982
self.car_charging_exclusive[car_n] = self.get_arg("car_charging_exclusive", False, index=car_n)
19801983

19811984
if self.num_cars > 0:
1985+
car_charging_limit_percent = [dp1(limit / size * 100) if size else 0 for limit, size in zip(self.car_charging_limit, self.car_charging_battery_size)]
19821986
self.log(
1983-
"Cars {} charging from battery {} planned {}, charging_now {} smart {}, max_price {}{}, plan_time {}, battery size {}kWh, limit {}%, rate {}kW, exclusive {}".format(
1987+
"Cars {} charging from battery {} planned {}, charging_now {} smart {}, max_price {}{}, plan_time {}, battery size {}kWh, limit {}% ({}kWh), rate {}kW, exclusive {}".format(
19841988
self.num_cars,
19851989
self.car_charging_from_battery,
19861990
self.car_charging_planned,
@@ -1990,6 +1994,7 @@ def get_car_charging_planned(self):
19901994
self.currency_symbols[1],
19911995
self.car_charging_plan_time,
19921996
self.car_charging_battery_size,
1997+
car_charging_limit_percent,
19931998
self.car_charging_limit,
19941999
self.car_charging_rate,
19952000
self.car_charging_exclusive,

0 commit comments

Comments
 (0)