mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-06-15 12:26:33 +03:00
don't show Scheduler items of type immediate in Dashboard
This commit is contained in:
@@ -488,8 +488,6 @@ void WebDataService::dashboard_data(AsyncWebServerRequest * request) {
|
|||||||
|
|
||||||
EMSESP::webSchedulerService.read([&](const WebScheduler & webScheduler) {
|
EMSESP::webSchedulerService.read([&](const WebScheduler & webScheduler) {
|
||||||
for (const ScheduleItem & scheduleItem : webScheduler.scheduleItems) {
|
for (const ScheduleItem & scheduleItem : webScheduler.scheduleItems) {
|
||||||
// only add if we have a name and it's not of type SCHEDULE_IMMEDIATE - we don't need a u (UOM) for this
|
|
||||||
if (scheduleItem.name[0] != '\0' && scheduleItem.flags != SCHEDULEFLAG_SCHEDULE_IMMEDIATE) {
|
|
||||||
JsonObject node = nodes.add<JsonObject>();
|
JsonObject node = nodes.add<JsonObject>();
|
||||||
node["id"] = (EMSdevice::DeviceTypeUniqueID::SCHEDULER_UID * 100) + count++;
|
node["id"] = (EMSdevice::DeviceTypeUniqueID::SCHEDULER_UID * 100) + count++;
|
||||||
|
|
||||||
@@ -502,10 +500,13 @@ void WebDataService::dashboard_data(AsyncWebServerRequest * request) {
|
|||||||
l.add(Helpers::render_boolean(s, false, true));
|
l.add(Helpers::render_boolean(s, false, true));
|
||||||
l.add(Helpers::render_boolean(s, true, true));
|
l.add(Helpers::render_boolean(s, true, true));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Serial.println("All dashboard_data: ");
|
||||||
|
serializeJson(root, Serial);
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
#if defined(EMSESP_TEST) && defined(EMSESP_STANDALONE)
|
#if defined(EMSESP_TEST) && defined(EMSESP_STANDALONE)
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.print("All dashboard_data: ");
|
Serial.print("All dashboard_data: ");
|
||||||
|
|||||||
@@ -333,10 +333,12 @@ void WebSchedulerService::publish(const bool force) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// count number of entries, default: only named items
|
// count number of entries, default: only named items
|
||||||
uint8_t WebSchedulerService::count_entities(bool cmd_only) {
|
// if exclude_immediate is true, include those that are of type SCHEDULEFLAG_SCHEDULE_IMMEDIATE
|
||||||
|
uint8_t WebSchedulerService::count_entities(bool exclude_immediate) {
|
||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
for (const ScheduleItem & scheduleItem : *scheduleItems_) {
|
for (const ScheduleItem & scheduleItem : *scheduleItems_) {
|
||||||
if (scheduleItem.name[0] != '\0' || !cmd_only) {
|
// count all except SCHEDULE_IMMEDIATE if exclude_immediate is true, else count all
|
||||||
|
if (!exclude_immediate || scheduleItem.flags != SCHEDULEFLAG_SCHEDULE_IMMEDIATE) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class WebSchedulerService : public StatefulService<WebScheduler> {
|
|||||||
void ha_reset() {
|
void ha_reset() {
|
||||||
ha_configdone_ = false;
|
ha_configdone_ = false;
|
||||||
}
|
}
|
||||||
uint8_t count_entities(bool cmd_only = false);
|
uint8_t count_entities(bool exclude_immediate = false);
|
||||||
bool onChange(const char * cmd);
|
bool onChange(const char * cmd);
|
||||||
|
|
||||||
bool executeSchedule(const char * name);
|
bool executeSchedule(const char * name);
|
||||||
|
|||||||
Reference in New Issue
Block a user