mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 21:44:55 +01:00
fixes https://github.com/esphome/issues/issues/3873
This commit is contained in:
parent
ed4a7210d3
commit
a9b7d98194
1 changed files with 10 additions and 5 deletions
|
@ -37,9 +37,13 @@ void BedJetFan::control(const fan::FanCall &call) {
|
||||||
|
|
||||||
// ignore speed changes if not on or turning on
|
// ignore speed changes if not on or turning on
|
||||||
if (this->state && call.get_speed().has_value()) {
|
if (this->state && call.get_speed().has_value()) {
|
||||||
this->speed = *call.get_speed();
|
auto speed = *call.get_speed();
|
||||||
this->parent_->set_fan_index(this->speed);
|
if (speed >= 1) {
|
||||||
did_change = true;
|
this->speed = speed;
|
||||||
|
// Fan.speed is 1-20, but Bedjet expects 0-19, so subtract 1
|
||||||
|
this->parent_->set_fan_index(this->speed - 1);
|
||||||
|
did_change = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (did_change) {
|
if (did_change) {
|
||||||
|
@ -57,8 +61,9 @@ void BedJetFan::on_status(const BedjetStatusPacket *data) {
|
||||||
did_change = true;
|
did_change = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->fan_step != this->speed) {
|
// BedjetStatusPacket.fan_step is in range 0-19, but Fan.speed wants 1-20.
|
||||||
this->speed = data->fan_step;
|
if (data->fan_step + 1 != this->speed) {
|
||||||
|
this->speed = data->fan_step + 1;
|
||||||
did_change = true;
|
did_change = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue