test_logicom_powerstrip.py 3.3 KB

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