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

Use new unit enums from HA 2023.1

Use new units for electric current and potential, frequency, and time.
These only affect tests, so this change does not force the use of
2023.1 on end users, only on developers who want to run the unit
tests.
Jason Rumney 3 лет назад
Родитель
Сommit
f2e8f07ede
52 измененных файлов с 159 добавлено и 160 удалено
  1. 1 1
      requirements-dev.txt
  2. 2 2
      tests/devices/test_anko_fan.py
  3. 3 3
      tests/devices/test_avatto_blinds.py
  4. 2 2
      tests/devices/test_betterlife_bl1500_heater.py
  5. 4 4
      tests/devices/test_compteur_energy_meter.py
  6. 2 2
      tests/devices/test_devola_patio_heater.py
  7. 7 7
      tests/devices/test_digoo_dgsp202.py
  8. 2 2
      tests/devices/test_eberg_qubo_q40hd_heatpump.py
  9. 2 2
      tests/devices/test_ecostrad_accentiq_heater.py
  10. 4 4
      tests/devices/test_energy_monitoring_powerstrip.py
  11. 5 5
      tests/devices/test_es01_powerstrip.py
  12. 2 2
      tests/devices/test_essentials_purifier.py
  13. 2 2
      tests/devices/test_goldair_dehumidifier.py
  14. 2 2
      tests/devices/test_goldair_geco_heater.py
  15. 2 2
      tests/devices/test_goldair_gpcv_heater.py
  16. 2 2
      tests/devices/test_goldair_gpph_heater.py
  17. 7 7
      tests/devices/test_grid_connect_double_power_point.py
  18. 0 1
      tests/devices/test_himox_h05_purifier.py
  19. 2 2
      tests/devices/test_himox_h06_purifier.py
  20. 2 2
      tests/devices/test_hysen_hy08we2_thermostat.py
  21. 2 2
      tests/devices/test_inkbird_itc306a_thermostat.py
  22. 2 2
      tests/devices/test_inkbird_itc308_thermostat.py
  23. 3 3
      tests/devices/test_inkbird_sousvide.py
  24. 2 2
      tests/devices/test_jjpro_jpd01_dehumidifier.py
  25. 2 2
      tests/devices/test_kogan_kahtp_heater.py
  26. 2 2
      tests/devices/test_kogan_kawfhtp_heater.py
  27. 2 2
      tests/devices/test_kyvol_e30_vacuum.py
  28. 2 2
      tests/devices/test_lefant_m213_vacuum.py
  29. 2 2
      tests/devices/test_lexy_f501_fan.py
  30. 6 6
      tests/devices/test_logicom_powerstrip.py
  31. 3 3
      tests/devices/test_m027_curtain.py
  32. 6 6
      tests/devices/test_moes_rgb_socket.py
  33. 3 3
      tests/devices/test_moes_temp_humidity.py
  34. 2 2
      tests/devices/test_nashone_mts700wb_thermostat.py
  35. 2 2
      tests/devices/test_nedis_htpl20f_heater.py
  36. 7 7
      tests/devices/test_parkside_plgs2012a1_smart_charger.py
  37. 11 11
      tests/devices/test_pc321ty_energy_meter.py
  38. 2 2
      tests/devices/test_poiema_one_purifier.py
  39. 2 2
      tests/devices/test_qoto_03_sprinkler.py
  40. 2 2
      tests/devices/test_qs_c01_curtain.py
  41. 2 2
      tests/devices/test_rgbcw_lightbulb.py
  42. 2 2
      tests/devices/test_simple_switch_with_timer.py
  43. 2 2
      tests/devices/test_simple_switch_with_timerv2.py
  44. 2 2
      tests/devices/test_smartplug_encoded.py
  45. 6 6
      tests/devices/test_smartplugv1.py
  46. 6 6
      tests/devices/test_smartplugv2.py
  47. 6 6
      tests/devices/test_smartplugv2_energy.py
  48. 2 2
      tests/devices/test_tmwf02_fan.py
  49. 2 2
      tests/devices/test_treatlife_ds02f.py
  50. 2 2
      tests/devices/test_vork_vk6067aw_purifier.py
  51. 2 2
      tests/devices/test_wetair_wch750_heater.py
  52. 5 5
      tests/devices/test_woox_r4028_powerstrip.py

+ 1 - 1
requirements-dev.txt

@@ -1,6 +1,6 @@
 black
 isort
-pytest-homeassistant-custom-component>=0.12.17
+pytest-homeassistant-custom-component>=0.12.42
 pytest
 pytest-asyncio
 pytest-cov

+ 2 - 2
tests/devices/test_anko_fan.py

@@ -1,5 +1,5 @@
 from homeassistant.components.fan import FanEntityFeature
-from homeassistant.const import TIME_SECONDS
+from homeassistant.const import UnitOfTime
 
 from ..const import ANKO_FAN_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -25,7 +25,7 @@ class TestAnkoFan(SwitchableTests, BasicNumberTests, TuyaDeviceTestCase):
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=9,
-            unit=TIME_SECONDS,
+            unit=UnitOfTime.SECONDS,
         )
         self.mark_secondary(["number_timer"])
 

+ 3 - 3
tests/devices/test_avatto_blinds.py

@@ -3,7 +3,7 @@ from homeassistant.components.cover import (
     CoverDeviceClass,
     CoverEntityFeature,
 )
-from homeassistant.const import TIME_MILLISECONDS, TIME_SECONDS
+from homeassistant.const import UnitOfTime
 
 from ..const import AVATTO_BLINDS_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -34,14 +34,14 @@ class TestAvattoBlinds(MultiSensorTests, BasicSelectTests, TuyaDeviceTestCase):
                     "name": "sensor_travel_time",
                     "min": 0,
                     "max": 120000,
-                    "unit": TIME_MILLISECONDS,
+                    "unit": UnitOfTime.MILLISECONDS,
                 },
                 {
                     "dps": COUNTDOWN_DP,
                     "name": "sensor_timer",
                     "min": 0,
                     "max": 86400,
-                    "unit": TIME_SECONDS,
+                    "unit": UnitOfTime.SECONDS,
                 },
             ]
         )

+ 2 - 2
tests/devices/test_betterlife_bl1500_heater.py

@@ -2,7 +2,7 @@ from homeassistant.components.climate.const import (
     ClimateEntityFeature,
     HVACMode,
 )
-from homeassistant.const import TIME_MINUTES, UnitOfTemperature
+from homeassistant.const import UnitOfTime, UnitOfTemperature
 
 from ..const import BETTERLIFE_BL1500_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -62,7 +62,7 @@ class TestBetterlifeBL1500Heater(
         self.setUpBasicSensor(
             COUNTDOWN_DPS,
             self.entities.get("sensor_timer_countdown"),
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
         )
         self.mark_secondary(
             ["lock_child_lock", "select_timer", "sensor_timer_countdown"]

+ 4 - 4
tests/devices/test_compteur_energy_meter.py

@@ -5,8 +5,8 @@ from homeassistant.components.sensor import (
     STATE_CLASS_TOTAL_INCREASING,
 )
 from homeassistant.const import (
-    ELECTRIC_CURRENT_AMPERE,
-    ELECTRIC_POTENTIAL_VOLT,
+    UnitOfElectricCurrent,
+    UnitOfElectricPotential,
     UnitOfEnergy,
     UnitOfPower,
 )
@@ -49,7 +49,7 @@ class TestCompteurEnergyMeter(MultiSensorTests, TuyaDeviceTestCase):
                 {
                     "dps": VOLTAGE_DP,
                     "name": "sensor_voltage",
-                    "unit": ELECTRIC_POTENTIAL_VOLT,
+                    "unit": UnitOfElectricPotential.VOLT,
                     "device_class": SensorDeviceClass.VOLTAGE,
                     "state_class": STATE_CLASS_MEASUREMENT,
                     "testdata": (2348, 234.8),
@@ -57,7 +57,7 @@ class TestCompteurEnergyMeter(MultiSensorTests, TuyaDeviceTestCase):
                 {
                     "dps": CURRENT_DP,
                     "name": "sensor_current",
-                    "unit": ELECTRIC_CURRENT_AMPERE,
+                    "unit": UnitOfElectricCurrent.AMPERE,
                     "device_class": SensorDeviceClass.CURRENT,
                     "state_class": STATE_CLASS_MEASUREMENT,
                     "testdata": (4567, 4.567),

+ 2 - 2
tests/devices/test_devola_patio_heater.py

@@ -5,7 +5,7 @@ from homeassistant.components.climate.const import (
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.const import (
     PERCENTAGE,
-    TIME_MINUTES,
+    UnitOfTime,
     UnitOfTemperature,
 )
 
@@ -55,7 +55,7 @@ class TestDevolaPatioHeater(
             self.entities.get("number_timer"),
             max=1440,
             step=1.0,
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
         )
         self.setUpMultiSensors(
             [

+ 7 - 7
tests/devices/test_digoo_dgsp202.py

@@ -2,9 +2,9 @@
 from homeassistant.components.switch import SwitchDeviceClass
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.const import (
-    ELECTRIC_CURRENT_MILLIAMPERE,
-    ELECTRIC_POTENTIAL_VOLT,
-    TIME_MINUTES,
+    UnitOfElectricCurrent,
+    UnitOfElectricPotential,
+    UnitOfTime,
     UnitOfPower,
 )
 
@@ -53,14 +53,14 @@ class TestDigooDGSP202Switch(
                     "name": "number_timer_1",
                     "max": 1440,
                     "scale": 60,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "dps": TIMER2_DPS,
                     "name": "number_timer_2",
                     "max": 1440,
                     "scale": 60,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
             ]
         )
@@ -69,7 +69,7 @@ class TestDigooDGSP202Switch(
                 {
                     "name": "sensor_voltage",
                     "dps": VOLTAGE_DPS,
-                    "unit": ELECTRIC_POTENTIAL_VOLT,
+                    "unit": UnitOfElectricPotential.VOLT,
                     "device_class": SensorDeviceClass.VOLTAGE,
                     "state_class": "measurement",
                     "testdata": (2300, 230.0),
@@ -77,7 +77,7 @@ class TestDigooDGSP202Switch(
                 {
                     "name": "sensor_current",
                     "dps": CURRENT_DPS,
-                    "unit": ELECTRIC_CURRENT_MILLIAMPERE,
+                    "unit": UnitOfElectricCurrent.MILLIAMPERE,
                     "device_class": SensorDeviceClass.CURRENT,
                     "state_class": "measurement",
                 },

+ 2 - 2
tests/devices/test_eberg_qubo_q40hd_heatpump.py

@@ -8,7 +8,7 @@ from homeassistant.components.climate.const import (
     SWING_VERTICAL,
 )
 from homeassistant.const import (
-    TIME_HOURS,
+    UnitOfTime,
     UnitOfTemperature,
 )
 
@@ -51,7 +51,7 @@ class TestEbergQuboQ40HDHeatpump(
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=24,
-            unit=TIME_HOURS,
+            unit=UnitOfTime.HOURS,
         )
         self.mark_secondary(["number_timer"])
 

+ 2 - 2
tests/devices/test_ecostrad_accentiq_heater.py

@@ -3,7 +3,7 @@ from homeassistant.components.climate.const import (
     HVACMode,
 )
 from homeassistant.const import (
-    TIME_HOURS,
+    UnitOfTime,
     UnitOfTemperature,
 )
 
@@ -38,7 +38,7 @@ class TestEcostradAccentIqHeater(
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=12,
-            unit=TIME_HOURS,
+            unit=UnitOfTime.HOURS,
         )
         self.mark_secondary(["number_timer"])
 

+ 4 - 4
tests/devices/test_energy_monitoring_powerstrip.py

@@ -2,8 +2,8 @@
 from homeassistant.components.sensor import SensorDeviceClass, STATE_CLASS_MEASUREMENT
 from homeassistant.components.switch import SwitchDeviceClass
 from homeassistant.const import (
-    ELECTRIC_CURRENT_MILLIAMPERE,
-    ELECTRIC_POTENTIAL_VOLT,
+    UnitOfElectricCurrent,
+    UnitOfElectricPotential,
     UnitOfPower,
 )
 
@@ -67,7 +67,7 @@ class TestEnergyMonitoringPowerstrip(
                     "name": "sensor_current",
                     "dps": CURRENT_DP,
                     "device_class": SensorDeviceClass.CURRENT,
-                    "unit": ELECTRIC_CURRENT_MILLIAMPERE,
+                    "unit": UnitOfElectricCurrent.MILLIAMPERE,
                     "state_class": STATE_CLASS_MEASUREMENT,
                 },
                 {
@@ -82,7 +82,7 @@ class TestEnergyMonitoringPowerstrip(
                     "name": "sensor_voltage",
                     "dps": VOLTAGE_DP,
                     "device_class": SensorDeviceClass.VOLTAGE,
-                    "unit": ELECTRIC_POTENTIAL_VOLT,
+                    "unit": UnitOfElectricPotential.VOLT,
                     "state_class": STATE_CLASS_MEASUREMENT,
                     "testdata": (2345, 234.5),
                 },

+ 5 - 5
tests/devices/test_es01_powerstrip.py

@@ -1,6 +1,6 @@
 """Tests for the ES01 powerstrip."""
 from homeassistant.components.switch import SwitchDeviceClass
-from homeassistant.const import TIME_MINUTES
+from homeassistant.const import UnitOfTime
 
 from ..const import ES01_POWERSTRIP_PAYLOAD
 from ..mixins.number import MultiNumberTests
@@ -53,28 +53,28 @@ class TestES01Powerstrip(
                     "name": "number_timer_socket_1",
                     "max": 1440,
                     "scale": 60,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "dps": TIMER2_DPS,
                     "name": "number_timer_socket_2",
                     "max": 1440,
                     "scale": 60,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "dps": TIMER3_DPS,
                     "name": "number_timer_socket_3",
                     "max": 1440,
                     "scale": 60,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "dps": TIMERUSB_DPS,
                     "name": "number_usb_timer",
                     "max": 1440,
                     "scale": 60,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
             ]
         )

+ 2 - 2
tests/devices/test_essentials_purifier.py

@@ -4,7 +4,7 @@ from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.const import (
     CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
     PERCENTAGE,
-    TIME_MINUTES,
+    UnitOfTime,
 )
 
 from ..const import ESSENTIALS_PURIFIER_PAYLOAD
@@ -89,7 +89,7 @@ class TestEssentialsPurifier(
                 {
                     "dps": COUNTDOWN_DP,
                     "name": "sensor_timer",
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "dps": PM25_DP,

+ 2 - 2
tests/devices/test_goldair_dehumidifier.py

@@ -3,7 +3,7 @@ from unittest.mock import ANY
 from homeassistant.components.binary_sensor import BinarySensorDeviceClass
 from homeassistant.components.light import ColorMode
 from homeassistant.components.sensor import SensorDeviceClass
-from homeassistant.const import TIME_HOURS, UnitOfTemperature
+from homeassistant.const import UnitOfTime, UnitOfTemperature
 
 from ..const import DEHUMIDIFIER_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -60,7 +60,7 @@ class TestGoldairDehumidifier(
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=24,
-            unit=TIME_HOURS,
+            unit=UnitOfTime.HOURS,
         )
 
         self.setUpMultiSensors(

+ 2 - 2
tests/devices/test_goldair_geco_heater.py

@@ -3,7 +3,7 @@ from homeassistant.components.climate.const import (
     ClimateEntityFeature,
     HVACMode,
 )
-from homeassistant.const import TIME_HOURS, UnitOfTemperature
+from homeassistant.const import UnitOfTime, UnitOfTemperature
 
 from ..const import GECO_HEATER_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -44,7 +44,7 @@ class TestGoldairGECOHeater(
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=24,
-            unit=TIME_HOURS,
+            unit=UnitOfTime.HOURS,
         )
         self.setUpBasicBinarySensor(
             ERROR_DPS,

+ 2 - 2
tests/devices/test_goldair_gpcv_heater.py

@@ -3,7 +3,7 @@ from homeassistant.components.climate.const import (
     ClimateEntityFeature,
     HVACMode,
 )
-from homeassistant.const import TIME_HOURS, UnitOfTemperature
+from homeassistant.const import UnitOfTime, UnitOfTemperature
 
 from ..const import GPCV_HEATER_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -45,7 +45,7 @@ class TestGoldairGPCVHeater(
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=24,
-            unit=TIME_HOURS,
+            unit=UnitOfTime.HOURS,
         )
         self.setUpBasicBinarySensor(
             ERROR_DPS,

+ 2 - 2
tests/devices/test_goldair_gpph_heater.py

@@ -4,7 +4,7 @@ from homeassistant.components.climate.const import (
     HVACMode,
 )
 from homeassistant.components.sensor import SensorDeviceClass
-from homeassistant.const import PERCENTAGE, TIME_MINUTES, UnitOfTemperature
+from homeassistant.const import PERCENTAGE, UnitOfTime, UnitOfTemperature
 
 from ..const import GPPH_HEATER_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -57,7 +57,7 @@ class TestGoldairHeater(
             self.entities.get("number_timer"),
             max=1440,
             step=60,
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
         )
         self.setUpBasicSensor(
             POWERLEVEL_DPS,

+ 7 - 7
tests/devices/test_grid_connect_double_power_point.py

@@ -2,9 +2,9 @@
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.components.switch import SwitchDeviceClass
 from homeassistant.const import (
-    ELECTRIC_CURRENT_MILLIAMPERE,
-    ELECTRIC_POTENTIAL_VOLT,
-    TIME_SECONDS,
+    UnitOfElectricCurrent,
+    UnitOfElectricPotential,
+    UnitOfTime,
     UnitOfEnergy,
     UnitOfPower,
 )
@@ -97,7 +97,7 @@ class TestGridConnectDoubleSwitch(
                     "name": "sensor_current",
                     "dps": CURRENT_DPS,
                     "device_class": SensorDeviceClass.CURRENT,
-                    "unit": ELECTRIC_CURRENT_MILLIAMPERE,
+                    "unit": UnitOfElectricCurrent.MILLIAMPERE,
                     "state_class": "measurement",
                 },
                 {
@@ -112,7 +112,7 @@ class TestGridConnectDoubleSwitch(
                     "name": "sensor_voltage",
                     "dps": VOLTAGE_DPS,
                     "device_class": SensorDeviceClass.VOLTAGE,
-                    "unit": ELECTRIC_POTENTIAL_VOLT,
+                    "unit": UnitOfElectricPotential.VOLT,
                     "state_class": "measurement",
                     "testdata": (2345, 234.5),
                 },
@@ -124,13 +124,13 @@ class TestGridConnectDoubleSwitch(
                     "name": "number_timer_1",
                     "dps": COUNTDOWN1_DPS,
                     "max": 86400,
-                    "unit": TIME_SECONDS,
+                    "unit": UnitOfTime.SECONDS,
                 },
                 {
                     "name": "number_timer_2",
                     "dps": COUNTDOWN2_DPS,
                     "max": 86400,
-                    "unit": TIME_SECONDS,
+                    "unit": UnitOfTime.SECONDS,
                 },
             ]
         )

+ 0 - 1
tests/devices/test_himox_h05_purifier.py

@@ -6,7 +6,6 @@ from homeassistant.components.sensor import (
 )
 from homeassistant.const import (
     PERCENTAGE,
-    TIME_MINUTES,
     UnitOfTemperature,
 )
 

+ 2 - 2
tests/devices/test_himox_h06_purifier.py

@@ -2,7 +2,7 @@ from homeassistant.components.button import ButtonDeviceClass
 from homeassistant.components.fan import FanEntityFeature
 from homeassistant.const import (
     PERCENTAGE,
-    TIME_MINUTES,
+    UnitOfTime,
 )
 
 from ..const import HIMOX_H06_PURIFIER_PAYLOAD
@@ -79,7 +79,7 @@ class TestHimoxH06Purifier(
                 {
                     "dps": COUNTDOWN_DPS,
                     "name": "sensor_timer",
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "dps": AQI_DPS,

+ 2 - 2
tests/devices/test_hysen_hy08we2_thermostat.py

@@ -7,7 +7,7 @@ from homeassistant.components.climate.const import (
     HVACMode,
 )
 from homeassistant.components.sensor import SensorDeviceClass
-from homeassistant.const import TIME_DAYS, UnitOfTemperature
+from homeassistant.const import UnitOfTime, UnitOfTemperature
 
 from ..const import HYSEN_HY08WE2_THERMOSTAT_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -132,7 +132,7 @@ class TestHysenHY08WE2Thermostat(
                     "name": "number_holiday_days",
                     "min": 1,
                     "max": 30,
-                    "unit": TIME_DAYS,
+                    "unit": UnitOfTime.DAYS,
                 },
                 {
                     "dps": HOLIDAYTEMP_DPS,

+ 2 - 2
tests/devices/test_inkbird_itc306a_thermostat.py

@@ -3,7 +3,7 @@ from homeassistant.components.climate.const import (
     ClimateEntityFeature,
     HVACAction,
 )
-from homeassistant.const import TIME_HOURS, UnitOfTemperature
+from homeassistant.const import UnitOfTime, UnitOfTemperature
 
 
 from ..const import INKBIRD_ITC306A_THERMOSTAT_PAYLOAD
@@ -99,7 +99,7 @@ class TestInkbirdThermostat(
                     "name": "number_continuous_heat_hours",
                     "dps": TIME_THRES_DPS,
                     "max": 96,
-                    "unit": TIME_HOURS,
+                    "unit": UnitOfTime.HOURS,
                 },
                 {
                     "name": "number_high_temperature_limit",

+ 2 - 2
tests/devices/test_inkbird_itc308_thermostat.py

@@ -3,7 +3,7 @@ from homeassistant.components.climate.const import (
     ClimateEntityFeature,
     HVACAction,
 )
-from homeassistant.const import TIME_MINUTES, UnitOfTemperature
+from homeassistant.const import UnitOfTime, UnitOfTemperature
 
 
 from ..const import INKBIRD_ITC308_THERMOSTAT_PAYLOAD
@@ -99,7 +99,7 @@ class TestInkbirdITC308Thermostat(
                     "name": "number_compressor_delay",
                     "dps": TIME_THRES_DPS,
                     "max": 10,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "name": "number_high_temperature_limit",

+ 3 - 3
tests/devices/test_inkbird_sousvide.py

@@ -4,7 +4,7 @@ from homeassistant.components.climate.const import (
     HVACAction,
     HVACMode,
 )
-from homeassistant.const import TIME_MINUTES, UnitOfTemperature
+from homeassistant.const import UnitOfTime, UnitOfTemperature
 
 from ..const import INKBIRD_SOUSVIDE_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -53,7 +53,7 @@ class TestInkbirdSousVideCooker(
                     "dps": TIMER_DPS,
                     "name": "number_cooking_time",
                     "max": 5999,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "dps": RECIPE_DPS,
@@ -87,7 +87,7 @@ class TestInkbirdSousVideCooker(
         self.setUpBasicSensor(
             REMAIN_DPS,
             self.entities.get("sensor_remaining_time"),
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
         )
         self.mark_secondary(
             [

+ 2 - 2
tests/devices/test_jjpro_jpd01_dehumidifier.py

@@ -4,7 +4,7 @@ from homeassistant.components.humidifier import HumidifierEntityFeature
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.const import (
     PERCENTAGE,
-    TIME_HOURS,
+    UnitOfTime,
     UnitOfTemperature,
 )
 from ..const import JJPRO_JPD01_PAYLOAD
@@ -48,7 +48,7 @@ class TestJJProJPD01Dehumidifier(
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=24,
-            unit=TIME_HOURS,
+            unit=UnitOfTime.HOURS,
         )
         self.setUpMultiBinarySensors(
             [

+ 2 - 2
tests/devices/test_kogan_kahtp_heater.py

@@ -2,7 +2,7 @@ from homeassistant.components.climate.const import (
     ClimateEntityFeature,
     HVACMode,
 )
-from homeassistant.const import TIME_MINUTES, UnitOfTemperature
+from homeassistant.const import UnitOfTime, UnitOfTemperature
 
 from ..const import KOGAN_HEATER_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -38,7 +38,7 @@ class TestGoldairKoganKAHTPHeater(
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=1440,
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
         )
         self.mark_secondary(["lock_child_lock", "number_timer"])
 

+ 2 - 2
tests/devices/test_kogan_kawfhtp_heater.py

@@ -2,7 +2,7 @@ from homeassistant.components.climate.const import (
     ClimateEntityFeature,
     HVACMode,
 )
-from homeassistant.const import TIME_MINUTES, UnitOfTemperature
+from homeassistant.const import UnitOfTime, UnitOfTemperature
 
 from ..const import KOGAN_KAWFHTP_HEATER_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -41,7 +41,7 @@ class TestGoldairKoganKAHTPHeater(
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=1440,
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
         )
         self.mark_secondary(["lock_child_lock", "number_timer"])
 

+ 2 - 2
tests/devices/test_kyvol_e30_vacuum.py

@@ -8,7 +8,7 @@ from homeassistant.components.vacuum import (
 )
 from homeassistant.const import (
     AREA_SQUARE_METERS,
-    TIME_MINUTES,
+    UnitOfTime,
     PERCENTAGE,
 )
 
@@ -80,7 +80,7 @@ class TestKyvolE30Vacuum(
                 {
                     "dps": TIME_DPS,
                     "name": "sensor_clean_time",
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "dps": EDGE_DPS,

+ 2 - 2
tests/devices/test_lefant_m213_vacuum.py

@@ -7,7 +7,7 @@ from homeassistant.components.vacuum import (
 )
 from homeassistant.const import (
     AREA_SQUARE_METERS,
-    TIME_MINUTES,
+    UnitOfTime,
 )
 
 from ..const import LEFANT_M213_VACUUM_PAYLOAD
@@ -49,7 +49,7 @@ class TestLefantM213Vacuum(MultiSensorTests, TuyaDeviceTestCase):
                 {
                     "dps": TIME_DPS,
                     "name": "sensor_clean_time",
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
             ],
         )

+ 2 - 2
tests/devices/test_lexy_f501_fan.py

@@ -1,5 +1,5 @@
 from homeassistant.components.fan import FanEntityFeature
-from homeassistant.const import TIME_HOURS
+from homeassistant.const import UnitOfTime
 
 from ..const import LEXY_F501_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -39,7 +39,7 @@ class TestLexyF501Fan(
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=7,
-            unit=TIME_HOURS,
+            unit=UnitOfTime.HOURS,
         )
         self.setUpBasicSwitch(SWITCH_DPS, self.entities.get("switch_sound"))
         self.mark_secondary(

+ 6 - 6
tests/devices/test_logicom_powerstrip.py

@@ -1,6 +1,6 @@
 """Tests for the Logicom Strippy 4-way+USB powerstrip."""
 from homeassistant.components.switch import SwitchDeviceClass
-from homeassistant.const import TIME_MINUTES
+from homeassistant.const import UnitOfTime
 
 from ..const import LOGICOM_STRIPPY_PAYLOAD
 from ..mixins.number import MultiNumberTests
@@ -60,35 +60,35 @@ class TestLogicomPowerstrip(
                     "name": "number_timer_1",
                     "max": 1440,
                     "scale": 60,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "dps": TIMER2_DPS,
                     "name": "number_timer_2",
                     "max": 1440,
                     "scale": 60,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "dps": TIMER3_DPS,
                     "name": "number_timer_3",
                     "max": 1440,
                     "scale": 60,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "dps": TIMER4_DPS,
                     "name": "number_timer_4",
                     "max": 1440,
                     "scale": 60,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "dps": TIMERUSB_DPS,
                     "name": "number_usb_timer",
                     "max": 1440,
                     "scale": 60,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
             ]
         )

+ 3 - 3
tests/devices/test_m027_curtain.py

@@ -3,7 +3,7 @@ from homeassistant.components.cover import (
     CoverDeviceClass,
     CoverEntityFeature,
 )
-from homeassistant.const import TIME_MILLISECONDS, TIME_SECONDS
+from homeassistant.const import UnitOfTime
 
 from ..const import M027_CURTAIN_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -35,14 +35,14 @@ class TestM027Curtains(MultiSensorTests, BasicSelectTests, TuyaDeviceTestCase):
                     "name": "sensor_travel_time",
                     "min": 1,
                     "max": 120000,
-                    "unit": TIME_MILLISECONDS,
+                    "unit": UnitOfTime.MILLISECONDS,
                 },
                 {
                     "dps": TIMER_DPS,
                     "name": "sensor_time_remaining",
                     "min": 0,
                     "max": 86400,
-                    "unit": TIME_SECONDS,
+                    "unit": UnitOfTime.SECONDS,
                 },
             ]
         )

+ 6 - 6
tests/devices/test_moes_rgb_socket.py

@@ -7,9 +7,9 @@ from homeassistant.components.light import (
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.components.switch import SwitchDeviceClass
 from homeassistant.const import (
-    ELECTRIC_CURRENT_MILLIAMPERE,
-    ELECTRIC_POTENTIAL_VOLT,
-    TIME_MINUTES,
+    UnitOfElectricCurrent,
+    UnitOfElectricPotential,
+    UnitOfTime,
     UnitOfPower,
 )
 
@@ -60,7 +60,7 @@ class TestMoesRGBWSocket(
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=1440.0,
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
             scale=60,
         )
         self.setUpMultiSensors(
@@ -68,7 +68,7 @@ class TestMoesRGBWSocket(
                 {
                     "name": "sensor_voltage",
                     "dps": VOLTAGE_DPS,
-                    "unit": ELECTRIC_POTENTIAL_VOLT,
+                    "unit": UnitOfElectricPotential.VOLT,
                     "device_class": SensorDeviceClass.VOLTAGE,
                     "state_class": "measurement",
                     "testdata": (2300, 230.0),
@@ -76,7 +76,7 @@ class TestMoesRGBWSocket(
                 {
                     "name": "sensor_current",
                     "dps": CURRENT_DPS,
-                    "unit": ELECTRIC_CURRENT_MILLIAMPERE,
+                    "unit": UnitOfElectricCurrent.MILLIAMPERE,
                     "device_class": SensorDeviceClass.CURRENT,
                     "state_class": "measurement",
                 },

+ 3 - 3
tests/devices/test_moes_temp_humidity.py

@@ -1,5 +1,5 @@
 from homeassistant.components.sensor import SensorDeviceClass
-from homeassistant.const import TIME_SECONDS, UnitOfTemperature
+from homeassistant.const import UnitOfTime, UnitOfTemperature
 
 from ..const import MOES_TEMP_HUMID_PAYLOAD
 from ..mixins.number import MultiNumberTests
@@ -63,13 +63,13 @@ class TestMoesTempHumidity(
                     "dps": TIMER1_DPS,
                     "name": "number_timer_1",
                     "max": 86400,
-                    "unit": TIME_SECONDS,
+                    "unit": UnitOfTime.SECONDS,
                 },
                 {
                     "dps": TIMER2_DPS,
                     "name": "number_timer_2",
                     "max": 86400,
-                    "unit": TIME_SECONDS,
+                    "unit": UnitOfTime.SECONDS,
                 },
             ]
         )

+ 2 - 2
tests/devices/test_nashone_mts700wb_thermostat.py

@@ -4,7 +4,7 @@ from homeassistant.components.climate.const import (
     HVACMode,
 )
 from homeassistant.const import (
-    TIME_MINUTES,
+    UnitOfTime,
 )
 
 from ..const import NASHONE_MTS700WB_THERMOSTAT_PAYLOAD
@@ -76,7 +76,7 @@ class TestNashoneMTS700WBThermostat(
         self.setUpBasicSensor(
             COUNTDOWN_DPS,
             self.entities.get("sensor_timer"),
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
             testdata=(600, 10.0),
         )
         self.setUpBasicSwitch(

+ 2 - 2
tests/devices/test_nedis_htpl20f_heater.py

@@ -5,7 +5,7 @@ from homeassistant.components.climate.const import (
     PRESET_COMFORT,
     PRESET_ECO,
 )
-from homeassistant.const import TIME_MINUTES, UnitOfTemperature
+from homeassistant.const import UnitOfTime, UnitOfTemperature
 
 from ..const import NEDIS_HTPL20F_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -46,7 +46,7 @@ class TestNedisHtpl20fHeater(
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=1440,
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
         )
         self.mark_secondary(["lock_child_lock", "number_timer"])
 

+ 7 - 7
tests/devices/test_parkside_plgs2012a1_smart_charger.py

@@ -1,9 +1,9 @@
 """Tests for Parkside PLGS 2012 A1 Smart Charger"""
 from homeassistant.const import (
-    ELECTRIC_CURRENT_MILLIAMPERE,
-    ELECTRIC_POTENTIAL_VOLT,
+    UnitOfElectricCurrent,
+    UnitOfElectricPotential,
     PERCENTAGE,
-    TIME_MINUTES,
+    UnitOfTime,
     UnitOfTemperature,
 )
 from homeassistant.components.sensor import (
@@ -68,7 +68,7 @@ class TestParksidePLGS2012A1Charger(
                     "dps": CURRENT_DPS,
                     "max": 30000,
                     "step": 100,
-                    "unit": ELECTRIC_CURRENT_MILLIAMPERE,
+                    "unit": UnitOfElectricCurrent.MILLIAMPERE,
                 },
                 {
                     "name": "number_charge_voltage",
@@ -76,7 +76,7 @@ class TestParksidePLGS2012A1Charger(
                     "max": 25.0,
                     "scale": 1000,
                     "step": 0.1,
-                    "unit": ELECTRIC_POTENTIAL_VOLT,
+                    "unit": UnitOfElectricPotential.VOLT,
                 },
             ],
         )
@@ -101,7 +101,7 @@ class TestParksidePLGS2012A1Charger(
                 {
                     "name": "sensor_time_remaining",
                     "dps": REMAIN_DPS,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "name": "sensor_current_temperature",
@@ -113,7 +113,7 @@ class TestParksidePLGS2012A1Charger(
                 {
                     "name": "sensor_max_current",
                     "dps": MAXCURRENT_DPS,
-                    "unit": ELECTRIC_CURRENT_MILLIAMPERE,
+                    "unit": UnitOfElectricCurrent.MILLIAMPERE,
                     "device_class": SensorDeviceClass.CURRENT,
                 },
                 {

+ 11 - 11
tests/devices/test_pc321ty_energy_meter.py

@@ -5,9 +5,9 @@ from homeassistant.components.sensor import (
     STATE_CLASS_TOTAL_INCREASING,
 )
 from homeassistant.const import (
-    ELECTRIC_CURRENT_AMPERE,
-    ELECTRIC_POTENTIAL_VOLT,
-    FREQUENCY_HERTZ,
+    UnitOfElectricCurrent,
+    UnitOfElectricPotential,
+    UnitOfFrequency,
     UnitOfEnergy,
     UnitOfPower,
     UnitOfTemperature,
@@ -60,7 +60,7 @@ class TestPC321TYPowerClamp(MultiSensorTests, TuyaDeviceTestCase):
                 {
                     "dps": VOLTAGE1_DP,
                     "name": "sensor_voltage_a",
-                    "unit": ELECTRIC_POTENTIAL_VOLT,
+                    "unit": UnitOfElectricPotential.VOLT,
                     "device_class": SensorDeviceClass.VOLTAGE,
                     "state_class": STATE_CLASS_MEASUREMENT,
                     "testdata": (2348, 234.8),
@@ -68,7 +68,7 @@ class TestPC321TYPowerClamp(MultiSensorTests, TuyaDeviceTestCase):
                 {
                     "dps": CURRENT1_DP,
                     "name": "sensor_current_a",
-                    "unit": ELECTRIC_CURRENT_AMPERE,
+                    "unit": UnitOfElectricCurrent.AMPERE,
                     "device_class": SensorDeviceClass.CURRENT,
                     "state_class": STATE_CLASS_MEASUREMENT,
                     "testdata": (4567, 4.567),
@@ -98,7 +98,7 @@ class TestPC321TYPowerClamp(MultiSensorTests, TuyaDeviceTestCase):
                 {
                     "dps": VOLTAGE2_DP,
                     "name": "sensor_voltage_b",
-                    "unit": ELECTRIC_POTENTIAL_VOLT,
+                    "unit": UnitOfElectricPotential.VOLT,
                     "device_class": SensorDeviceClass.VOLTAGE,
                     "state_class": STATE_CLASS_MEASUREMENT,
                     "testdata": (2348, 234.8),
@@ -106,7 +106,7 @@ class TestPC321TYPowerClamp(MultiSensorTests, TuyaDeviceTestCase):
                 {
                     "dps": CURRENT2_DP,
                     "name": "sensor_current_b",
-                    "unit": ELECTRIC_CURRENT_AMPERE,
+                    "unit": UnitOfElectricCurrent.AMPERE,
                     "device_class": SensorDeviceClass.CURRENT,
                     "state_class": STATE_CLASS_MEASUREMENT,
                     "testdata": (4567, 4.567),
@@ -136,7 +136,7 @@ class TestPC321TYPowerClamp(MultiSensorTests, TuyaDeviceTestCase):
                 {
                     "dps": VOLTAGE3_DP,
                     "name": "sensor_voltage_c",
-                    "unit": ELECTRIC_POTENTIAL_VOLT,
+                    "unit": UnitOfElectricPotential.VOLT,
                     "device_class": SensorDeviceClass.VOLTAGE,
                     "state_class": STATE_CLASS_MEASUREMENT,
                     "testdata": (2348, 234.8),
@@ -144,7 +144,7 @@ class TestPC321TYPowerClamp(MultiSensorTests, TuyaDeviceTestCase):
                 {
                     "dps": CURRENT3_DP,
                     "name": "sensor_current_c",
-                    "unit": ELECTRIC_CURRENT_AMPERE,
+                    "unit": UnitOfElectricCurrent.AMPERE,
                     "device_class": SensorDeviceClass.CURRENT,
                     "state_class": STATE_CLASS_MEASUREMENT,
                     "testdata": (4567, 4.567),
@@ -174,7 +174,7 @@ class TestPC321TYPowerClamp(MultiSensorTests, TuyaDeviceTestCase):
                 {
                     "dps": TOTALCURRENT_DP,
                     "name": "sensor_total_current",
-                    "unit": ELECTRIC_CURRENT_AMPERE,
+                    "unit": UnitOfElectricCurrent.AMPERE,
                     "device_class": SensorDeviceClass.CURRENT,
                     "state_class": STATE_CLASS_MEASUREMENT,
                     "testdata": (12345, 12.345),
@@ -189,7 +189,7 @@ class TestPC321TYPowerClamp(MultiSensorTests, TuyaDeviceTestCase):
                 {
                     "dps": FREQUENCY_DP,
                     "name": "sensor_frequency",
-                    "unit": FREQUENCY_HERTZ,
+                    "unit": UnitOfFrequency.HERTZ,
                     "state_class": STATE_CLASS_MEASUREMENT,
                     "device_class": SensorDeviceClass.FREQUENCY,
                 },

+ 2 - 2
tests/devices/test_poiema_one_purifier.py

@@ -3,7 +3,7 @@ from homeassistant.components.fan import FanEntityFeature
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.const import (
     CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
-    TIME_MINUTES,
+    UnitOfTime,
 )
 
 from ..const import POIEMA_ONE_PURIFIER_PAYLOAD
@@ -71,7 +71,7 @@ class TestPoeimaOnePurifier(
                 {
                     "dps": COUNTDOWN_DPS,
                     "name": "sensor_timer",
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
             ]
         )

+ 2 - 2
tests/devices/test_qoto_03_sprinkler.py

@@ -1,6 +1,6 @@
 """Tests for the Quto 03 Sprinkler."""
 from homeassistant.components.binary_sensor import BinarySensorDeviceClass
-from homeassistant.const import PERCENTAGE, TIME_SECONDS
+from homeassistant.const import PERCENTAGE, UnitOfTime
 
 from ..const import QOTO_SPRINKLER_PAYLOAD
 from ..mixins.binary_sensor import BasicBinarySensorTests
@@ -44,7 +44,7 @@ class TestQotoSprinkler(
                     "name": "number_timer",
                     "dps": TIMER_DPS,
                     "max": 86399,
-                    "unit": TIME_SECONDS,
+                    "unit": UnitOfTime.SECONDS,
                 },
             ]
         )

+ 2 - 2
tests/devices/test_qs_c01_curtain.py

@@ -3,7 +3,7 @@ from homeassistant.components.cover import (
     CoverDeviceClass,
     CoverEntityFeature,
 )
-from homeassistant.const import TIME_SECONDS
+from homeassistant.const import UnitOfTime
 
 from ..const import QS_C01_CURTAIN_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -28,7 +28,7 @@ class TestQSC01Curtains(BasicNumberTests, BasicSelectTests, TuyaDeviceTestCase):
             self.entities.get("number_travel_time"),
             min=1,
             max=60,
-            unit=TIME_SECONDS,
+            unit=UnitOfTime.SECONDS,
         )
         self.setUpBasicSelect(
             BACKMODE_DPS,

+ 2 - 2
tests/devices/test_rgbcw_lightbulb.py

@@ -4,7 +4,7 @@ from homeassistant.components.light import (
     EFFECT_COLORLOOP,
     EFFECT_RANDOM,
 )
-from homeassistant.const import TIME_MINUTES
+from homeassistant.const import UnitOfTime
 
 from ..const import RGBCW_LIGHTBULB_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -31,7 +31,7 @@ class TestRGBCWLightbulb(BasicNumberTests, TuyaDeviceTestCase):
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=1440.0,
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
             scale=60,
         )
         self.mark_secondary(["number_timer"])

+ 2 - 2
tests/devices/test_simple_switch_with_timer.py

@@ -1,6 +1,6 @@
 """Tests for a simple switch with timer"""
 from homeassistant.components.switch import SwitchDeviceClass
-from homeassistant.const import TIME_MINUTES
+from homeassistant.const import UnitOfTime
 
 from ..const import TIMED_SOCKET_PAYLOAD
 from ..mixins.number import BasicNumberTests
@@ -23,7 +23,7 @@ class TestTimedSwitch(BasicNumberTests, SwitchableTests, TuyaDeviceTestCase):
             self.entities.get("number_timer"),
             max=1440,
             scale=60,
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
         )
         self.mark_secondary(["number_timer"])
 

+ 2 - 2
tests/devices/test_simple_switch_with_timerv2.py

@@ -1,6 +1,6 @@
 """Tests for a simple switch with timer"""
 from homeassistant.components.switch import SwitchDeviceClass
-from homeassistant.const import TIME_MINUTES
+from homeassistant.const import UnitOfTime
 
 from ..const import TIMED_SOCKETV2_PAYLOAD
 from ..mixins.number import BasicNumberTests
@@ -23,7 +23,7 @@ class TestTimedSwitch(BasicNumberTests, SwitchableTests, TuyaDeviceTestCase):
             self.entities.get("number_timer"),
             max=1440,
             scale=60,
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
         )
         self.mark_secondary(["number_timer"])
 

+ 2 - 2
tests/devices/test_smartplug_encoded.py

@@ -1,7 +1,7 @@
 """Tests for the switch entity."""
 from homeassistant.components.switch import SwitchDeviceClass
 from homeassistant.const import (
-    TIME_MINUTES,
+    UnitOfTime,
 )
 
 from ..const import SMARTPLUG_ENCODED_PAYLOAD
@@ -27,7 +27,7 @@ class TestSwitchEncoded(BasicNumberTests, SwitchableTests, TuyaDeviceTestCase):
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=1440.0,
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
             scale=60,
         )
         self.mark_secondary(["number_timer"])

+ 6 - 6
tests/devices/test_smartplugv1.py

@@ -2,9 +2,9 @@
 from homeassistant.components.switch import SwitchDeviceClass
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.const import (
-    ELECTRIC_CURRENT_MILLIAMPERE,
-    ELECTRIC_POTENTIAL_VOLT,
-    TIME_MINUTES,
+    UnitOfElectricCurrent,
+    UnitOfElectricPotential,
+    UnitOfTime,
     UnitOfPower,
 )
 
@@ -34,7 +34,7 @@ class TestKoganSwitch(
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=1440.0,
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
             scale=60,
         )
         self.setUpMultiSensors(
@@ -42,7 +42,7 @@ class TestKoganSwitch(
                 {
                     "name": "sensor_voltage",
                     "dps": VOLTAGE_DPS,
-                    "unit": ELECTRIC_POTENTIAL_VOLT,
+                    "unit": UnitOfElectricPotential.VOLT,
                     "device_class": SensorDeviceClass.VOLTAGE,
                     "state_class": "measurement",
                     "testdata": (2300, 230.0),
@@ -50,7 +50,7 @@ class TestKoganSwitch(
                 {
                     "name": "sensor_current",
                     "dps": CURRENT_DPS,
-                    "unit": ELECTRIC_CURRENT_MILLIAMPERE,
+                    "unit": UnitOfElectricCurrent.MILLIAMPERE,
                     "device_class": SensorDeviceClass.CURRENT,
                     "state_class": "measurement",
                 },

+ 6 - 6
tests/devices/test_smartplugv2.py

@@ -2,9 +2,9 @@
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.components.switch import SwitchDeviceClass
 from homeassistant.const import (
-    ELECTRIC_CURRENT_MILLIAMPERE,
-    ELECTRIC_POTENTIAL_VOLT,
-    TIME_MINUTES,
+    UnitOfElectricCurrent,
+    UnitOfElectricPotential,
+    UnitOfTime,
     UnitOfPower,
 )
 
@@ -34,7 +34,7 @@ class TestSwitchV2(
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=1440.0,
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
             scale=60,
         )
         self.setUpMultiSensors(
@@ -42,7 +42,7 @@ class TestSwitchV2(
                 {
                     "name": "sensor_voltage",
                     "dps": VOLTAGE_DPS,
-                    "unit": ELECTRIC_POTENTIAL_VOLT,
+                    "unit": UnitOfElectricPotential.VOLT,
                     "device_class": SensorDeviceClass.VOLTAGE,
                     "state_class": "measurement",
                     "testdata": (2300, 230.0),
@@ -50,7 +50,7 @@ class TestSwitchV2(
                 {
                     "name": "sensor_current",
                     "dps": CURRENT_DPS,
-                    "unit": ELECTRIC_CURRENT_MILLIAMPERE,
+                    "unit": UnitOfElectricCurrent.MILLIAMPERE,
                     "device_class": SensorDeviceClass.CURRENT,
                     "state_class": "measurement",
                 },

+ 6 - 6
tests/devices/test_smartplugv2_energy.py

@@ -3,9 +3,9 @@ from homeassistant.components.binary_sensor import BinarySensorDeviceClass
 from homeassistant.components.sensor import SensorDeviceClass
 from homeassistant.components.switch import SwitchDeviceClass
 from homeassistant.const import (
-    ELECTRIC_CURRENT_MILLIAMPERE,
-    ELECTRIC_POTENTIAL_VOLT,
-    TIME_MINUTES,
+    UnitOfElectricCurrent,
+    UnitOfElectricPotential,
+    UnitOfTime,
     UnitOfEnergy,
     UnitOfPower,
 )
@@ -71,7 +71,7 @@ class TestSwitchV2Energy(
             TIMER_DPS,
             self.entities.get("number_timer"),
             max=1440.0,
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
             scale=60,
         )
         self.setUpBasicSelect(
@@ -95,7 +95,7 @@ class TestSwitchV2Energy(
                 {
                     "name": "sensor_voltage",
                     "dps": VOLTAGE_DPS,
-                    "unit": ELECTRIC_POTENTIAL_VOLT,
+                    "unit": UnitOfElectricPotential.VOLT,
                     "device_class": SensorDeviceClass.VOLTAGE,
                     "state_class": "measurement",
                     "testdata": (2300, 230.0),
@@ -103,7 +103,7 @@ class TestSwitchV2Energy(
                 {
                     "name": "sensor_current",
                     "dps": CURRENT_DPS,
-                    "unit": ELECTRIC_CURRENT_MILLIAMPERE,
+                    "unit": UnitOfElectricCurrent.MILLIAMPERE,
                     "device_class": SensorDeviceClass.CURRENT,
                     "state_class": "measurement",
                 },

+ 2 - 2
tests/devices/test_tmwf02_fan.py

@@ -1,6 +1,6 @@
 from homeassistant.components.fan import FanEntityFeature
 from homeassistant.const import (
-    TIME_MINUTES,
+    UnitOfTime,
 )
 from ..const import TMWF02_FAN_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -26,7 +26,7 @@ class TestTMWF02Fan(BasicNumberTests, SwitchableTests, TuyaDeviceTestCase):
             self.entities.get("number_timer"),
             max=1440,
             scale=60,
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
         )
         self.mark_secondary(["number_timer"])
 

+ 2 - 2
tests/devices/test_treatlife_ds02f.py

@@ -1,5 +1,5 @@
 from homeassistant.components.fan import FanEntityFeature
-from homeassistant.const import TIME_MINUTES
+from homeassistant.const import UnitOfTime
 
 from ..const import TREATLIFE_DS02F_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -24,7 +24,7 @@ class TestTreatlifeFan(SwitchableTests, BasicNumberTests, TuyaDeviceTestCase):
             self.entities.get("number_timer"),
             max=1440.0,
             scale=60,
-            unit=TIME_MINUTES,
+            unit=UnitOfTime.MINUTES,
         )
         self.mark_secondary(["number_timer"])
 

+ 2 - 2
tests/devices/test_vork_vk6067aw_purifier.py

@@ -3,7 +3,7 @@ from homeassistant.components.button import ButtonDeviceClass
 from homeassistant.components.fan import FanEntityFeature
 from homeassistant.const import (
     PERCENTAGE,
-    TIME_MINUTES,
+    UnitOfTime,
 )
 
 from ..const import VORK_VK6067_PURIFIER_PAYLOAD
@@ -75,7 +75,7 @@ class TestVorkVK6267AWPurifier(
                 {
                     "dps": COUNTDOWN_DPS,
                     "name": "sensor_timer",
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "dps": FILTER_DPS,

+ 2 - 2
tests/devices/test_wetair_wch750_heater.py

@@ -5,7 +5,7 @@ from homeassistant.components.climate.const import (
     PRESET_COMFORT,
     PRESET_BOOST,
 )
-from homeassistant.const import TIME_MINUTES, UnitOfTemperature
+from homeassistant.const import UnitOfTime, UnitOfTemperature
 
 from ..const import WETAIR_WCH750_HEATER_PAYLOAD
 from ..helpers import assert_device_properties_set
@@ -85,7 +85,7 @@ class TestWetairWCH750Heater(
             },
         )
         self.setUpBasicSensor(
-            COUNTDOWN_DPS, self.entities.get("sensor_timer"), unit=TIME_MINUTES
+            COUNTDOWN_DPS, self.entities.get("sensor_timer"), unit=UnitOfTime.MINUTES
         )
         self.mark_secondary(
             [

+ 5 - 5
tests/devices/test_woox_r4028_powerstrip.py

@@ -1,6 +1,6 @@
 """Tests for the Woox R4028 powerstrip."""
 from homeassistant.components.switch import SwitchDeviceClass
-from homeassistant.const import TIME_MINUTES
+from homeassistant.const import UnitOfTime
 
 from ..const import WOOX_R4028_SOCKET_PAYLOAD
 from ..mixins.number import MultiNumberTests
@@ -53,28 +53,28 @@ class TestWooxR4028Powerstrip(
                     "name": "number_timer_1",
                     "max": 1440,
                     "scale": 60,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "dps": TIMER2_DPS,
                     "name": "number_timer_2",
                     "max": 1440,
                     "scale": 60,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "dps": TIMER3_DPS,
                     "name": "number_timer_3",
                     "max": 1440,
                     "scale": 60,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
                 {
                     "dps": TIMERUSB_DPS,
                     "name": "number_usb_timer",
                     "max": 1440,
                     "scale": 60,
-                    "unit": TIME_MINUTES,
+                    "unit": UnitOfTime.MINUTES,
                 },
             ]
         )