percentage: reset fault state if no component is configured#3670
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent “stale” fault/error states from influencing percentage (“Strom-Mix”) calculation and battery aggregate values when no underlying components are actually configured.
Changes:
- Updated
analyse_percentage()to only treatbat/cp/pvfault_state == 2as relevant when component entries exist beyond"all". - Updated
BatAll.calc_power_for_all_components()to clear aggregateget/*values when no battery modules are configured.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/helpermodules/measurement_logging/process_log.py | Adjusts fault-state gating for Strom-Mix calculation to avoid treating empty component groups as faulted. |
| packages/control/bat_all.py | Clears aggregate battery values when unconfigured to avoid stale state. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+421
to
425
| # Wenn neben dem "all" Eintrag kein weiterer Eintrag existiert, dann gibt es keine Komponenten. | ||
| if ((safe_get_nested(entry, "bat", "all", "fault_state") == 2 and len(entry.get("bat", {})) > 2) or | ||
| (safe_get_nested(entry, "cp", "all", "fault_state") == 2 and len(entry.get("cp", {})) > 2) or | ||
| (safe_get_nested(entry, "pv", "all", "fault_state") == 2 and len(entry.get("pv", {})) > 2) or | ||
| grid_counter.get("fault_state", None) == 2): |
Comment on lines
+428
to
+432
| if safe_get_nested(entry, "bat", "all", "fault_state") == 2 and len(entry.get("bat", {})) > 2: | ||
| message += EOOR_STATE_MSG.format("mind. einer der Speicher") | ||
| if safe_get_nested(entry, "cp", "all", "fault_state") == 2: | ||
| if safe_get_nested(entry, "cp", "all", "fault_state") == 2 and len(entry.get("cp", {})) > 2: | ||
| message += EOOR_STATE_MSG.format("mind. einer der Ladepunkte") | ||
| if safe_get_nested(entry, "pv", "all", "fault_state") == 2: | ||
| if safe_get_nested(entry, "pv", "all", "fault_state") == 2 and len(entry.get("pv", {})) > 2: |
Comment on lines
175
to
+182
| else: | ||
| self.data.config.configured = False | ||
| # prevent stale values when no inverter modules are configured | ||
| self.data.get.power = 0 | ||
| self.data.get.exported = 0 | ||
| self.data.get.fault_state = 0 | ||
| self.data.get.fault_str = NO_ERROR | ||
| self.data.get.daily_exported = 0 |
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.
No description provided.