This issue is back again in tuya v2, however you can just use it by patching it.
This is a test repo that works with current HA stable: GitHub - 3v1n0/tuya-ha-hacks
Main dirty changes needed are:
commit b85573b19849e4f2c3d0d50e0291b9585aa71784
Author: Marco Trevisan (Treviño) <[email protected]>
Date: Mon Nov 1 19:06:23 2021 +0100
climate: Also use Upper temp as current temperature
diff --git a/climate.py b/climate.py
index bd3afd8..e6aaf7b 100644
--- a/climate.py
+++ b/climate.py
@@ -144,9 +144,9 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity):
# use whatever the device is set to, with a fallback to celsius.
if all(
dpcode in device.status
- for dpcode in (DPCode.TEMP_CURRENT, DPCode.TEMP_CURRENT_F)
+ for dpcode in (DPCode.TEMP_CURRENT, DPCode.TEMP_CURRENT_F, DPCode.UPPER_TEMP)
) or all(
- dpcode in device.status for dpcode in (DPCode.TEMP_SET, DPCode.TEMP_SET_F)
+ dpcode in device.status for dpcode in (DPCode.TEMP_SET, DPCode.TEMP_SET_F, DPCode.UPPER_TEMP)
):
self._attr_temperature_unit = TEMP_CELSIUS
if any(
@@ -198,7 +198,7 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity):
# Determine dpcode to use for getting the current temperature
if all(
dpcode in device.status
- for dpcode in (DPCode.TEMP_CURRENT, DPCode.TEMP_CURRENT_F)
+ for dpcode in (DPCode.TEMP_CURRENT, DPCode.TEMP_CURRENT_F, DPCode.UPPER_TEMP)
):
self._current_temperature_dpcode = DPCode.TEMP_CURRENT
if self._attr_temperature_unit == TEMP_FAHRENHEIT:
@@ -207,6 +207,8 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity):
self._current_temperature_dpcode = DPCode.TEMP_CURRENT
elif DPCode.TEMP_CURRENT_F in device.status:
self._current_temperature_dpcode = DPCode.TEMP_CURRENT_F
+ elif DPCode.UPPER_TEMP in device.status:
+ self._current_temperature_dpcode = DPCode.UPPER_TEMP
# If we have a current temperature dpcode, get the integer type data
if (
diff --git a/const.py b/const.py
index a9f7afb..f0f1ecd 100644
--- a/const.py
+++ b/const.py
@@ -298,6 +298,7 @@ class DPCode(str, Enum):
TEMP_VALUE = "temp_value" # Color temperature
TEMP_VALUE_V2 = "temp_value_v2"
TEMPER_ALARM = "temper_alarm" # Tamper alarm
+ UPPER_TEMP = "upper_temp"
UV = "uv" # UV sterilization
VA_BATTERY = "va_battery"
VA_HUMIDITY = "va_humidity"
And
commit e46a5922b9e5630eb2e5702557ccc9803c1289e1
Author: Marco Trevisan (Treviño) <[email protected]>
Date: Mon Nov 1 19:11:53 2021 +0100
climate: Adjust temperature dividers to support my setup
diff --git a/climate.py b/climate.py
index e6aaf7b..e0943ac 100644
--- a/climate.py
+++ b/climate.py
@@ -191,8 +191,8 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity):
)
self._attr_supported_features |= SUPPORT_TARGET_TEMPERATURE
self._set_temperature_type = type_data
- self._attr_max_temp = type_data.max_scaled
- self._attr_min_temp = type_data.min_scaled
+ self._attr_max_temp = type_data.max_scaled * 10.0 / 2.0
+ self._attr_min_temp = type_data.min_scaled * 10.0 / 2.0
self._attr_target_temperature_step = type_data.step_scaled
# Determine dpcode to use for getting the current temperature
@@ -367,9 +367,7 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity):
[
{
"code": self._set_temperature_dpcode,
- "value": round(
- self._set_temperature_type.scale_value(kwargs["temperature"])
- ),
+ "value": round(float(kwargs["temperature"]) * 2.0),
}
]
)
@@ -387,7 +385,7 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity):
if temperature is None:
return None
- return self._current_temperature_type.scale_value(temperature)
+ return self._current_temperature_type.scale_value(temperature) / 2.0
@property
def current_humidity(self) -> int | None:
@@ -411,7 +409,7 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity):
if temperature is None:
return None
- return self._set_temperature_type.scale_value(temperature)
+ return self._set_temperature_type.scale_value(temperature) * 10 / 2.0
@property
def target_humidity(self) -> int | None: