mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
fix: stop tuya light state getting reset (#2401)
* fix: stop tuya light state getting reset * fix typo
This commit is contained in:
parent
8c86a18dc6
commit
1ba560dc9e
1 changed files with 6 additions and 1 deletions
|
@ -111,6 +111,11 @@ void TuyaLight::write_state(light::LightState *state) {
|
|||
state->current_values_as_brightness(&brightness);
|
||||
}
|
||||
|
||||
if (!state->current_values.is_on() && this->switch_id_.has_value()) {
|
||||
parent_->set_boolean_datapoint_value(*this->switch_id_, false);
|
||||
return;
|
||||
}
|
||||
|
||||
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_);
|
||||
|
@ -138,7 +143,7 @@ void TuyaLight::write_state(light::LightState *state) {
|
|||
}
|
||||
|
||||
if (this->switch_id_.has_value()) {
|
||||
parent_->set_boolean_datapoint_value(*this->switch_id_, state->current_values.is_on());
|
||||
parent_->set_boolean_datapoint_value(*this->switch_id_, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue