diff color_convert.py @ 21:b8201490c731

more light types
author drewp@bigasterisk.com
date Mon, 29 Jan 2024 12:27:08 -0800
parents 24a574108365
children ecbbf76318bb
line wrap: on
line diff
--- a/color_convert.py	Mon Jan 29 11:52:43 2024 -0800
+++ b/color_convert.py	Mon Jan 29 12:27:08 2024 -0800
@@ -18,19 +18,31 @@
     cw: float = 0
     ww: float = 0
     brightness: float = 0
+    temp: float = 0
 
     def summary(self) -> dict:
         return dict([(k, round(v, 3)) for k, v in self.__dict__.items() if v > 0])
 
+
 # fix this to send what z2m likes
 def zbConv(c: Color) -> DeviceColor:
     return DeviceColor(r=c.r, g=c.g, b=c.b, brightness=max(c.r, c.g, c.b))
 
+
+def ikeaWhiteConv(c: Color) -> DeviceColor:
+    return DeviceColor(brightness=max(c.r, c.g, c.b), temp=454)
+
+
 def oneWhiteConv(c: Color) -> DeviceColor:
     return DeviceColor(r=c.r, g=c.g, b=c.b, w=max(c.r, c.g, c.b))
 
+def brightnessConv(c: Color) -> DeviceColor:
+    return DeviceColor(brightness=max(c.r, c.g, c.b))
+
+
 def twoWhitesConv(c: Color) -> DeviceColor:
-    return DeviceColor(r=c.r, g=c.g, b=c.b, cw=max(c.r, c.g, c.b))
+    return DeviceColor(r=c.r, g=c.g, b=c.b, cw=max(c.r, c.g, c.b), ww=0)
+
 
 def relayConv(c: Color) -> DeviceColor:
-    return DeviceColor(brightness=1 if (max(c.r, c.g, c.b) > 0) else 0)
\ No newline at end of file
+    return DeviceColor(brightness=1 if (max(c.r, c.g, c.b) > 0) else 0)