mirror of
https://github.com/esphome/esphome.git
synced 2025-01-03 11:21:43 +01:00
tuya_light: fix float->int conversion while setting color temperature (#5067)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Co-authored-by: kswt <kswt@xmpp.is>
This commit is contained in:
parent
5f531ac9b0
commit
6ecc1c14d2
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue