Skip to content

electricity pricing: update prices after config change#3376

Open
LKuemmel wants to merge 2 commits into
openWB:masterfrom
LKuemmel:fix_electricity_pricing_update
Open

electricity pricing: update prices after config change#3376
LKuemmel wants to merge 2 commits into
openWB:masterfrom
LKuemmel:fix_electricity_pricing_update

Conversation

@LKuemmel
Copy link
Copy Markdown
Contributor

@LKuemmel LKuemmel commented May 20, 2026

Ticket #66004415
Preise wurden nur beim Wechsel des Anbieters, aber nicht beim Ändern von Einstellungen aktualisiert.

@LKuemmel LKuemmel requested a review from Copilot May 20, 2026 09:18
@LKuemmel LKuemmel added this to the 2.2.0-Patch.1 milestone May 20, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the electricity pricing module reset logic so price data is cleared and re-fetched when the flexible tariff or grid fee provider configuration changes, rather than only when the provider name changes.

Changes:

  • Changed flexible tariff module “config changed” detection from config.name comparison to comparing the full config object.
  • Changed grid fee module “config changed” detection from config.name comparison to comparing the full config object.
Comments suppressed due to low confidence (1)

packages/control/optional.py:61

  • Same issue as above: self._grid_fee_module.config != value.config will almost always be true for configs that don’t define __eq__, causing unnecessary resets/price clearing whenever the provider config topic is reprocessed. Use a stable config fingerprint or explicit field comparison (excluding volatile runtime fields) to decide when a reset is actually needed.
    def grid_fee_module(self, value: TypingOptional[ConfigurableGridFee]):
        if (value is None or
                (self._grid_fee_module and value and
                 self._grid_fee_module.config != value.config)):
            self.data.electricity_pricing.grid_fee.get = PricingGet()
            self._reset_state(self.data.electricity_pricing.grid_fee)

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

Comment on lines 43 to 47
if (value is None or
(self._flexible_tariff_module and value and
self._flexible_tariff_module.config.name != value.config.name)):
self._flexible_tariff_module.config != value.config)):
self.data.electricity_pricing.flexible_tariff.get = PricingGet()
self._reset_state(self.data.electricity_pricing.flexible_tariff)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Umstellung auf dataclasses für die config-Klassen und dann compare=False-Attribut benutzen.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

Comments suppressed due to low confidence (1)

packages/modules/electricity_pricing/flexible_tariffs/voltego/config.py:9

  • expires_in and created_at are typed as Optional[str], but the implementation treats them as numeric seconds/timestamps (e.g. created_at + expires_in in voltego/tariff.py). Please change these annotations to numeric types (e.g. Optional[int]/Optional[float]) to match actual usage and avoid accidental string values breaking token validation.
class VoltegoToken:
    access_token: Optional[str] = field(default=None, compare=False, repr=False)  # don't show in UI
    expires_in: Optional[str] = field(default=None, compare=False)  # don't show in UI
    created_at: Optional[str] = field(default=None, compare=False)  # don't show in UI

Comment on lines +5 to 10
@dataclass
class VoltegoToken:
access_token: Optional[str] = field(default=None, compare=False, repr=False) # don't show in UI
expires_in: Optional[str] = field(default=None, compare=False) # don't show in UI
created_at: Optional[str] = field(default=None, compare=False) # don't show in UI

Comment on lines +5 to +11
@dataclass
class WestfalenWindToken:
access_token: Optional[str] = field(default=None, compare=False, repr=False) # don't show in UI
refresh_token: Optional[str] = field(default=None, compare=False, repr=False) # don't show in UI
token_type: Optional[str] = field(default=None, compare=False) # don't show in UI
expires: Optional[int] = field(default=None, compare=False) # don't show in UI
created_at: Optional[float] = field(default=None, compare=False) # don't show in UI
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.

2 participants