Convert color temperature to hue and saturation for HomeKit (#40089)
The HomeKit spec does not permit the color temp characteristic being exposed when color (hue, sat) is present. Since Home Assistant will still send color temp values, we need to convert them to hue, sat values for HomeKit
This commit is contained in:
parent
8d687c951a
commit
2ea604cc2a
2 changed files with 30 additions and 3 deletions
|
@ -293,9 +293,25 @@ async def test_light_color_temperature_and_rgb_color(hass, hk_driver, cls, event
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
acc = cls.light(hass, hk_driver, "Light", entity_id, 2, None)
|
||||
assert acc.char_hue.value == 260
|
||||
assert acc.char_saturation.value == 90
|
||||
|
||||
assert not hasattr(acc, "char_color_temperature")
|
||||
|
||||
hass.states.async_set(entity_id, STATE_ON, {ATTR_COLOR_TEMP: 224})
|
||||
await hass.async_block_till_done()
|
||||
await acc.run_handler()
|
||||
await hass.async_block_till_done()
|
||||
assert acc.char_hue.value == 27
|
||||
assert acc.char_saturation.value == 27
|
||||
|
||||
hass.states.async_set(entity_id, STATE_ON, {ATTR_COLOR_TEMP: 352})
|
||||
await hass.async_block_till_done()
|
||||
await acc.run_handler()
|
||||
await hass.async_block_till_done()
|
||||
assert acc.char_hue.value == 28
|
||||
assert acc.char_saturation.value == 61
|
||||
|
||||
|
||||
async def test_light_rgb_color(hass, hk_driver, cls, events):
|
||||
"""Test light with rgb_color."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue