From 11069085e3819dac3adb62f3f41df8004e27c10d Mon Sep 17 00:00:00 2001 From: Paul Nicholls Date: Thu, 12 Mar 2020 13:17:29 +1300 Subject: [PATCH] Fix esphome/issues#947 - RGBW(W) white brightness (#925) --- esphome/components/light/light_color_values.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/esphome/components/light/light_color_values.h b/esphome/components/light/light_color_values.h index cda86d3f1c..9ac8be1dd0 100644 --- a/esphome/components/light/light_color_values.h +++ b/esphome/components/light/light_color_values.h @@ -185,7 +185,7 @@ class LightColorValues { /// Convert these light color values to an RGBW representation and write them to red, green, blue, white. void as_rgbw(float *red, float *green, float *blue, float *white) const { this->as_rgb(red, green, blue); - *white = this->state_ * this->white_; + *white = this->state_ * this->brightness_ * this->white_; } /// Convert these light color values to an RGBWW representation with the given parameters. @@ -196,8 +196,8 @@ class LightColorValues { const float ww_fraction = (color_temp - color_temperature_cw) / (color_temperature_ww - color_temperature_cw); const float cw_fraction = 1.0f - ww_fraction; const float max_cw_ww = std::max(ww_fraction, cw_fraction); - *cold_white = this->state_ * this->white_ * (cw_fraction / max_cw_ww); - *warm_white = this->state_ * this->white_ * (ww_fraction / max_cw_ww); + *cold_white = this->state_ * this->brightness_ * this->white_ * (cw_fraction / max_cw_ww); + *warm_white = this->state_ * this->brightness_ * this->white_ * (ww_fraction / max_cw_ww); } /// Convert these light color values to an CWWW representation with the given parameters.