mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-01 18:48:28 +02:00
Color mode implementation (#2012)
This commit is contained in:
@@ -45,11 +45,14 @@ void TuyaLight::dump_config() {
|
||||
|
||||
light::LightTraits TuyaLight::get_traits() {
|
||||
auto traits = light::LightTraits();
|
||||
traits.set_supports_brightness(this->dimmer_id_.has_value());
|
||||
traits.set_supports_color_temperature(this->color_temperature_id_.has_value());
|
||||
if (this->color_temperature_id_.has_value()) {
|
||||
if (this->color_temperature_id_.has_value() && this->dimmer_id_.has_value()) {
|
||||
traits.set_supported_color_modes({light::ColorMode::COLOR_TEMPERATURE});
|
||||
traits.set_min_mireds(this->cold_white_temperature_);
|
||||
traits.set_max_mireds(this->warm_white_temperature_);
|
||||
} else if (this->dimmer_id_.has_value()) {
|
||||
traits.set_supported_color_modes({light::ColorMode::BRIGHTNESS});
|
||||
} else {
|
||||
traits.set_supported_color_modes({light::ColorMode::ON_OFF});
|
||||
}
|
||||
return traits;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user