test_woox_r4028_powerstrip.py 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. """Tests for the Woox R4028 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 WOOX_R4028_SOCKET_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. SWITCHUSB_DPS = "7"
  13. TIMER1_DPS = "101"
  14. TIMER2_DPS = "102"
  15. TIMER3_DPS = "103"
  16. TIMERUSB_DPS = "105"
  17. class TestWooxR4028Powerstrip(
  18. MultiNumberTests,
  19. MultiSwitchTests,
  20. TuyaDeviceTestCase,
  21. ):
  22. __test__ = True
  23. def setUp(self):
  24. self.setUpForConfig("woox_r4028_powerstrip.yaml", WOOX_R4028_SOCKET_PAYLOAD)
  25. self.setUpMultiSwitch(
  26. [
  27. {
  28. "dps": SWITCH1_DPS,
  29. "name": "switch_outlet_1",
  30. "device_class": SwitchDeviceClass.OUTLET,
  31. },
  32. {
  33. "dps": SWITCH2_DPS,
  34. "name": "switch_outlet_2",
  35. "device_class": SwitchDeviceClass.OUTLET,
  36. },
  37. {
  38. "dps": SWITCH3_DPS,
  39. "name": "switch_outlet_3",
  40. "device_class": SwitchDeviceClass.OUTLET,
  41. },
  42. {
  43. "dps": SWITCHUSB_DPS,
  44. "name": "switch_usb_switch",
  45. "device_class": SwitchDeviceClass.SWITCH,
  46. },
  47. ]
  48. )
  49. self.setUpMultiNumber(
  50. [
  51. {
  52. "dps": TIMER1_DPS,
  53. "name": "number_timer_1",
  54. "max": 86400,
  55. "unit": UnitOfTime.SECONDS,
  56. "device_class": NumberDeviceClass.DURATION,
  57. },
  58. {
  59. "dps": TIMER2_DPS,
  60. "name": "number_timer_2",
  61. "max": 86400,
  62. "unit": UnitOfTime.SECONDS,
  63. "device_class": NumberDeviceClass.DURATION,
  64. },
  65. {
  66. "dps": TIMER3_DPS,
  67. "name": "number_timer_3",
  68. "max": 86400,
  69. "unit": UnitOfTime.SECONDS,
  70. "device_class": NumberDeviceClass.DURATION,
  71. },
  72. {
  73. "dps": TIMERUSB_DPS,
  74. "name": "number_usb_timer",
  75. "max": 86400,
  76. "unit": UnitOfTime.SECONDS,
  77. "device_class": NumberDeviceClass.DURATION,
  78. },
  79. ]
  80. )
  81. self.mark_secondary(
  82. [
  83. "number_timer_1",
  84. "number_timer_2",
  85. "number_timer_3",
  86. "number_usb_timer",
  87. ]
  88. )