Skip to content

fix(car-charging): show car charging limit as % (with kWh) in debug logs, not mislabelled kWh-as-% - #4420

Merged
springfall2008 merged 2 commits into
mainfrom
fix/car-charging-limit-log-units
Aug 3, 2026
Merged

fix(car-charging): show car charging limit as % (with kWh) in debug logs, not mislabelled kWh-as-%#4420
springfall2008 merged 2 commits into
mainfrom
fix/car-charging-limit-log-units

Conversation

@chalfontchubby

Copy link
Copy Markdown
Collaborator

Summary

Related to #4416

Test plan

  • ./run_all --quick passes
  • run_pre_commit clean
  • No behavioural change - log-only fix, three call sites in fetch.py all updated for consistency

…d 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Predbat’s car-charging debug logs to avoid mislabelling internally kWh-based car_charging_limit values as percentages, by recomputing and displaying the percentage alongside the kWh value (e.g., 80% (61.6kWh)). This aligns debug output with how users configure targets (percent) while preserving the internal kWh arithmetic visibility for troubleshooting (as discussed in #4416).

Changes:

  • Recompute charge-limit percent from the internal kWh limit + battery size for logging.
  • Update three debug log lines to display limit {percent}% ({kWh}kWh) instead of a misleading % suffix on kWh values.
  • Keep log output consistent across car-planning and car-status debug messages.

Comment thread apps/predbat/fetch.py
Comment on lines 1126 to 1128
self.log(
"Car {} plan charging from {} to {}, with slots {} from SoC {}% to {}%, ready by {}".format(
"Car {} plan charging from {} to {}, with slots {} from SoC {}kWh to {}% ({}kWh), ready by {}".format(
car_n,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed - collapsed to a single SoC → limit expression with explicit units (kWh, plus recomputed %), slot list and ready-by time kept as-is. Pushed in d7e3d9c.

…plan log

Per Copilot review on #4420: the log repeated SoC/limit twice - once with
no units (ambiguous, could read as times or percentages) and once with
units. Collapsed to a single SoC -> limit expression with explicit units.
@springfall2008
springfall2008 merged commit d750937 into main Aug 3, 2026
2 checks passed
@springfall2008
springfall2008 deleted the fix/car-charging-limit-log-units branch August 3, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants