Forecast: make solar adjustment a server-side setting#31862
Merged
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The
changeAdjustedhandler now only posts to the API and logs errors, but does not revert the checkbox state on failure, which can leave the UI out of sync with the actual server-side setting; consider either optimistic updating with rollback on error or re-readingsolarAdjustedfrom the store after the request. - The new
solarAdjustedflag is used inEnergyflow.vuevia a prop, but it’s only added as a prop toSite.vuehere; double-check that all parent components wiringEnergyflowpass the correctsolarAdjustedvalue from the store so the forecast scaling behavior stays consistent across views.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `changeAdjusted` handler now only posts to the API and logs errors, but does not revert the checkbox state on failure, which can leave the UI out of sync with the actual server-side setting; consider either optimistic updating with rollback on error or re-reading `solarAdjusted` from the store after the request.
- The new `solarAdjusted` flag is used in `Energyflow.vue` via a prop, but it’s only added as a prop to `Site.vue` here; double-check that all parent components wiring `Energyflow` pass the correct `solarAdjusted` value from the store so the forecast scaling behavior stays consistent across views.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Member
|
😆 I have a mostly identical unpublished PR locally. |
naltatis
approved these changes
Jul 17, 2026
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 #31832
Promotes the solar forecast adjustment from a browser-local UI preference to a server-side setting, per @naltatis' suggestion in the issue.
The "adjust to real production data" switch was stored only in
localStorage(settings_solar_adjusted), so it silently reset whenever a browser dropped site storage, and it was per-client rather than per-installation. Meanwhile the optimizer applied the scale factor unconditionally, so the switch never matched what the optimizer actually did.solarAdjustedsite setting, persisted in the settings table and published to the UIPOST /api/solaradjusted/{enable}plus asolarAdjustedMQTT settereffectiveSolarScale)localStorageforecast.solar.scaleis still published unconditionally and is now always present, carrying1when unscaled. This keeps the percentage label on the toggle meaningful while the setting is off.Default is off, matching the previous UI default. Note this changes optimizer behaviour: it no longer scales the solar forecast unless the setting is enabled.
Per-forecast granularity (as raised in the issue) is not included, since the scale value is calculated on totals.
🤖 Generated with Claude Code