Ensure HomeKit passes min/max mireds as ints (#54372)

This commit is contained in:
J. Nick Koston 2021-08-10 20:28:01 -05:00 committed by GitHub
parent e99576c094
commit d0b11568cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 2 deletions

View file

@ -15,6 +15,8 @@ from homeassistant.components.light import (
ATTR_BRIGHTNESS_PCT,
ATTR_COLOR_TEMP,
ATTR_HS_COLOR,
ATTR_MAX_MIREDS,
ATTR_MIN_MIREDS,
ATTR_SUPPORTED_COLOR_MODES,
DOMAIN,
)
@ -639,6 +641,26 @@ async def test_light_set_brightness_and_color(hass, hk_driver, events):
)
async def test_light_min_max_mireds(hass, hk_driver, events):
"""Test mireds are forced to ints."""
entity_id = "light.demo"
hass.states.async_set(
entity_id,
STATE_ON,
{
ATTR_SUPPORTED_COLOR_MODES: ["color_temp"],
ATTR_BRIGHTNESS: 255,
ATTR_MAX_MIREDS: 500.5,
ATTR_MIN_MIREDS: 100.5,
},
)
await hass.async_block_till_done()
acc = Light(hass, hk_driver, "Light", entity_id, 1, None)
acc.char_color_temp.properties["maxValue"] == 500
acc.char_color_temp.properties["minValue"] == 100
async def test_light_set_brightness_and_color_temp(hass, hk_driver, events):
"""Test light with all chars in one go."""
entity_id = "light.demo"