mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
Command uses flash fullname instead of custom, to save on heap
This commit is contained in:
14
interface/package-lock.json
generated
14
interface/package-lock.json
generated
@@ -16,7 +16,7 @@
|
|||||||
"@table-library/react-table-library": "4.0.18",
|
"@table-library/react-table-library": "4.0.18",
|
||||||
"@types/lodash": "^4.14.184",
|
"@types/lodash": "^4.14.184",
|
||||||
"@types/node": "^18.7.16",
|
"@types/node": "^18.7.16",
|
||||||
"@types/react": "^18.0.18",
|
"@types/react": "^18.0.19",
|
||||||
"@types/react-dom": "^18.0.6",
|
"@types/react-dom": "^18.0.6",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
"async-validator": "^4.2.5",
|
"async-validator": "^4.2.5",
|
||||||
@@ -4048,9 +4048,9 @@
|
|||||||
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw=="
|
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw=="
|
||||||
},
|
},
|
||||||
"node_modules/@types/react": {
|
"node_modules/@types/react": {
|
||||||
"version": "18.0.18",
|
"version": "18.0.19",
|
||||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.18.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.19.tgz",
|
||||||
"integrity": "sha512-6hI08umYs6NaiHFEEGioXnxJ+oEhY3eRz8VCUaudZmGdtvPviCJB8mgaMxaDWAdPSYd4eFavrPk2QIolwbLYrg==",
|
"integrity": "sha512-BDc3Q+4Q3zsn7k9xZrKfjWyJsSlEDMs38gD1qp2eDazLCdcPqAT+vq1ND+Z8AGel/UiwzNUk8ptpywgNQcJ1MQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/prop-types": "*",
|
"@types/prop-types": "*",
|
||||||
"@types/scheduler": "*",
|
"@types/scheduler": "*",
|
||||||
@@ -20236,9 +20236,9 @@
|
|||||||
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw=="
|
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw=="
|
||||||
},
|
},
|
||||||
"@types/react": {
|
"@types/react": {
|
||||||
"version": "18.0.18",
|
"version": "18.0.19",
|
||||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.18.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.19.tgz",
|
||||||
"integrity": "sha512-6hI08umYs6NaiHFEEGioXnxJ+oEhY3eRz8VCUaudZmGdtvPviCJB8mgaMxaDWAdPSYd4eFavrPk2QIolwbLYrg==",
|
"integrity": "sha512-BDc3Q+4Q3zsn7k9xZrKfjWyJsSlEDMs38gD1qp2eDazLCdcPqAT+vq1ND+Z8AGel/UiwzNUk8ptpywgNQcJ1MQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/prop-types": "*",
|
"@types/prop-types": "*",
|
||||||
"@types/scheduler": "*",
|
"@types/scheduler": "*",
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"@table-library/react-table-library": "4.0.18",
|
"@table-library/react-table-library": "4.0.18",
|
||||||
"@types/lodash": "^4.14.184",
|
"@types/lodash": "^4.14.184",
|
||||||
"@types/node": "^18.7.16",
|
"@types/node": "^18.7.16",
|
||||||
"@types/react": "^18.0.18",
|
"@types/react": "^18.0.19",
|
||||||
"@types/react-dom": "^18.0.6",
|
"@types/react-dom": "^18.0.6",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
"async-validator": "^4.2.5",
|
"async-validator": "^4.2.5",
|
||||||
|
|||||||
@@ -37,18 +37,18 @@ void AnalogSensor::start() {
|
|||||||
EMSdevice::DeviceType::ANALOGSENSOR,
|
EMSdevice::DeviceType::ANALOGSENSOR,
|
||||||
F_(info),
|
F_(info),
|
||||||
[&](const char * value, const int8_t id, JsonObject & output) { return command_info(value, id, output); },
|
[&](const char * value, const int8_t id, JsonObject & output) { return command_info(value, id, output); },
|
||||||
uuid::read_flash_string(F_(info_cmd)));
|
F_(info_cmd));
|
||||||
Command::add(
|
Command::add(
|
||||||
EMSdevice::DeviceType::ANALOGSENSOR,
|
EMSdevice::DeviceType::ANALOGSENSOR,
|
||||||
F_(setvalue),
|
F_(setvalue),
|
||||||
[&](const char * value, const int8_t id) { return command_setvalue(value, id); },
|
[&](const char * value, const int8_t id) { return command_setvalue(value, id); },
|
||||||
"set io value", // TODO this needs translating
|
F("set io value"), // TODO this needs translating
|
||||||
CommandFlag::ADMIN_ONLY);
|
CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(
|
Command::add(
|
||||||
EMSdevice::DeviceType::ANALOGSENSOR,
|
EMSdevice::DeviceType::ANALOGSENSOR,
|
||||||
F_(commands),
|
F_(commands),
|
||||||
[&](const char * value, const int8_t id, JsonObject & output) { return command_commands(value, id, output); },
|
[&](const char * value, const int8_t id, JsonObject & output) { return command_commands(value, id, output); },
|
||||||
uuid::read_flash_string(F_(commands_cmd)));
|
F_(commands_cmd));
|
||||||
|
|
||||||
Mqtt::subscribe(EMSdevice::DeviceType::ANALOGSENSOR, "analogsensor/#", nullptr); // use empty function callback
|
Mqtt::subscribe(EMSdevice::DeviceType::ANALOGSENSOR, "analogsensor/#", nullptr); // use empty function callback
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,15 +264,15 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char *
|
|||||||
|
|
||||||
if ((value == nullptr) || (strlen(value) == 0)) {
|
if ((value == nullptr) || (strlen(value) == 0)) {
|
||||||
if (EMSESP::system_.readonly_mode()) {
|
if (EMSESP::system_.readonly_mode()) {
|
||||||
LOG_INFO(F("[readonly] Calling command '%s/%s' (%s)"), dname.c_str(), cmd, cf->description_.c_str());
|
LOG_INFO(F("[readonly] Calling command '%s/%s' (%s)"), dname.c_str(), cmd, read_flash_string(cf->description_).c_str());
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG(F("Calling command '%s/%s' (%s)"), dname.c_str(), cmd, cf->description_.c_str());
|
LOG_DEBUG(F("Calling command '%s/%s' (%s)"), dname.c_str(), cmd, read_flash_string(cf->description_).c_str());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (EMSESP::system_.readonly_mode()) {
|
if (EMSESP::system_.readonly_mode()) {
|
||||||
LOG_INFO(F("[readonly] Calling command '%s/%s' (%s) with value %s"), dname.c_str(), cmd, cf->description_.c_str(), value);
|
LOG_INFO(F("[readonly] Calling command '%s/%s' (%s) with value %s"), dname.c_str(), cmd, read_flash_string(cf->description_).c_str(), value);
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG(F("Calling command '%s/%s' (%s) with value %s"), dname.c_str(), cmd, cf->description_.c_str(), value);
|
LOG_DEBUG(F("Calling command '%s/%s' (%s) with value %s"), dname.c_str(), cmd, read_flash_string(cf->description_).c_str(), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,14 +299,14 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char *
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add a command to the list, which does not return json
|
// add a command to the list, which does not return json
|
||||||
void Command::add(const uint8_t device_type, const __FlashStringHelper * cmd, const cmd_function_p cb, const std::string & description, uint8_t flags) {
|
void Command::add(const uint8_t device_type, const __FlashStringHelper * cmd, const cmd_function_p cb, const __FlashStringHelper * description, uint8_t flags) {
|
||||||
// if the command already exists for that device type don't add it
|
// if the command already exists for that device type don't add it
|
||||||
if (find_command(device_type, read_flash_string(cmd).c_str()) != nullptr) {
|
if (find_command(device_type, read_flash_string(cmd).c_str()) != nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the description is empty, it's hidden which means it will not show up in Web API or Console as an available command
|
// if the description is empty, it's hidden which means it will not show up in Web API or Console as an available command
|
||||||
if (description.empty()) {
|
if (!description) {
|
||||||
flags |= CommandFlag::HIDDEN;
|
flags |= CommandFlag::HIDDEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,7 +314,7 @@ void Command::add(const uint8_t device_type, const __FlashStringHelper * cmd, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add a command to the list, which does return a json object as output
|
// add a command to the list, which does return a json object as output
|
||||||
void Command::add(const uint8_t device_type, const __FlashStringHelper * cmd, const cmd_json_function_p cb, const std::string & description, uint8_t flags) {
|
void Command::add(const uint8_t device_type, const __FlashStringHelper * cmd, const cmd_json_function_p cb, const __FlashStringHelper * description, uint8_t flags) {
|
||||||
// if the command already exists for that device type don't add it
|
// if the command already exists for that device type don't add it
|
||||||
if (find_command(device_type, read_flash_string(cmd).c_str()) != nullptr) {
|
if (find_command(device_type, read_flash_string(cmd).c_str()) != nullptr) {
|
||||||
return;
|
return;
|
||||||
@@ -364,7 +364,7 @@ bool Command::list(const uint8_t device_type, JsonObject & output) {
|
|||||||
|
|
||||||
for (const auto & cl : sorted_cmds) {
|
for (const auto & cl : sorted_cmds) {
|
||||||
for (const auto & cf : cmdfunctions_) {
|
for (const auto & cf : cmdfunctions_) {
|
||||||
if ((cf.device_type_ == device_type) && !cf.has_flags(CommandFlag::HIDDEN) && !cf.description_.empty() && (cl == read_flash_string(cf.cmd_))) {
|
if ((cf.device_type_ == device_type) && !cf.has_flags(CommandFlag::HIDDEN) && cf.description_ && (cl == read_flash_string(cf.cmd_))) {
|
||||||
output[cl] = cf.description_;
|
output[cl] = cf.description_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -404,7 +404,7 @@ void Command::show(uuid::console::Shell & shell, uint8_t device_type, bool verbo
|
|||||||
for (const auto & cl : sorted_cmds) {
|
for (const auto & cl : sorted_cmds) {
|
||||||
// find and print the description
|
// find and print the description
|
||||||
for (const auto & cf : cmdfunctions_) {
|
for (const auto & cf : cmdfunctions_) {
|
||||||
if ((cf.device_type_ == device_type) && !cf.has_flags(CommandFlag::HIDDEN) && !cf.description_.empty() && (cl == read_flash_string(cf.cmd_))) {
|
if ((cf.device_type_ == device_type) && !cf.has_flags(CommandFlag::HIDDEN) && cf.description_ && (cl == read_flash_string(cf.cmd_))) {
|
||||||
uint8_t i = cl.length();
|
uint8_t i = cl.length();
|
||||||
shell.print(" ");
|
shell.print(" ");
|
||||||
if (cf.has_flags(MQTT_SUB_FLAG_HC)) {
|
if (cf.has_flags(MQTT_SUB_FLAG_HC)) {
|
||||||
@@ -424,7 +424,7 @@ void Command::show(uuid::console::Shell & shell, uint8_t device_type, bool verbo
|
|||||||
shell.print(EMSdevice::tag_to_string(DeviceValueTAG::TAG_DEVICE_DATA_WW));
|
shell.print(EMSdevice::tag_to_string(DeviceValueTAG::TAG_DEVICE_DATA_WW));
|
||||||
shell.print(' ');
|
shell.print(' ');
|
||||||
}
|
}
|
||||||
shell.print(cf.description_.c_str());
|
shell.print(read_flash_string(cf.description_).c_str());
|
||||||
if (!cf.has_flags(CommandFlag::ADMIN_ONLY)) {
|
if (!cf.has_flags(CommandFlag::ADMIN_ONLY)) {
|
||||||
shell.print(' ');
|
shell.print(' ');
|
||||||
shell.print(COLOR_BRIGHT_RED);
|
shell.print(COLOR_BRIGHT_RED);
|
||||||
|
|||||||
@@ -59,14 +59,14 @@ class Command {
|
|||||||
const __FlashStringHelper * cmd_;
|
const __FlashStringHelper * cmd_;
|
||||||
const cmd_function_p cmdfunction_;
|
const cmd_function_p cmdfunction_;
|
||||||
const cmd_json_function_p cmdfunction_json_;
|
const cmd_json_function_p cmdfunction_json_;
|
||||||
const std::string description_;
|
const __FlashStringHelper * description_;
|
||||||
|
|
||||||
CmdFunction(const uint8_t device_type,
|
CmdFunction(const uint8_t device_type,
|
||||||
const uint8_t flags,
|
const uint8_t flags,
|
||||||
const __FlashStringHelper * cmd,
|
const __FlashStringHelper * cmd,
|
||||||
const cmd_function_p cmdfunction,
|
const cmd_function_p cmdfunction,
|
||||||
const cmd_json_function_p cmdfunction_json,
|
const cmd_json_function_p cmdfunction_json,
|
||||||
const std::string & description)
|
const __FlashStringHelper * description)
|
||||||
: device_type_(device_type)
|
: device_type_(device_type)
|
||||||
, flags_(flags)
|
, flags_(flags)
|
||||||
, cmd_(cmd)
|
, cmd_(cmd)
|
||||||
@@ -102,14 +102,14 @@ class Command {
|
|||||||
static void add(const uint8_t device_type,
|
static void add(const uint8_t device_type,
|
||||||
const __FlashStringHelper * cmd,
|
const __FlashStringHelper * cmd,
|
||||||
const cmd_function_p cb,
|
const cmd_function_p cb,
|
||||||
const std::string & description,
|
const __FlashStringHelper * description,
|
||||||
uint8_t flags = CommandFlag::MQTT_SUB_FLAG_DEFAULT);
|
uint8_t flags = CommandFlag::MQTT_SUB_FLAG_DEFAULT);
|
||||||
|
|
||||||
// callback function taking value, id and a json object for its output
|
// callback function taking value, id and a json object for its output
|
||||||
static void add(const uint8_t device_type,
|
static void add(const uint8_t device_type,
|
||||||
const __FlashStringHelper * cmd,
|
const __FlashStringHelper * cmd,
|
||||||
const cmd_json_function_p cb,
|
const cmd_json_function_p cb,
|
||||||
const std::string & description,
|
const __FlashStringHelper * description,
|
||||||
uint8_t flags = CommandFlag::MQTT_SUB_FLAG_DEFAULT);
|
uint8_t flags = CommandFlag::MQTT_SUB_FLAG_DEFAULT);
|
||||||
|
|
||||||
static void show_all(uuid::console::Shell & shell);
|
static void show_all(uuid::console::Shell & shell);
|
||||||
|
|||||||
@@ -50,12 +50,12 @@ void DallasSensor::start() {
|
|||||||
EMSdevice::DeviceType::DALLASSENSOR,
|
EMSdevice::DeviceType::DALLASSENSOR,
|
||||||
F_(info),
|
F_(info),
|
||||||
[&](const char * value, const int8_t id, JsonObject & output) { return command_info(value, id, output); },
|
[&](const char * value, const int8_t id, JsonObject & output) { return command_info(value, id, output); },
|
||||||
uuid::read_flash_string(F_(info_cmd)));
|
F_(info_cmd));
|
||||||
Command::add(
|
Command::add(
|
||||||
EMSdevice::DeviceType::DALLASSENSOR,
|
EMSdevice::DeviceType::DALLASSENSOR,
|
||||||
F_(commands),
|
F_(commands),
|
||||||
[&](const char * value, const int8_t id, JsonObject & output) { return command_commands(value, id, output); },
|
[&](const char * value, const int8_t id, JsonObject & output) { return command_commands(value, id, output); },
|
||||||
uuid::read_flash_string(F_(commands_cmd)));
|
F_(commands_cmd));
|
||||||
|
|
||||||
Mqtt::subscribe(EMSdevice::DeviceType::DALLASSENSOR, "dallasssensor/#", nullptr); // use empty function callback
|
Mqtt::subscribe(EMSdevice::DeviceType::DALLASSENSOR, "dallasssensor/#", nullptr); // use empty function callback
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -453,17 +453,6 @@ void EMSdevice::add_device_value(uint8_t tag,
|
|||||||
shortname = entity_id.substr(2);
|
shortname = entity_id.substr(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Serial.print(COLOR_BRIGHT_GREEN);
|
|
||||||
Serial.print(" entity name=");
|
|
||||||
Serial.print(entity_id.c_str());
|
|
||||||
Serial.print(" ,matched name=");
|
|
||||||
Serial.print(matched_entity.c_str());
|
|
||||||
Serial.print(" ,matched pos=");
|
|
||||||
Serial.println(custom_name_pos);
|
|
||||||
Serial.print(COLOR_RESET);
|
|
||||||
*/
|
|
||||||
|
|
||||||
// we found the device entity
|
// we found the device entity
|
||||||
if (shortname == entity) {
|
if (shortname == entity) {
|
||||||
// get Mask
|
// get Mask
|
||||||
@@ -471,11 +460,6 @@ void EMSdevice::add_device_value(uint8_t tag,
|
|||||||
state = mask << 4; // set state high bits to flag, turn off active and ha flags
|
state = mask << 4; // set state high bits to flag, turn off active and ha flags
|
||||||
// see if there is a custom name in the entity string
|
// see if there is a custom name in the entity string
|
||||||
if (has_custom_name) {
|
if (has_custom_name) {
|
||||||
/*
|
|
||||||
Serial.print(COLOR_BRIGHT_MAGENTA);
|
|
||||||
Serial.println(entity_id.substr(custom_name_pos + 1).c_str());
|
|
||||||
Serial.print(COLOR_RESET);
|
|
||||||
*/
|
|
||||||
custom_fullname = entity_id.substr(custom_name_pos + 1);
|
custom_fullname = entity_id.substr(custom_name_pos + 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -505,8 +489,8 @@ void EMSdevice::add_device_value(uint8_t tag,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add the command to our library
|
// add the command to our library
|
||||||
// cmd is the short_name and the description is the fullname
|
// cmd is the short_name and the description is the fullname (not the custom fullname)
|
||||||
Command::add(device_type_, short_name, f, Helpers::translated_word(fullname), flags);
|
Command::add(device_type_, short_name, f, Helpers::translated_fword(fullname), flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
// single list of options
|
// single list of options
|
||||||
|
|||||||
@@ -1052,25 +1052,25 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const
|
|||||||
[device_type](const char * value, const int8_t id, JsonObject & output) {
|
[device_type](const char * value, const int8_t id, JsonObject & output) {
|
||||||
return command_info(device_type, output, id, EMSdevice::OUTPUT_TARGET::API_VERBOSE);
|
return command_info(device_type, output, id, EMSdevice::OUTPUT_TARGET::API_VERBOSE);
|
||||||
},
|
},
|
||||||
uuid::read_flash_string(F_(info_cmd)));
|
F_(info_cmd));
|
||||||
Command::add(
|
Command::add(
|
||||||
device_type,
|
device_type,
|
||||||
F("values"),
|
F("values"),
|
||||||
[device_type](const char * value, const int8_t id, JsonObject & output) {
|
[device_type](const char * value, const int8_t id, JsonObject & output) {
|
||||||
return command_info(device_type, output, id, EMSdevice::OUTPUT_TARGET::API_SHORTNAMES); // HIDDEN command showing short names, used in e.g. /api/boiler
|
return command_info(device_type, output, id, EMSdevice::OUTPUT_TARGET::API_SHORTNAMES); // HIDDEN command showing short names, used in e.g. /api/boiler
|
||||||
},
|
},
|
||||||
"",
|
nullptr,
|
||||||
CommandFlag::HIDDEN); // this command is hidden
|
CommandFlag::HIDDEN); // this command is hidden
|
||||||
Command::add(
|
Command::add(
|
||||||
device_type,
|
device_type,
|
||||||
F_(commands),
|
F_(commands),
|
||||||
[device_type](const char * value, const int8_t id, JsonObject & output) { return command_commands(device_type, output, id); },
|
[device_type](const char * value, const int8_t id, JsonObject & output) { return command_commands(device_type, output, id); },
|
||||||
uuid::read_flash_string(F_(commands_cmd)));
|
F_(commands_cmd));
|
||||||
Command::add(
|
Command::add(
|
||||||
device_type,
|
device_type,
|
||||||
F_(entities),
|
F_(entities),
|
||||||
[device_type](const char * value, const int8_t id, JsonObject & output) { return command_entities(device_type, output, id); },
|
[device_type](const char * value, const int8_t id, JsonObject & output) { return command_entities(device_type, output, id); },
|
||||||
uuid::read_flash_string(F_(entities_cmd)));
|
F_(entities_cmd));
|
||||||
|
|
||||||
// MQTT subscribe to the device e.g. "ems-esp/boiler/#"
|
// MQTT subscribe to the device e.g. "ems-esp/boiler/#"
|
||||||
Mqtt::subscribe(device_type, EMSdevice::device_type_2_device_name(device_type) + "/#", nullptr);
|
Mqtt::subscribe(device_type, EMSdevice::device_type_2_device_name(device_type) + "/#", nullptr);
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ void System::syslog_init() {
|
|||||||
|
|
||||||
// register the command
|
// register the command
|
||||||
// TODO translate this
|
// TODO translate this
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(syslog), System::command_syslog_level, "change the syslog level", CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(syslog), System::command_syslog_level, F("change the syslog level"), CommandFlag::ADMIN_ONLY);
|
||||||
|
|
||||||
} else if (was_enabled) {
|
} else if (was_enabled) {
|
||||||
// in case service is still running, this flushes the queue
|
// in case service is still running, this flushes the queue
|
||||||
@@ -698,24 +698,24 @@ void System::commands_init() {
|
|||||||
// Command::add(EMSdevice::DeviceType::SYSTEM, F_(pin), System::command_pin, F("set a GPIO on/off"), CommandFlag::ADMIN_ONLY);
|
// Command::add(EMSdevice::DeviceType::SYSTEM, F_(pin), System::command_pin, F("set a GPIO on/off"), CommandFlag::ADMIN_ONLY);
|
||||||
|
|
||||||
// TODO these should be translated too
|
// TODO these should be translated too
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(send), System::command_send, "send a telegram", CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(send), System::command_send, F("send a telegram"), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(fetch), System::command_fetch, "refresh all EMS values", CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(fetch), System::command_fetch, F("refresh all EMS values"), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(restart), System::command_restart, "restart EMS-ESP", CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(restart), System::command_restart, F("restart EMS-ESP"), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(watch), System::command_watch, "watch incoming telegrams");
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(watch), System::command_watch, F("watch incoming telegrams"));
|
||||||
|
|
||||||
// register syslog command in syslog init
|
// register syslog command in syslog init
|
||||||
// Command::add(EMSdevice::DeviceType::SYSTEM, F_(syslog), System::command_syslog_level, F("set syslog level"), CommandFlag::ADMIN_ONLY);
|
// Command::add(EMSdevice::DeviceType::SYSTEM, F_(syslog), System::command_syslog_level, F("set syslog level"), CommandFlag::ADMIN_ONLY);
|
||||||
|
|
||||||
if (Mqtt::enabled()) {
|
if (Mqtt::enabled()) {
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(publish), System::command_publish, "force a MQTT publish");
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(publish), System::command_publish, F("force a MQTT publish"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// these commands will return data in JSON format
|
// these commands will return data in JSON format
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(info), System::command_info, "show system status");
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(info), System::command_info, F("show system status"));
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(commands), System::command_commands, "fetch system commands");
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(commands), System::command_commands, F("fetch system commands"));
|
||||||
|
|
||||||
#if defined(EMSESP_DEBUG)
|
#if defined(EMSESP_DEBUG)
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F("test"), System::command_test, "run a specific test");
|
Command::add(EMSdevice::DeviceType::SYSTEM, F("test"), System::command_test, F("run a specific test"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// MQTT subscribe "ems-esp/system/#"
|
// MQTT subscribe "ems-esp/system/#"
|
||||||
|
|||||||
Reference in New Issue
Block a user