-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Catch invalid temperature for offline inverters using TCP #336
Conversation
Codecov ReportBase: 100.00% // Head: 100.00% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## main #336 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 6
Lines 325 327 +2
Branches 55 55
=========================================
+ Hits 325 327 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
omnikinverter/tcp.py
Outdated
@@ -255,10 +255,15 @@ def int_to_bool(num: int) -> bool: | |||
1: True, | |||
}[num] | |||
|
|||
# Set temperature to None if it matches 65326, this is returned | |||
# when the inverter is "offline". | |||
def temperature_to_int(temp: int) -> Optional[float]: |
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.
To float?
What does it do?
For some reason an inverter that is offline returns "65326" as a temperature. This PR makes sure that value is checked and
None
is returned instead of 6532.6 degrees 🔥Potentially breaking because
None
is returned instead of a float. Please decide @klaasnicolaas.