-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Growatt solar, prevent invalid readouts during boot cycle #6724
base: dev
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #6724 +/- ##
==========================================
+ Coverage 53.70% 54.18% +0.47%
==========================================
Files 50 50
Lines 9408 9587 +179
Branches 1654 1689 +35
==========================================
+ Hits 5053 5195 +142
- Misses 4056 4067 +11
- Partials 299 325 +26 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a user configurable config of duration that defaults to 0s
(to no break existing configs).
This user provided time should then just be checked inside update
and just do a return
if its less than the time, preventing it from ever sending any data requests.
Thanks for your review.
Good point, I will change this soon This morning it worked fine on my unit, the invalid spike in readout was gone so the idea does the trick on the initial issue 👍 |
08ae0fa
to
984a3d0
Compare
Hey there @leeuwte, mind taking a look at this pull request as it has been labeled with an integration ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks better =)
Just a few minor things below
@@ -108,6 +109,7 @@ | |||
cv.Optional(CONF_PROTOCOL_VERSION, default="RTU"): cv.enum( | |||
PROTOCOL_VERSIONS, upper=True | |||
), | |||
cv.Optional(CONF_WARM_UP_TIME, default=0): cv.uint8_t, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cv.Optional(CONF_WARM_UP_TIME, default=0): cv.uint8_t, | |
cv.Optional(CONF_WARM_UP_TIME, default="0s"): cv.All(cv.positive_time_period_seconds, cv.uint8_t), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for asking, but setting a string as default for an int would cause an issue right? Or does the Optional
function convert/cast that? The int()
cast on line 169 will error on "0s"
but can handle "0"
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Co-authored-by: Jesse Hills <[email protected]>
What does this implement/fix?
Early morning when first light hits the solar panels the inverter boots up and powers the USB port on which the ESPhome device is powered.
The first readouts can be invalid, giving either invalid values or values from the previous day, which is annoying when counting energy production per day. (this ruins home assistant energy dashboard graphs).
This PR gives the inverter a bit time (30s) to complete it's boot cycle before ESPHome will pay attention to the data values it will be sending.
I wrote this fix in the evening, but I can't this in the evening. Compilation works and tomorrow when the sun shines again I will flash this branch and let it run for a couple of days to see if the spikes are gone.
Types of changes
Related issue or feature (if applicable): fixes esphome/issues/issues/3965
Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs/pull/3832
Test Environment
Example entry for
config.yaml
:Example will do the trick, https://esphome.io/components/sensor/growatt_solar.html
Checklist:
tests/
folder).If user exposed functionality or configuration variables are added/changed: