mirror of
https://github.com/esphome/esphome.git
synced 2024-10-04 18:27:06 +02: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
@ -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 New Issue
Block a user