Skip to content

Feature fix charge costs - #4110

Merged
LKuemmel merged 8 commits into
openWB:masterfrom
AlexanderHa98:feature_fix_charge_costs_PR
Oct 20, 2026
Merged

LKuemmel merged 8 commits into
openWB:masterfrom
AlexanderHa98:feature_fix_charge_costs_PR

Conversation

@AlexanderHa98

Copy link
Copy Markdown
Contributor

No description provided.

* fix chargelog energy source calculation

* Add Test
* Improve Log

* Move generate_totals-Logger in logger.py

* Fix

* Fix Circular Import

* Update .gitignore

* fix

* Ensure ramdisk folder exists

* retrigger Copilot

* Add Copilot suggestions

* fix
* fix chargelog energy source calculation

* Add Test

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.

🟡 Changes recommended

Cost snapshots introduce an unnecessary synchronous SmartHome collection wait that delays charging regulation.

1 open issue
What changed in this PR

Improves charging-cost accounting by using live measurements at finalization and including small positive charging amounts.

Changes:

  • Extracts shared measurement-entry construction.
  • Uses live snapshots for final charging intervals.
  • Adds charging-cost and energy-source regression tests.
File Description
packages/​helpermodules/​measurement_logging/​write_log.py Delegates entry construction to the shared builder.
packages/​helpermodules/​measurement_logging/​write_log_test.py Updates imports for extracted functionality.
packages/​helpermodules/​measurement_logging/​process_log_unit_test.py Adds energy-source calculation coverage.
packages/​helpermodules/​measurement_logging/​process_log_entry_builder.py Houses shared snapshot construction and value correction.
packages/​helpermodules/​measurement_logging/​process_log_calculation.py Adjusts spacing and comment placement without changing behavior.
packages/​helpermodules/​data_migration/​data_migration.py Updates the SmartHome collector import.
packages/​control/​chargelog/​chargelog.py Uses live finalization snapshots and counts small charging amounts.
packages/​control/​chargelog/​chargelog_test.py Tests live snapshots and small charging amounts.

Review effort: Balanced

Comment thread packages/control/chargelog/chargelog.py Outdated
entries_day_before = get_daily_log(date_day_before)["entries"]
previous_entry = entries_day_before[-1]

current_entry = create_entry(LegacySmartHomeLogData(), previous_entry)
@LKuemmel
LKuemmel merged commit 67f0d95 into openWB:master Oct 20, 2026
1 check passed
buhito81 added a commit to buhito81/core that referenced this pull request Oct 20, 2026
openWB#4110 hat create_entry nach process_log_entry_builder.py verschoben: die
tariff_name-Zeilen stehen jetzt dort, write_log.py übernimmt die master-Seite.
chargelog_test.py: beide Seiten behalten, dazu ein Test, dass das
angebrochene letzte Intervall den Tarifzeitraum der aktuellen Messung bekommt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LKuemmel pushed a commit that referenced this pull request Oct 22, 2026
* Keep small charged energy amounts (#3905)

* Fix charge cost calc (#4022)

* fix chargelog energy source calculation

* Add Test

* Improve Monthly/Yearly Log (#3829)

* Improve Log

* Move generate_totals-Logger in logger.py

* Fix

* Fix Circular Import

* Update .gitignore

* fix

* Ensure ramdisk folder exists

* retrigger Copilot

* Add Copilot suggestions

* fix

* Fix charge cost calc (#4022)

* fix chargelog energy source calculation

* Add Test

* fix circular error

* Remove duplicate function

* Revert previous change

* Add copilot suggestion
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