Skip to content

Commit

Permalink
tuya/climate: Add support for halves precision if the sensor supports it
Browse files Browse the repository at this point in the history
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
  • Loading branch information
3v1n0 committed Nov 26, 2020
1 parent 39efbcb commit 0978654
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions homeassistant/components/tuya/climate.py
Expand Up @@ -23,6 +23,7 @@
ATTR_TEMPERATURE,
CONF_PLATFORM,
CONF_UNIT_OF_MEASUREMENT,
PRECISION_HALVES,
PRECISION_TENTHS,
PRECISION_WHOLE,
TEMP_CELSIUS,
Expand Down Expand Up @@ -159,6 +160,8 @@ def precision(self):
"""Return the precision of the system."""
if self._tuya.has_decimal():
return PRECISION_TENTHS
if self._tuya.has_halves():
return PRECISION_HALVES
return PRECISION_WHOLE

@property
Expand Down

0 comments on commit 0978654

Please sign in to comment.