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

Replace cover, fan, humidifier, vacuum constants with enums.
- SUPPORT_* replaced with *EntityFeature enums since HA 2022.05

Issue #167

Jason Rumney 3 лет назад
Родитель
Сommit
f7e434a88c
34 измененных файлов с 170 добавлено и 186 удалено
  1. 6 9
      custom_components/tuya_local/generic/cover.py
  2. 5 8
      custom_components/tuya_local/generic/fan.py
  3. 7 3
      custom_components/tuya_local/generic/humidifier.py
  4. 13 20
      custom_components/tuya_local/generic/vacuum.py
  5. 4 6
      tests/devices/test_anko_fan.py
  6. 6 4
      tests/devices/test_arlec_fan.py
  7. 6 4
      tests/devices/test_arlec_fan_light.py
  8. 6 4
      tests/devices/test_aspen_adv200_fan.py
  9. 2 2
      tests/devices/test_deta_fan.py
  10. 4 6
      tests/devices/test_eanons_humidifier.py
  11. 2 2
      tests/devices/test_electriq_cd12_dehumidifier.py
  12. 2 2
      tests/devices/test_electriq_cd12pwv2_dehumidifier.py
  13. 4 4
      tests/devices/test_electriq_cd20_dehumidifier.py
  14. 4 4
      tests/devices/test_electriq_cd25_dehumidifier.py
  15. 2 3
      tests/devices/test_garage_door_opener.py
  16. 6 4
      tests/devices/test_goldair_fan.py
  17. 2 2
      tests/devices/test_himox_h05_purifier.py
  18. 2 2
      tests/devices/test_himox_h06_purifier.py
  19. 4 4
      tests/devices/test_jjpro_jpd01_dehumidifier.py
  20. 7 4
      tests/devices/test_kogan_dehumidifier.py
  21. 2 3
      tests/devices/test_kogan_garage_door_opener.py
  22. 15 24
      tests/devices/test_kyvol_e30_vacuum.py
  23. 14 22
      tests/devices/test_lefant_m213_vacuum.py
  24. 6 6
      tests/devices/test_lexy_f501_fan.py
  25. 7 5
      tests/devices/test_m027_curtain.py
  26. 2 2
      tests/devices/test_poiema_one_purifier.py
  27. 7 5
      tests/devices/test_qs_c01_curtain.py
  28. 2 2
      tests/devices/test_renpho_rp_ap001s.py
  29. 7 5
      tests/devices/test_simple_blinds.py
  30. 6 6
      tests/devices/test_stirling_fs140dc_fan.py
  31. 2 2
      tests/devices/test_tmwf02_fan.py
  32. 2 2
      tests/devices/test_vork_vk6067aw_purifier.py
  33. 2 2
      tests/devices/test_wetair_wawh1210lw_humidifier.py
  34. 2 3
      tests/devices/test_wilfa_haze_hu400bc_humidifier.py

+ 6 - 9
custom_components/tuya_local/generic/cover.py

@@ -4,12 +4,9 @@ Platform to control tuya cover devices.
 import logging
 
 from homeassistant.components.cover import (
-    CoverEntity,
     CoverDeviceClass,
-    SUPPORT_CLOSE,
-    SUPPORT_OPEN,
-    SUPPORT_SET_POSITION,
-    SUPPORT_STOP,
+    CoverEntity,
+    CoverEntityFeature,
 )
 
 from ..device import TuyaLocalDevice
@@ -40,14 +37,14 @@ class TuyaLocalCover(TuyaLocalEntity, CoverEntity):
 
         self._support_flags = 0
         if self._position_dps:
-            self._support_flags |= SUPPORT_SET_POSITION
+            self._support_flags |= CoverEntityFeature.SET_POSITION
         if self._control_dps:
             if "stop" in self._control_dps.values(self._device):
-                self._support_flags |= SUPPORT_STOP
+                self._support_flags |= CoverEntityFeature.STOP
             if "open" in self._control_dps.values(self._device):
-                self._support_flags |= SUPPORT_OPEN
+                self._support_flags |= CoverEntityFeature.OPEN
             if "close" in self._control_dps.values(self._device):
-                self._support_flags |= SUPPORT_CLOSE
+                self._support_flags |= CoverEntityFeature.CLOSE
         # Tilt not yet supported, as no test devices known
 
     @property

+ 5 - 8
custom_components/tuya_local/generic/fan.py

@@ -5,10 +5,7 @@ import logging
 
 from homeassistant.components.fan import (
     FanEntity,
-    SUPPORT_DIRECTION,
-    SUPPORT_OSCILLATE,
-    SUPPORT_PRESET_MODE,
-    SUPPORT_SET_SPEED,
+    FanEntityFeature,
 )
 
 from ..device import TuyaLocalDevice
@@ -38,13 +35,13 @@ class TuyaLocalFan(TuyaLocalEntity, FanEntity):
 
         self._support_flags = 0
         if self._preset_dps:
-            self._support_flags |= SUPPORT_PRESET_MODE
+            self._support_flags |= FanEntityFeature.PRESET_MODE
         if self._speed_dps:
-            self._support_flags |= SUPPORT_SET_SPEED
+            self._support_flags |= FanEntityFeature.SET_SPEED
         if self._oscillate_dps:
-            self._support_flags |= SUPPORT_OSCILLATE
+            self._support_flags |= FanEntityFeature.OSCILLATE
         if self._direction_dps:
-            self._support_flags |= SUPPORT_DIRECTION
+            self._support_flags |= FanEntityFeature.DIRECTION
 
     @property
     def supported_features(self):

+ 7 - 3
custom_components/tuya_local/generic/humidifier.py

@@ -3,11 +3,15 @@ Platform to control tuya humidifier and dehumidifier devices.
 """
 import logging
 
-from homeassistant.components.humidifier import HumidifierEntity, HumidifierDeviceClass
+from homeassistant.components.humidifier import (
+    HumidifierDeviceClass,
+    HumidifierEntity,
+    HumidifierEntityFeature,
+)
+
 from homeassistant.components.humidifier.const import (
     DEFAULT_MAX_HUMIDITY,
     DEFAULT_MIN_HUMIDITY,
-    SUPPORT_MODES,
 )
 
 from ..device import TuyaLocalDevice
@@ -35,7 +39,7 @@ class TuyaLocalHumidifier(TuyaLocalEntity, HumidifierEntity):
 
         self._support_flags = 0
         if self._mode_dps:
-            self._support_flags |= SUPPORT_MODES
+            self._support_flags |= HumidifierEntityFeature.MODES
 
     @property
     def supported_features(self):

+ 13 - 20
custom_components/tuya_local/generic/vacuum.py

@@ -8,19 +8,8 @@ from homeassistant.components.vacuum import (
     STATE_DOCKED,
     STATE_RETURNING,
     STATE_ERROR,
-    SUPPORT_BATTERY,
-    SUPPORT_FAN_SPEED,
-    SUPPORT_CLEAN_SPOT,
-    SUPPORT_LOCATE,
-    SUPPORT_PAUSE,
-    SUPPORT_RETURN_HOME,
-    SUPPORT_SEND_COMMAND,
-    SUPPORT_START,
-    SUPPORT_STATE,
-    SUPPORT_STATUS,
-    SUPPORT_TURN_ON,
-    SUPPORT_TURN_OFF,
     StateVacuumEntity,
+    VacuumEntityFeature,
 )
 from ..device import TuyaLocalDevice
 from ..helpers.device_config import TuyaEntityConfig
@@ -54,23 +43,27 @@ class TuyaLocalVacuum(TuyaLocalEntity, StateVacuumEntity):
     @property
     def supported_features(self):
         """Return the features supported by this vacuum cleaner."""
-        support = SUPPORT_STATE | SUPPORT_STATUS | SUPPORT_SEND_COMMAND
+        support = (
+            VacuumEntityFeature.STATE
+            | VacuumEntityFeature.STATUS
+            | VacuumEntityFeature.SEND_COMMAND
+        )
         if self._battery_dps:
-            support |= SUPPORT_BATTERY
+            support |= VacuumEntityFeature.BATTERY
         if self._fan_dps:
-            support |= SUPPORT_FAN_SPEED
+            support |= VacuumEntityFeature.FAN_SPEED
         if self._power_dps:
-            support |= SUPPORT_TURN_ON | SUPPORT_TURN_OFF
+            support |= VacuumEntityFeature.TURN_ON | VacuumEntityFeature.TURN_OFF
         if self._active_dps:
-            support |= SUPPORT_START | SUPPORT_PAUSE
+            support |= VacuumEntityFeature.START | VacuumEntityFeature.PAUSE
         if self._locate_dps:
-            support |= SUPPORT_LOCATE
+            support |= VacuumEntityFeature.LOCATE
 
         status_support = self._status_dps.values(self._device)
         if SERVICE_RETURN_TO_BASE in status_support:
-            support |= SUPPORT_RETURN_HOME
+            support |= VacuumEntityFeature.RETURN_HOME
         if SERVICE_CLEAN_SPOT in status_support:
-            support |= SUPPORT_CLEAN_SPOT
+            support |= VacuumEntityFeature.CLEAN_SPOT
         return support
 
     @property

+ 4 - 6
tests/devices/test_anko_fan.py

@@ -1,8 +1,4 @@
-from homeassistant.components.fan import (
-    SUPPORT_OSCILLATE,
-    SUPPORT_PRESET_MODE,
-    SUPPORT_SET_SPEED,
-)
+from homeassistant.components.fan import FanEntityFeature
 from homeassistant.const import TIME_SECONDS
 
 from ..const import ANKO_FAN_PAYLOAD
@@ -36,7 +32,9 @@ class TestAnkoFan(SwitchableTests, BasicNumberTests, TuyaDeviceTestCase):
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_OSCILLATE | SUPPORT_PRESET_MODE | SUPPORT_SET_SPEED,
+            FanEntityFeature.OSCILLATE
+            | FanEntityFeature.PRESET_MODE
+            | FanEntityFeature.SET_SPEED,
         )
 
     def test_preset_mode(self):

+ 6 - 4
tests/devices/test_arlec_fan.py

@@ -1,9 +1,7 @@
 from homeassistant.components.fan import (
     DIRECTION_FORWARD,
     DIRECTION_REVERSE,
-    SUPPORT_DIRECTION,
-    SUPPORT_PRESET_MODE,
-    SUPPORT_SET_SPEED,
+    FanEntityFeature,
 )
 
 from ..const import ARLEC_FAN_PAYLOAD
@@ -42,7 +40,11 @@ class TestArlecFan(SwitchableTests, BasicSelectTests, TuyaDeviceTestCase):
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_DIRECTION | SUPPORT_PRESET_MODE | SUPPORT_SET_SPEED,
+            (
+                FanEntityFeature.DIRECTION
+                | FanEntityFeature.PRESET_MODE
+                | FanEntityFeature.SET_SPEED
+            ),
         )
 
     def test_preset_mode(self):

+ 6 - 4
tests/devices/test_arlec_fan_light.py

@@ -1,9 +1,7 @@
 from homeassistant.components.fan import (
     DIRECTION_FORWARD,
     DIRECTION_REVERSE,
-    SUPPORT_DIRECTION,
-    SUPPORT_PRESET_MODE,
-    SUPPORT_SET_SPEED,
+    FanEntityFeature,
 )
 from homeassistant.components.light import (
     ATTR_BRIGHTNESS,
@@ -51,7 +49,11 @@ class TestArlecFan(SwitchableTests, BasicSelectTests, TuyaDeviceTestCase):
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_DIRECTION | SUPPORT_PRESET_MODE | SUPPORT_SET_SPEED,
+            (
+                FanEntityFeature.DIRECTION
+                | FanEntityFeature.PRESET_MODE
+                | FanEntityFeature.SET_SPEED
+            ),
         )
 
     def test_preset_mode(self):

+ 6 - 4
tests/devices/test_aspen_adv200_fan.py

@@ -5,9 +5,7 @@ from homeassistant.components.climate.const import (
 from homeassistant.components.fan import (
     DIRECTION_FORWARD,
     DIRECTION_REVERSE,
-    SUPPORT_DIRECTION,
-    SUPPORT_PRESET_MODE,
-    SUPPORT_SET_SPEED,
+    FanEntityFeature,
 )
 from homeassistant.const import TEMP_FAHRENHEIT
 
@@ -59,7 +57,11 @@ class TestAspenASP200Fan(
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_DIRECTION | SUPPORT_PRESET_MODE | SUPPORT_SET_SPEED,
+            (
+                FanEntityFeature.DIRECTION
+                | FanEntityFeature.PRESET_MODE
+                | FanEntityFeature.SET_SPEED
+            ),
         )
         self.assertEqual(
             self.climate.supported_features,

+ 2 - 2
tests/devices/test_deta_fan.py

@@ -1,4 +1,4 @@
-from homeassistant.components.fan import SUPPORT_SET_SPEED
+from homeassistant.components.fan import FanEntityFeature
 from homeassistant.components.light import COLOR_MODE_ONOFF
 
 from ..const import DETA_FAN_PAYLOAD
@@ -31,7 +31,7 @@ class TestDetaFan(
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_SET_SPEED,
+            FanEntityFeature.SET_SPEED,
         )
 
     def test_speed(self):

+ 4 - 6
tests/devices/test_eanons_humidifier.py

@@ -6,14 +6,12 @@ from homeassistant.components.climate.const import (
     FAN_LOW,
     HVACMode,
 )
-from homeassistant.components.fan import (
-    SUPPORT_SET_SPEED,
-)
+from homeassistant.components.fan import FanEntityFeature
+from homeassistant.components.humidifier import HumidifierEntityFeature
 from homeassistant.components.humidifier.const import (
     MODE_NORMAL,
     MODE_AUTO,
     MODE_SLEEP,
-    SUPPORT_MODES,
 )
 
 from ..const import EANONS_HUMIDIFIER_PAYLOAD
@@ -93,8 +91,8 @@ class TestEanonsHumidifier(
                 | ClimateEntityFeature.FAN_MODE
             ),
         )
-        self.assertEqual(self.subject.supported_features, SUPPORT_MODES)
-        self.assertEqual(self.fan.supported_features, SUPPORT_SET_SPEED)
+        self.assertEqual(self.subject.supported_features, HumidifierEntityFeature.MODES)
+        self.assertEqual(self.fan.supported_features, FanEntityFeature.SET_SPEED)
 
     def test_climate_icon_is_humidifier(self):
         """Test that the icon is as expected."""

+ 2 - 2
tests/devices/test_electriq_cd12_dehumidifier.py

@@ -1,4 +1,4 @@
-from homeassistant.components.humidifier import SUPPORT_MODES
+from homeassistant.components.humidifier import HumidifierEntityFeature
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.const import (
     PERCENTAGE,
@@ -53,7 +53,7 @@ class TestElectriqCD12PWDehumidifier(
         self.mark_secondary(["light_display"])
 
     def test_supported_features(self):
-        self.assertEqual(self.subject.supported_features, SUPPORT_MODES)
+        self.assertEqual(self.subject.supported_features, HumidifierEntityFeature.MODES)
 
     def test_icon(self):
         """Test that the icon is as expected."""

+ 2 - 2
tests/devices/test_electriq_cd12pwv2_dehumidifier.py

@@ -1,4 +1,4 @@
-from homeassistant.components.humidifier import SUPPORT_MODES
+from homeassistant.components.humidifier import HumidifierEntityFeature
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.const import (
     PERCENTAGE,
@@ -56,7 +56,7 @@ class TestElectriqCD12PWV2Dehumidifier(
         self.mark_secondary(["light_display", "switch_sleep", "binary_sensor_tank"])
 
     def test_supported_features(self):
-        self.assertEqual(self.subject.supported_features, SUPPORT_MODES)
+        self.assertEqual(self.subject.supported_features, HumidifierEntityFeature.MODES)
 
     def test_icon(self):
         """Test that the icon is as expected."""

+ 4 - 4
tests/devices/test_electriq_cd20_dehumidifier.py

@@ -1,5 +1,5 @@
-from homeassistant.components.fan import SUPPORT_PRESET_MODE
-from homeassistant.components.humidifier import SUPPORT_MODES
+from homeassistant.components.fan import FanEntityFeature
+from homeassistant.components.humidifier import HumidifierEntityFeature
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.const import (
     PERCENTAGE,
@@ -68,8 +68,8 @@ class TestElectriqCD20ProDehumidifier(
         self.mark_secondary(["light_display"])
 
     def test_supported_features(self):
-        self.assertEqual(self.subject.supported_features, SUPPORT_MODES)
-        self.assertEqual(self.fan.supported_features, SUPPORT_PRESET_MODE)
+        self.assertEqual(self.subject.supported_features, HumidifierEntityFeature.MODES)
+        self.assertEqual(self.fan.supported_features, FanEntityFeature.PRESET_MODE)
 
     def test_icon(self):
         """Test that the icon is as expected."""

+ 4 - 4
tests/devices/test_electriq_cd25_dehumidifier.py

@@ -1,5 +1,5 @@
-from homeassistant.components.fan import SUPPORT_PRESET_MODE
-from homeassistant.components.humidifier import SUPPORT_MODES
+from homeassistant.components.fan import FanEntityFeature
+from homeassistant.components.humidifier import HumidifierEntityFeature
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.const import (
     PERCENTAGE,
@@ -66,8 +66,8 @@ class TestElectriqCD25ProDehumidifier(
         self.mark_secondary(["lock_child_lock"])
 
     def test_supported_features(self):
-        self.assertEqual(self.subject.supported_features, SUPPORT_MODES)
-        self.assertEqual(self.fan.supported_features, SUPPORT_PRESET_MODE)
+        self.assertEqual(self.subject.supported_features, HumidifierEntityFeature.MODES)
+        self.assertEqual(self.fan.supported_features, FanEntityFeature.PRESET_MODE)
 
     def test_icon(self):
         """Test that the icon is as expected."""

+ 2 - 3
tests/devices/test_garage_door_opener.py

@@ -1,8 +1,7 @@
 """Tests for the simple garage door opener."""
 from homeassistant.components.cover import (
     CoverDeviceClass,
-    SUPPORT_CLOSE,
-    SUPPORT_OPEN,
+    CoverEntityFeature,
 )
 
 from ..const import SIMPLE_GARAGE_DOOR_PAYLOAD
@@ -26,7 +25,7 @@ class TestSimpleGarageOpener(TuyaDeviceTestCase):
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_OPEN | SUPPORT_CLOSE,
+            CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE,
         )
 
     def test_current_cover_position(self):

+ 6 - 4
tests/devices/test_goldair_fan.py

@@ -7,9 +7,7 @@ from homeassistant.components.climate.const import (
     SWING_OFF,
 )
 from homeassistant.components.fan import (
-    SUPPORT_OSCILLATE,
-    SUPPORT_PRESET_MODE,
-    SUPPORT_SET_SPEED,
+    FanEntityFeature,
 )
 
 from ..const import FAN_PAYLOAD
@@ -40,7 +38,11 @@ class TestGoldairFan(BasicLightTests, SwitchableTests, TuyaDeviceTestCase):
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_OSCILLATE | SUPPORT_PRESET_MODE | SUPPORT_SET_SPEED,
+            (
+                FanEntityFeature.OSCILLATE
+                | FanEntityFeature.PRESET_MODE
+                | FanEntityFeature.SET_SPEED
+            ),
         )
         self.assertEqual(
             self.climate.supported_features,

+ 2 - 2
tests/devices/test_himox_h05_purifier.py

@@ -1,4 +1,4 @@
-from homeassistant.components.fan import SUPPORT_PRESET_MODE
+from homeassistant.components.fan import FanEntityFeature
 from homeassistant.components.sensor import (
     SensorDeviceClass,
     STATE_CLASS_MEASUREMENT,
@@ -87,7 +87,7 @@ class TestHimoxH05Purifier(
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_PRESET_MODE,
+            FanEntityFeature.PRESET_MODE,
         )
 
     def test_preset_modes(self):

+ 2 - 2
tests/devices/test_himox_h06_purifier.py

@@ -1,4 +1,4 @@
-from homeassistant.components.fan import SUPPORT_SET_SPEED
+from homeassistant.components.fan import FanEntityFeature
 from homeassistant.const import (
     PERCENTAGE,
     TIME_MINUTES,
@@ -92,7 +92,7 @@ class TestHimoxH06Purifier(
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_SET_SPEED,
+            FanEntityFeature.SET_SPEED,
         )
 
     def test_speed(self):

+ 4 - 4
tests/devices/test_jjpro_jpd01_dehumidifier.py

@@ -1,6 +1,6 @@
 from homeassistant.components.binary_sensor import BinarySensorDeviceClass
-from homeassistant.components.fan import SUPPORT_SET_SPEED
-from homeassistant.components.humidifier import SUPPORT_MODES
+from homeassistant.components.fan import FanEntityFeature
+from homeassistant.components.humidifier import HumidifierEntityFeature
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.const import (
     PERCENTAGE,
@@ -104,8 +104,8 @@ class TestJJProJPD01Dehumidifier(
         )
 
     def test_supported_features(self):
-        self.assertEqual(self.subject.supported_features, SUPPORT_MODES)
-        self.assertEqual(self.fan.supported_features, SUPPORT_SET_SPEED)
+        self.assertEqual(self.subject.supported_features, HumidifierEntityFeature.MODES)
+        self.assertEqual(self.fan.supported_features, FanEntityFeature.SET_SPEED)
 
     def test_icon(self):
         """Test that the icon is as expected."""

+ 7 - 4
tests/devices/test_kogan_dehumidifier.py

@@ -1,6 +1,6 @@
 from homeassistant.components.binary_sensor import BinarySensorDeviceClass
-from homeassistant.components.fan import SUPPORT_OSCILLATE, SUPPORT_SET_SPEED
-from homeassistant.components.humidifier import SUPPORT_MODES
+from homeassistant.components.fan import FanEntityFeature
+from homeassistant.components.humidifier import HumidifierEntityFeature
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.const import PERCENTAGE
 
@@ -47,10 +47,13 @@ class TestKoganDehumidifier(
         self.mark_secondary(["binary_sensor_tank"])
 
     def test_supported_features(self):
-        self.assertEqual(self.subject.supported_features, SUPPORT_MODES)
+        self.assertEqual(
+            self.subject.supported_features,
+            HumidifierEntityFeature.MODES,
+        )
         self.assertEqual(
             self.fan.supported_features,
-            SUPPORT_OSCILLATE | SUPPORT_SET_SPEED,
+            FanEntityFeature.OSCILLATE | FanEntityFeature.SET_SPEED,
         )
 
     def test_icon(self):

+ 2 - 3
tests/devices/test_kogan_garage_door_opener.py

@@ -2,8 +2,7 @@
 from homeassistant.components.binary_sensor import BinarySensorDeviceClass
 from homeassistant.components.cover import (
     CoverDeviceClass,
-    SUPPORT_CLOSE,
-    SUPPORT_OPEN,
+    CoverEntityFeature,
 )
 from homeassistant.components.sensor import SensorDeviceClass
 
@@ -47,7 +46,7 @@ class TestKoganGarageOpener(
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_OPEN | SUPPORT_CLOSE,
+            CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE,
         )
 
     def test_current_cover_position(self):

+ 15 - 24
tests/devices/test_kyvol_e30_vacuum.py

@@ -3,18 +3,7 @@ from homeassistant.components.vacuum import (
     STATE_DOCKED,
     STATE_ERROR,
     STATE_RETURNING,
-    SUPPORT_BATTERY,
-    SUPPORT_CLEAN_SPOT,
-    SUPPORT_FAN_SPEED,
-    SUPPORT_LOCATE,
-    SUPPORT_PAUSE,
-    SUPPORT_RETURN_HOME,
-    SUPPORT_SEND_COMMAND,
-    SUPPORT_START,
-    SUPPORT_STATE,
-    SUPPORT_STATUS,
-    SUPPORT_TURN_OFF,
-    SUPPORT_TURN_ON,
+    VacuumEntityFeature,
 )
 from homeassistant.const import (
     TIME_MINUTES,
@@ -115,18 +104,20 @@ class TestKyvolE30Vacuum(MultiSensorTests, MultiSwitchTests, TuyaDeviceTestCase)
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_STATE
-            | SUPPORT_STATUS
-            | SUPPORT_SEND_COMMAND
-            | SUPPORT_BATTERY
-            | SUPPORT_FAN_SPEED
-            | SUPPORT_TURN_ON
-            | SUPPORT_TURN_OFF
-            | SUPPORT_START
-            | SUPPORT_PAUSE
-            | SUPPORT_LOCATE
-            | SUPPORT_RETURN_HOME
-            | SUPPORT_CLEAN_SPOT,
+            (
+                VacuumEntityFeature.STATE
+                | VacuumEntityFeature.STATUS
+                | VacuumEntityFeature.SEND_COMMAND
+                | VacuumEntityFeature.BATTERY
+                | VacuumEntityFeature.FAN_SPEED
+                | VacuumEntityFeature.TURN_ON
+                | VacuumEntityFeature.TURN_OFF
+                | VacuumEntityFeature.START
+                | VacuumEntityFeature.PAUSE
+                | VacuumEntityFeature.LOCATE
+                | VacuumEntityFeature.RETURN_HOME
+                | VacuumEntityFeature.CLEAN_SPOT
+            ),
         )
 
     def test_battery_level(self):

+ 14 - 22
tests/devices/test_lefant_m213_vacuum.py

@@ -3,17 +3,7 @@ from homeassistant.components.vacuum import (
     STATE_DOCKED,
     STATE_ERROR,
     STATE_RETURNING,
-    SUPPORT_BATTERY,
-    SUPPORT_CLEAN_SPOT,
-    SUPPORT_LOCATE,
-    SUPPORT_PAUSE,
-    SUPPORT_RETURN_HOME,
-    SUPPORT_SEND_COMMAND,
-    SUPPORT_START,
-    SUPPORT_STATE,
-    SUPPORT_STATUS,
-    SUPPORT_TURN_OFF,
-    SUPPORT_TURN_ON,
+    VacuumEntityFeature,
 )
 from homeassistant.const import (
     AREA_SQUARE_METERS,
@@ -68,17 +58,19 @@ class TestLefantM213Vacuum(MultiSensorTests, TuyaDeviceTestCase):
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_STATE
-            | SUPPORT_STATUS
-            | SUPPORT_SEND_COMMAND
-            | SUPPORT_BATTERY
-            | SUPPORT_TURN_ON
-            | SUPPORT_TURN_OFF
-            | SUPPORT_START
-            | SUPPORT_PAUSE
-            | SUPPORT_LOCATE
-            | SUPPORT_RETURN_HOME
-            | SUPPORT_CLEAN_SPOT,
+            (
+                VacuumEntityFeature.STATE
+                | VacuumEntityFeature.STATUS
+                | VacuumEntityFeature.SEND_COMMAND
+                | VacuumEntityFeature.BATTERY
+                | VacuumEntityFeature.TURN_ON
+                | VacuumEntityFeature.TURN_OFF
+                | VacuumEntityFeature.START
+                | VacuumEntityFeature.PAUSE
+                | VacuumEntityFeature.LOCATE
+                | VacuumEntityFeature.RETURN_HOME
+                | VacuumEntityFeature.CLEAN_SPOT
+            ),
         )
 
     def test_battery_level(self):

+ 6 - 6
tests/devices/test_lexy_f501_fan.py

@@ -1,8 +1,4 @@
-from homeassistant.components.fan import (
-    SUPPORT_OSCILLATE,
-    SUPPORT_PRESET_MODE,
-    SUPPORT_SET_SPEED,
-)
+from homeassistant.components.fan import FanEntityFeature
 from homeassistant.const import TIME_HOURS
 
 from ..const import LEXY_F501_PAYLOAD
@@ -58,7 +54,11 @@ class TestLexyF501Fan(
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_OSCILLATE | SUPPORT_PRESET_MODE | SUPPORT_SET_SPEED,
+            (
+                FanEntityFeature.OSCILLATE
+                | FanEntityFeature.PRESET_MODE
+                | FanEntityFeature.SET_SPEED
+            ),
         )
 
     def test_preset_mode(self):

+ 7 - 5
tests/devices/test_m027_curtain.py

@@ -1,10 +1,7 @@
 """Tests for the M027 curtain module."""
 from homeassistant.components.cover import (
     CoverDeviceClass,
-    SUPPORT_CLOSE,
-    SUPPORT_OPEN,
-    SUPPORT_SET_POSITION,
-    SUPPORT_STOP,
+    CoverEntityFeature,
 )
 from homeassistant.const import TIME_MILLISECONDS, TIME_SECONDS
 
@@ -65,7 +62,12 @@ class TestM027Curtains(MultiSensorTests, BasicSelectTests, TuyaDeviceTestCase):
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_SET_POSITION | SUPPORT_STOP,
+            (
+                CoverEntityFeature.OPEN
+                | CoverEntityFeature.CLOSE
+                | CoverEntityFeature.SET_POSITION
+                | CoverEntityFeature.STOP
+            ),
         )
 
     def test_current_cover_position(self):

+ 2 - 2
tests/devices/test_poiema_one_purifier.py

@@ -1,4 +1,4 @@
-from homeassistant.components.fan import SUPPORT_PRESET_MODE, SUPPORT_SET_SPEED
+from homeassistant.components.fan import FanEntityFeature
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.const import (
     CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
@@ -79,7 +79,7 @@ class TestPoeimaOnePurifier(
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_PRESET_MODE | SUPPORT_SET_SPEED,
+            FanEntityFeature.PRESET_MODE | FanEntityFeature.SET_SPEED,
         )
 
     def test_speed(self):

+ 7 - 5
tests/devices/test_qs_c01_curtain.py

@@ -1,10 +1,7 @@
 """Tests for the QS C01 curtain module."""
 from homeassistant.components.cover import (
     CoverDeviceClass,
-    SUPPORT_CLOSE,
-    SUPPORT_OPEN,
-    SUPPORT_SET_POSITION,
-    SUPPORT_STOP,
+    CoverEntityFeature,
 )
 from homeassistant.const import TIME_SECONDS
 
@@ -49,7 +46,12 @@ class TestQSC01Curtains(BasicNumberTests, BasicSelectTests, TuyaDeviceTestCase):
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_SET_POSITION | SUPPORT_STOP,
+            (
+                CoverEntityFeature.OPEN
+                | CoverEntityFeature.CLOSE
+                | CoverEntityFeature.SET_POSITION
+                | CoverEntityFeature.STOP
+            ),
         )
 
     def test_current_cover_position(self):

+ 2 - 2
tests/devices/test_renpho_rp_ap001s.py

@@ -1,4 +1,4 @@
-from homeassistant.components.fan import SUPPORT_PRESET_MODE
+from homeassistant.components.fan import FanEntityFeature
 from homeassistant.components.sensor import SensorDeviceClass
 
 from ..const import RENPHO_PURIFIER_PAYLOAD
@@ -77,7 +77,7 @@ class TestRenphoPurifier(
         )
 
     def test_supported_features(self):
-        self.assertEqual(self.subject.supported_features, SUPPORT_PRESET_MODE)
+        self.assertEqual(self.subject.supported_features, FanEntityFeature.PRESET_MODE)
 
     def test_preset_modes(self):
         self.assertCountEqual(

+ 7 - 5
tests/devices/test_simple_blinds.py

@@ -1,10 +1,7 @@
 """Tests for the simple blinds controller."""
 from homeassistant.components.cover import (
     CoverDeviceClass,
-    SUPPORT_CLOSE,
-    SUPPORT_OPEN,
-    SUPPORT_SET_POSITION,
-    SUPPORT_STOP,
+    CoverEntityFeature,
 )
 
 from ..const import SIMPLE_BLINDS_PAYLOAD
@@ -30,7 +27,12 @@ class TestSimpleBlinds(TuyaDeviceTestCase):
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_SET_POSITION | SUPPORT_STOP,
+            (
+                CoverEntityFeature.OPEN
+                | CoverEntityFeature.CLOSE
+                | CoverEntityFeature.SET_POSITION
+                | CoverEntityFeature.STOP
+            ),
         )
 
     def test_current_cover_position(self):

+ 6 - 6
tests/devices/test_stirling_fs140dc_fan.py

@@ -1,8 +1,4 @@
-from homeassistant.components.fan import (
-    SUPPORT_OSCILLATE,
-    SUPPORT_PRESET_MODE,
-    SUPPORT_SET_SPEED,
-)
+from homeassistant.components.fan import FanEntityFeature
 
 from ..const import STIRLING_FS1_FAN_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -29,7 +25,11 @@ class TestStirlingFS1Fan(SwitchableTests, TuyaDeviceTestCase):
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_OSCILLATE | SUPPORT_PRESET_MODE | SUPPORT_SET_SPEED,
+            (
+                FanEntityFeature.OSCILLATE
+                | FanEntityFeature.PRESET_MODE
+                | FanEntityFeature.SET_SPEED
+            ),
         )
 
     def test_preset_mode(self):

+ 2 - 2
tests/devices/test_tmwf02_fan.py

@@ -1,4 +1,4 @@
-from homeassistant.components.fan import SUPPORT_SET_SPEED
+from homeassistant.components.fan import FanEntityFeature
 from homeassistant.const import (
     TIME_MINUTES,
 )
@@ -33,7 +33,7 @@ class TestTMWF02Fan(BasicNumberTests, SwitchableTests, TuyaDeviceTestCase):
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_SET_SPEED,
+            FanEntityFeature.SET_SPEED,
         )
 
     def test_speed(self):

+ 2 - 2
tests/devices/test_vork_vk6067aw_purifier.py

@@ -1,5 +1,5 @@
 from homeassistant.components.binary_sensor import BinarySensorDeviceClass
-from homeassistant.components.fan import SUPPORT_PRESET_MODE
+from homeassistant.components.fan import FanEntityFeature
 from homeassistant.const import (
     PERCENTAGE,
     TIME_MINUTES,
@@ -91,7 +91,7 @@ class TestVorkVK6267AWPurifier(
     def test_supported_features(self):
         self.assertEqual(
             self.subject.supported_features,
-            SUPPORT_PRESET_MODE,
+            FanEntityFeature.PRESET_MODE,
         )
 
     def test_preset_modes(self):

+ 2 - 2
tests/devices/test_wetair_wawh1210lw_humidifier.py

@@ -1,9 +1,9 @@
+from homeassistant.components.humidifier import HumidifierEntityFeature
 from homeassistant.components.humidifier.const import (
     MODE_AUTO,
     MODE_BOOST,
     MODE_NORMAL,
     MODE_SLEEP,
-    SUPPORT_MODES,
 )
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.const import (
@@ -86,7 +86,7 @@ class TestWetairWAWH1210LWHumidifier(
         )
 
     def test_supported_features(self):
-        self.assertEqual(self.subject.supported_features, SUPPORT_MODES)
+        self.assertEqual(self.subject.supported_features, HumidifierEntityFeature.MODES)
 
     def test_icons(self):
         self.dps[SWITCH_DPS] = True

+ 2 - 3
tests/devices/test_wilfa_haze_hu400bc_humidifier.py

@@ -1,11 +1,10 @@
 from homeassistant.components.binary_sensor import BinarySensorDeviceClass
+from homeassistant.components.humidifier import HumidifierEntityFeature
 from homeassistant.components.humidifier.const import (
     MODE_AUTO,
     MODE_NORMAL,
-    SUPPORT_MODES,
 )
 from homeassistant.components.sensor import SensorDeviceClass
-from homeassistant.components.humidifier import HumidifierDeviceClass
 
 from homeassistant.const import PERCENTAGE, TEMP_CELSIUS
 
@@ -151,7 +150,7 @@ class TestWilfaHazeHumidifier(
         )
 
     def test_supported_features(self):
-        self.assertEqual(self.subject.supported_features, SUPPORT_MODES)
+        self.assertEqual(self.subject.supported_features, HumidifierEntityFeature.MODES)
 
     def test_icons(self):
         self.dps[SWITCH_DPS] = True