test_ledvance_light.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. def setUp(self):
  12. self.setUpForConfig(
  13. "ledvance_smart_plabl100x25b.yaml",
  14. LEDVANCE_PANEL_PAYLOAD,
  15. )
  16. self.white = self.entities.get("light")
  17. self.color = self.entities.get("light_backlight")
  18. self.mark_secondary(["number_timer", "time_timer"])
  19. async def test_color_combined_bright(self):
  20. self.dps[COMBO_DP] = "AAcAOQPoA+gCngDI"
  21. self.assertEqual(self.color.brightness, 255)
  22. self.assertEqual(self.white.brightness, 171)
  23. async with assert_device_properties_set(
  24. self.white._device,
  25. {COMBO_DP: "AAcAOQPoA+gD6ADI"},
  26. ):
  27. await self.white.async_turn_on(brightness=255)
  28. async def test_color_combined_rgb(self):
  29. self.dps[COMBO_DP] = "AAcAOQPoA+gCngDI"
  30. self.assertSequenceEqual(self.color.hs_color, (57, 100))
  31. async with assert_device_properties_set(
  32. self.color._device,
  33. {COMBO_DP: "AAcAtAPoA+gCngDI"},
  34. ):
  35. await self.color.async_turn_on(hs_color=(180, 100))