Add kelvin/brightness_pct alternatives to light.turn_on (#7596)

* Refactor color profiles to a class

* Refactor into preprocess_turn_on_alternatives

* LIFX: use light.preprocess_turn_on_alternatives

This avoids the color_name duplication and gains support for profile.

* Add kelvin parameter to light.turn_on

* Add brightness_pct parameter to light.turn_on

* LIFX: accept brightness_pct in effects

* Add test of kelvin/brightness_pct conversions
This commit is contained in:
Anders Melchiorsen authored and Paulus Schoutsen committed 2017-05-16 23:00:46 -07:00
1 parent 9dcc0b5ef5
commit ed5f94fd8a
5 files changed
+106 -54

No files matched your search

+5
View File
@@ -56,6 +56,11 @@ class TestDemoLight(unittest.TestCase):
self.assertEqual(154, state.attributes.get(light.ATTR_MIN_MIREDS))
self.assertEqual(500, state.attributes.get(light.ATTR_MAX_MIREDS))
self.assertEqual('none', state.attributes.get(light.ATTR_EFFECT))
light.turn_on(self.hass, ENTITY_LIGHT, kelvin=4000, brightness_pct=50)
self.hass.block_till_done()
state = self.hass.states.get(ENTITY_LIGHT)
self.assertEqual(250, state.attributes.get(light.ATTR_COLOR_TEMP))
self.assertEqual(127, state.attributes.get(light.ATTR_BRIGHTNESS))
def test_turn_off(self):
"""Test light turn off method."""