mirror of
https://github.com/esphome/esphome.git
synced 2024-12-26 07:24:54 +01:00
Add detail param to allow listing of select options in WebServer REST API (#5503)
This commit is contained in:
parent
2fc4e88271
commit
689dcd1e24
1 changed files with 6 additions and 1 deletions
|
@ -805,7 +805,12 @@ void WebServer::handle_select_request(AsyncWebServerRequest *request, const UrlM
|
|||
continue;
|
||||
|
||||
if (request->method() == HTTP_GET) {
|
||||
std::string data = this->select_json(obj, obj->state, DETAIL_STATE);
|
||||
auto detail = DETAIL_STATE;
|
||||
auto *param = request->getParam("detail");
|
||||
if (param && param->value() == "all") {
|
||||
detail = DETAIL_ALL;
|
||||
}
|
||||
std::string data = this->select_json(obj, obj->state, detail);
|
||||
request->send(200, "application/json", data.c_str());
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue