added new command called commands

This commit is contained in:
proddy
2021-05-09 10:58:44 +02:00
parent 4a06d328d6
commit 81f4724d71
9 changed files with 157 additions and 51 deletions

View File

@@ -968,18 +968,31 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, std::
return true;
}
Command::add_with_json(device_type, F_(info), [device_type](const char * value, const int8_t id, JsonObject & json) {
return command_info(device_type, json, id, true);
});
Command::add_with_json(
device_type,
F_(info),
[device_type](const char * value, const int8_t id, JsonObject & json) { return command_info(device_type, json, id, true); },
F_(info_cmd));
Command::add_with_json(
device_type,
F("info_short"),
[device_type](const char * value, const int8_t id, JsonObject & json) { return command_info(device_type, json, id, false); },
nullptr,
true); // this command is hidden
Command::add_with_json(
device_type,
F_(commands),
[device_type](const char * value, const int8_t id, JsonObject & json) { return command_commands(device_type, json, id); },
F_(commands_cmd));
return true;
}
// list all available commands, return as json
bool EMSESP::command_commands(uint8_t device_type, JsonObject & json, const int8_t id) {
return Command::list(device_type, json);
}
// export all values to info command
// value is ignored here
// info command always shows in verbose mode, so full names are displayed