test_logicom_powerstrip.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. {"dps": SWITCHUSB_DPS, "name": "switch_usb_switch"},
  49. ]
  50. )
  51. self.setUpMultiNumber(
  52. [
  53. {
  54. "dps": TIMER1_DPS,
  55. "name": "number_timer_1",
  56. "max": 1440,
  57. "scale": 60,
  58. "unit": UnitOfTime.MINUTES,
  59. },
  60. {
  61. "dps": TIMER2_DPS,
  62. "name": "number_timer_2",
  63. "max": 1440,
  64. "scale": 60,
  65. "unit": UnitOfTime.MINUTES,
  66. },
  67. {
  68. "dps": TIMER3_DPS,
  69. "name": "number_timer_3",
  70. "max": 1440,
  71. "scale": 60,
  72. "unit": UnitOfTime.MINUTES,
  73. },
  74. {
  75. "dps": TIMER4_DPS,
  76. "name": "number_timer_4",
  77. "max": 1440,
  78. "scale": 60,
  79. "unit": UnitOfTime.MINUTES,
  80. },
  81. {
  82. "dps": TIMERUSB_DPS,
  83. "name": "number_usb_timer",
  84. "max": 1440,
  85. "scale": 60,
  86. "unit": UnitOfTime.MINUTES,
  87. },
  88. ]
  89. )
  90. self.mark_secondary(
  91. [
  92. "number_timer_1",
  93. "number_timer_2",
  94. "number_timer_3",
  95. "number_timer_4",
  96. "number_usb_timer",
  97. ]
  98. )