fix: preserve location-based PV installation saves and merged config - #277
Open
ohAnd wants to merge 1 commit into
Conversation
- run dependency checks after merged config rebuild so pv_forecast.0.* entries are visible - convert wizard PV template keys into indexed payload keys for location-based sources - synthesize fallback pv_forecast from unindexed template keys in the merger - add regression tests for API save flow, merged config rebuilding, and PV startup validation
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.
This pull request introduces improved support and validation for PV forecast configuration, especially for location-based sources and legacy/unindexed template keys. The main changes ensure that PV installation entries are correctly synthesized from both indexed and unindexed keys, configuration dependencies are validated after merging, and the web wizard transforms payloads as needed. Comprehensive tests are added to cover these scenarios.
PV Forecast Configuration Handling:
_build_pv_forecastfunction inmerger.pynow synthesizes a PV installation entry if unindexed template keys (likepv_forecast.name) are found, ensuring backward compatibility with legacy configs. Indexed keys take precedence if both exist. [1] [2]wizard.js) transforms unindexedpv_forecast.*fields into indexed form (pv_forecast.0.*) for location-based sources, ensuring consistency in payloads sent to the backend.Configuration Validation Improvements:
api.py, cross-field dependency checks are now performed after merging the new config. This ensures that dependencies are validated against the fully updated configuration, including any changes to arrays likepv_forecast. [1] [2]Testing Enhancements:
Other Minor Improvements:
reimport tomerger.pyfor regular expression matching.pv_forecastas an empty list for consistency.