mirror of
https://github.com/esphome/esphome.git
synced 2026-06-05 01:52:47 +08:00
[light] Fix binary light spamming 'brightness not supported' warning with strobe effect (#14735)
This commit is contained in:
@@ -214,7 +214,14 @@ LightColorValues LightCall::validate_() {
|
|||||||
if (this->has_brightness() && this->brightness_ == 0.0f) {
|
if (this->has_brightness() && this->brightness_ == 0.0f) {
|
||||||
this->state_ = false;
|
this->state_ = false;
|
||||||
this->set_flag_(FLAG_HAS_STATE);
|
this->set_flag_(FLAG_HAS_STATE);
|
||||||
|
if (color_mode & ColorCapability::BRIGHTNESS) {
|
||||||
|
// Reset brightness so the light has nonzero brightness when turned back on.
|
||||||
this->brightness_ = 1.0f;
|
this->brightness_ = 1.0f;
|
||||||
|
} else {
|
||||||
|
// Light doesn't support brightness; clear the flag to avoid a spurious
|
||||||
|
// "brightness not supported" warning during capability validation.
|
||||||
|
this->clear_flag_(FLAG_HAS_BRIGHTNESS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set color brightness to 100% if currently zero and a color is set.
|
// Set color brightness to 100% if currently zero and a color is set.
|
||||||
|
|||||||
Reference in New Issue
Block a user