exclude disabled sensors from dashboard

This commit is contained in:
MichaelDvP
2025-11-17 13:57:30 +01:00
parent 5df82b7e2c
commit f112e6f6cc

View File

@@ -435,11 +435,10 @@ void WebDataService::dashboard_data(AsyncWebServerRequest * request) {
JsonArray nodes = obj["nodes"].to<JsonArray>(); JsonArray nodes = obj["nodes"].to<JsonArray>();
uint8_t count = 0; uint8_t count = 0;
for (const auto & sensor : EMSESP::analogsensor_.sensors()) { for (const auto & sensor : EMSESP::analogsensor_.sensors()) {
// ignore system sensors // ignore system and disabled sensors
if (sensor.is_system()) { if (sensor.is_system() || sensor.type() == AnalogSensor::AnalogType::NOTUSED || sensor.gpio() == 99) {
continue; continue;
} }
if (sensor.type() != AnalogSensor::AnalogType::NOTUSED) { // ignore disabled
JsonObject node = nodes.add<JsonObject>(); JsonObject node = nodes.add<JsonObject>();
node["id"] = (EMSdevice::DeviceTypeUniqueID::ANALOGSENSOR_UID * 100) + count++; node["id"] = (EMSdevice::DeviceTypeUniqueID::ANALOGSENSOR_UID * 100) + count++;
@@ -472,7 +471,6 @@ void WebDataService::dashboard_data(AsyncWebServerRequest * request) {
} }
} }
} }
}
// show scheduler, with name, on/off // show scheduler, with name, on/off
if (EMSESP::webSchedulerService.count_entities(true)) { if (EMSESP::webSchedulerService.count_entities(true)) {