From 0978654e420d24e1da5273f554df0569162b0e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 26 Nov 2020 17:05:27 +0100 Subject: [PATCH] tuya/climate: Add support for halves precision if the sensor supports it 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 https://github.com/PaulAnnekov/tuyaha/pull/54 --- homeassistant/components/tuya/climate.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/homeassistant/components/tuya/climate.py b/homeassistant/components/tuya/climate.py index 6da15b0d29eba0..19dd4feeadee00 100644 --- a/homeassistant/components/tuya/climate.py +++ b/homeassistant/components/tuya/climate.py @@ -23,6 +23,7 @@ ATTR_TEMPERATURE, CONF_PLATFORM, CONF_UNIT_OF_MEASUREMENT, + PRECISION_HALVES, PRECISION_TENTHS, PRECISION_WHOLE, TEMP_CELSIUS, @@ -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