Skip to content

octopus energy: fix timezone handling - #3268

Merged
benderl merged 2 commits into
openWB:masterfrom
LKuemmel:fix_tariff
Apr 7, 2026
Merged

benderl merged 2 commits into
openWB:masterfrom
LKuemmel:fix_tariff

Conversation

@LKuemmel

@LKuemmel LKuemmel commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Ticket #66002546

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

This PR fixes timezone handling for Octopus Energy (Germany) flexible tariff price calculation by explicitly converting between UTC and Europe/Berlin, and adds regression tests to validate correct behavior across DST (summer/winter time).

Changes:

  • Introduce explicit Europe/Berlin timezone conversion when matching time-of-use slots and generating hourly epoch keys.
  • Correct time-of-use slot selection logic for midnight wrap-around.
  • Add pytest coverage for expected price timestamps/values in both summer and winter time scenarios.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/modules/electricity_pricing/flexible_tariffs/octopusenergy/tariff.py Uses an explicit German timezone for slot matching and timestamps; improves midnight wrap handling.
packages/modules/electricity_pricing/flexible_tariffs/octopusenergy/tariff_test.py Adds DST-focused tests by freezing datetime.now() and asserting the produced hourly price map.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@benderl benderl added the bug Something isn't working label Apr 7, 2026
@benderl
benderl merged commit 514e8c5 into openWB:master Apr 7, 2026
1 check passed
@LKuemmel
LKuemmel deleted the fix_tariff branch September 14, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants