electricity pricing: update prices after config change#3376
Open
LKuemmel wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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.namecomparison to comparing the fullconfigobject. - Changed grid fee module “config changed” detection from
config.namecomparison to comparing the fullconfigobject.
Comments suppressed due to low confidence (1)
packages/control/optional.py:61
- Same issue as above:
self._grid_fee_module.config != value.configwill 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) |
Contributor
Author
There was a problem hiding this comment.
Umstellung auf dataclasses für die config-Klassen und dann compare=False-Attribut benutzen.
Contributor
There was a problem hiding this comment.
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_inandcreated_atare typed asOptional[str], but the implementation treats them as numeric seconds/timestamps (e.g.created_at + expires_ininvoltego/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket #66004415
Preise wurden nur beim Wechsel des Anbieters, aber nicht beim Ändern von Einstellungen aktualisiert.