mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
fix call commands from console
This commit is contained in:
@@ -65,7 +65,7 @@ bool Command::call(const uint8_t device_type, const char * cmd, const char * val
|
||||
#endif
|
||||
|
||||
auto cf = find_command(device_type, cmd);
|
||||
if ((cf == nullptr) || (!cf->cmdfunction_json_)) {
|
||||
if (cf == nullptr) {
|
||||
return false; // command not found or not json
|
||||
}
|
||||
|
||||
@@ -75,7 +75,11 @@ bool Command::call(const uint8_t device_type, const char * cmd, const char * val
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((cf->cmdfunction_json_)(value, id, json));
|
||||
if (!cf->cmdfunction_json_) {
|
||||
return ((cf->cmdfunction_)(value, id));
|
||||
} else {
|
||||
return ((cf->cmdfunction_json_)(value, id, json));
|
||||
}
|
||||
}
|
||||
|
||||
// add a command to the list, which does not return json
|
||||
@@ -197,4 +201,4 @@ void Command::show_all(uuid::console::Shell & shell) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace emsesp
|
||||
} // namespace emsesp
|
||||
|
||||
Reference in New Issue
Block a user