Skip to content

Commit

Permalink
Fix brightness not being properly adapted for RGB(W)(W) lights
Browse files Browse the repository at this point in the history
  • Loading branch information
Breina committed Sep 7, 2022
1 parent 1c0d44c commit a4513c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions custom_components/artnet_led/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,11 +544,11 @@ def get_target_values(self):

switcher = {
"d": lambda: self._brightness,
"r": lambda: self.is_on * red,
"r": lambda: self.is_on * red * self._brightness / max_color,
"R": lambda: self.is_on * red * 255 / max_color,
"g": lambda: self.is_on * green,
"g": lambda: self.is_on * green * self._brightness / max_color,
"G": lambda: self.is_on * green * 255 / max_color,
"b": lambda: self.is_on * blue,
"b": lambda: self.is_on * blue * self._brightness / max_color,
"B": lambda: self.is_on * blue * 255 / max_color
}

Expand Down Expand Up @@ -627,13 +627,13 @@ def get_target_values(self):

switcher = {
"d": lambda: self._brightness,
"r": lambda: self.is_on * red,
"r": lambda: self.is_on * red * self._brightness / max_color,
"R": lambda: self.is_on * red * 255 / max_color,
"g": lambda: self.is_on * green,
"g": lambda: self.is_on * green * self._brightness / max_color,
"G": lambda: self.is_on * green * 255 / max_color,
"b": lambda: self.is_on * blue,
"b": lambda: self.is_on * blue* self._brightness / max_color,
"B": lambda: self.is_on * blue * 255 / max_color,
"w": lambda: self.is_on * white,
"w": lambda: self.is_on * white* self._brightness / max_color,
"W": lambda: self.is_on * white * 255 / max_color,
}

Expand Down Expand Up @@ -735,15 +735,15 @@ def get_target_values(self):

switcher = {
"d": lambda: self._brightness,
"r": lambda: self.is_on * red,
"r": lambda: self.is_on * red * self._brightness / max_color,
"R": lambda: self.is_on * red * 255 / max_color,
"g": lambda: self.is_on * green,
"g": lambda: self.is_on * green * self._brightness / max_color,
"G": lambda: self.is_on * green * 255 / max_color,
"b": lambda: self.is_on * blue,
"b": lambda: self.is_on * blue * self._brightness / max_color,
"B": lambda: self.is_on * blue * 255 / max_color,
"c": lambda: self.is_on * cold_white,
"c": lambda: self.is_on * cold_white * self._brightness / max_color,
"C": lambda: self.is_on * cold_white * 255 / max_color,
"h": lambda: self.is_on * warm_white,
"h": lambda: self.is_on * warm_white * self._brightness / max_color,
"H": lambda: self.is_on * warm_white * 255 / max_color,
"t": lambda: 255 - ((self.color_temp - self.min_mireds) / (self.max_mireds - self.min_mireds) * 255),
"T": lambda: (self.color_temp - self.min_mireds) / (self.max_mireds - self.min_mireds) * 255
Expand Down
2 changes: 1 addition & 1 deletion custom_components/artnet_led/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
],
"requirements": ["pyartnet==0.8.3"],
"iot_class": "assumed_state",
"version": "0.0.2"
"version": "0.0.3"
}

0 comments on commit a4513c0

Please sign in to comment.