myio-js-library 0.1.151 → 0.1.152
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 +15 -1
- package/dist/index.js +15 -1
- package/dist/myio-js-library.umd.js +15 -1
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4818,6 +4818,19 @@ function normalizeParams(params) {
|
|
|
4818
4818
|
function getIconSvg(deviceType) {
|
|
4819
4819
|
return ICON_MAP[deviceType] || ICON_MAP.DEFAULT;
|
|
4820
4820
|
}
|
|
4821
|
+
function formatPower(valueInWatts) {
|
|
4822
|
+
if (valueInWatts === null || valueInWatts === void 0 || isNaN(valueInWatts)) {
|
|
4823
|
+
return { num: "-", unit: "" };
|
|
4824
|
+
}
|
|
4825
|
+
const val = Number(valueInWatts);
|
|
4826
|
+
if (val >= 1e3) {
|
|
4827
|
+
const kw = Math.ceil(val / 1e3 * 100) / 100;
|
|
4828
|
+
return { num: kw.toFixed(2), unit: "kW" };
|
|
4829
|
+
} else {
|
|
4830
|
+
const w = Math.ceil(val);
|
|
4831
|
+
return { num: w.toString(), unit: "W" };
|
|
4832
|
+
}
|
|
4833
|
+
}
|
|
4821
4834
|
function formatValueByDomain(value, domain) {
|
|
4822
4835
|
if (domain === "water") {
|
|
4823
4836
|
return formatWaterVolumeM3(value);
|
|
@@ -5071,7 +5084,8 @@ function paint(root, state) {
|
|
|
5071
5084
|
const powerVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(2) .val");
|
|
5072
5085
|
if (powerVal) {
|
|
5073
5086
|
const instantPower = entityObject.instantaneousPower ?? entityObject.consumption_power ?? null;
|
|
5074
|
-
|
|
5087
|
+
const powerFormatted = formatPower(instantPower);
|
|
5088
|
+
powerVal.textContent = instantPower !== null ? `${powerFormatted.num} ${powerFormatted.unit}` : "-";
|
|
5075
5089
|
}
|
|
5076
5090
|
}
|
|
5077
5091
|
function bindEvents(root, state, callbacks) {
|
package/dist/index.js
CHANGED
|
@@ -4710,6 +4710,19 @@ function normalizeParams(params) {
|
|
|
4710
4710
|
function getIconSvg(deviceType) {
|
|
4711
4711
|
return ICON_MAP[deviceType] || ICON_MAP.DEFAULT;
|
|
4712
4712
|
}
|
|
4713
|
+
function formatPower(valueInWatts) {
|
|
4714
|
+
if (valueInWatts === null || valueInWatts === void 0 || isNaN(valueInWatts)) {
|
|
4715
|
+
return { num: "-", unit: "" };
|
|
4716
|
+
}
|
|
4717
|
+
const val = Number(valueInWatts);
|
|
4718
|
+
if (val >= 1e3) {
|
|
4719
|
+
const kw = Math.ceil(val / 1e3 * 100) / 100;
|
|
4720
|
+
return { num: kw.toFixed(2), unit: "kW" };
|
|
4721
|
+
} else {
|
|
4722
|
+
const w = Math.ceil(val);
|
|
4723
|
+
return { num: w.toString(), unit: "W" };
|
|
4724
|
+
}
|
|
4725
|
+
}
|
|
4713
4726
|
function formatValueByDomain(value, domain) {
|
|
4714
4727
|
if (domain === "water") {
|
|
4715
4728
|
return formatWaterVolumeM3(value);
|
|
@@ -4963,7 +4976,8 @@ function paint(root, state) {
|
|
|
4963
4976
|
const powerVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(2) .val");
|
|
4964
4977
|
if (powerVal) {
|
|
4965
4978
|
const instantPower = entityObject.instantaneousPower ?? entityObject.consumption_power ?? null;
|
|
4966
|
-
|
|
4979
|
+
const powerFormatted = formatPower(instantPower);
|
|
4980
|
+
powerVal.textContent = instantPower !== null ? `${powerFormatted.num} ${powerFormatted.unit}` : "-";
|
|
4967
4981
|
}
|
|
4968
4982
|
}
|
|
4969
4983
|
function bindEvents(root, state, callbacks) {
|
|
@@ -4708,6 +4708,19 @@
|
|
|
4708
4708
|
function getIconSvg(deviceType) {
|
|
4709
4709
|
return ICON_MAP[deviceType] || ICON_MAP.DEFAULT;
|
|
4710
4710
|
}
|
|
4711
|
+
function formatPower(valueInWatts) {
|
|
4712
|
+
if (valueInWatts === null || valueInWatts === void 0 || isNaN(valueInWatts)) {
|
|
4713
|
+
return { num: "-", unit: "" };
|
|
4714
|
+
}
|
|
4715
|
+
const val = Number(valueInWatts);
|
|
4716
|
+
if (val >= 1e3) {
|
|
4717
|
+
const kw = Math.ceil(val / 1e3 * 100) / 100;
|
|
4718
|
+
return { num: kw.toFixed(2), unit: "kW" };
|
|
4719
|
+
} else {
|
|
4720
|
+
const w = Math.ceil(val);
|
|
4721
|
+
return { num: w.toString(), unit: "W" };
|
|
4722
|
+
}
|
|
4723
|
+
}
|
|
4711
4724
|
function formatValueByDomain(value, domain) {
|
|
4712
4725
|
if (domain === "water") {
|
|
4713
4726
|
return formatWaterVolumeM3(value);
|
|
@@ -4961,7 +4974,8 @@
|
|
|
4961
4974
|
const powerVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(2) .val");
|
|
4962
4975
|
if (powerVal) {
|
|
4963
4976
|
const instantPower = entityObject.instantaneousPower ?? entityObject.consumption_power ?? null;
|
|
4964
|
-
|
|
4977
|
+
const powerFormatted = formatPower(instantPower);
|
|
4978
|
+
powerVal.textContent = instantPower !== null ? `${powerFormatted.num} ${powerFormatted.unit}` : "-";
|
|
4965
4979
|
}
|
|
4966
4980
|
}
|
|
4967
4981
|
function bindEvents(root, state, callbacks) {
|