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

Fan: add turn_on/off to support flags

Issue #2164
Jason Rumney 1 год назад
Родитель
Сommit
52816db805
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      custom_components/tuya_local/fan.py

+ 4 - 0
custom_components/tuya_local/fan.py

@@ -58,6 +58,10 @@ class TuyaLocalFan(TuyaLocalEntity, FanEntity):
             self._support_flags |= FanEntityFeature.OSCILLATE
             self._support_flags |= FanEntityFeature.OSCILLATE
         if self._direction_dps:
         if self._direction_dps:
             self._support_flags |= FanEntityFeature.DIRECTION
             self._support_flags |= FanEntityFeature.DIRECTION
+        if self._switch_dps:
+            self._support_flags |= FanEntityFeature.TURN_ON | FanEntityFeature.TURN_OFF
+        # Until the deprecation period ends (eexpected 2025.2)
+        self._enable_turn_on_off_backwards_compatibility = False
 
 
     @property
     @property
     def supported_features(self):
     def supported_features(self):