Просмотр исходного кода

climate: revert back to returning auto for no hvac_mode

When we return None, the entity card shows a status of "Unknown".

When we return "auto", in addition to the mode "Auto", the entity card
also shows set temperature, current temperature and hvac_action
if available.

The latter is definitely better, even if the mode is wrong.

To resolve the issue of an empty mode select box, include "auto"
in the hvac_modes, as the card may be checking for only one entry
in the list rather than one or none to hide this select box.

Issue #1144.

Reverts 82fa229ee7cb79
Jason Rumney 2 лет назад
Родитель
Сommit
337d8baa3b
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      custom_components/tuya_local/climate.py

+ 2 - 2
custom_components/tuya_local/climate.py

@@ -312,7 +312,7 @@ class TuyaLocalClimate(TuyaLocalEntity, ClimateEntity):
     def hvac_mode(self):
         """Return current HVAC mode."""
         if self._hvac_mode_dps is None:
-            return None
+            return HVACMode.AUTO
         hvac_mode = self._hvac_mode_dps.get_value(self._device)
         try:
             return HVACMode(hvac_mode) if hvac_mode else None
@@ -329,7 +329,7 @@ class TuyaLocalClimate(TuyaLocalEntity, ClimateEntity):
     def hvac_modes(self):
         """Return available HVAC modes."""
         if self._hvac_mode_dps is None:
-            return []
+            return [HVACMode.AUTO]
         else:
             return self._hvac_mode_dps.values(self._device)