From 21b4835542cc6ddbd34cb92c93764c15191d643b Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 16 Feb 2022 17:41:43 +0100 Subject: [PATCH] Add current temp fallback in Tuya climate (#66664) --- homeassistant/components/tuya/climate.py | 8 ++++++-- homeassistant/components/tuya/const.py | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/tuya/climate.py b/homeassistant/components/tuya/climate.py index a97a27a7453..c29c46b6bf8 100644 --- a/homeassistant/components/tuya/climate.py +++ b/homeassistant/components/tuya/climate.py @@ -155,8 +155,12 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity): self._attr_temperature_unit = TEMP_CELSIUS # Figure out current temperature, use preferred unit or what is available - celsius_type = self.find_dpcode(DPCode.TEMP_CURRENT, dptype=DPType.INTEGER) - farhenheit_type = self.find_dpcode(DPCode.TEMP_CURRENT_F, dptype=DPType.INTEGER) + celsius_type = self.find_dpcode( + (DPCode.TEMP_CURRENT, DPCode.UPPER_TEMP), dptype=DPType.INTEGER + ) + farhenheit_type = self.find_dpcode( + (DPCode.TEMP_CURRENT_F, DPCode.UPPER_TEMP_F), dptype=DPType.INTEGER + ) if farhenheit_type and ( prefered_temperature_unit == TEMP_FAHRENHEIT or (prefered_temperature_unit == TEMP_CELSIUS and not celsius_type) diff --git a/homeassistant/components/tuya/const.py b/homeassistant/components/tuya/const.py index 6d6a2aa2937..4d7f9d8e166 100644 --- a/homeassistant/components/tuya/const.py +++ b/homeassistant/components/tuya/const.py @@ -345,6 +345,11 @@ class DPCode(StrEnum): TOTAL_CLEAN_COUNT = "total_clean_count" TOTAL_CLEAN_TIME = "total_clean_time" TOTAL_FORWARD_ENERGY = "total_forward_energy" + TOTAL_TIME = "total_time" + TOTAL_PM = "total_pm" + TVOC = "tvoc" + UPPER_TEMP = "upper_temp" + UPPER_TEMP_F = "upper_temp_f" UV = "uv" # UV sterilization VA_BATTERY = "va_battery" VA_HUMIDITY = "va_humidity"