Ensure HomeKit passes min/max mireds as ints - adapted from #54372

This commit is contained in:
J. Nick Koston
2021-08-10 20:28:01 -05:00
committed by Paulus Schoutsen
parent c6fc5e35fe
commit 5fc5b53c01

View File

@@ -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,