diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index b9f4ba0f4..34e2a2a09 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -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; } diff --git a/src/web/WebDataService.cpp b/src/web/WebDataService.cpp index 2c532add5..7a17c5698 100644 --- a/src/web/WebDataService.cpp +++ b/src/web/WebDataService.cpp @@ -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();