fixed for HA 2023.11.0b1

This commit is contained in:
Johannes
2023-10-28 11:38:43 +02:00
committed by GitHub
parent ffcd872f4a
commit e2223ac7a6

View File

@@ -96,16 +96,17 @@ class LuiPagesGen(object):
if state == "sunny":
icon_color = 65504 #bright-yellow
if "rgb_color" in attr:
if "rgb_color" in attr and attr.rgb_color:
color = attr.rgb_color
if "brightness" in attr:
if "brightness" in attr and attr.brightness:
color = rgb_brightness(color, attr.brightness)
icon_color = rgb_dec565(color)
elif "brightness" in attr:
elif "brightness" in attr and attr.brightness:
color = rgb_brightness([253, 216, 53], attr.brightness)
icon_color = rgb_dec565(color)
return icon_color
def update_time(self, kwargs):
time = datetime.datetime.now().strftime(self._config.get("timeFormat"))
addTemplate = self._config.get("timeAdditionalTemplate")
@@ -787,13 +788,13 @@ class LuiPagesGen(object):
if "onoff" not in entity.attributes.supported_color_modes:
brightness = 0
if entity.state == "on":
if "brightness" in entity.attributes:
if "brightness" in entity.attributes and entity.attributes.brightness:
# scale 0-255 brightness from ha to 0-100
brightness = int(scale(entity.attributes.brightness,(0,255),(0,100)))
else:
brightness = "disable"
if "color_temp" in entity.attributes.supported_color_modes:
if "color_temp" in entity.attributes:
if "color_temp" in entity.attributes.supported_color_modes and entity.attributes.supported_color_modes:
if "color_temp" in entity.attributes and entity.attributes.color_temp:
# scale ha color temp range to 0-100
color_temp = int(scale(entity.attributes.color_temp,(entity.attributes.min_mireds, entity.attributes.max_mireds),(0,100)))
else: