Skip to content
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

Merged
merged 3 commits into from Feb 13, 2023

Conversation

robbinjanssen
Copy link
Collaborator

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.

@robbinjanssen robbinjanssen added the enhancement Enhancement of the code, not introducing new features. label Feb 7, 2023
@codecov
Copy link

codecov bot commented Feb 7, 2023

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (5dfeb18) compared to base (02e091d).
Patch coverage: 100.00% of modified lines in pull request are covered.

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     
Impacted Files Coverage Δ
omnikinverter/tcp.py 100.00% <100.00%> (ø)

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

omnikinverter/tcp.py Outdated Show resolved Hide resolved
@@ -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]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To float?

@robbinjanssen robbinjanssen merged commit 1e74109 into main Feb 13, 2023
@robbinjanssen robbinjanssen deleted the rja/fix-temperature branch February 13, 2023 07:48
@github-actions github-actions bot locked and limited conversation to collaborators Feb 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Enhancement of the code, not introducing new features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants