mirror of
https://github.com/esphome/esphome.git
synced 2024-11-09 16:57:47 +01:00
[fan] fix initial FanCall to properly set speed (#7113)
Speed settings were ignored for the first FanCall, if no speed has been restored before. This commit changes the behaviour to: set speed to 100%, iff current speed AND new speed are not set.
This commit is contained in:
parent
e88e32bf23
commit
19a787c235
1 changed files with 2 additions and 2 deletions
|
@ -45,8 +45,8 @@ void FanCall::validate_() {
|
|||
this->speed_ = clamp(*this->speed_, 1, traits.supported_speed_count());
|
||||
|
||||
if (this->binary_state_.has_value() && *this->binary_state_) {
|
||||
// when turning on, if current speed is zero, set speed to 100%
|
||||
if (traits.supports_speed() && !this->parent_.state && this->parent_.speed == 0) {
|
||||
// when turning on, if neither current nor new speed available, set speed to 100%
|
||||
if (traits.supports_speed() && !this->parent_.state && this->parent_.speed == 0 && !this->speed_.has_value()) {
|
||||
this->speed_ = traits.supported_speed_count();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue