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 <glm.net@gmail.com>
This commit is contained in:
Cody James 2021-03-02 21:41:15 -05:00 committed by GitHub
parent 8e93735861
commit c5dc736c53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,8 +14,8 @@ class RGBWWLightOutput : public light::LightOutput {
void set_blue(output::FloatOutput *blue) { blue_ = blue; } void set_blue(output::FloatOutput *blue) { blue_ = blue; }
void set_cold_white(output::FloatOutput *cold_white) { cold_white_ = cold_white; } 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_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_cold_white_temperature(int 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_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_constant_brightness(bool constant_brightness) { constant_brightness_ = constant_brightness; }
void set_color_interlock(bool color_interlock) { color_interlock_ = color_interlock; } void set_color_interlock(bool color_interlock) { color_interlock_ = color_interlock; }
light::LightTraits get_traits() override { light::LightTraits get_traits() override {
@ -46,8 +46,8 @@ class RGBWWLightOutput : public light::LightOutput {
output::FloatOutput *blue_; output::FloatOutput *blue_;
output::FloatOutput *cold_white_; output::FloatOutput *cold_white_;
output::FloatOutput *warm_white_; output::FloatOutput *warm_white_;
float cold_white_temperature_; int cold_white_temperature_;
float warm_white_temperature_; int warm_white_temperature_;
bool constant_brightness_; bool constant_brightness_;
bool color_interlock_{false}; bool color_interlock_{false};
}; };