Skip to content

Commit

Permalink
improve handling of rgbw controllers (#41)
Browse files Browse the repository at this point in the history
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()
  • Loading branch information
wuub authored and Danielhiversen committed Apr 29, 2017
1 parent b25b4a1 commit 87be2ee
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions flux_led/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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":
Expand Down

0 comments on commit 87be2ee

Please sign in to comment.