Use hue/sat as internal light color interface (#11288)

* Accept and report both xy and RGB color for lights

* Fix demo light supported_features

* Add new XY color util functions

* Always make color changes available as xy and RGB

* Always expose color as RGB and XY

* Consolidate color supported_features

* Test fixes

* Additional test fix

* Use hue/sat as the hass core color interface

* Tests updates

* Assume MQTT RGB devices need full RGB brightness

* Convert new platforms

* More migration

* Use float for HS API

* Fix backwards conversion for KNX lights

* Adjust limitless min saturation for new scale
This commit is contained in:
Adam Mills 2018-03-18 18:00:29 -04:00 committed by Paulus Schoutsen
parent 6b059489a6
commit 89c7c80e42
57 changed files with 898 additions and 965 deletions

View file

@ -361,12 +361,10 @@ async def test_color_spectrum_light(hass):
"""Test ColorSpectrum trait support for light domain."""
assert not trait.ColorSpectrumTrait.supported(light.DOMAIN, 0)
assert trait.ColorSpectrumTrait.supported(light.DOMAIN,
light.SUPPORT_RGB_COLOR)
assert trait.ColorSpectrumTrait.supported(light.DOMAIN,
light.SUPPORT_XY_COLOR)
light.SUPPORT_COLOR)
trt = trait.ColorSpectrumTrait(State('light.bla', STATE_ON, {
light.ATTR_RGB_COLOR: [255, 10, 10]
light.ATTR_HS_COLOR: (0, 94),
}))
assert trt.sync_attributes() == {
@ -375,7 +373,7 @@ async def test_color_spectrum_light(hass):
assert trt.query_attributes() == {
'color': {
'spectrumRGB': 16714250
'spectrumRGB': 16715535
}
}
@ -399,7 +397,7 @@ async def test_color_spectrum_light(hass):
assert len(calls) == 1
assert calls[0].data == {
ATTR_ENTITY_ID: 'light.bla',
light.ATTR_RGB_COLOR: [16, 16, 255]
light.ATTR_HS_COLOR: (240, 93.725),
}