forked from home-assistant/core
Ensure HomeKit passes min/max mireds as ints - adapted from #54372
This commit is contained in:
committed by
Paulus Schoutsen
parent
c6fc5e35fe
commit
5fc5b53c01
@@ -1,5 +1,6 @@
|
|||||||
"""Class to hold all light accessories."""
|
"""Class to hold all light accessories."""
|
||||||
import logging
|
import logging
|
||||||
|
import math
|
||||||
|
|
||||||
from pyhap.const import CATEGORY_LIGHTBULB
|
from pyhap.const import CATEGORY_LIGHTBULB
|
||||||
|
|
||||||
@@ -115,8 +116,8 @@ class Light(HomeAccessory):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if self.is_color_temp_supported:
|
if self.is_color_temp_supported:
|
||||||
min_mireds = attributes.get(ATTR_MIN_MIREDS, 153)
|
min_mireds = math.floor(attributes.get(ATTR_MIN_MIREDS, 153))
|
||||||
max_mireds = attributes.get(ATTR_MAX_MIREDS, 500)
|
max_mireds = math.ceil(attributes.get(ATTR_MAX_MIREDS, 500))
|
||||||
serv_light = serv_light_secondary or serv_light_primary
|
serv_light = serv_light_secondary or serv_light_primary
|
||||||
self.char_color_temperature = serv_light.configure_char(
|
self.char_color_temperature = serv_light.configure_char(
|
||||||
CHAR_COLOR_TEMPERATURE,
|
CHAR_COLOR_TEMPERATURE,
|
||||||
|
Reference in New Issue
Block a user