mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
show message if empty return from call command
This commit is contained in:
@@ -563,7 +563,8 @@ static void setup_commands(std::shared_ptr<Commands> & commands) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (return_code == CommandRet::OK && json.size()) {
|
if (return_code == CommandRet::OK) {
|
||||||
|
if (json.size()) {
|
||||||
if (json.containsKey("api_data")) {
|
if (json.containsKey("api_data")) {
|
||||||
String data = json["api_data"].as<String>();
|
String data = json["api_data"].as<String>();
|
||||||
shell.println(data.c_str());
|
shell.println(data.c_str());
|
||||||
@@ -572,6 +573,11 @@ static void setup_commands(std::shared_ptr<Commands> & commands) {
|
|||||||
serializeJsonPretty(doc, shell);
|
serializeJsonPretty(doc, shell);
|
||||||
shell.println();
|
shell.println();
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
// show message if no data returned (e.g. for analogsensor, temperaturesensor, custom)
|
||||||
|
shell.println("No data.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (return_code == CommandRet::NOT_FOUND) {
|
if (return_code == CommandRet::NOT_FOUND) {
|
||||||
|
|||||||
Reference in New Issue
Block a user