1
0
mirror of https://github.com/natekspencer/hacs-oasis_mini.git synced 2025-11-16 17:13:49 -05:00

Handle empty color code

This commit is contained in:
Nathan Spencer
2024-08-06 09:36:59 -06:00
parent 3f4f7720c0
commit 99bf3b2ef0
2 changed files with 40 additions and 31 deletions

View File

@@ -68,8 +68,10 @@ class OasisMiniLightEntity(OasisMiniEntity, LightEntity):
return self.device.brightness > 0
@property
def rgb_color(self) -> tuple[int, int, int]:
def rgb_color(self) -> tuple[int, int, int] | None:
"""Return the rgb color value [int, int, int]."""
if not self.device.color:
return None
return rgb_hex_to_rgb_list(self.device.color.replace("#", ""))
@property