show message if empty return from call command

This commit is contained in:
proddy
2024-07-14 23:22:28 +02:00
parent d696da2ee8
commit 2c2ffe1555

View File

@@ -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")) {
String data = json["api_data"].as<String>();
shell.println(data.c_str());
@@ -572,6 +573,11 @@ static void setup_commands(std::shared_ptr<Commands> & commands) {
serializeJsonPretty(doc, shell);
shell.println();
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) {