Fix fan speed restore issue on boot (#1867)

This commit is contained in:
wifwucite
2021-09-08 05:30:17 +02:00
committed by GitHub
parent b0533db2eb
commit 1be106c0b5
5 changed files with 14 additions and 3 deletions
+4 -1
View File
@@ -56,7 +56,10 @@ void SpeedFan::loop() {
ESP_LOGD(TAG, "Setting reverse direction: %s", ONOFF(enable));
}
}
float SpeedFan::get_setup_priority() const { return setup_priority::DATA; }
// We need a higher priority than the FanState component to make sure that the traits are set
// when that component sets itself up.
float SpeedFan::get_setup_priority() const { return fan_->get_setup_priority() + 1.0f; }
} // namespace speed
} // namespace esphome