This repository was archived by the owner on Oct 7, 2021. It is now read-only.
climate: Add halves when divider is at least 2#54
Open
3v1n0 wants to merge 1 commit intoPaulAnnekov:masterfrom
Open
climate: Add halves when divider is at least 2#543v1n0 wants to merge 1 commit intoPaulAnnekov:masterfrom
3v1n0 wants to merge 1 commit intoPaulAnnekov:masterfrom
Conversation
3v1n0
added a commit
to 3v1n0/ha-core
that referenced
this pull request
Nov 26, 2020
Devices may use a temperature divider of 2, in such case tuyah won't properly handle its halves values using whole precision. Fix this by checking if the device supports halves, and in such case to return such precision This needs PaulAnnekov/tuyaha#54
21 tasks
3v1n0
added a commit
to 3v1n0/ha-core
that referenced
this pull request
Nov 26, 2020
Devices may use a temperature divider of 2, in such case tuyah won't properly handle its halves values using whole precision. Fix this by checking if the device supports halves, and in such case to return such precision This needs PaulAnnekov/tuyaha#54
3v1n0
added a commit
to 3v1n0/ha-core
that referenced
this pull request
Nov 26, 2020
Devices may use a temperature divider of 2, in such case tuyah won't properly handle its halves values using whole precision. Fix this by checking if the device supports halves, and in such case to return such precision This needs PaulAnnekov/tuyaha#54
Various climate devices use a temperature divider of 2, and they do allow use of halves values, however current tuyaha doesn't allow this. As per this, add an has_halves function that will return true for multiple of 2, while fix target_temperature_step() so that it returns the proper value depending we support decimals or halves
matitalatina
reviewed
Dec 8, 2020
| if not self.has_decimal(): | ||
| temp_val = round(float(temperature)) | ||
| if self.has_halves(): | ||
| temp_val = round(float(temperature) * 20.0) / 20.0 |
There was a problem hiding this comment.
What does the magic number 20 mean?
I don't understand what you're doing here, at the end you'll have some decimal values here. So It's the same as round(number, 1).
For example: temperature=17.7
round(float(17.7) * 20.0) / 20.0 = 17.7
matitalatina
reviewed
Dec 8, 2020
|
|
||
| def has_halves(self): | ||
| """Return if temperature values support halves""" | ||
| return self._divider % 2 == 0 |
There was a problem hiding this comment.
Divider can be overridden by home assistant.
If someone wants to divide by 3, he will not have halves.
What the reason behind using this divider to know that the device support halves?
Contributor
|
I think that this PR should be closed because obsolete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Various climate devices use a temperature divider of 2, and they do
allow use of halves values, however current tuyaha doesn't allow this.
As per this, add an has_halves function that will return true for
multiple of 2, while fix target_temperature_step() so that it returns
the proper value depending we support decimals or halves