1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Light effects (#4538)

* Add support for light effects

* Move PLATFORM_SCHEMA changes in light to mqtt_template

* Add effect validation

* Add unittests

* Add light effect to demo and unittests

* Use cv.string for config validation

* Use cv.ensure_list for config validation

* Fix typo

* Remove unused exception management for effect
This commit is contained in:
Antoine Bertin
2016-11-28 02:15:28 +01:00
committed by Paulus Schoutsen
parent cf57db919e
commit f0db698f75
5 changed files with 120 additions and 24 deletions

View File

@@ -37,6 +37,7 @@ class TestDemoClimate(unittest.TestCase):
self.assertEqual(25, state.attributes.get(light.ATTR_BRIGHTNESS))
self.assertEqual(
(82, 91, 0), state.attributes.get(light.ATTR_RGB_COLOR))
self.assertEqual('rainbow', state.attributes.get(light.ATTR_EFFECT))
light.turn_on(
self.hass, ENTITY_LIGHT, rgb_color=(251, 252, 253),
white_value=254)
@@ -45,10 +46,11 @@ class TestDemoClimate(unittest.TestCase):
self.assertEqual(254, state.attributes.get(light.ATTR_WHITE_VALUE))
self.assertEqual(
(251, 252, 253), state.attributes.get(light.ATTR_RGB_COLOR))
light.turn_on(self.hass, ENTITY_LIGHT, color_temp=400)
light.turn_on(self.hass, ENTITY_LIGHT, color_temp=400, effect='none')
self.hass.block_till_done()
state = self.hass.states.get(ENTITY_LIGHT)
self.assertEqual(400, state.attributes.get(light.ATTR_COLOR_TEMP))
self.assertEqual('none', state.attributes.get(light.ATTR_EFFECT))
def test_turn_off(self):
"""Test light turn off method."""