Sfoglia il codice sorgente

Fan: add turn_on/off to support flags

Issue #2164
Jason Rumney 1 anno fa
parent
commit
52816db805
1 ha cambiato i file con 4 aggiunte e 0 eliminazioni
  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
         if self._direction_dps:
             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
     def supported_features(self):