mirror of
https://github.com/esphome/esphome.git
synced 2025-01-18 12:05:41 +00:00
fix(web_server/fan): send speed update values even when fan is off (#8086)
This commit is contained in:
parent
17b88f2e3e
commit
c43d8460bd
@ -455,8 +455,9 @@ void WebServer::handle_fan_request(AsyncWebServerRequest *request, const UrlMatc
|
||||
} else if (match.method == "toggle") {
|
||||
this->schedule_([obj]() { obj->toggle().perform(); });
|
||||
request->send(200);
|
||||
} else if (match.method == "turn_on") {
|
||||
auto call = obj->turn_on();
|
||||
} else if (match.method == "turn_on" || match.method == "turn_off") {
|
||||
auto call = match.method == "turn_on" ? obj->turn_on() : obj->turn_off();
|
||||
|
||||
if (request->hasParam("speed_level")) {
|
||||
auto speed_level = request->getParam("speed_level")->value();
|
||||
auto val = parse_number<int>(speed_level.c_str());
|
||||
@ -486,9 +487,6 @@ void WebServer::handle_fan_request(AsyncWebServerRequest *request, const UrlMatc
|
||||
}
|
||||
this->schedule_([call]() mutable { call.perform(); });
|
||||
request->send(200);
|
||||
} else if (match.method == "turn_off") {
|
||||
this->schedule_([obj]() { obj->turn_off().perform(); });
|
||||
request->send(200);
|
||||
} else {
|
||||
request->send(404);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user