Correct current temperature for tuya thermostats (#66715)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Sascha Sander 2022-02-18 15:00:49 +01:00 committed by Paulus Schoutsen
parent 7f9017316b
commit 86aad35e77

View File

@ -353,6 +353,13 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity):
if temperature is None:
return None
if self._current_temperature.scale == 0 and self._current_temperature.step != 1:
# The current temperature can have a scale of 0 or 1 and is used for
# rounding, Home Assistant doesn't need to round but we will always
# need to divide the value by 10^1 in case of 0 as scale.
# https://developer.tuya.com/en/docs/iot/shift-temperature-scale-follow-the-setting-of-app-account-center?id=Ka9qo7so58efq#title-7-Round%20values
temperature = temperature / 10
return self._current_temperature.scale_value(temperature)
@property