mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
show dashboard nodes when there is data
This commit is contained in:
@@ -37,7 +37,7 @@ uint8_t EMSdevice::count_entities() {
|
||||
uint8_t EMSdevice::count_entities_fav() {
|
||||
uint8_t count = 0;
|
||||
for (const auto & dv : devicevalues_) {
|
||||
count += dv.has_state(DeviceValueState::DV_FAVORITE);
|
||||
count += dv.has_state(DeviceValueState::DV_FAVORITE) && dv.hasValue();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -355,6 +355,7 @@ void WebDataService::dashboard_data(AsyncWebServerRequest * request) {
|
||||
JsonArray root = response->getRoot();
|
||||
#endif
|
||||
|
||||
// first do all the recognized devices
|
||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||
if (emsdevice->count_entities_fav()) {
|
||||
JsonObject obj = root.add<JsonObject>();
|
||||
|
||||
Reference in New Issue
Block a user