show emsesp-devices in system info, add common fields to value_info #2033

This commit is contained in:
MichaelDvP
2024-09-25 18:47:09 +02:00
parent 9ca16bd2c8
commit 83d5b919d6
10 changed files with 57 additions and 35 deletions

View File

@@ -178,8 +178,9 @@ bool WebSchedulerService::get_value_info(JsonObject output, const char * cmd) {
// build the json for specific entity
void WebSchedulerService::get_value_json(JsonObject output, const ScheduleItem & scheduleItem) {
output["name"] = scheduleItem.name;
output["type"] = "boolean";
output["name"] = scheduleItem.name;
output["fullname"] = scheduleItem.name;
output["type"] = "boolean";
if (EMSESP::system_.bool_format() == BOOL_FORMAT_TRUEFALSE) {
output["value"] = scheduleItem.active;
} else if (EMSESP::system_.bool_format() == BOOL_FORMAT_10) {
@@ -299,18 +300,15 @@ void WebSchedulerService::publish(const bool force) {
}
}
bool WebSchedulerService::has_commands() {
if (scheduleItems_->size() == 0) {
return false;
}
// count number of entries, default: only named items
uint8_t WebSchedulerService::count_entities(bool cmd_only) {
uint8_t count = 0;
for (const ScheduleItem & scheduleItem : *scheduleItems_) {
if (!scheduleItem.name.empty()) {
return true;
if (!scheduleItem.name.empty() || !cmd_only) {
count++;
}
}
return false;
return count;
}
#include "shuntingYard.hpp"