mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
exclude disabled sensors from dashboard
This commit is contained in:
@@ -435,11 +435,10 @@ void WebDataService::dashboard_data(AsyncWebServerRequest * request) {
|
||||
JsonArray nodes = obj["nodes"].to<JsonArray>();
|
||||
uint8_t count = 0;
|
||||
for (const auto & sensor : EMSESP::analogsensor_.sensors()) {
|
||||
// ignore system sensors
|
||||
if (sensor.is_system()) {
|
||||
// ignore system and disabled sensors
|
||||
if (sensor.is_system() || sensor.type() == AnalogSensor::AnalogType::NOTUSED || sensor.gpio() == 99) {
|
||||
continue;
|
||||
}
|
||||
if (sensor.type() != AnalogSensor::AnalogType::NOTUSED) { // ignore disabled
|
||||
JsonObject node = nodes.add<JsonObject>();
|
||||
node["id"] = (EMSdevice::DeviceTypeUniqueID::ANALOGSENSOR_UID * 100) + count++;
|
||||
|
||||
@@ -472,7 +471,6 @@ void WebDataService::dashboard_data(AsyncWebServerRequest * request) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// show scheduler, with name, on/off
|
||||
if (EMSESP::webSchedulerService.count_entities(true)) {
|
||||
|
||||
Reference in New Issue
Block a user