mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
Merge pull request #2424 from proddy/dev
fix weird bug where the total # entities would be incorrect
This commit is contained in:
@@ -72,7 +72,7 @@ export interface Device {
|
|||||||
d: number; // deviceid
|
d: number; // deviceid
|
||||||
p: number; // productid
|
p: number; // productid
|
||||||
v: string; // version
|
v: string; // version
|
||||||
e: number; // entities
|
e: number; // total number of entities
|
||||||
url?: string; // lowercase type name used in API URL
|
url?: string; // lowercase type name used in API URL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,12 +21,13 @@
|
|||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
|
|
||||||
// returns number of visible device values (entries) for this device
|
// returns number of visible device values (entities) for this device, for the Devices page
|
||||||
// this includes commands since they can also be entities and visible in the web UI
|
// this includes commands since they can also be entities and visible in the web UI
|
||||||
uint8_t EMSdevice::count_entities() {
|
uint8_t EMSdevice::count_entities() {
|
||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
for (const auto & dv : devicevalues_) {
|
for (const auto & dv : devicevalues_) {
|
||||||
if (!dv.has_state(DeviceValueState::DV_WEB_EXCLUDE) && dv.hasValue()) {
|
// if (!dv.has_state(DeviceValueState::DV_WEB_EXCLUDE) && dv.hasValue()) {
|
||||||
|
if (dv.hasValue()) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user