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 EMSdevice::count_entities_fav() {
|
||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
for (const auto & dv : devicevalues_) {
|
for (const auto & dv : devicevalues_) {
|
||||||
count += dv.has_state(DeviceValueState::DV_FAVORITE);
|
count += dv.has_state(DeviceValueState::DV_FAVORITE) && dv.hasValue();
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -355,6 +355,7 @@ void WebDataService::dashboard_data(AsyncWebServerRequest * request) {
|
|||||||
JsonArray root = response->getRoot();
|
JsonArray root = response->getRoot();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// first do all the recognized devices
|
||||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||||
if (emsdevice->count_entities_fav()) {
|
if (emsdevice->count_entities_fav()) {
|
||||||
JsonObject obj = root.add<JsonObject>();
|
JsonObject obj = root.add<JsonObject>();
|
||||||
|
|||||||
Reference in New Issue
Block a user