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

feat(fan): allow fans to conditionally have preset mode.

Rather than just the preset_mode existing, check that it has modes as well.
This allows a config to conditionally enable presets, leaving none defined
if the model does not support them, reducing the number of config files
needed to cover variants of devices.

PR #4899
Jason Rumney 2 месяцев назад
Родитель
Сommit
d3b3556b76
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      custom_components/tuya_local/fan.py

+ 1 - 1
custom_components/tuya_local/fan.py

@@ -50,7 +50,7 @@ class TuyaLocalFan(TuyaLocalEntity, FanEntity):
         self._init_end(dps_map)
 
         self._support_flags = FanEntityFeature(0)
-        if self._preset_dps:
+        if self._preset_dps and self._preset_dps.values(device):
             self._support_flags |= FanEntityFeature.PRESET_MODE
         if self._speed_dps:
             self._support_flags |= FanEntityFeature.SET_SPEED