Skip to content

Commit

Permalink
tuya_light: fix float->int conversion while setting color temperature (
Browse files Browse the repository at this point in the history
…#5067)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Co-authored-by: kswt <kswt@xmpp.is>
  • Loading branch information
3 people committed Jul 12, 2023
1 parent 5f531ac commit 6ecc1c1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion esphome/components/tuya/light/tuya_light.cpp
Expand Up @@ -168,7 +168,7 @@ void TuyaLight::write_state(light::LightState *state) {

if (brightness > 0.0f || !color_interlock_) {
if (this->color_temperature_id_.has_value()) {
uint32_t color_temp_int = static_cast<uint32_t>(color_temperature * this->color_temperature_max_value_);
uint32_t color_temp_int = static_cast<uint32_t>(roundf(color_temperature * this->color_temperature_max_value_));
if (this->color_temperature_invert_) {
color_temp_int = this->color_temperature_max_value_ - color_temp_int;
}
Expand Down

0 comments on commit 6ecc1c1

Please sign in to comment.