Do not convert the target temperature to integer #81
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.
In places where Fahrenheit is the default temperature scale (like
US), home assistant UI shows the climate cards in Fahrenheit scale
and converts the temperature to Celcius implicitly for integrations
that use Celcius.
So the set_temperature() calls in this case will get a floating
point temperature value for celcius and converting that to an integer
before converting that to Kelvin makes setting certain temperature
values in Fahrenheit impossible because of the rounding errors.
Consider the following case:
User sets 74F -> Home assistant converts it to 23.3C -> Converting
that to integer becomes 23C which is equivalent to 73F. So setting
74F is impossible because of this rounding.
Not converting the value to integer and converting directly to a
floating point Kelvin temperature solves this issue and users would
be able to set any Fahrenheit temperatures they want. Note that the
underlying libdyson library supports setting any floating point
temperature in Kelvin and the rounding to integer was not really
necessary in the first place.