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 GitHub
parent 56d45c49e9
commit 9389d1e561
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -365,6 +365,13 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity):
if temperature is None: if temperature is None:
return 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) return self._current_temperature.scale_value(temperature)
@property @property