Claude/investigate grid import tr3rm - #2
Merged
Merged
Conversation
The Growatt API occasionally returns spurious spikes in the instantaneous pacToUserTotal field (observed values >6000 W while simultaneously exporting). These spikes were being plotted as "Grid Import" and integrated into bogus kWh totals that didn't match the device's own etoUserToday counter. Instead of trusting the instantaneous power fields for the chart, diff the cumulative daily counters (etoUserToday / etoGridToday) between consecutive samples to derive average power over each interval. The chart series now integrates back to the counter total by construction, so the summary card and the chart estimate agree. https://claude.ai/code/session_01MryGckmy51CK79w35d2g54
Pure counter-delta derivation loses resolution for grid flows below the counter's 0.1 kWh tick (e.g. ~1200 W for a 5-min interval). Fall back to the instantaneous pacToUserTotal / pacToGridTotal reading when the counter is flat, but clamp it to the per-interval ceiling implied by the counter quantum: if the counter did not tick, the true average power must have been below that ceiling, so any larger value is a spurious spike. This preserves low-power resolution while still suppressing the 6 kW+ bogus spikes observed from the API. https://claude.ai/code/session_01MryGckmy51CK79w35d2g54
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.