test_ledvance_light.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. """Tests for Ledvance Panel lighting, in particular the combined settings"""
  2. from ..const import LEDVANCE_PANEL_PAYLOAD
  3. from ..helpers import assert_device_properties_set
  4. from .base_device_tests import TuyaDeviceTestCase
  5. POWER_DP = "20"
  6. COMBO_DP = "51"
  7. class TestLedvanceLight(TuyaDeviceTestCase):
  8. """
  9. Tests for Ledvance Panel lighting.
  10. """
  11. __test__ = True
  12. def setUp(self):
  13. self.setUpForConfig(
  14. "ledvance_smart_plabl100x25b.yaml",
  15. LEDVANCE_PANEL_PAYLOAD,
  16. )
  17. self.white = self.entities.get("light")
  18. self.color = self.entities.get("light_backlight")
  19. self.mark_secondary(["number_timer", "time_timer"])
  20. async def test_color_combined_bright(self):
  21. self.dps[COMBO_DP] = "AAcAOQPoA+gCngDI"
  22. self.assertEqual(self.color.brightness, 255)
  23. self.assertEqual(self.white.brightness, 171)
  24. async with assert_device_properties_set(
  25. self.white._device,
  26. {COMBO_DP: "AAcAOQPoA+gD6ADI"},
  27. ):
  28. await self.white.async_turn_on(brightness=255)
  29. async def test_color_combined_rgb(self):
  30. self.dps[COMBO_DP] = "AAcAOQPoA+gCngDI"
  31. self.assertSequenceEqual(self.color.hs_color, (57, 100))
  32. async with assert_device_properties_set(
  33. self.color._device,
  34. {COMBO_DP: "AAcAtAPoA+gCngDI"},
  35. ):
  36. await self.color.async_turn_on(hs_color=(180, 100))