mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
show scheduler/custom always
This commit is contained in:
@@ -132,12 +132,9 @@ bool WebSchedulerService::command_setvalue(const char * value, const std::string
|
||||
// process json output for info/commands and value_info
|
||||
bool WebSchedulerService::get_value_info(JsonObject & output, const char * cmd) {
|
||||
EMSESP::webSchedulerService.read([&](WebScheduler & webScheduler) { scheduleItems = &webScheduler.scheduleItems; });
|
||||
if (scheduleItems->size() == 0) {
|
||||
return false;
|
||||
}
|
||||
if (Helpers::toLower(cmd) == "commands") {
|
||||
output["info"] = "lists all values";
|
||||
output["commands"] = "lists all commands";
|
||||
if (Helpers::toLower(cmd) == F_(commands)) {
|
||||
output[F_(info)] = Helpers::translated_word(FL_(info_cmd));
|
||||
output[F_(commands)] = Helpers::translated_word(FL_(commands_cmd));
|
||||
for (const ScheduleItem & scheduleItem : *scheduleItems) {
|
||||
if (!scheduleItem.name.empty()) {
|
||||
output[scheduleItem.name] = "activate schedule";
|
||||
@@ -145,7 +142,7 @@ bool WebSchedulerService::get_value_info(JsonObject & output, const char * cmd)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (strlen(cmd) == 0 || Helpers::toLower(cmd) == "values" || Helpers::toLower(cmd) == "info") {
|
||||
if (strlen(cmd) == 0 || Helpers::toLower(cmd) == F_(values) || Helpers::toLower(cmd) == F_(info)) {
|
||||
// list all names
|
||||
for (const ScheduleItem & scheduleItem : *scheduleItems) {
|
||||
if (!scheduleItem.name.empty()) {
|
||||
@@ -161,6 +158,10 @@ bool WebSchedulerService::get_value_info(JsonObject & output, const char * cmd)
|
||||
}
|
||||
return (output.size() > 0);
|
||||
}
|
||||
if (scheduleItems->size() == 0) {
|
||||
output["message"] = "no schedules";
|
||||
return false;
|
||||
}
|
||||
char command_s[30];
|
||||
strlcpy(command_s, cmd, sizeof(command_s));
|
||||
char * attribute_s = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user