In case if anyone have to divide the temp, this is what I did. In my case temp was 5 times higher than it should be and max temp was 10 times higher.
Home Assistant 2022.4.6
For Docker:
vi /usr/src/homeassistant/homeassistant/components/tuya/climate.py
1. Setting MAX temp to 35
From:
if self._set_temperature:
self._attr_supported_features |= SUPPORT_TARGET_TEMPERATURE
self._attr_max_temp = self._set_temperature.max_scaled
self._attr_min_temp = self._set_temperature.min_scaled
self._attr_target_temperature_step = self._set_temperature.step_scaled
To:
if self._set_temperature:
self._attr_supported_features |= SUPPORT_TARGET_TEMPERATURE
self._attr_max_temp = self._set_temperature.max_scaled / 10
self._attr_min_temp = self._set_temperature.min_scaled
self._attr_target_temperature_step = self._set_temperature.step_scaled
You can change the min too, if it's not set to 5.
2. Setting step value (for setting the correct temp)
From:
"code": self._set_temperature.dpcode,
"value": round(
self._set_temperature.scale_value_back(kwargs["temperature"])
),
To:
"code": self._set_temperature.dpcode,
"value": round(
self._set_temperature.scale_value_back(kwargs["temperature"]) * 5
),
3. To show correct current temp
From:
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=Ka9
temperature = temperature / 10
return self._current_temperature.scale_value(temperature)
To:
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=Ka9
temperature = temperature / 10
temperature = temperature / 5
return self._current_temperature.scale_value(temperature)
4. To show current set temp:
From:
temperature = self.device.status.get(self._set_temperature.dpcode)
if temperature is None:
return None
return self._set_temperature.scale_value(temperature)
To:
temperature = self.device.status.get(self._set_temperature.dpcode)
if temperature is None:
return None
temperature = temperature / 5
return self._set_temperature.scale_value(temperature)
