mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
show sensor command commands
This commit is contained in:
@@ -176,7 +176,7 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec
|
||||
String dat = output["api_data"];
|
||||
output.clear();
|
||||
input["data"] = dat.c_str();
|
||||
data = input["data"];
|
||||
data = input["data"];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -439,7 +439,11 @@ void Command::erase_command(const uint8_t device_type, const char * cmd) {
|
||||
|
||||
// list all commands for a specific device, output as json
|
||||
bool Command::list(const uint8_t device_type, JsonObject output) {
|
||||
if (cmdfunctions_.empty()) {
|
||||
// force add info and commands for those non-EMS devices
|
||||
if (device_type == EMSdevice::DeviceType::TEMPERATURESENSOR || device_type == EMSdevice::DeviceType::ANALOGSENSOR) {
|
||||
output[F_(info)] = Helpers::translated_word(FL_(info_cmd));
|
||||
output[F_(commands)] = Helpers::translated_word(FL_(commands_cmd));
|
||||
} else if (cmdfunctions_.empty()) {
|
||||
output["message"] = "no commands available";
|
||||
return false;
|
||||
}
|
||||
@@ -453,12 +457,6 @@ bool Command::list(const uint8_t device_type, JsonObject output) {
|
||||
}
|
||||
sorted_cmds.sort();
|
||||
|
||||
// force add info and commands for those non-EMS devices
|
||||
if (device_type == EMSdevice::DeviceType::TEMPERATURESENSOR) {
|
||||
output[F_(info)] = Helpers::translated_word(FL_(info_cmd));
|
||||
output[F_(commands)] = Helpers::translated_word(FL_(commands_cmd));
|
||||
}
|
||||
|
||||
for (const auto & cl : sorted_cmds) {
|
||||
for (const auto & cf : cmdfunctions_) {
|
||||
if ((cf.device_type_ == device_type) && !cf.has_flags(CommandFlag::HIDDEN) && cf.description_ && (cl == std::string(cf.cmd_))) {
|
||||
|
||||
Reference in New Issue
Block a user