Site: drop stale battery grid charge limit without a dynamic tariff#29964
Closed
andig wants to merge 2 commits into
Closed
Site: drop stale battery grid charge limit without a dynamic tariff#29964andig wants to merge 2 commits into
andig wants to merge 2 commits into
Conversation
The battery grid charge price limit is a persisted setting. When a user switches from a dynamic to a static tariff, the limit survives in the database but the UI editor for it is hidden (it requires a dynamic tariff), leaving the user unable to remove a cap that is still shown in the energy flow. A stale limit could also still trigger grid charging against a configured fixed price. On restore, only reapply the persisted limit when the planner tariff is dynamic; otherwise clear the stale value. Fixes #29961 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- When clearing a stale
BatteryGridChargeLimit, consider handling the error returned bysettings.SetStringso that a failure to clear the persisted value doesn’t silently leave an inconsistent state. - Instead of
SetString(keys.BatteryGridChargeLimit, ""), consider using a dedicated delete/clear method (if available) so the storage semantics reflect that the limit is absent rather than an empty string.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- When clearing a stale `BatteryGridChargeLimit`, consider handling the error returned by `settings.SetString` so that a failure to clear the persisted value doesn’t silently leave an inconsistent state.
- Instead of `SetString(keys.BatteryGridChargeLimit, "")`, consider using a dedicated delete/clear method (if available) so the storage semantics reflect that the limit is absent rather than an empty string.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
…tariff Same stale-state issue as the battery grid charge limit: the loadpoint smartCostLimit and smartFeedInPriorityLimit are persisted and restored unconditionally, but their UI editors require a dynamic tariff. After switching away from a dynamic tariff the limits linger with no way to remove them, and a stale smartCostLimit still drives charging. The loadpoint restore runs before it has tariff context, so clear the stale limits from the site once tariff availability is known. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Member
Author
|
@naltatis fixed two more occurrences of this kind- anything else you have in mind? |
Member
|
We already had a solution for this in place. We show a warning dialog with the option to remove the existing limit when we detect that there is an unusable limit. This can either by because the battery is not controllable any more or your tariffs have changed. The battery grid charge path was broken. See fix here: #30013 I'd prefer the manual way (UI) over the auto-cleanup way. Doing this on boot has the potential of deleting limits as an effect of a temporary tariff initialization error or reconfiguration for tariffs by the user (remove > add). |
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.
Fixes #29961
Problem
A user switched from a dynamic electricity tariff to a static one and could no longer remove the battery grid-charge price cap — it stayed visible with no way to clear it.
Root cause
Three settings depend on a dynamic tariff but are persisted and restored unconditionally at boot, while their UI editors are gated on
smartCostAvailable/smartFeedInPriorityAvailable(= a dynamic tariff). After switching to a static tariff the editor — and its remove control — is hidden, leaving a stale limit that the user cannot clear:batteryGridChargeLimit(site)smartCostLimit(loadpoint)smartFeedInPriorityLimit(loadpoint)Beyond the UI, a stale
batteryGridChargeLimit/smartCostLimitcan still actively drive grid/loadpoint charging against a configured fixed price.Fix
In the site's settings restore, once tariff availability is known:
batteryGridChargeLimitwhen the planner tariff is dynamic, otherwise clear the stale value;smartCostLimit/smartFeedInPriorityLimitwhen the respective tariff is not dynamic.The loadpoint restore runs before the loadpoint has any tariff context, so the loadpoint limits are reconciled from the site.
Verification
go build ./core/...,go vet ./core/,go test ./core/,gofmt— all clean.🤖 Generated with Claude Code