From c5dc736c5300eb43680e85a148a21a54549d6f97 Mon Sep 17 00:00:00 2001 From: Cody James <33857557+codyjamestechnical@users.noreply.github.com> Date: Tue, 2 Mar 2021 21:41:15 -0500 Subject: [PATCH] changed color temp from float to int (#1522) * changed color temp from float to int Changed cold_white_temperature and warm_white temperature from a float to an integer. This makes home assisting show it correctly in the color temperature slider. If it is set to float home assistant show something like 470.8390000283847829304845 in the slider which provides an ugly ui and color temperature to as a decimal is invalid anyway. * Update esphome/components/rgbww/light.py * Update esphome/components/rgbww/light.py Co-authored-by: Guillermo Ruffino --- esphome/components/rgbww/rgbww_light_output.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/esphome/components/rgbww/rgbww_light_output.h b/esphome/components/rgbww/rgbww_light_output.h index 152766970e..e14b967530 100644 --- a/esphome/components/rgbww/rgbww_light_output.h +++ b/esphome/components/rgbww/rgbww_light_output.h @@ -14,8 +14,8 @@ class RGBWWLightOutput : public light::LightOutput { void set_blue(output::FloatOutput *blue) { blue_ = blue; } void set_cold_white(output::FloatOutput *cold_white) { cold_white_ = cold_white; } void set_warm_white(output::FloatOutput *warm_white) { warm_white_ = warm_white; } - void set_cold_white_temperature(float cold_white_temperature) { cold_white_temperature_ = cold_white_temperature; } - void set_warm_white_temperature(float warm_white_temperature) { warm_white_temperature_ = warm_white_temperature; } + void set_cold_white_temperature(int cold_white_temperature) { cold_white_temperature_ = cold_white_temperature; } + void set_warm_white_temperature(int warm_white_temperature) { warm_white_temperature_ = warm_white_temperature; } void set_constant_brightness(bool constant_brightness) { constant_brightness_ = constant_brightness; } void set_color_interlock(bool color_interlock) { color_interlock_ = color_interlock; } light::LightTraits get_traits() override { @@ -46,8 +46,8 @@ class RGBWWLightOutput : public light::LightOutput { output::FloatOutput *blue_; output::FloatOutput *cold_white_; output::FloatOutput *warm_white_; - float cold_white_temperature_; - float warm_white_temperature_; + int cold_white_temperature_; + int warm_white_temperature_; bool constant_brightness_; bool color_interlock_{false}; };