mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
remove specific commands like ntp/enabled (ap/enabled didn't work) and replace with just service name
This commit is contained in:
@@ -367,6 +367,7 @@ uint8_t Command::call(const uint8_t device_type, const char * command, const cha
|
||||
// or a special command like 'info', 'values', 'commands', 'entities' etc
|
||||
bool single_command = (!value || !strlen(value));
|
||||
if (single_command) {
|
||||
Serial.println("single_command");
|
||||
if (!strcmp(cmd, F_(commands))) {
|
||||
return Command::list(device_type, output);
|
||||
}
|
||||
@@ -583,15 +584,13 @@ bool Command::list(const uint8_t device_type, JsonObject output) {
|
||||
output[F_(entities)] = Helpers::translated_word(FL_(entities_cmd));
|
||||
|
||||
if (device_type == EMSdevice::DeviceType::SYSTEM) {
|
||||
output["settings/showertimer"] = Helpers::translated_word(FL_(system_cmd));
|
||||
output["settings/showeralert"] = Helpers::translated_word(FL_(system_cmd));
|
||||
output["settings/hideled"] = Helpers::translated_word(FL_(system_cmd));
|
||||
output["settings/analogenabled"] = Helpers::translated_word(FL_(system_cmd));
|
||||
output["mqtt/enabled"] = Helpers::translated_word(FL_(system_cmd));
|
||||
output["ntp/enabled"] = Helpers::translated_word(FL_(system_cmd));
|
||||
output["ap/enabled"] = Helpers::translated_word(FL_(system_cmd));
|
||||
output["syslog/enabled"] = Helpers::translated_word(FL_(system_cmd));
|
||||
output["settings"] = Helpers::translated_word(FL_(system_cmd));
|
||||
output["mqtt"] = Helpers::translated_word(FL_(system_cmd));
|
||||
output["ntp"] = Helpers::translated_word(FL_(system_cmd));
|
||||
output["ap"] = Helpers::translated_word(FL_(system_cmd));
|
||||
output["syslog"] = Helpers::translated_word(FL_(system_cmd));
|
||||
}
|
||||
|
||||
// create a list of commands we have registered, and sort them
|
||||
std::list<std::string> sorted_cmds;
|
||||
for (const auto & cf : cmdfunctions_) {
|
||||
@@ -621,14 +620,11 @@ void Command::show(uuid::console::Shell & shell, uint8_t device_type, bool verbo
|
||||
}
|
||||
}
|
||||
if (device_type == EMSdevice::DeviceType::SYSTEM) {
|
||||
sorted_cmds.emplace_back("settings/showertimer");
|
||||
sorted_cmds.emplace_back("settings/showeralert");
|
||||
sorted_cmds.emplace_back("settings/hideled");
|
||||
sorted_cmds.emplace_back("settings/analogenabled");
|
||||
sorted_cmds.emplace_back("mqtt/enabled");
|
||||
sorted_cmds.emplace_back("ntp/enabled");
|
||||
sorted_cmds.emplace_back("ap/enabled");
|
||||
sorted_cmds.emplace_back("syslog/enabled");
|
||||
sorted_cmds.emplace_back("settings");
|
||||
sorted_cmds.emplace_back("mqtt");
|
||||
sorted_cmds.emplace_back("ntp");
|
||||
sorted_cmds.emplace_back("ap");
|
||||
sorted_cmds.emplace_back("syslog");
|
||||
}
|
||||
sorted_cmds.sort(); // sort them
|
||||
|
||||
|
||||
@@ -1668,6 +1668,21 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output
|
||||
node["timestamp"] = time(nullptr);
|
||||
#endif
|
||||
|
||||
// AP Status
|
||||
node = output["ap"].to<JsonObject>();
|
||||
EMSESP::esp32React.getAPSettingsService()->read([&](const APSettings & settings) {
|
||||
node["provisionMode"] = settings.provisionMode; // 0 is on, 2 is off
|
||||
node["ssid"] = settings.ssid;
|
||||
#ifndef EMSESP_STANDALONE
|
||||
node["channel"] = settings.channel;
|
||||
node["ssidHidden"] = settings.ssidHidden;
|
||||
node["maxClients"] = settings.maxClients;
|
||||
node["localIP"] = settings.localIP.toString();
|
||||
node["gatewayIP"] = settings.gatewayIP.toString();
|
||||
node["subnetMask"] = settings.subnetMask.toString();
|
||||
#endif
|
||||
});
|
||||
|
||||
// MQTT Status
|
||||
node = output["mqtt"].to<JsonObject>();
|
||||
node["MQTTStatus"] = Mqtt::connected() ? F_(connected) : F_(disconnected);
|
||||
|
||||
Reference in New Issue
Block a user