From 87be2ee180ccef3a9737db73ae7f57e12061c6d5 Mon Sep 17 00:00:00 2001 From: Wojciech Bederski Date: Sat, 29 Apr 2017 07:04:10 +0200 Subject: [PATCH] improve handling of rgbw controllers (#41) they were incorrectly recognized as "ww" only, and because of that a lot of HA integrations did not work corrrectly (getRgb() et. al.) this is a rather simple approach fixing detection using rgbwcapable flag + small improvement to str() --- flux_led/__main__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/flux_led/__main__.py b/flux_led/__main__.py index 8d43b400..66467105 100755 --- a/flux_led/__main__.py +++ b/flux_led/__main__.py @@ -572,7 +572,9 @@ def close(self): def _determineMode(self, ww_level, pattern_code): mode = "unknown" if pattern_code in [ 0x61, 0x62]: - if ww_level != 0: + if self.rgbwcapable: + mode = "color" + elif ww_level != 0: mode = "ww" else: mode = "color" @@ -730,9 +732,10 @@ def __str__(self): green = rx[7] blue = rx[8] mode_str = "Color: {}".format((red, green, blue)) - mode_str += " Brightness: {}".format(self.brightness) - - + if self.rgbwcapable: + mode_str += " White: {}".format(rx[9]) + else: + mode_str += " Brightness: {}".format(self.brightness) elif mode == "ww": mode_str = "Warm White: {}%".format(utils.byteToPercent(ww_level)) elif mode == "preset":