myio-js-library 0.1.188 → 0.1.189
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +90 -54
- package/dist/index.js +90 -54
- package/dist/myio-js-library.umd.js +90 -54
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -34404,35 +34404,53 @@ var EnergySummaryTooltip = {
|
|
|
34404
34404
|
summary.byCategory = [entrada, lojas, areaComum];
|
|
34405
34405
|
summary.totalDevices = entrada.deviceCount + lojas.deviceCount + areaComumDeviceCount;
|
|
34406
34406
|
summary.totalConsumption = state5.grandTotal || entrada.consumption;
|
|
34407
|
-
const
|
|
34408
|
-
if (
|
|
34409
|
-
summary.byStatus =
|
|
34407
|
+
const widgetAggregation = receivedData?.deviceStatusAggregation;
|
|
34408
|
+
if (widgetAggregation && widgetAggregation.hasData) {
|
|
34409
|
+
summary.byStatus = {
|
|
34410
|
+
normal: widgetAggregation.normal || 0,
|
|
34411
|
+
alert: widgetAggregation.alert || 0,
|
|
34412
|
+
failure: widgetAggregation.failure || 0,
|
|
34413
|
+
standby: widgetAggregation.standby || 0,
|
|
34414
|
+
offline: widgetAggregation.offline || 0,
|
|
34415
|
+
noConsumption: widgetAggregation.noConsumption || 0,
|
|
34416
|
+
normalDevices: widgetAggregation.normalDevices || [],
|
|
34417
|
+
alertDevices: widgetAggregation.alertDevices || [],
|
|
34418
|
+
failureDevices: widgetAggregation.failureDevices || [],
|
|
34419
|
+
standbyDevices: widgetAggregation.standbyDevices || [],
|
|
34420
|
+
offlineDevices: widgetAggregation.offlineDevices || [],
|
|
34421
|
+
noConsumptionDevices: widgetAggregation.noConsumptionDevices || []
|
|
34422
|
+
};
|
|
34410
34423
|
} else {
|
|
34411
|
-
const
|
|
34412
|
-
|
|
34413
|
-
|
|
34414
|
-
summary.byStatus = {
|
|
34415
|
-
normal: statusData.normal || 0,
|
|
34416
|
-
alert: statusData.alert || 0,
|
|
34417
|
-
failure: statusData.failure || 0,
|
|
34418
|
-
standby: statusData.standby || 0,
|
|
34419
|
-
offline: statusData.offline || 0,
|
|
34420
|
-
noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
|
|
34421
|
-
};
|
|
34424
|
+
const statusAggregation = this._aggregateDeviceStatusFromOrchestrator(domain);
|
|
34425
|
+
if (statusAggregation.hasData) {
|
|
34426
|
+
summary.byStatus = statusAggregation.byStatus;
|
|
34422
34427
|
} else {
|
|
34423
|
-
|
|
34424
|
-
|
|
34425
|
-
|
|
34426
|
-
|
|
34427
|
-
|
|
34428
|
-
|
|
34429
|
-
|
|
34430
|
-
|
|
34431
|
-
|
|
34432
|
-
|
|
34433
|
-
|
|
34434
|
-
|
|
34435
|
-
summary.byStatus
|
|
34428
|
+
const totalDevices = summary.totalDevices;
|
|
34429
|
+
const statusData = receivedData?.statusCounts || receivedData?.deviceStatus || null;
|
|
34430
|
+
if (statusData && typeof statusData === "object") {
|
|
34431
|
+
summary.byStatus = {
|
|
34432
|
+
normal: statusData.normal || 0,
|
|
34433
|
+
alert: statusData.alert || 0,
|
|
34434
|
+
failure: statusData.failure || 0,
|
|
34435
|
+
standby: statusData.standby || 0,
|
|
34436
|
+
offline: statusData.offline || 0,
|
|
34437
|
+
noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
|
|
34438
|
+
};
|
|
34439
|
+
} else {
|
|
34440
|
+
summary.byStatus = {
|
|
34441
|
+
normal: Math.floor(totalDevices * 0.75),
|
|
34442
|
+
alert: Math.floor(totalDevices * 0.06),
|
|
34443
|
+
failure: Math.floor(totalDevices * 0.02),
|
|
34444
|
+
standby: Math.floor(totalDevices * 0.02),
|
|
34445
|
+
offline: Math.floor(totalDevices * 0.03),
|
|
34446
|
+
noConsumption: Math.floor(totalDevices * 0.12)
|
|
34447
|
+
};
|
|
34448
|
+
const statusSum = Object.values(summary.byStatus).reduce((a, b) => {
|
|
34449
|
+
return typeof b === "number" ? a + b : a;
|
|
34450
|
+
}, 0);
|
|
34451
|
+
if (statusSum !== totalDevices && totalDevices > 0) {
|
|
34452
|
+
summary.byStatus.normal += totalDevices - statusSum;
|
|
34453
|
+
}
|
|
34436
34454
|
}
|
|
34437
34455
|
}
|
|
34438
34456
|
}
|
|
@@ -35740,35 +35758,53 @@ var WaterSummaryTooltip = {
|
|
|
35740
35758
|
}
|
|
35741
35759
|
summary.totalDevices = summary.byCategory.reduce((sum, cat) => sum + cat.deviceCount, 0);
|
|
35742
35760
|
summary.totalConsumption = state5.entrada?.total || 0;
|
|
35743
|
-
const
|
|
35744
|
-
if (
|
|
35745
|
-
summary.byStatus =
|
|
35761
|
+
const widgetAggregation = receivedData?.deviceStatusAggregation;
|
|
35762
|
+
if (widgetAggregation && widgetAggregation.hasData) {
|
|
35763
|
+
summary.byStatus = {
|
|
35764
|
+
normal: widgetAggregation.normal || 0,
|
|
35765
|
+
alert: widgetAggregation.alert || 0,
|
|
35766
|
+
failure: widgetAggregation.failure || 0,
|
|
35767
|
+
standby: widgetAggregation.standby || 0,
|
|
35768
|
+
offline: widgetAggregation.offline || 0,
|
|
35769
|
+
noConsumption: widgetAggregation.noConsumption || 0,
|
|
35770
|
+
normalDevices: widgetAggregation.normalDevices || [],
|
|
35771
|
+
alertDevices: widgetAggregation.alertDevices || [],
|
|
35772
|
+
failureDevices: widgetAggregation.failureDevices || [],
|
|
35773
|
+
standbyDevices: widgetAggregation.standbyDevices || [],
|
|
35774
|
+
offlineDevices: widgetAggregation.offlineDevices || [],
|
|
35775
|
+
noConsumptionDevices: widgetAggregation.noConsumptionDevices || []
|
|
35776
|
+
};
|
|
35746
35777
|
} else {
|
|
35747
|
-
const
|
|
35748
|
-
|
|
35749
|
-
|
|
35750
|
-
summary.byStatus = {
|
|
35751
|
-
normal: statusData.normal || 0,
|
|
35752
|
-
alert: statusData.alert || 0,
|
|
35753
|
-
failure: statusData.failure || 0,
|
|
35754
|
-
standby: statusData.standby || 0,
|
|
35755
|
-
offline: statusData.offline || 0,
|
|
35756
|
-
noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
|
|
35757
|
-
};
|
|
35778
|
+
const statusAggregation = this._aggregateDeviceStatusFromOrchestrator(domain);
|
|
35779
|
+
if (statusAggregation.hasData) {
|
|
35780
|
+
summary.byStatus = statusAggregation.byStatus;
|
|
35758
35781
|
} else {
|
|
35759
|
-
|
|
35760
|
-
|
|
35761
|
-
|
|
35762
|
-
|
|
35763
|
-
|
|
35764
|
-
|
|
35765
|
-
|
|
35766
|
-
|
|
35767
|
-
|
|
35768
|
-
|
|
35769
|
-
|
|
35770
|
-
|
|
35771
|
-
summary.byStatus
|
|
35782
|
+
const totalDevices = summary.totalDevices;
|
|
35783
|
+
const statusData = receivedData?.statusCounts || receivedData?.deviceStatus || null;
|
|
35784
|
+
if (statusData && typeof statusData === "object") {
|
|
35785
|
+
summary.byStatus = {
|
|
35786
|
+
normal: statusData.normal || 0,
|
|
35787
|
+
alert: statusData.alert || 0,
|
|
35788
|
+
failure: statusData.failure || 0,
|
|
35789
|
+
standby: statusData.standby || 0,
|
|
35790
|
+
offline: statusData.offline || 0,
|
|
35791
|
+
noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
|
|
35792
|
+
};
|
|
35793
|
+
} else {
|
|
35794
|
+
summary.byStatus = {
|
|
35795
|
+
normal: Math.floor(totalDevices * 0.8),
|
|
35796
|
+
alert: Math.floor(totalDevices * 0.05),
|
|
35797
|
+
failure: Math.floor(totalDevices * 0.02),
|
|
35798
|
+
standby: Math.floor(totalDevices * 0.02),
|
|
35799
|
+
offline: Math.floor(totalDevices * 0.03),
|
|
35800
|
+
noConsumption: Math.floor(totalDevices * 0.08)
|
|
35801
|
+
};
|
|
35802
|
+
const statusSum = Object.values(summary.byStatus).reduce((a, b) => {
|
|
35803
|
+
return typeof b === "number" ? a + b : a;
|
|
35804
|
+
}, 0);
|
|
35805
|
+
if (statusSum !== totalDevices && totalDevices > 0) {
|
|
35806
|
+
summary.byStatus.normal += totalDevices - statusSum;
|
|
35807
|
+
}
|
|
35772
35808
|
}
|
|
35773
35809
|
}
|
|
35774
35810
|
}
|
package/dist/index.js
CHANGED
|
@@ -34235,35 +34235,53 @@ var EnergySummaryTooltip = {
|
|
|
34235
34235
|
summary.byCategory = [entrada, lojas, areaComum];
|
|
34236
34236
|
summary.totalDevices = entrada.deviceCount + lojas.deviceCount + areaComumDeviceCount;
|
|
34237
34237
|
summary.totalConsumption = state5.grandTotal || entrada.consumption;
|
|
34238
|
-
const
|
|
34239
|
-
if (
|
|
34240
|
-
summary.byStatus =
|
|
34238
|
+
const widgetAggregation = receivedData?.deviceStatusAggregation;
|
|
34239
|
+
if (widgetAggregation && widgetAggregation.hasData) {
|
|
34240
|
+
summary.byStatus = {
|
|
34241
|
+
normal: widgetAggregation.normal || 0,
|
|
34242
|
+
alert: widgetAggregation.alert || 0,
|
|
34243
|
+
failure: widgetAggregation.failure || 0,
|
|
34244
|
+
standby: widgetAggregation.standby || 0,
|
|
34245
|
+
offline: widgetAggregation.offline || 0,
|
|
34246
|
+
noConsumption: widgetAggregation.noConsumption || 0,
|
|
34247
|
+
normalDevices: widgetAggregation.normalDevices || [],
|
|
34248
|
+
alertDevices: widgetAggregation.alertDevices || [],
|
|
34249
|
+
failureDevices: widgetAggregation.failureDevices || [],
|
|
34250
|
+
standbyDevices: widgetAggregation.standbyDevices || [],
|
|
34251
|
+
offlineDevices: widgetAggregation.offlineDevices || [],
|
|
34252
|
+
noConsumptionDevices: widgetAggregation.noConsumptionDevices || []
|
|
34253
|
+
};
|
|
34241
34254
|
} else {
|
|
34242
|
-
const
|
|
34243
|
-
|
|
34244
|
-
|
|
34245
|
-
summary.byStatus = {
|
|
34246
|
-
normal: statusData.normal || 0,
|
|
34247
|
-
alert: statusData.alert || 0,
|
|
34248
|
-
failure: statusData.failure || 0,
|
|
34249
|
-
standby: statusData.standby || 0,
|
|
34250
|
-
offline: statusData.offline || 0,
|
|
34251
|
-
noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
|
|
34252
|
-
};
|
|
34255
|
+
const statusAggregation = this._aggregateDeviceStatusFromOrchestrator(domain);
|
|
34256
|
+
if (statusAggregation.hasData) {
|
|
34257
|
+
summary.byStatus = statusAggregation.byStatus;
|
|
34253
34258
|
} else {
|
|
34254
|
-
|
|
34255
|
-
|
|
34256
|
-
|
|
34257
|
-
|
|
34258
|
-
|
|
34259
|
-
|
|
34260
|
-
|
|
34261
|
-
|
|
34262
|
-
|
|
34263
|
-
|
|
34264
|
-
|
|
34265
|
-
|
|
34266
|
-
summary.byStatus
|
|
34259
|
+
const totalDevices = summary.totalDevices;
|
|
34260
|
+
const statusData = receivedData?.statusCounts || receivedData?.deviceStatus || null;
|
|
34261
|
+
if (statusData && typeof statusData === "object") {
|
|
34262
|
+
summary.byStatus = {
|
|
34263
|
+
normal: statusData.normal || 0,
|
|
34264
|
+
alert: statusData.alert || 0,
|
|
34265
|
+
failure: statusData.failure || 0,
|
|
34266
|
+
standby: statusData.standby || 0,
|
|
34267
|
+
offline: statusData.offline || 0,
|
|
34268
|
+
noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
|
|
34269
|
+
};
|
|
34270
|
+
} else {
|
|
34271
|
+
summary.byStatus = {
|
|
34272
|
+
normal: Math.floor(totalDevices * 0.75),
|
|
34273
|
+
alert: Math.floor(totalDevices * 0.06),
|
|
34274
|
+
failure: Math.floor(totalDevices * 0.02),
|
|
34275
|
+
standby: Math.floor(totalDevices * 0.02),
|
|
34276
|
+
offline: Math.floor(totalDevices * 0.03),
|
|
34277
|
+
noConsumption: Math.floor(totalDevices * 0.12)
|
|
34278
|
+
};
|
|
34279
|
+
const statusSum = Object.values(summary.byStatus).reduce((a, b) => {
|
|
34280
|
+
return typeof b === "number" ? a + b : a;
|
|
34281
|
+
}, 0);
|
|
34282
|
+
if (statusSum !== totalDevices && totalDevices > 0) {
|
|
34283
|
+
summary.byStatus.normal += totalDevices - statusSum;
|
|
34284
|
+
}
|
|
34267
34285
|
}
|
|
34268
34286
|
}
|
|
34269
34287
|
}
|
|
@@ -35571,35 +35589,53 @@ var WaterSummaryTooltip = {
|
|
|
35571
35589
|
}
|
|
35572
35590
|
summary.totalDevices = summary.byCategory.reduce((sum, cat) => sum + cat.deviceCount, 0);
|
|
35573
35591
|
summary.totalConsumption = state5.entrada?.total || 0;
|
|
35574
|
-
const
|
|
35575
|
-
if (
|
|
35576
|
-
summary.byStatus =
|
|
35592
|
+
const widgetAggregation = receivedData?.deviceStatusAggregation;
|
|
35593
|
+
if (widgetAggregation && widgetAggregation.hasData) {
|
|
35594
|
+
summary.byStatus = {
|
|
35595
|
+
normal: widgetAggregation.normal || 0,
|
|
35596
|
+
alert: widgetAggregation.alert || 0,
|
|
35597
|
+
failure: widgetAggregation.failure || 0,
|
|
35598
|
+
standby: widgetAggregation.standby || 0,
|
|
35599
|
+
offline: widgetAggregation.offline || 0,
|
|
35600
|
+
noConsumption: widgetAggregation.noConsumption || 0,
|
|
35601
|
+
normalDevices: widgetAggregation.normalDevices || [],
|
|
35602
|
+
alertDevices: widgetAggregation.alertDevices || [],
|
|
35603
|
+
failureDevices: widgetAggregation.failureDevices || [],
|
|
35604
|
+
standbyDevices: widgetAggregation.standbyDevices || [],
|
|
35605
|
+
offlineDevices: widgetAggregation.offlineDevices || [],
|
|
35606
|
+
noConsumptionDevices: widgetAggregation.noConsumptionDevices || []
|
|
35607
|
+
};
|
|
35577
35608
|
} else {
|
|
35578
|
-
const
|
|
35579
|
-
|
|
35580
|
-
|
|
35581
|
-
summary.byStatus = {
|
|
35582
|
-
normal: statusData.normal || 0,
|
|
35583
|
-
alert: statusData.alert || 0,
|
|
35584
|
-
failure: statusData.failure || 0,
|
|
35585
|
-
standby: statusData.standby || 0,
|
|
35586
|
-
offline: statusData.offline || 0,
|
|
35587
|
-
noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
|
|
35588
|
-
};
|
|
35609
|
+
const statusAggregation = this._aggregateDeviceStatusFromOrchestrator(domain);
|
|
35610
|
+
if (statusAggregation.hasData) {
|
|
35611
|
+
summary.byStatus = statusAggregation.byStatus;
|
|
35589
35612
|
} else {
|
|
35590
|
-
|
|
35591
|
-
|
|
35592
|
-
|
|
35593
|
-
|
|
35594
|
-
|
|
35595
|
-
|
|
35596
|
-
|
|
35597
|
-
|
|
35598
|
-
|
|
35599
|
-
|
|
35600
|
-
|
|
35601
|
-
|
|
35602
|
-
summary.byStatus
|
|
35613
|
+
const totalDevices = summary.totalDevices;
|
|
35614
|
+
const statusData = receivedData?.statusCounts || receivedData?.deviceStatus || null;
|
|
35615
|
+
if (statusData && typeof statusData === "object") {
|
|
35616
|
+
summary.byStatus = {
|
|
35617
|
+
normal: statusData.normal || 0,
|
|
35618
|
+
alert: statusData.alert || 0,
|
|
35619
|
+
failure: statusData.failure || 0,
|
|
35620
|
+
standby: statusData.standby || 0,
|
|
35621
|
+
offline: statusData.offline || 0,
|
|
35622
|
+
noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
|
|
35623
|
+
};
|
|
35624
|
+
} else {
|
|
35625
|
+
summary.byStatus = {
|
|
35626
|
+
normal: Math.floor(totalDevices * 0.8),
|
|
35627
|
+
alert: Math.floor(totalDevices * 0.05),
|
|
35628
|
+
failure: Math.floor(totalDevices * 0.02),
|
|
35629
|
+
standby: Math.floor(totalDevices * 0.02),
|
|
35630
|
+
offline: Math.floor(totalDevices * 0.03),
|
|
35631
|
+
noConsumption: Math.floor(totalDevices * 0.08)
|
|
35632
|
+
};
|
|
35633
|
+
const statusSum = Object.values(summary.byStatus).reduce((a, b) => {
|
|
35634
|
+
return typeof b === "number" ? a + b : a;
|
|
35635
|
+
}, 0);
|
|
35636
|
+
if (statusSum !== totalDevices && totalDevices > 0) {
|
|
35637
|
+
summary.byStatus.normal += totalDevices - statusSum;
|
|
35638
|
+
}
|
|
35603
35639
|
}
|
|
35604
35640
|
}
|
|
35605
35641
|
}
|
|
@@ -34049,35 +34049,53 @@
|
|
|
34049
34049
|
summary.byCategory = [entrada, lojas, areaComum];
|
|
34050
34050
|
summary.totalDevices = entrada.deviceCount + lojas.deviceCount + areaComumDeviceCount;
|
|
34051
34051
|
summary.totalConsumption = state5.grandTotal || entrada.consumption;
|
|
34052
|
-
const
|
|
34053
|
-
if (
|
|
34054
|
-
summary.byStatus =
|
|
34052
|
+
const widgetAggregation = receivedData?.deviceStatusAggregation;
|
|
34053
|
+
if (widgetAggregation && widgetAggregation.hasData) {
|
|
34054
|
+
summary.byStatus = {
|
|
34055
|
+
normal: widgetAggregation.normal || 0,
|
|
34056
|
+
alert: widgetAggregation.alert || 0,
|
|
34057
|
+
failure: widgetAggregation.failure || 0,
|
|
34058
|
+
standby: widgetAggregation.standby || 0,
|
|
34059
|
+
offline: widgetAggregation.offline || 0,
|
|
34060
|
+
noConsumption: widgetAggregation.noConsumption || 0,
|
|
34061
|
+
normalDevices: widgetAggregation.normalDevices || [],
|
|
34062
|
+
alertDevices: widgetAggregation.alertDevices || [],
|
|
34063
|
+
failureDevices: widgetAggregation.failureDevices || [],
|
|
34064
|
+
standbyDevices: widgetAggregation.standbyDevices || [],
|
|
34065
|
+
offlineDevices: widgetAggregation.offlineDevices || [],
|
|
34066
|
+
noConsumptionDevices: widgetAggregation.noConsumptionDevices || []
|
|
34067
|
+
};
|
|
34055
34068
|
} else {
|
|
34056
|
-
const
|
|
34057
|
-
|
|
34058
|
-
|
|
34059
|
-
summary.byStatus = {
|
|
34060
|
-
normal: statusData.normal || 0,
|
|
34061
|
-
alert: statusData.alert || 0,
|
|
34062
|
-
failure: statusData.failure || 0,
|
|
34063
|
-
standby: statusData.standby || 0,
|
|
34064
|
-
offline: statusData.offline || 0,
|
|
34065
|
-
noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
|
|
34066
|
-
};
|
|
34069
|
+
const statusAggregation = this._aggregateDeviceStatusFromOrchestrator(domain);
|
|
34070
|
+
if (statusAggregation.hasData) {
|
|
34071
|
+
summary.byStatus = statusAggregation.byStatus;
|
|
34067
34072
|
} else {
|
|
34068
|
-
|
|
34069
|
-
|
|
34070
|
-
|
|
34071
|
-
|
|
34072
|
-
|
|
34073
|
-
|
|
34074
|
-
|
|
34075
|
-
|
|
34076
|
-
|
|
34077
|
-
|
|
34078
|
-
|
|
34079
|
-
|
|
34080
|
-
summary.byStatus
|
|
34073
|
+
const totalDevices = summary.totalDevices;
|
|
34074
|
+
const statusData = receivedData?.statusCounts || receivedData?.deviceStatus || null;
|
|
34075
|
+
if (statusData && typeof statusData === "object") {
|
|
34076
|
+
summary.byStatus = {
|
|
34077
|
+
normal: statusData.normal || 0,
|
|
34078
|
+
alert: statusData.alert || 0,
|
|
34079
|
+
failure: statusData.failure || 0,
|
|
34080
|
+
standby: statusData.standby || 0,
|
|
34081
|
+
offline: statusData.offline || 0,
|
|
34082
|
+
noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
|
|
34083
|
+
};
|
|
34084
|
+
} else {
|
|
34085
|
+
summary.byStatus = {
|
|
34086
|
+
normal: Math.floor(totalDevices * 0.75),
|
|
34087
|
+
alert: Math.floor(totalDevices * 0.06),
|
|
34088
|
+
failure: Math.floor(totalDevices * 0.02),
|
|
34089
|
+
standby: Math.floor(totalDevices * 0.02),
|
|
34090
|
+
offline: Math.floor(totalDevices * 0.03),
|
|
34091
|
+
noConsumption: Math.floor(totalDevices * 0.12)
|
|
34092
|
+
};
|
|
34093
|
+
const statusSum = Object.values(summary.byStatus).reduce((a, b) => {
|
|
34094
|
+
return typeof b === "number" ? a + b : a;
|
|
34095
|
+
}, 0);
|
|
34096
|
+
if (statusSum !== totalDevices && totalDevices > 0) {
|
|
34097
|
+
summary.byStatus.normal += totalDevices - statusSum;
|
|
34098
|
+
}
|
|
34081
34099
|
}
|
|
34082
34100
|
}
|
|
34083
34101
|
}
|
|
@@ -35385,35 +35403,53 @@
|
|
|
35385
35403
|
}
|
|
35386
35404
|
summary.totalDevices = summary.byCategory.reduce((sum, cat) => sum + cat.deviceCount, 0);
|
|
35387
35405
|
summary.totalConsumption = state5.entrada?.total || 0;
|
|
35388
|
-
const
|
|
35389
|
-
if (
|
|
35390
|
-
summary.byStatus =
|
|
35406
|
+
const widgetAggregation = receivedData?.deviceStatusAggregation;
|
|
35407
|
+
if (widgetAggregation && widgetAggregation.hasData) {
|
|
35408
|
+
summary.byStatus = {
|
|
35409
|
+
normal: widgetAggregation.normal || 0,
|
|
35410
|
+
alert: widgetAggregation.alert || 0,
|
|
35411
|
+
failure: widgetAggregation.failure || 0,
|
|
35412
|
+
standby: widgetAggregation.standby || 0,
|
|
35413
|
+
offline: widgetAggregation.offline || 0,
|
|
35414
|
+
noConsumption: widgetAggregation.noConsumption || 0,
|
|
35415
|
+
normalDevices: widgetAggregation.normalDevices || [],
|
|
35416
|
+
alertDevices: widgetAggregation.alertDevices || [],
|
|
35417
|
+
failureDevices: widgetAggregation.failureDevices || [],
|
|
35418
|
+
standbyDevices: widgetAggregation.standbyDevices || [],
|
|
35419
|
+
offlineDevices: widgetAggregation.offlineDevices || [],
|
|
35420
|
+
noConsumptionDevices: widgetAggregation.noConsumptionDevices || []
|
|
35421
|
+
};
|
|
35391
35422
|
} else {
|
|
35392
|
-
const
|
|
35393
|
-
|
|
35394
|
-
|
|
35395
|
-
summary.byStatus = {
|
|
35396
|
-
normal: statusData.normal || 0,
|
|
35397
|
-
alert: statusData.alert || 0,
|
|
35398
|
-
failure: statusData.failure || 0,
|
|
35399
|
-
standby: statusData.standby || 0,
|
|
35400
|
-
offline: statusData.offline || 0,
|
|
35401
|
-
noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
|
|
35402
|
-
};
|
|
35423
|
+
const statusAggregation = this._aggregateDeviceStatusFromOrchestrator(domain);
|
|
35424
|
+
if (statusAggregation.hasData) {
|
|
35425
|
+
summary.byStatus = statusAggregation.byStatus;
|
|
35403
35426
|
} else {
|
|
35404
|
-
|
|
35405
|
-
|
|
35406
|
-
|
|
35407
|
-
|
|
35408
|
-
|
|
35409
|
-
|
|
35410
|
-
|
|
35411
|
-
|
|
35412
|
-
|
|
35413
|
-
|
|
35414
|
-
|
|
35415
|
-
|
|
35416
|
-
summary.byStatus
|
|
35427
|
+
const totalDevices = summary.totalDevices;
|
|
35428
|
+
const statusData = receivedData?.statusCounts || receivedData?.deviceStatus || null;
|
|
35429
|
+
if (statusData && typeof statusData === "object") {
|
|
35430
|
+
summary.byStatus = {
|
|
35431
|
+
normal: statusData.normal || 0,
|
|
35432
|
+
alert: statusData.alert || 0,
|
|
35433
|
+
failure: statusData.failure || 0,
|
|
35434
|
+
standby: statusData.standby || 0,
|
|
35435
|
+
offline: statusData.offline || 0,
|
|
35436
|
+
noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
|
|
35437
|
+
};
|
|
35438
|
+
} else {
|
|
35439
|
+
summary.byStatus = {
|
|
35440
|
+
normal: Math.floor(totalDevices * 0.8),
|
|
35441
|
+
alert: Math.floor(totalDevices * 0.05),
|
|
35442
|
+
failure: Math.floor(totalDevices * 0.02),
|
|
35443
|
+
standby: Math.floor(totalDevices * 0.02),
|
|
35444
|
+
offline: Math.floor(totalDevices * 0.03),
|
|
35445
|
+
noConsumption: Math.floor(totalDevices * 0.08)
|
|
35446
|
+
};
|
|
35447
|
+
const statusSum = Object.values(summary.byStatus).reduce((a, b) => {
|
|
35448
|
+
return typeof b === "number" ? a + b : a;
|
|
35449
|
+
}, 0);
|
|
35450
|
+
if (statusSum !== totalDevices && totalDevices > 0) {
|
|
35451
|
+
summary.byStatus.normal += totalDevices - statusSum;
|
|
35452
|
+
}
|
|
35417
35453
|
}
|
|
35418
35454
|
}
|
|
35419
35455
|
}
|