瀏覽代碼

Climate: look for temperature on other temperature dps

Before defaulting to the HA default units, check all temperature
related dps for specified units.

Since some devices use temp_high/temp_low instead of a single temperature
setting, just checking temperature dp is not enough.
Jason Rumney 2 年之前
父節點
當前提交
a93d58d68b
共有 1 個文件被更改,包括 12 次插入0 次删除
  1. 12 0
      custom_components/tuya_local/climate.py

+ 12 - 0
custom_components/tuya_local/climate.py

@@ -130,6 +130,18 @@ class TuyaLocalClimate(TuyaLocalEntity, ClimateEntity):
             unit = validate_temp_unit(self._temperature_dps.unit)
             if unit is not None:
                 return unit
+        if self._temp_high_dps:
+            unit = validate_temp_unit(self._temp_high_dps.unit)
+            if unit is not None:
+                return unit
+        if self._temp_low_dps:
+            unit = validate_temp_unit(self._temp_low_dps.unit)
+            if unit is not None:
+                return unit
+        if self._current_temperature_dps:
+            unit = validate_temp_unit(self._current_temperature_dps.unit)
+            if unit is not None:
+                return unit
         # Return the default unit
         return UnitOfTemperature.CELSIUS