Skip to content

Commit

Permalink
Fix setting random color for RGBW controller
Browse files Browse the repository at this point in the history
  • Loading branch information
fracz committed Aug 4, 2019
1 parent 3a51f5c commit dc6954b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function execute(HasFunction $subject, array $actionParams = []) {
$color = ColorUtils::hexToDec($color);
}
} elseif (isset($actionParams['hue'])) {
$color = ColorUtils::hueToDec($actionParams['hue']);
$color = $actionParams['hue'] === 'random' ? 'random' : ColorUtils::hueToDec($actionParams['hue']);
} elseif (isset($actionParams['rgb'])) {
$rgb = $actionParams['rgb'];
$color = ColorUtils::rgbToDec([$rgb['red'], $rgb['green'], $rgb['blue']]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public function colorParamsExamples() {
[['color' => '16711680', 'color_brightness' => 55], 'SET-RGBW-VALUE:1,1,1,16711680,55,0'],
[['color' => 'random', 'color_brightness' => 55], 'SET-RAND-RGBW-VALUE:1,1,1,55,0'],
[['hue' => 0, 'color_brightness' => 55], 'SET-RGBW-VALUE:1,1,1,16711680,55,0'],
[['hue' => 'random', 'color_brightness' => 55], 'SET-RAND-RGBW-VALUE:1,1,1,55,0'],
[['hsv' => ['hue' => 0, 'saturation' => 100, 'value' => 55]], 'SET-RGBW-VALUE:1,1,1,16711680,55,0'],
[['rgb' => ['red' => 140, 'green' => 0, 'blue' => 0]], 'SET-RGBW-VALUE:1,1,1,16711680,55,0'],
];
Expand Down

0 comments on commit dc6954b

Please sign in to comment.