fix(ac): allow half-degree integer temperatures #412
Merged
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.
This is deduplicating the temperature functions, and then finally dropping the int(...) cast on the "integer" temperature value. This is used on e.g. the Midea PortaSplit, which reports half-degree values via this field (decimal value = 0).
I'd think if a device reports a decimal value as int + decimal, then it won't report half-degree steps for the integer, and the casting of the integer would be redundant. To be on the safe side though, and avoid potential regressions, I've implemented it to only return the integer as float, if the decimal really is 0. So even if the integer is reported with half-degree steps and a seperate decimal simultaneously, it'd be fine, since in that case the integer should be a whole number anyway.
PS: Let me know if and what you'd want as "proof", e.g. HA or Midea-App screenshots, debug logs (before or after fix), etc., and I'll provide it (just don't want to waste time on unnecessary stuff)