test_logicom_powerstrip.py 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. """Tests for the Logicom Strippy 4-way+USB powerstrip."""
  2. from homeassistant.components.number import NumberDeviceClass
  3. from homeassistant.components.switch import SwitchDeviceClass
  4. from homeassistant.const import UnitOfTime
  5. from ..const import LOGICOM_STRIPPY_PAYLOAD
  6. from ..mixins.number import MultiNumberTests
  7. from ..mixins.switch import MultiSwitchTests
  8. from .base_device_tests import TuyaDeviceTestCase
  9. SWITCH1_DPS = "1"
  10. SWITCH2_DPS = "2"
  11. SWITCH3_DPS = "3"
  12. SWITCH4_DPS = "4"
  13. SWITCHUSB_DPS = "5"
  14. TIMER1_DPS = "9"
  15. TIMER2_DPS = "10"
  16. TIMER3_DPS = "11"
  17. TIMER4_DPS = "12"
  18. TIMERUSB_DPS = "13"
  19. class TestLogicomPowerstrip(
  20. MultiNumberTests,
  21. MultiSwitchTests,
  22. TuyaDeviceTestCase,
  23. ):
  24. __test__ = True
  25. def setUp(self):
  26. self.setUpForConfig("logicom_powerstrip.yaml", LOGICOM_STRIPPY_PAYLOAD)
  27. self.setUpMultiSwitch(
  28. [
  29. {
  30. "dps": SWITCH1_DPS,
  31. "name": "switch_outlet_1",
  32. "device_class": SwitchDeviceClass.OUTLET,
  33. },
  34. {
  35. "dps": SWITCH2_DPS,
  36. "name": "switch_outlet_2",
  37. "device_class": SwitchDeviceClass.OUTLET,
  38. },
  39. {
  40. "dps": SWITCH3_DPS,
  41. "name": "switch_outlet_3",
  42. "device_class": SwitchDeviceClass.OUTLET,
  43. },
  44. {
  45. "dps": SWITCH4_DPS,
  46. "name": "switch_outlet_4",
  47. "device_class": SwitchDeviceClass.OUTLET,
  48. },
  49. {
  50. "dps": SWITCHUSB_DPS,
  51. "name": "switch_usb_switch",
  52. "device_class": SwitchDeviceClass.SWITCH,
  53. },
  54. ]
  55. )
  56. self.setUpMultiNumber(
  57. [
  58. {
  59. "dps": TIMER1_DPS,
  60. "name": "number_timer_1",
  61. "max": 1440,
  62. "scale": 60,
  63. "device_class": NumberDeviceClass.DURATION,
  64. "unit": UnitOfTime.MINUTES,
  65. },
  66. {
  67. "dps": TIMER2_DPS,
  68. "name": "number_timer_2",
  69. "max": 1440,
  70. "scale": 60,
  71. "device_class": NumberDeviceClass.DURATION,
  72. "unit": UnitOfTime.MINUTES,
  73. },
  74. {
  75. "dps": TIMER3_DPS,
  76. "name": "number_timer_3",
  77. "max": 1440,
  78. "scale": 60,
  79. "device_class": NumberDeviceClass.DURATION,
  80. "unit": UnitOfTime.MINUTES,
  81. },
  82. {
  83. "dps": TIMER4_DPS,
  84. "name": "number_timer_4",
  85. "max": 1440,
  86. "scale": 60,
  87. "device_class": NumberDeviceClass.DURATION,
  88. "unit": UnitOfTime.MINUTES,
  89. },
  90. {
  91. "dps": TIMERUSB_DPS,
  92. "name": "number_usb_timer",
  93. "max": 1440,
  94. "scale": 60,
  95. "device_class": NumberDeviceClass.DURATION,
  96. "unit": UnitOfTime.MINUTES,
  97. },
  98. ]
  99. )
  100. self.mark_secondary(
  101. [
  102. "number_timer_1",
  103. "number_timer_2",
  104. "number_timer_3",
  105. "number_timer_4",
  106. "number_usb_timer",
  107. "time_timer_1",
  108. "time_timer_2",
  109. "time_timer_3",
  110. "time_timer_4",
  111. "time_timer_usb",
  112. ]
  113. )