mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59: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>();
|
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)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user