myio-js-library 0.1.568 → 0.1.570
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 +52 -23
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +52 -23
- package/dist/myio-js-library.umd.js +52 -23
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -953,7 +953,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
953
953
|
// package.json
|
|
954
954
|
var package_default = {
|
|
955
955
|
name: "myio-js-library",
|
|
956
|
-
version: "0.1.
|
|
956
|
+
version: "0.1.570",
|
|
957
957
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
958
958
|
license: "MIT",
|
|
959
959
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -2338,6 +2338,7 @@ var DeviceIconType = {
|
|
|
2338
2338
|
BOMBA_INCENDIO: "BOMBA_INCENDIO",
|
|
2339
2339
|
BOMBA: "BOMBA",
|
|
2340
2340
|
BOMBA_POCO: "BOMBA_POCO",
|
|
2341
|
+
BOMBA_CISTERNA: "BOMBA_CISTERNA",
|
|
2341
2342
|
MEDIDOR_3F: "3F_MEDIDOR",
|
|
2342
2343
|
RELOGIO: "RELOGIO",
|
|
2343
2344
|
ENTRADA: "ENTRADA",
|
|
@@ -2375,6 +2376,8 @@ var deviceIcons = {
|
|
|
2375
2376
|
BOMBA: "https://dashboard.myio-bas.com/api/images/public/Rge8Q3t0CP5PW8XyTn9bBK9aVP6uzSTT",
|
|
2376
2377
|
// BOMBA_POCO (ED-1354): bomba de poço artesiano — sem arte própria ainda, usa a do MOTOR/BOMBA.
|
|
2377
2378
|
BOMBA_POCO: "https://dashboard.myio-bas.com/api/images/public/Rge8Q3t0CP5PW8XyTn9bBK9aVP6uzSTT",
|
|
2379
|
+
// BOMBA_CISTERNA: mesmo comportamento/arte de BOMBA_POCO.
|
|
2380
|
+
BOMBA_CISTERNA: "https://dashboard.myio-bas.com/api/images/public/Rge8Q3t0CP5PW8XyTn9bBK9aVP6uzSTT",
|
|
2378
2381
|
"3F_MEDIDOR": "https://dashboard.myio-bas.com/api/images/public/f9Ce4meybsdaAhAkUlAfy5ei3I4kcN4k",
|
|
2379
2382
|
RELOGIO: "https://dashboard.myio-bas.com/api/images/public/ljHZostWg0G5AfKiyM8oZixWRIIGRASB",
|
|
2380
2383
|
ENTRADA: "https://dashboard.myio-bas.com/api/images/public/TQHPFqiejMW6lOSVsb8Pi85WtC0QKOLU",
|
|
@@ -2414,6 +2417,7 @@ var deviceIconLabels = {
|
|
|
2414
2417
|
BOMBA_INCENDIO: "Bomba Inc\xEAndio",
|
|
2415
2418
|
BOMBA: "Bomba",
|
|
2416
2419
|
BOMBA_POCO: "Bomba de Po\xE7o",
|
|
2420
|
+
BOMBA_CISTERNA: "Bomba de Cisterna",
|
|
2417
2421
|
"3F_MEDIDOR": "Medidor 3F",
|
|
2418
2422
|
RELOGIO: "Rel\xF3gio",
|
|
2419
2423
|
ENTRADA: "Entrada",
|
|
@@ -2477,6 +2481,8 @@ var DEVICE_TYPE_CONFIG = {
|
|
|
2477
2481
|
CISTERNA_ENTRADA: { category: "water", image: deviceIcons.CISTERNA_ENTRADA },
|
|
2478
2482
|
BOMBA_POCO: { category: "energy", image: deviceIcons.BOMBA_POCO },
|
|
2479
2483
|
// ED-1354: bomba do poço (consumption W)
|
|
2484
|
+
BOMBA_CISTERNA: { category: "energy", image: deviceIcons.BOMBA_CISTERNA },
|
|
2485
|
+
// mesmo comportamento de BOMBA_POCO
|
|
2480
2486
|
// Tank devices (dynamic images based on level)
|
|
2481
2487
|
TANK: { category: "tank", image: null },
|
|
2482
2488
|
// Temperature devices (dynamic images based on status)
|
|
@@ -4032,7 +4038,7 @@ function isEntradaDevice(device) {
|
|
|
4032
4038
|
}
|
|
4033
4039
|
|
|
4034
4040
|
// src/utils/devices/deviceClassificationProfile.ts
|
|
4035
|
-
var WELL_AUTOMATION_PROFILES = /* @__PURE__ */ new Set(["BOMBA_POCO", "SOLENOIDE"]);
|
|
4041
|
+
var WELL_AUTOMATION_PROFILES = /* @__PURE__ */ new Set(["BOMBA_POCO", "BOMBA_CISTERNA", "SOLENOIDE"]);
|
|
4036
4042
|
function filterWellAutomationItems(items) {
|
|
4037
4043
|
return (items || []).filter(
|
|
4038
4044
|
(item) => !WELL_AUTOMATION_PROFILES.has(String(item?.deviceProfile || "").trim().toUpperCase())
|
|
@@ -36692,8 +36698,9 @@ function renderTemperatureBarsPng(opts) {
|
|
|
36692
36698
|
ctx.fillStyle = "#6b7280";
|
|
36693
36699
|
ctx.font = "20px Helvetica, Arial, sans-serif";
|
|
36694
36700
|
ctx.textBaseline = "middle";
|
|
36695
|
-
const
|
|
36696
|
-
|
|
36701
|
+
const unit = opts.unit || "\xB0C";
|
|
36702
|
+
const scale = `Escala ${fmt2(lo)}\u2013${fmt2(hi)} ${unit}`;
|
|
36703
|
+
ctx.fillText(ideal ? `${scale} \xB7 faixa ideal ${fmt2(ideal.min)}\u2013${fmt2(ideal.max)} ${unit}` : scale, 16, 26);
|
|
36697
36704
|
opts.items.forEach((item, i) => {
|
|
36698
36705
|
const y = TOP + i * ROW;
|
|
36699
36706
|
const cy = y + ROW / 2;
|
|
@@ -36741,7 +36748,8 @@ var DOMAIN_CONFIG = {
|
|
|
36741
36748
|
label: "Consumo (kWh)",
|
|
36742
36749
|
formatter: (v) => fmtPt(v),
|
|
36743
36750
|
summaryType: "total",
|
|
36744
|
-
summaryLabel: "Total"
|
|
36751
|
+
summaryLabel: "Total",
|
|
36752
|
+
measureLabel: "Consumo"
|
|
36745
36753
|
},
|
|
36746
36754
|
water: {
|
|
36747
36755
|
endpoint: "water",
|
|
@@ -36749,7 +36757,8 @@ var DOMAIN_CONFIG = {
|
|
|
36749
36757
|
label: "Consumo (m\xB3)",
|
|
36750
36758
|
formatter: (v) => fmtPt(v),
|
|
36751
36759
|
summaryType: "total",
|
|
36752
|
-
summaryLabel: "Total"
|
|
36760
|
+
summaryLabel: "Total",
|
|
36761
|
+
measureLabel: "Consumo"
|
|
36753
36762
|
},
|
|
36754
36763
|
temperature: {
|
|
36755
36764
|
endpoint: "temperature",
|
|
@@ -36757,7 +36766,23 @@ var DOMAIN_CONFIG = {
|
|
|
36757
36766
|
label: "Temperatura (\xB0C)",
|
|
36758
36767
|
formatter: (v) => fmtPt(v),
|
|
36759
36768
|
summaryType: "average",
|
|
36760
|
-
summaryLabel: "M\xE9dia"
|
|
36769
|
+
summaryLabel: "M\xE9dia",
|
|
36770
|
+
measureLabel: "Temperatura",
|
|
36771
|
+
rankingDayTitle: "Dias mais quentes (m\xE9dia do dia)",
|
|
36772
|
+
rankingHourTitle: "Horas mais quentes"
|
|
36773
|
+
},
|
|
36774
|
+
// Nível de tanque/caixa/cisterna — não existe no Ingestion; o chamador injeta um
|
|
36775
|
+
// `fetcher` que lê o timeseries do ThingsBoard (water_percentage × 100).
|
|
36776
|
+
water_level: {
|
|
36777
|
+
endpoint: "water_level",
|
|
36778
|
+
unit: "%",
|
|
36779
|
+
label: "N\xEDvel (%)",
|
|
36780
|
+
formatter: (v) => fmtPt(v),
|
|
36781
|
+
summaryType: "average",
|
|
36782
|
+
summaryLabel: "M\xE9dia",
|
|
36783
|
+
measureLabel: "N\xEDvel",
|
|
36784
|
+
rankingDayTitle: "Dias com maior n\xEDvel (m\xE9dia do dia)",
|
|
36785
|
+
rankingHourTitle: "Horas com maior n\xEDvel"
|
|
36761
36786
|
}
|
|
36762
36787
|
};
|
|
36763
36788
|
var createDefaultEnergyFetcher = (params, getGranularity) => {
|
|
@@ -37329,12 +37354,12 @@ var DeviceReportModal = class {
|
|
|
37329
37354
|
kpis.push(
|
|
37330
37355
|
{
|
|
37331
37356
|
value: maxRow ? fmt2(maxRow.consumption) : "\u2014",
|
|
37332
|
-
label: `${rowLabel} com Maior ${
|
|
37357
|
+
label: `${rowLabel} com Maior ${this.domainConfig.measureLabel} (${unit})`,
|
|
37333
37358
|
...maxRow ? { sub: this.formatDate(maxRow.date) } : {}
|
|
37334
37359
|
},
|
|
37335
37360
|
{
|
|
37336
37361
|
value: minRow ? fmt2(minRow.consumption) : "\u2014",
|
|
37337
|
-
label: `${rowLabel} com Menor ${
|
|
37362
|
+
label: `${rowLabel} com Menor ${this.domainConfig.measureLabel} (${unit})`,
|
|
37338
37363
|
...minRow ? { sub: this.formatDate(minRow.date) } : {}
|
|
37339
37364
|
}
|
|
37340
37365
|
);
|
|
@@ -37390,12 +37415,13 @@ var DeviceReportModal = class {
|
|
|
37390
37415
|
<div style="position:absolute;top:2px;bottom:2px;left:0;width:${pos(r.consumption)};background:${color(r.consumption)};border-radius:4px;opacity:.85;"></div></div>` : `<span style="font-size:11px;color:var(--myio-text-muted,#9ca3af);">Sem leitura</span>`}
|
|
37391
37416
|
<span style="text-align:right;font-variant-numeric:tabular-nums;font-weight:600;">${r ? this.domainConfig.formatter(r.consumption) : "\u2014"}</span>
|
|
37392
37417
|
</div>`;
|
|
37393
|
-
const
|
|
37418
|
+
const unit = this.domainConfig.unit;
|
|
37419
|
+
const title = isHourly ? `${this.domainConfig.rankingHourTitle}${ranked.length > TOP_HOURS ? ` (top ${TOP_HOURS})` : ""}` : this.domainConfig.rankingDayTitle;
|
|
37394
37420
|
container.innerHTML = `
|
|
37395
37421
|
<div style="border:1px solid var(--myio-border,#e5e7eb);border-radius:10px;padding:12px 14px;max-height:620px;overflow-y:auto;">
|
|
37396
37422
|
<div style="font-weight:700;font-size:14px;margin-bottom:2px;">${title}</div>
|
|
37397
37423
|
<div style="font-size:11px;color:var(--myio-text-muted,#6b7280);margin-bottom:10px;">
|
|
37398
|
-
Escala ${this.domainConfig.formatter(lo)}\u2013${this.domainConfig.formatter(hi)}
|
|
37424
|
+
Escala ${this.domainConfig.formatter(lo)}\u2013${this.domainConfig.formatter(hi)} ${unit}${hasIdeal ? ` \xB7 <span style="color:#16a34a;">faixa ideal ${this.domainConfig.formatter(Number(ideal.min))}\u2013${this.domainConfig.formatter(Number(ideal.max))} ${unit}</span>` : ""}
|
|
37399
37425
|
</div>
|
|
37400
37426
|
${shown.map((r) => line(this.formatDate(r.date), r)).join("")}
|
|
37401
37427
|
${noData.map((r) => line(this.formatDate(r.date), null)).join("")}
|
|
@@ -37608,9 +37634,10 @@ var DeviceReportModal = class {
|
|
|
37608
37634
|
...noData.map((r) => ({ label: this.formatDate(r.date), value: null }))
|
|
37609
37635
|
],
|
|
37610
37636
|
ideal: this.params.temperatureIdealRange ?? null,
|
|
37611
|
-
accent: this.resolveAccentHex()
|
|
37637
|
+
accent: this.resolveAccentHex(),
|
|
37638
|
+
unit: this.domainConfig.unit
|
|
37612
37639
|
});
|
|
37613
|
-
const title = isHourly ?
|
|
37640
|
+
const title = isHourly ? `${this.domainConfig.rankingHourTitle}${ranked.length > 24 ? " (top 24)" : ""}` : this.domainConfig.rankingDayTitle;
|
|
37614
37641
|
return png ? { ...png, title } : null;
|
|
37615
37642
|
}
|
|
37616
37643
|
const chartPng = await this.participationChart?.toPngDataUrl?.().catch(() => null);
|
|
@@ -63041,6 +63068,8 @@ var DeviceProfileTab = class {
|
|
|
63041
63068
|
};
|
|
63042
63069
|
|
|
63043
63070
|
// src/components/premium-modals/settings/well-equipment/WellEquipmentTab.ts
|
|
63071
|
+
var PUMP_EQUIPMENT_PROFILES = /* @__PURE__ */ new Set(["BOMBA_POCO", "BOMBA_CISTERNA"]);
|
|
63072
|
+
var kindOf = (profile) => PUMP_EQUIPMENT_PROFILES.has(profile) ? "pump" : "valve";
|
|
63044
63073
|
var ATTRIBUTE_KEYS = "deviceProfile,gcdrDeviceId,pumpBindings";
|
|
63045
63074
|
var MAX_CUSTOMER_DEVICE_PAGES = 100;
|
|
63046
63075
|
function escapeHtml6(value) {
|
|
@@ -63143,7 +63172,7 @@ var WellEquipmentTab = class {
|
|
|
63143
63172
|
try {
|
|
63144
63173
|
const attributes = await this.fetchAttributes(item.tbId, ATTRIBUTE_KEYS);
|
|
63145
63174
|
const profile = String(attributes.get("deviceProfile") || "").toUpperCase();
|
|
63146
|
-
if (profile
|
|
63175
|
+
if (!PUMP_EQUIPMENT_PROFILES.has(profile) && profile !== "SOLENOIDE") continue;
|
|
63147
63176
|
matching.push({
|
|
63148
63177
|
tbId: item.tbId,
|
|
63149
63178
|
profile,
|
|
@@ -63160,8 +63189,8 @@ var WellEquipmentTab = class {
|
|
|
63160
63189
|
return matching.sort((a, b) => a.label.localeCompare(b.label));
|
|
63161
63190
|
}
|
|
63162
63191
|
render() {
|
|
63163
|
-
const options = (
|
|
63164
|
-
const eligible = this.equipment.filter((item) => item.profile ===
|
|
63192
|
+
const options = (kind, code, existing) => {
|
|
63193
|
+
const eligible = this.equipment.filter((item) => kindOf(item.profile) === kind);
|
|
63165
63194
|
const missing = existing && !eligible.some((item) => item.tbId === existing.tbId) ? `<option value="${escapeHtml6(existing.tbId)}" selected data-unavailable="true">V\xEDnculo atual indispon\xEDvel \u2014 ${escapeHtml6(existing.label)}</option>` : "";
|
|
63166
63195
|
const items = eligible.map(
|
|
63167
63196
|
(item) => `<option value="${escapeHtml6(item.tbId)}"${item.tbId === existing?.tbId ? " selected" : ""}>${escapeHtml6(item.label)}</option>`
|
|
@@ -63176,9 +63205,9 @@ var WellEquipmentTab = class {
|
|
|
63176
63205
|
<section class="wet-tab">
|
|
63177
63206
|
<p>Configure as bombas e o solenoide associados a este po\xE7o. O mesmo equipamento pode ser usado em outros po\xE7os.</p>
|
|
63178
63207
|
<div class="wet-grid">
|
|
63179
|
-
<label for="wet-b1-device">Bomba B1</label>${options("
|
|
63180
|
-
<label for="wet-b2-device">Bomba B2</label>${options("
|
|
63181
|
-
<label for="wet-s-device">Solenoide S</label>${options("
|
|
63208
|
+
<label for="wet-b1-device">Bomba B1</label>${options("pump", "B1", binding(this.bindings.pumps, "B1"))}${labelInput("B1", binding(this.bindings.pumps, "B1"))}
|
|
63209
|
+
<label for="wet-b2-device">Bomba B2</label>${options("pump", "B2", binding(this.bindings.pumps, "B2"))}${labelInput("B2", binding(this.bindings.pumps, "B2"))}
|
|
63210
|
+
<label for="wet-s-device">Solenoide S</label>${options("valve", "S", binding(this.bindings.valves, "S"))}${labelInput("S", binding(this.bindings.valves, "S"))}
|
|
63182
63211
|
</div>
|
|
63183
63212
|
<p id="wet-message" class="wet-message" role="status" aria-live="polite"></p>
|
|
63184
63213
|
<button type="button" id="wet-save" ${this.loaded ? "" : "disabled"}>Salvar v\xEDnculos</button>
|
|
@@ -63215,14 +63244,14 @@ var WellEquipmentTab = class {
|
|
|
63215
63244
|
return;
|
|
63216
63245
|
}
|
|
63217
63246
|
const selected = [
|
|
63218
|
-
...b1 ? [{ id: b1,
|
|
63219
|
-
...b2 ? [{ id: b2,
|
|
63220
|
-
...solenoid ? [{ id: solenoid,
|
|
63247
|
+
...b1 ? [{ id: b1, kind: "pump", code: "B1" }] : [],
|
|
63248
|
+
...b2 ? [{ id: b2, kind: "pump", code: "B2" }] : [],
|
|
63249
|
+
...solenoid ? [{ id: solenoid, kind: "valve", code: "S" }] : []
|
|
63221
63250
|
];
|
|
63222
63251
|
for (const item of selected) {
|
|
63223
63252
|
const current = item.code === "S" ? this.bindings.valves.find((binding) => binding.code === item.code) : this.bindings.pumps.find((binding) => binding.code === item.code);
|
|
63224
63253
|
const unchangedUnavailableBinding = current?.tbId === item.id && !this.equipment.some((equipment) => equipment.tbId === item.id);
|
|
63225
|
-
if (!unchangedUnavailableBinding && !this.equipment.some((equipment) => equipment.tbId === item.id && equipment.profile === item.
|
|
63254
|
+
if (!unchangedUnavailableBinding && !this.equipment.some((equipment) => equipment.tbId === item.id && kindOf(equipment.profile) === item.kind)) {
|
|
63226
63255
|
this.showMessage(`O equipamento selecionado para ${item.code} n\xE3o pertence ao cat\xE1logo v\xE1lido.`, true);
|
|
63227
63256
|
return;
|
|
63228
63257
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -924,6 +924,7 @@ declare const DeviceIconType: {
|
|
|
924
924
|
readonly BOMBA_INCENDIO: "BOMBA_INCENDIO";
|
|
925
925
|
readonly BOMBA: "BOMBA";
|
|
926
926
|
readonly BOMBA_POCO: "BOMBA_POCO";
|
|
927
|
+
readonly BOMBA_CISTERNA: "BOMBA_CISTERNA";
|
|
927
928
|
readonly MEDIDOR_3F: "3F_MEDIDOR";
|
|
928
929
|
readonly RELOGIO: "RELOGIO";
|
|
929
930
|
readonly ENTRADA: "ENTRADA";
|
|
@@ -6318,7 +6319,7 @@ interface OpenDeviceReportParams {
|
|
|
6318
6319
|
deviceId?: string;
|
|
6319
6320
|
identifier?: string;
|
|
6320
6321
|
label?: string;
|
|
6321
|
-
domain?: 'energy' | 'water' | 'temperature';
|
|
6322
|
+
domain?: 'energy' | 'water' | 'temperature' | 'water_level';
|
|
6322
6323
|
granularity?: '1d' | '1h';
|
|
6323
6324
|
ui?: BaseUiCfg;
|
|
6324
6325
|
api: BaseApiCfg;
|
package/dist/index.d.ts
CHANGED
|
@@ -924,6 +924,7 @@ declare const DeviceIconType: {
|
|
|
924
924
|
readonly BOMBA_INCENDIO: "BOMBA_INCENDIO";
|
|
925
925
|
readonly BOMBA: "BOMBA";
|
|
926
926
|
readonly BOMBA_POCO: "BOMBA_POCO";
|
|
927
|
+
readonly BOMBA_CISTERNA: "BOMBA_CISTERNA";
|
|
927
928
|
readonly MEDIDOR_3F: "3F_MEDIDOR";
|
|
928
929
|
readonly RELOGIO: "RELOGIO";
|
|
929
930
|
readonly ENTRADA: "ENTRADA";
|
|
@@ -6318,7 +6319,7 @@ interface OpenDeviceReportParams {
|
|
|
6318
6319
|
deviceId?: string;
|
|
6319
6320
|
identifier?: string;
|
|
6320
6321
|
label?: string;
|
|
6321
|
-
domain?: 'energy' | 'water' | 'temperature';
|
|
6322
|
+
domain?: 'energy' | 'water' | 'temperature' | 'water_level';
|
|
6322
6323
|
granularity?: '1d' | '1h';
|
|
6323
6324
|
ui?: BaseUiCfg;
|
|
6324
6325
|
api: BaseApiCfg;
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
// package.json
|
|
11
11
|
var package_default = {
|
|
12
12
|
name: "myio-js-library",
|
|
13
|
-
version: "0.1.
|
|
13
|
+
version: "0.1.570",
|
|
14
14
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
15
15
|
license: "MIT",
|
|
16
16
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -1395,6 +1395,7 @@ var DeviceIconType = {
|
|
|
1395
1395
|
BOMBA_INCENDIO: "BOMBA_INCENDIO",
|
|
1396
1396
|
BOMBA: "BOMBA",
|
|
1397
1397
|
BOMBA_POCO: "BOMBA_POCO",
|
|
1398
|
+
BOMBA_CISTERNA: "BOMBA_CISTERNA",
|
|
1398
1399
|
MEDIDOR_3F: "3F_MEDIDOR",
|
|
1399
1400
|
RELOGIO: "RELOGIO",
|
|
1400
1401
|
ENTRADA: "ENTRADA",
|
|
@@ -1432,6 +1433,8 @@ var deviceIcons = {
|
|
|
1432
1433
|
BOMBA: "https://dashboard.myio-bas.com/api/images/public/Rge8Q3t0CP5PW8XyTn9bBK9aVP6uzSTT",
|
|
1433
1434
|
// BOMBA_POCO (ED-1354): bomba de poço artesiano — sem arte própria ainda, usa a do MOTOR/BOMBA.
|
|
1434
1435
|
BOMBA_POCO: "https://dashboard.myio-bas.com/api/images/public/Rge8Q3t0CP5PW8XyTn9bBK9aVP6uzSTT",
|
|
1436
|
+
// BOMBA_CISTERNA: mesmo comportamento/arte de BOMBA_POCO.
|
|
1437
|
+
BOMBA_CISTERNA: "https://dashboard.myio-bas.com/api/images/public/Rge8Q3t0CP5PW8XyTn9bBK9aVP6uzSTT",
|
|
1435
1438
|
"3F_MEDIDOR": "https://dashboard.myio-bas.com/api/images/public/f9Ce4meybsdaAhAkUlAfy5ei3I4kcN4k",
|
|
1436
1439
|
RELOGIO: "https://dashboard.myio-bas.com/api/images/public/ljHZostWg0G5AfKiyM8oZixWRIIGRASB",
|
|
1437
1440
|
ENTRADA: "https://dashboard.myio-bas.com/api/images/public/TQHPFqiejMW6lOSVsb8Pi85WtC0QKOLU",
|
|
@@ -1471,6 +1474,7 @@ var deviceIconLabels = {
|
|
|
1471
1474
|
BOMBA_INCENDIO: "Bomba Inc\xEAndio",
|
|
1472
1475
|
BOMBA: "Bomba",
|
|
1473
1476
|
BOMBA_POCO: "Bomba de Po\xE7o",
|
|
1477
|
+
BOMBA_CISTERNA: "Bomba de Cisterna",
|
|
1474
1478
|
"3F_MEDIDOR": "Medidor 3F",
|
|
1475
1479
|
RELOGIO: "Rel\xF3gio",
|
|
1476
1480
|
ENTRADA: "Entrada",
|
|
@@ -1534,6 +1538,8 @@ var DEVICE_TYPE_CONFIG = {
|
|
|
1534
1538
|
CISTERNA_ENTRADA: { category: "water", image: deviceIcons.CISTERNA_ENTRADA },
|
|
1535
1539
|
BOMBA_POCO: { category: "energy", image: deviceIcons.BOMBA_POCO },
|
|
1536
1540
|
// ED-1354: bomba do poço (consumption W)
|
|
1541
|
+
BOMBA_CISTERNA: { category: "energy", image: deviceIcons.BOMBA_CISTERNA },
|
|
1542
|
+
// mesmo comportamento de BOMBA_POCO
|
|
1537
1543
|
// Tank devices (dynamic images based on level)
|
|
1538
1544
|
TANK: { category: "tank", image: null },
|
|
1539
1545
|
// Temperature devices (dynamic images based on status)
|
|
@@ -3089,7 +3095,7 @@ function isEntradaDevice(device) {
|
|
|
3089
3095
|
}
|
|
3090
3096
|
|
|
3091
3097
|
// src/utils/devices/deviceClassificationProfile.ts
|
|
3092
|
-
var WELL_AUTOMATION_PROFILES = /* @__PURE__ */ new Set(["BOMBA_POCO", "SOLENOIDE"]);
|
|
3098
|
+
var WELL_AUTOMATION_PROFILES = /* @__PURE__ */ new Set(["BOMBA_POCO", "BOMBA_CISTERNA", "SOLENOIDE"]);
|
|
3093
3099
|
function filterWellAutomationItems(items) {
|
|
3094
3100
|
return (items || []).filter(
|
|
3095
3101
|
(item) => !WELL_AUTOMATION_PROFILES.has(String(item?.deviceProfile || "").trim().toUpperCase())
|
|
@@ -35024,8 +35030,9 @@ function renderTemperatureBarsPng(opts) {
|
|
|
35024
35030
|
ctx.fillStyle = "#6b7280";
|
|
35025
35031
|
ctx.font = "20px Helvetica, Arial, sans-serif";
|
|
35026
35032
|
ctx.textBaseline = "middle";
|
|
35027
|
-
const
|
|
35028
|
-
|
|
35033
|
+
const unit = opts.unit || "\xB0C";
|
|
35034
|
+
const scale = `Escala ${fmt2(lo)}\u2013${fmt2(hi)} ${unit}`;
|
|
35035
|
+
ctx.fillText(ideal ? `${scale} \xB7 faixa ideal ${fmt2(ideal.min)}\u2013${fmt2(ideal.max)} ${unit}` : scale, 16, 26);
|
|
35029
35036
|
opts.items.forEach((item, i) => {
|
|
35030
35037
|
const y = TOP + i * ROW;
|
|
35031
35038
|
const cy = y + ROW / 2;
|
|
@@ -35073,7 +35080,8 @@ var DOMAIN_CONFIG = {
|
|
|
35073
35080
|
label: "Consumo (kWh)",
|
|
35074
35081
|
formatter: (v) => fmtPt(v),
|
|
35075
35082
|
summaryType: "total",
|
|
35076
|
-
summaryLabel: "Total"
|
|
35083
|
+
summaryLabel: "Total",
|
|
35084
|
+
measureLabel: "Consumo"
|
|
35077
35085
|
},
|
|
35078
35086
|
water: {
|
|
35079
35087
|
endpoint: "water",
|
|
@@ -35081,7 +35089,8 @@ var DOMAIN_CONFIG = {
|
|
|
35081
35089
|
label: "Consumo (m\xB3)",
|
|
35082
35090
|
formatter: (v) => fmtPt(v),
|
|
35083
35091
|
summaryType: "total",
|
|
35084
|
-
summaryLabel: "Total"
|
|
35092
|
+
summaryLabel: "Total",
|
|
35093
|
+
measureLabel: "Consumo"
|
|
35085
35094
|
},
|
|
35086
35095
|
temperature: {
|
|
35087
35096
|
endpoint: "temperature",
|
|
@@ -35089,7 +35098,23 @@ var DOMAIN_CONFIG = {
|
|
|
35089
35098
|
label: "Temperatura (\xB0C)",
|
|
35090
35099
|
formatter: (v) => fmtPt(v),
|
|
35091
35100
|
summaryType: "average",
|
|
35092
|
-
summaryLabel: "M\xE9dia"
|
|
35101
|
+
summaryLabel: "M\xE9dia",
|
|
35102
|
+
measureLabel: "Temperatura",
|
|
35103
|
+
rankingDayTitle: "Dias mais quentes (m\xE9dia do dia)",
|
|
35104
|
+
rankingHourTitle: "Horas mais quentes"
|
|
35105
|
+
},
|
|
35106
|
+
// Nível de tanque/caixa/cisterna — não existe no Ingestion; o chamador injeta um
|
|
35107
|
+
// `fetcher` que lê o timeseries do ThingsBoard (water_percentage × 100).
|
|
35108
|
+
water_level: {
|
|
35109
|
+
endpoint: "water_level",
|
|
35110
|
+
unit: "%",
|
|
35111
|
+
label: "N\xEDvel (%)",
|
|
35112
|
+
formatter: (v) => fmtPt(v),
|
|
35113
|
+
summaryType: "average",
|
|
35114
|
+
summaryLabel: "M\xE9dia",
|
|
35115
|
+
measureLabel: "N\xEDvel",
|
|
35116
|
+
rankingDayTitle: "Dias com maior n\xEDvel (m\xE9dia do dia)",
|
|
35117
|
+
rankingHourTitle: "Horas com maior n\xEDvel"
|
|
35093
35118
|
}
|
|
35094
35119
|
};
|
|
35095
35120
|
var createDefaultEnergyFetcher = (params, getGranularity) => {
|
|
@@ -35661,12 +35686,12 @@ var DeviceReportModal = class {
|
|
|
35661
35686
|
kpis.push(
|
|
35662
35687
|
{
|
|
35663
35688
|
value: maxRow ? fmt2(maxRow.consumption) : "\u2014",
|
|
35664
|
-
label: `${rowLabel} com Maior ${
|
|
35689
|
+
label: `${rowLabel} com Maior ${this.domainConfig.measureLabel} (${unit})`,
|
|
35665
35690
|
...maxRow ? { sub: this.formatDate(maxRow.date) } : {}
|
|
35666
35691
|
},
|
|
35667
35692
|
{
|
|
35668
35693
|
value: minRow ? fmt2(minRow.consumption) : "\u2014",
|
|
35669
|
-
label: `${rowLabel} com Menor ${
|
|
35694
|
+
label: `${rowLabel} com Menor ${this.domainConfig.measureLabel} (${unit})`,
|
|
35670
35695
|
...minRow ? { sub: this.formatDate(minRow.date) } : {}
|
|
35671
35696
|
}
|
|
35672
35697
|
);
|
|
@@ -35722,12 +35747,13 @@ var DeviceReportModal = class {
|
|
|
35722
35747
|
<div style="position:absolute;top:2px;bottom:2px;left:0;width:${pos(r.consumption)};background:${color(r.consumption)};border-radius:4px;opacity:.85;"></div></div>` : `<span style="font-size:11px;color:var(--myio-text-muted,#9ca3af);">Sem leitura</span>`}
|
|
35723
35748
|
<span style="text-align:right;font-variant-numeric:tabular-nums;font-weight:600;">${r ? this.domainConfig.formatter(r.consumption) : "\u2014"}</span>
|
|
35724
35749
|
</div>`;
|
|
35725
|
-
const
|
|
35750
|
+
const unit = this.domainConfig.unit;
|
|
35751
|
+
const title = isHourly ? `${this.domainConfig.rankingHourTitle}${ranked.length > TOP_HOURS ? ` (top ${TOP_HOURS})` : ""}` : this.domainConfig.rankingDayTitle;
|
|
35726
35752
|
container.innerHTML = `
|
|
35727
35753
|
<div style="border:1px solid var(--myio-border,#e5e7eb);border-radius:10px;padding:12px 14px;max-height:620px;overflow-y:auto;">
|
|
35728
35754
|
<div style="font-weight:700;font-size:14px;margin-bottom:2px;">${title}</div>
|
|
35729
35755
|
<div style="font-size:11px;color:var(--myio-text-muted,#6b7280);margin-bottom:10px;">
|
|
35730
|
-
Escala ${this.domainConfig.formatter(lo)}\u2013${this.domainConfig.formatter(hi)}
|
|
35756
|
+
Escala ${this.domainConfig.formatter(lo)}\u2013${this.domainConfig.formatter(hi)} ${unit}${hasIdeal ? ` \xB7 <span style="color:#16a34a;">faixa ideal ${this.domainConfig.formatter(Number(ideal.min))}\u2013${this.domainConfig.formatter(Number(ideal.max))} ${unit}</span>` : ""}
|
|
35731
35757
|
</div>
|
|
35732
35758
|
${shown.map((r) => line(this.formatDate(r.date), r)).join("")}
|
|
35733
35759
|
${noData.map((r) => line(this.formatDate(r.date), null)).join("")}
|
|
@@ -35940,9 +35966,10 @@ var DeviceReportModal = class {
|
|
|
35940
35966
|
...noData.map((r) => ({ label: this.formatDate(r.date), value: null }))
|
|
35941
35967
|
],
|
|
35942
35968
|
ideal: this.params.temperatureIdealRange ?? null,
|
|
35943
|
-
accent: this.resolveAccentHex()
|
|
35969
|
+
accent: this.resolveAccentHex(),
|
|
35970
|
+
unit: this.domainConfig.unit
|
|
35944
35971
|
});
|
|
35945
|
-
const title = isHourly ?
|
|
35972
|
+
const title = isHourly ? `${this.domainConfig.rankingHourTitle}${ranked.length > 24 ? " (top 24)" : ""}` : this.domainConfig.rankingDayTitle;
|
|
35946
35973
|
return png ? { ...png, title } : null;
|
|
35947
35974
|
}
|
|
35948
35975
|
const chartPng = await this.participationChart?.toPngDataUrl?.().catch(() => null);
|
|
@@ -61373,6 +61400,8 @@ var DeviceProfileTab = class {
|
|
|
61373
61400
|
};
|
|
61374
61401
|
|
|
61375
61402
|
// src/components/premium-modals/settings/well-equipment/WellEquipmentTab.ts
|
|
61403
|
+
var PUMP_EQUIPMENT_PROFILES = /* @__PURE__ */ new Set(["BOMBA_POCO", "BOMBA_CISTERNA"]);
|
|
61404
|
+
var kindOf = (profile) => PUMP_EQUIPMENT_PROFILES.has(profile) ? "pump" : "valve";
|
|
61376
61405
|
var ATTRIBUTE_KEYS = "deviceProfile,gcdrDeviceId,pumpBindings";
|
|
61377
61406
|
var MAX_CUSTOMER_DEVICE_PAGES = 100;
|
|
61378
61407
|
function escapeHtml6(value) {
|
|
@@ -61475,7 +61504,7 @@ var WellEquipmentTab = class {
|
|
|
61475
61504
|
try {
|
|
61476
61505
|
const attributes = await this.fetchAttributes(item.tbId, ATTRIBUTE_KEYS);
|
|
61477
61506
|
const profile = String(attributes.get("deviceProfile") || "").toUpperCase();
|
|
61478
|
-
if (profile
|
|
61507
|
+
if (!PUMP_EQUIPMENT_PROFILES.has(profile) && profile !== "SOLENOIDE") continue;
|
|
61479
61508
|
matching.push({
|
|
61480
61509
|
tbId: item.tbId,
|
|
61481
61510
|
profile,
|
|
@@ -61492,8 +61521,8 @@ var WellEquipmentTab = class {
|
|
|
61492
61521
|
return matching.sort((a, b) => a.label.localeCompare(b.label));
|
|
61493
61522
|
}
|
|
61494
61523
|
render() {
|
|
61495
|
-
const options = (
|
|
61496
|
-
const eligible = this.equipment.filter((item) => item.profile ===
|
|
61524
|
+
const options = (kind, code, existing) => {
|
|
61525
|
+
const eligible = this.equipment.filter((item) => kindOf(item.profile) === kind);
|
|
61497
61526
|
const missing = existing && !eligible.some((item) => item.tbId === existing.tbId) ? `<option value="${escapeHtml6(existing.tbId)}" selected data-unavailable="true">V\xEDnculo atual indispon\xEDvel \u2014 ${escapeHtml6(existing.label)}</option>` : "";
|
|
61498
61527
|
const items = eligible.map(
|
|
61499
61528
|
(item) => `<option value="${escapeHtml6(item.tbId)}"${item.tbId === existing?.tbId ? " selected" : ""}>${escapeHtml6(item.label)}</option>`
|
|
@@ -61508,9 +61537,9 @@ var WellEquipmentTab = class {
|
|
|
61508
61537
|
<section class="wet-tab">
|
|
61509
61538
|
<p>Configure as bombas e o solenoide associados a este po\xE7o. O mesmo equipamento pode ser usado em outros po\xE7os.</p>
|
|
61510
61539
|
<div class="wet-grid">
|
|
61511
|
-
<label for="wet-b1-device">Bomba B1</label>${options("
|
|
61512
|
-
<label for="wet-b2-device">Bomba B2</label>${options("
|
|
61513
|
-
<label for="wet-s-device">Solenoide S</label>${options("
|
|
61540
|
+
<label for="wet-b1-device">Bomba B1</label>${options("pump", "B1", binding(this.bindings.pumps, "B1"))}${labelInput("B1", binding(this.bindings.pumps, "B1"))}
|
|
61541
|
+
<label for="wet-b2-device">Bomba B2</label>${options("pump", "B2", binding(this.bindings.pumps, "B2"))}${labelInput("B2", binding(this.bindings.pumps, "B2"))}
|
|
61542
|
+
<label for="wet-s-device">Solenoide S</label>${options("valve", "S", binding(this.bindings.valves, "S"))}${labelInput("S", binding(this.bindings.valves, "S"))}
|
|
61514
61543
|
</div>
|
|
61515
61544
|
<p id="wet-message" class="wet-message" role="status" aria-live="polite"></p>
|
|
61516
61545
|
<button type="button" id="wet-save" ${this.loaded ? "" : "disabled"}>Salvar v\xEDnculos</button>
|
|
@@ -61547,14 +61576,14 @@ var WellEquipmentTab = class {
|
|
|
61547
61576
|
return;
|
|
61548
61577
|
}
|
|
61549
61578
|
const selected = [
|
|
61550
|
-
...b1 ? [{ id: b1,
|
|
61551
|
-
...b2 ? [{ id: b2,
|
|
61552
|
-
...solenoid ? [{ id: solenoid,
|
|
61579
|
+
...b1 ? [{ id: b1, kind: "pump", code: "B1" }] : [],
|
|
61580
|
+
...b2 ? [{ id: b2, kind: "pump", code: "B2" }] : [],
|
|
61581
|
+
...solenoid ? [{ id: solenoid, kind: "valve", code: "S" }] : []
|
|
61553
61582
|
];
|
|
61554
61583
|
for (const item of selected) {
|
|
61555
61584
|
const current = item.code === "S" ? this.bindings.valves.find((binding) => binding.code === item.code) : this.bindings.pumps.find((binding) => binding.code === item.code);
|
|
61556
61585
|
const unchangedUnavailableBinding = current?.tbId === item.id && !this.equipment.some((equipment) => equipment.tbId === item.id);
|
|
61557
|
-
if (!unchangedUnavailableBinding && !this.equipment.some((equipment) => equipment.tbId === item.id && equipment.profile === item.
|
|
61586
|
+
if (!unchangedUnavailableBinding && !this.equipment.some((equipment) => equipment.tbId === item.id && kindOf(equipment.profile) === item.kind)) {
|
|
61558
61587
|
this.showMessage(`O equipamento selecionado para ${item.code} n\xE3o pertence ao cat\xE1logo v\xE1lido.`, true);
|
|
61559
61588
|
return;
|
|
61560
61589
|
}
|