myio-js-library 0.1.263 → 0.1.264
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 +12 -34
- package/dist/index.js +12 -34
- package/dist/myio-js-library.umd.js +13 -35
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9280,6 +9280,8 @@ var EnergyRangeTooltip = {
|
|
|
9280
9280
|
var LABEL_CHAR_LIMIT = 18;
|
|
9281
9281
|
var DEFAUL_DELAY_TIME_CONNECTION_IN_MINS = 1440;
|
|
9282
9282
|
var CSS_TAG = "head-office-card-v1";
|
|
9283
|
+
var _warnedMissingEntityId = false;
|
|
9284
|
+
var _warnedMissingDelayTime = false;
|
|
9283
9285
|
function ensureCss() {
|
|
9284
9286
|
if (!document.querySelector(`style[data-myio-css="${CSS_TAG}"]`)) {
|
|
9285
9287
|
const style = document.createElement("style");
|
|
@@ -9295,13 +9297,19 @@ function normalizeParams(params) {
|
|
|
9295
9297
|
const LogHelper2 = createLogHelper(params.debugActive ?? false);
|
|
9296
9298
|
const entityObject = params.entityObject;
|
|
9297
9299
|
if (!entityObject.entityId) {
|
|
9298
|
-
|
|
9300
|
+
if (!_warnedMissingEntityId) {
|
|
9301
|
+
_warnedMissingEntityId = true;
|
|
9302
|
+
LogHelper2.warn("[CardHeadOffice] entityId is missing on some devices, generating temporary IDs");
|
|
9303
|
+
}
|
|
9299
9304
|
entityObject.entityId = `temp-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
9300
9305
|
}
|
|
9301
9306
|
if (!params.delayTimeConnectionInMins) {
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
|
|
9307
|
+
if (!_warnedMissingDelayTime) {
|
|
9308
|
+
_warnedMissingDelayTime = true;
|
|
9309
|
+
LogHelper2.warn(
|
|
9310
|
+
`[CardHeadOffice] delayTimeConnectionInMins is missing, defaulting to ${DEFAUL_DELAY_TIME_CONNECTION_IN_MINS} mins`
|
|
9311
|
+
);
|
|
9312
|
+
}
|
|
9305
9313
|
}
|
|
9306
9314
|
return {
|
|
9307
9315
|
entityObject,
|
|
@@ -9792,26 +9800,10 @@ function verifyOfflineStatus(entityObject, delayTimeInMins = 15, LogHelper2) {
|
|
|
9792
9800
|
let isOffline = false;
|
|
9793
9801
|
if (lastDisconnectTime.getTime() > lastConnectionTime.getTime()) {
|
|
9794
9802
|
isOffline = true;
|
|
9795
|
-
LogHelper2.log(
|
|
9796
|
-
"[CardHeadOffice][ConnectionStatus Verify] Device is OFFLINE because lastDisconnectTime is more recent than lastConnectTime",
|
|
9797
|
-
entityObject.nameEl
|
|
9798
|
-
);
|
|
9799
9803
|
} else if (timeSinceConnection > delayTimeInMs) {
|
|
9800
9804
|
isOffline = true;
|
|
9801
|
-
LogHelper2.log(
|
|
9802
|
-
"[CardHeadOffice][ConnectionStatus Verify] Device is OFFLINE because lastConnectTime is older than configured delayTimeConnectionInMins:",
|
|
9803
|
-
delayTimeInMins,
|
|
9804
|
-
"for device",
|
|
9805
|
-
entityObject.nameEl
|
|
9806
|
-
);
|
|
9807
9805
|
} else {
|
|
9808
9806
|
isOffline = false;
|
|
9809
|
-
LogHelper2.log(
|
|
9810
|
-
"[CardHeadOffice][ConnectionStatus Verify] Device is ONLINE because lastConnectTime is within configured delayTimeConnectionInMins:",
|
|
9811
|
-
delayTimeInMins,
|
|
9812
|
-
"for device",
|
|
9813
|
-
entityObject.nameEl
|
|
9814
|
-
);
|
|
9815
9807
|
}
|
|
9816
9808
|
return isOffline;
|
|
9817
9809
|
}
|
|
@@ -9820,30 +9812,16 @@ function paint(root, state6) {
|
|
|
9820
9812
|
let statusDecisionSource = "unknown";
|
|
9821
9813
|
if (entityObject.connectionStatus) {
|
|
9822
9814
|
if (entityObject.connectionStatus === "offline") {
|
|
9823
|
-
LogHelper2.log(
|
|
9824
|
-
"[CardHeadOffice][ConnectionStatus Verify 01] Setting deviceStatus to OFFLINE based on connectionStatus"
|
|
9825
|
-
);
|
|
9826
9815
|
entityObject.deviceStatus = DeviceStatusType.OFFLINE;
|
|
9827
9816
|
statusDecisionSource = 'connectionStatus === "offline"';
|
|
9828
9817
|
} else {
|
|
9829
|
-
LogHelper2.log(
|
|
9830
|
-
"[CardHeadOffice] Device is ONLINE or WAITING based on connectionStatus for device",
|
|
9831
|
-
entityObject.nameEl
|
|
9832
|
-
);
|
|
9833
9818
|
statusDecisionSource = `connectionStatus === "${entityObject.connectionStatus}" (kept original deviceStatus)`;
|
|
9834
9819
|
}
|
|
9835
9820
|
} else {
|
|
9836
9821
|
if (verifyOfflineStatus(entityObject, delayTimeConnectionInMins, LogHelper2) === false) {
|
|
9837
|
-
LogHelper2.log(
|
|
9838
|
-
"[CardHeadOffice][ConnectionStatus Verify 02] Setting deviceStatus to OFFLINE based on timestamp verification by verifyOfflineStatus METHOD with delayTimeConnectionInMins:",
|
|
9839
|
-
delayTimeConnectionInMins
|
|
9840
|
-
);
|
|
9841
9822
|
entityObject.deviceStatus = DeviceStatusType.OFFLINE;
|
|
9842
9823
|
statusDecisionSource = `verifyOfflineStatus() returned false (delay: ${delayTimeConnectionInMins} mins)`;
|
|
9843
9824
|
} else {
|
|
9844
|
-
LogHelper2.log(
|
|
9845
|
-
`[CardHeadOffice][ConnectionStatus Verify 03] Device is ONLINE with deviceStatus = ${entityObject.deviceStatus} based on timestamp verification for device ${entityObject.nameEl}`
|
|
9846
|
-
);
|
|
9847
9825
|
statusDecisionSource = `verifyOfflineStatus() returned true (delay: ${delayTimeConnectionInMins} mins)`;
|
|
9848
9826
|
}
|
|
9849
9827
|
}
|
package/dist/index.js
CHANGED
|
@@ -9063,6 +9063,8 @@ var EnergyRangeTooltip = {
|
|
|
9063
9063
|
var LABEL_CHAR_LIMIT = 18;
|
|
9064
9064
|
var DEFAUL_DELAY_TIME_CONNECTION_IN_MINS = 1440;
|
|
9065
9065
|
var CSS_TAG = "head-office-card-v1";
|
|
9066
|
+
var _warnedMissingEntityId = false;
|
|
9067
|
+
var _warnedMissingDelayTime = false;
|
|
9066
9068
|
function ensureCss() {
|
|
9067
9069
|
if (!document.querySelector(`style[data-myio-css="${CSS_TAG}"]`)) {
|
|
9068
9070
|
const style = document.createElement("style");
|
|
@@ -9078,13 +9080,19 @@ function normalizeParams(params) {
|
|
|
9078
9080
|
const LogHelper2 = createLogHelper(params.debugActive ?? false);
|
|
9079
9081
|
const entityObject = params.entityObject;
|
|
9080
9082
|
if (!entityObject.entityId) {
|
|
9081
|
-
|
|
9083
|
+
if (!_warnedMissingEntityId) {
|
|
9084
|
+
_warnedMissingEntityId = true;
|
|
9085
|
+
LogHelper2.warn("[CardHeadOffice] entityId is missing on some devices, generating temporary IDs");
|
|
9086
|
+
}
|
|
9082
9087
|
entityObject.entityId = `temp-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
9083
9088
|
}
|
|
9084
9089
|
if (!params.delayTimeConnectionInMins) {
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9090
|
+
if (!_warnedMissingDelayTime) {
|
|
9091
|
+
_warnedMissingDelayTime = true;
|
|
9092
|
+
LogHelper2.warn(
|
|
9093
|
+
`[CardHeadOffice] delayTimeConnectionInMins is missing, defaulting to ${DEFAUL_DELAY_TIME_CONNECTION_IN_MINS} mins`
|
|
9094
|
+
);
|
|
9095
|
+
}
|
|
9088
9096
|
}
|
|
9089
9097
|
return {
|
|
9090
9098
|
entityObject,
|
|
@@ -9575,26 +9583,10 @@ function verifyOfflineStatus(entityObject, delayTimeInMins = 15, LogHelper2) {
|
|
|
9575
9583
|
let isOffline = false;
|
|
9576
9584
|
if (lastDisconnectTime.getTime() > lastConnectionTime.getTime()) {
|
|
9577
9585
|
isOffline = true;
|
|
9578
|
-
LogHelper2.log(
|
|
9579
|
-
"[CardHeadOffice][ConnectionStatus Verify] Device is OFFLINE because lastDisconnectTime is more recent than lastConnectTime",
|
|
9580
|
-
entityObject.nameEl
|
|
9581
|
-
);
|
|
9582
9586
|
} else if (timeSinceConnection > delayTimeInMs) {
|
|
9583
9587
|
isOffline = true;
|
|
9584
|
-
LogHelper2.log(
|
|
9585
|
-
"[CardHeadOffice][ConnectionStatus Verify] Device is OFFLINE because lastConnectTime is older than configured delayTimeConnectionInMins:",
|
|
9586
|
-
delayTimeInMins,
|
|
9587
|
-
"for device",
|
|
9588
|
-
entityObject.nameEl
|
|
9589
|
-
);
|
|
9590
9588
|
} else {
|
|
9591
9589
|
isOffline = false;
|
|
9592
|
-
LogHelper2.log(
|
|
9593
|
-
"[CardHeadOffice][ConnectionStatus Verify] Device is ONLINE because lastConnectTime is within configured delayTimeConnectionInMins:",
|
|
9594
|
-
delayTimeInMins,
|
|
9595
|
-
"for device",
|
|
9596
|
-
entityObject.nameEl
|
|
9597
|
-
);
|
|
9598
9590
|
}
|
|
9599
9591
|
return isOffline;
|
|
9600
9592
|
}
|
|
@@ -9603,30 +9595,16 @@ function paint(root, state6) {
|
|
|
9603
9595
|
let statusDecisionSource = "unknown";
|
|
9604
9596
|
if (entityObject.connectionStatus) {
|
|
9605
9597
|
if (entityObject.connectionStatus === "offline") {
|
|
9606
|
-
LogHelper2.log(
|
|
9607
|
-
"[CardHeadOffice][ConnectionStatus Verify 01] Setting deviceStatus to OFFLINE based on connectionStatus"
|
|
9608
|
-
);
|
|
9609
9598
|
entityObject.deviceStatus = DeviceStatusType.OFFLINE;
|
|
9610
9599
|
statusDecisionSource = 'connectionStatus === "offline"';
|
|
9611
9600
|
} else {
|
|
9612
|
-
LogHelper2.log(
|
|
9613
|
-
"[CardHeadOffice] Device is ONLINE or WAITING based on connectionStatus for device",
|
|
9614
|
-
entityObject.nameEl
|
|
9615
|
-
);
|
|
9616
9601
|
statusDecisionSource = `connectionStatus === "${entityObject.connectionStatus}" (kept original deviceStatus)`;
|
|
9617
9602
|
}
|
|
9618
9603
|
} else {
|
|
9619
9604
|
if (verifyOfflineStatus(entityObject, delayTimeConnectionInMins, LogHelper2) === false) {
|
|
9620
|
-
LogHelper2.log(
|
|
9621
|
-
"[CardHeadOffice][ConnectionStatus Verify 02] Setting deviceStatus to OFFLINE based on timestamp verification by verifyOfflineStatus METHOD with delayTimeConnectionInMins:",
|
|
9622
|
-
delayTimeConnectionInMins
|
|
9623
|
-
);
|
|
9624
9605
|
entityObject.deviceStatus = DeviceStatusType.OFFLINE;
|
|
9625
9606
|
statusDecisionSource = `verifyOfflineStatus() returned false (delay: ${delayTimeConnectionInMins} mins)`;
|
|
9626
9607
|
} else {
|
|
9627
|
-
LogHelper2.log(
|
|
9628
|
-
`[CardHeadOffice][ConnectionStatus Verify 03] Device is ONLINE with deviceStatus = ${entityObject.deviceStatus} based on timestamp verification for device ${entityObject.nameEl}`
|
|
9629
|
-
);
|
|
9630
9608
|
statusDecisionSource = `verifyOfflineStatus() returned true (delay: ${delayTimeConnectionInMins} mins)`;
|
|
9631
9609
|
}
|
|
9632
9610
|
}
|
|
@@ -9050,6 +9050,8 @@
|
|
|
9050
9050
|
var LABEL_CHAR_LIMIT = 18;
|
|
9051
9051
|
var DEFAUL_DELAY_TIME_CONNECTION_IN_MINS = 1440;
|
|
9052
9052
|
var CSS_TAG = "head-office-card-v1";
|
|
9053
|
+
var _warnedMissingEntityId = false;
|
|
9054
|
+
var _warnedMissingDelayTime = false;
|
|
9053
9055
|
function ensureCss() {
|
|
9054
9056
|
if (!document.querySelector(`style[data-myio-css="${CSS_TAG}"]`)) {
|
|
9055
9057
|
const style = document.createElement("style");
|
|
@@ -9065,13 +9067,19 @@
|
|
|
9065
9067
|
const LogHelper2 = createLogHelper(params.debugActive ?? false);
|
|
9066
9068
|
const entityObject = params.entityObject;
|
|
9067
9069
|
if (!entityObject.entityId) {
|
|
9068
|
-
|
|
9070
|
+
if (!_warnedMissingEntityId) {
|
|
9071
|
+
_warnedMissingEntityId = true;
|
|
9072
|
+
LogHelper2.warn("[CardHeadOffice] entityId is missing on some devices, generating temporary IDs");
|
|
9073
|
+
}
|
|
9069
9074
|
entityObject.entityId = `temp-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
9070
9075
|
}
|
|
9071
9076
|
if (!params.delayTimeConnectionInMins) {
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9077
|
+
if (!_warnedMissingDelayTime) {
|
|
9078
|
+
_warnedMissingDelayTime = true;
|
|
9079
|
+
LogHelper2.warn(
|
|
9080
|
+
`[CardHeadOffice] delayTimeConnectionInMins is missing, defaulting to ${DEFAUL_DELAY_TIME_CONNECTION_IN_MINS} mins`
|
|
9081
|
+
);
|
|
9082
|
+
}
|
|
9075
9083
|
}
|
|
9076
9084
|
return {
|
|
9077
9085
|
entityObject,
|
|
@@ -9562,26 +9570,10 @@
|
|
|
9562
9570
|
let isOffline = false;
|
|
9563
9571
|
if (lastDisconnectTime.getTime() > lastConnectionTime.getTime()) {
|
|
9564
9572
|
isOffline = true;
|
|
9565
|
-
LogHelper2.log(
|
|
9566
|
-
"[CardHeadOffice][ConnectionStatus Verify] Device is OFFLINE because lastDisconnectTime is more recent than lastConnectTime",
|
|
9567
|
-
entityObject.nameEl
|
|
9568
|
-
);
|
|
9569
9573
|
} else if (timeSinceConnection > delayTimeInMs) {
|
|
9570
9574
|
isOffline = true;
|
|
9571
|
-
LogHelper2.log(
|
|
9572
|
-
"[CardHeadOffice][ConnectionStatus Verify] Device is OFFLINE because lastConnectTime is older than configured delayTimeConnectionInMins:",
|
|
9573
|
-
delayTimeInMins,
|
|
9574
|
-
"for device",
|
|
9575
|
-
entityObject.nameEl
|
|
9576
|
-
);
|
|
9577
9575
|
} else {
|
|
9578
9576
|
isOffline = false;
|
|
9579
|
-
LogHelper2.log(
|
|
9580
|
-
"[CardHeadOffice][ConnectionStatus Verify] Device is ONLINE because lastConnectTime is within configured delayTimeConnectionInMins:",
|
|
9581
|
-
delayTimeInMins,
|
|
9582
|
-
"for device",
|
|
9583
|
-
entityObject.nameEl
|
|
9584
|
-
);
|
|
9585
9577
|
}
|
|
9586
9578
|
return isOffline;
|
|
9587
9579
|
}
|
|
@@ -9590,30 +9582,16 @@
|
|
|
9590
9582
|
let statusDecisionSource = "unknown";
|
|
9591
9583
|
if (entityObject.connectionStatus) {
|
|
9592
9584
|
if (entityObject.connectionStatus === "offline") {
|
|
9593
|
-
LogHelper2.log(
|
|
9594
|
-
"[CardHeadOffice][ConnectionStatus Verify 01] Setting deviceStatus to OFFLINE based on connectionStatus"
|
|
9595
|
-
);
|
|
9596
9585
|
entityObject.deviceStatus = DeviceStatusType.OFFLINE;
|
|
9597
9586
|
statusDecisionSource = 'connectionStatus === "offline"';
|
|
9598
9587
|
} else {
|
|
9599
|
-
LogHelper2.log(
|
|
9600
|
-
"[CardHeadOffice] Device is ONLINE or WAITING based on connectionStatus for device",
|
|
9601
|
-
entityObject.nameEl
|
|
9602
|
-
);
|
|
9603
9588
|
statusDecisionSource = `connectionStatus === "${entityObject.connectionStatus}" (kept original deviceStatus)`;
|
|
9604
9589
|
}
|
|
9605
9590
|
} else {
|
|
9606
|
-
if (verifyOfflineStatus(entityObject, delayTimeConnectionInMins
|
|
9607
|
-
LogHelper2.log(
|
|
9608
|
-
"[CardHeadOffice][ConnectionStatus Verify 02] Setting deviceStatus to OFFLINE based on timestamp verification by verifyOfflineStatus METHOD with delayTimeConnectionInMins:",
|
|
9609
|
-
delayTimeConnectionInMins
|
|
9610
|
-
);
|
|
9591
|
+
if (verifyOfflineStatus(entityObject, delayTimeConnectionInMins) === false) {
|
|
9611
9592
|
entityObject.deviceStatus = DeviceStatusType.OFFLINE;
|
|
9612
9593
|
statusDecisionSource = `verifyOfflineStatus() returned false (delay: ${delayTimeConnectionInMins} mins)`;
|
|
9613
9594
|
} else {
|
|
9614
|
-
LogHelper2.log(
|
|
9615
|
-
`[CardHeadOffice][ConnectionStatus Verify 03] Device is ONLINE with deviceStatus = ${entityObject.deviceStatus} based on timestamp verification for device ${entityObject.nameEl}`
|
|
9616
|
-
);
|
|
9617
9595
|
statusDecisionSource = `verifyOfflineStatus() returned true (delay: ${delayTimeConnectionInMins} mins)`;
|
|
9618
9596
|
}
|
|
9619
9597
|
}
|