Răsfoiți Sursa

climate: allow min_temperature and max_temperature to be optional

Fall back on the range specified by temperature dps when these are configured
but not sent by the device.
Jason Rumney 2 ani în urmă
părinte
comite
0bb592dbf4
1 a modificat fișierele cu 6 adăugiri și 2 ștergeri
  1. 6 2
      custom_components/tuya_local/climate.py

+ 6 - 2
custom_components/tuya_local/climate.py

@@ -199,7 +199,9 @@ class TuyaLocalClimate(TuyaLocalEntity, ClimateEntity):
         """Return the minimum supported target temperature."""
         """Return the minimum supported target temperature."""
         # if a separate min_temperature dps is specified, the device tells us.
         # if a separate min_temperature dps is specified, the device tells us.
         if self._mintemp_dps is not None:
         if self._mintemp_dps is not None:
-            return self._mintemp_dps.get_value(self._device)
+            min = self._mintemp_dps.get_value(self._device)
+            if min is not None:
+                return min
 
 
         if self._temperature_dps is None:
         if self._temperature_dps is None:
             if self._temp_low_dps is None:
             if self._temp_low_dps is None:
@@ -214,7 +216,9 @@ class TuyaLocalClimate(TuyaLocalEntity, ClimateEntity):
         """Return the maximum supported target temperature."""
         """Return the maximum supported target temperature."""
         # if a separate max_temperature dps is specified, the device tells us.
         # if a separate max_temperature dps is specified, the device tells us.
         if self._maxtemp_dps is not None:
         if self._maxtemp_dps is not None:
-            return self._maxtemp_dps.get_value(self._device)
+            max = self._maxtemp_dps.get_value(self._device)
+            if max is not None:
+                return max
 
 
         if self._temperature_dps is None:
         if self._temperature_dps is None:
             if self._temp_high_dps is None:
             if self._temp_high_dps is None: