@camstack/types 1.2.558 → 1.2.559
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/CHANGELOG.md +6 -0
- package/dist/client.d.ts +2 -1
- package/dist/client.js +289 -0
- package/dist/client.mjs +288 -1
- package/dist/device/device-icon.d.ts +136 -0
- package/dist/device/hero/hero-measurement.d.ts +7 -0
- package/dist/device/hero/hero-text.d.ts +8 -0
- package/dist/device/hero/index.d.ts +2 -2
- package/dist/device/index.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +257 -32
- package/dist/index.mjs +250 -33
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -60097,6 +60097,19 @@ var HeroTextSchema = zod.z.object({
|
|
|
60097
60097
|
en: zod.z.string(),
|
|
60098
60098
|
it: zod.z.string()
|
|
60099
60099
|
});
|
|
60100
|
+
/**
|
|
60101
|
+
* What a device that has not reported says in place of its value: an empty "—",
|
|
60102
|
+
* never a word like "Unknown" and never a 0 (D393). The card stays its normal
|
|
60103
|
+
* self; only the value is empty.
|
|
60104
|
+
*/
|
|
60105
|
+
var NOT_REPORTED = {
|
|
60106
|
+
en: "—",
|
|
60107
|
+
it: "—"
|
|
60108
|
+
};
|
|
60109
|
+
/** Whether `text` is {@link NOT_REPORTED}: a client may leave such a slot out instead of painting a dash twice. */
|
|
60110
|
+
function isNotReported(text) {
|
|
60111
|
+
return text.en === NOT_REPORTED.en && text.it === NOT_REPORTED.it;
|
|
60112
|
+
}
|
|
60100
60113
|
//#endregion
|
|
60101
60114
|
//#region src/device/hero/hero-measurement.ts
|
|
60102
60115
|
/**
|
|
@@ -60254,6 +60267,62 @@ function textMeasurement(text, since) {
|
|
|
60254
60267
|
historyKey: null
|
|
60255
60268
|
};
|
|
60256
60269
|
}
|
|
60270
|
+
/** What each quantity draws beside its value, reported or not. */
|
|
60271
|
+
var QUANTITY_FACE = {
|
|
60272
|
+
temperature: {
|
|
60273
|
+
icon: "thermometer",
|
|
60274
|
+
unit: "°C",
|
|
60275
|
+
sinceKind: "updated",
|
|
60276
|
+
historyKey: "cap:temperature-sensor.temperature"
|
|
60277
|
+
},
|
|
60278
|
+
humidity: {
|
|
60279
|
+
icon: "droplets",
|
|
60280
|
+
unit: "%",
|
|
60281
|
+
sinceKind: "updated",
|
|
60282
|
+
historyKey: "cap:humidity-sensor.humidity"
|
|
60283
|
+
},
|
|
60284
|
+
power: {
|
|
60285
|
+
icon: "zap",
|
|
60286
|
+
unit: "W",
|
|
60287
|
+
sinceKind: "updated",
|
|
60288
|
+
historyKey: "cap:power-meter.power"
|
|
60289
|
+
},
|
|
60290
|
+
contact: {
|
|
60291
|
+
icon: null,
|
|
60292
|
+
unit: null,
|
|
60293
|
+
sinceKind: "changed",
|
|
60294
|
+
historyKey: null
|
|
60295
|
+
},
|
|
60296
|
+
text: {
|
|
60297
|
+
icon: null,
|
|
60298
|
+
unit: null,
|
|
60299
|
+
sinceKind: "updated",
|
|
60300
|
+
historyKey: null
|
|
60301
|
+
}
|
|
60302
|
+
};
|
|
60303
|
+
/**
|
|
60304
|
+
* The measurement of a sensor that has not reported yet: its normal card with
|
|
60305
|
+
* an empty "—" value and its unit — never a placeholder, never a 0 (D393). The
|
|
60306
|
+
* reading is `null` (nothing to format), the scene does not move, and nothing
|
|
60307
|
+
* claims a moment.
|
|
60308
|
+
*/
|
|
60309
|
+
function emptyMeasurement(quantity) {
|
|
60310
|
+
const face = QUANTITY_FACE[quantity];
|
|
60311
|
+
return {
|
|
60312
|
+
quantity,
|
|
60313
|
+
reading: null,
|
|
60314
|
+
icon: face.icon,
|
|
60315
|
+
value: NOT_REPORTED,
|
|
60316
|
+
unit: face.unit,
|
|
60317
|
+
band: null,
|
|
60318
|
+
level: null,
|
|
60319
|
+
word: NOT_REPORTED,
|
|
60320
|
+
tone: "muted",
|
|
60321
|
+
since: null,
|
|
60322
|
+
sinceKind: face.sinceKind,
|
|
60323
|
+
historyKey: face.historyKey
|
|
60324
|
+
};
|
|
60325
|
+
}
|
|
60257
60326
|
/**
|
|
60258
60327
|
* Roles whose reading is ANOTHER field of the slice a measurement comes from: an
|
|
60259
60328
|
* energy, voltage or current sensor rides the `power-meter` slice, which also carries
|
|
@@ -60447,17 +60516,17 @@ var HERO_SCENE_BY_ROLE = {
|
|
|
60447
60516
|
[require_composed_stable_id.DeviceRole.GenericNotifier]: "inherit",
|
|
60448
60517
|
[require_composed_stable_id.DeviceRole.IrTransmitter]: "inherit"
|
|
60449
60518
|
};
|
|
60450
|
-
function isDeviceType$
|
|
60519
|
+
function isDeviceType$3(type) {
|
|
60451
60520
|
return Object.values(require_composed_stable_id.DeviceType).includes(type);
|
|
60452
60521
|
}
|
|
60453
|
-
function isDeviceRole$
|
|
60522
|
+
function isDeviceRole$2(role) {
|
|
60454
60523
|
return Object.values(require_composed_stable_id.DeviceRole).includes(role);
|
|
60455
60524
|
}
|
|
60456
60525
|
/** The scene id of a (role, type) pair. Role beats type; a type this build does not know gets the terminal. */
|
|
60457
60526
|
function resolveHeroSceneId(role, type) {
|
|
60458
|
-
const byRole = role !== null && isDeviceRole$
|
|
60527
|
+
const byRole = role !== null && isDeviceRole$2(role) ? HERO_SCENE_BY_ROLE[role] : void 0;
|
|
60459
60528
|
if (byRole !== void 0 && byRole !== "inherit") return byRole;
|
|
60460
|
-
return isDeviceType$
|
|
60529
|
+
return isDeviceType$3(type) ? HERO_SCENE_BY_TYPE[type] : "generic";
|
|
60461
60530
|
}
|
|
60462
60531
|
//#endregion
|
|
60463
60532
|
//#region src/device/hero/hero-model.ts
|
|
@@ -101041,7 +101110,7 @@ function convertPresetFeature(input) {
|
|
|
101041
101110
|
* 0 (D393). The caller supplies the sources — it knows which entity is which;
|
|
101042
101111
|
* the preset guesses no entity id.
|
|
101043
101112
|
*/
|
|
101044
|
-
var UNKNOWN
|
|
101113
|
+
var UNKNOWN = {
|
|
101045
101114
|
kind: "expression",
|
|
101046
101115
|
expr: "null",
|
|
101047
101116
|
bindings: {}
|
|
@@ -101129,8 +101198,8 @@ function pumpCycleFeature(cycle) {
|
|
|
101129
101198
|
cap: "pump-cycle",
|
|
101130
101199
|
fields: {
|
|
101131
101200
|
enabled: from(cycle.interval, "switch", "on"),
|
|
101132
|
-
onTime: UNKNOWN
|
|
101133
|
-
offTime: UNKNOWN
|
|
101201
|
+
onTime: UNKNOWN,
|
|
101202
|
+
offTime: UNKNOWN,
|
|
101134
101203
|
lastFetchedAt: NOW
|
|
101135
101204
|
},
|
|
101136
101205
|
commands: {
|
|
@@ -101172,7 +101241,7 @@ function petFountainFromEntitiesComposition(sources) {
|
|
|
101172
101241
|
waterVolume: millilitresAsLitres(sources.waterVolume),
|
|
101173
101242
|
empty: over("l", from(sources.waterLevel, "enum-sensor", "value"), "number(l) == null ? null : number(l) <= 0"),
|
|
101174
101243
|
pumpRunning: from(sources.pump, "switch", "on"),
|
|
101175
|
-
error: UNKNOWN
|
|
101244
|
+
error: UNKNOWN,
|
|
101176
101245
|
lastFetchedAt: NOW
|
|
101177
101246
|
},
|
|
101178
101247
|
commands: { setPump: {
|
|
@@ -105670,7 +105739,7 @@ var lockContribution = contribution("lock-control", LockControlStatusSchema, (sl
|
|
|
105670
105739
|
const state = slice?.state ?? null;
|
|
105671
105740
|
const words = state === null ? null : LOCK_WORDS[state];
|
|
105672
105741
|
const since = slice === void 0 ? null : elapsedText(slice.lastChangedAt, ctx.now);
|
|
105673
|
-
const title = words?.title ??
|
|
105742
|
+
const title = words?.title ?? NOT_REPORTED;
|
|
105674
105743
|
return {
|
|
105675
105744
|
reading: reading("lock-control", words?.state ?? "unknown", false, words?.title),
|
|
105676
105745
|
rows: [row$1("lock", state === "locked" || state === "locking" ? "lock" : "lock-open", joinText([title, since]), lockControls(state, ctx.features.includes(require_composed_stable_id.DeviceFeature.LockOpen)))],
|
|
@@ -105762,7 +105831,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
|
|
|
105762
105831
|
const modes = slice === void 0 ? ALARM_MODES : slice.availableModes;
|
|
105763
105832
|
return {
|
|
105764
105833
|
reading: reading("alarm-panel", words?.state ?? "unknown", false, words?.title),
|
|
105765
|
-
rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ??
|
|
105834
|
+
rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? NOT_REPORTED, since]), alarmControls(state, modes, slice?.requiresCode ?? false))],
|
|
105766
105835
|
...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] },
|
|
105767
105836
|
...words === null ? {} : { tiles: {
|
|
105768
105837
|
left: [{
|
|
@@ -105793,7 +105862,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
|
|
|
105793
105862
|
return {
|
|
105794
105863
|
reading: reading("automation-control", state, false, title),
|
|
105795
105864
|
rows: [row$1("automation", "workflow", joinText([
|
|
105796
|
-
title ??
|
|
105865
|
+
title ?? NOT_REPORTED,
|
|
105797
105866
|
last === null ? null : require_sleep.t(`Ran ${last.en}`, `Eseguita ${last.it}`),
|
|
105798
105867
|
slice?.lastError == null ? null : require_sleep.t(slice.lastError, slice.lastError)
|
|
105799
105868
|
]), [asAction(run), toggle])],
|
|
@@ -105809,7 +105878,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
|
|
|
105809
105878
|
return {
|
|
105810
105879
|
reading: reading("script-runner", state, false, title),
|
|
105811
105880
|
rows: [row$1("script", "scroll-text", joinText([
|
|
105812
|
-
title ??
|
|
105881
|
+
title ?? NOT_REPORTED,
|
|
105813
105882
|
last === null ? null : require_sleep.t(`Ran ${last.en}`, `Eseguito ${last.it}`),
|
|
105814
105883
|
slice?.lastError == null ? null : require_sleep.t(slice.lastError, slice.lastError)
|
|
105815
105884
|
]), [asAction(control)])],
|
|
@@ -105818,7 +105887,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
|
|
|
105818
105887
|
}),
|
|
105819
105888
|
"do-not-disturb": contribution("do-not-disturb", DoNotDisturbStatusSchema, (slice) => {
|
|
105820
105889
|
const on = slice?.enabled ?? null;
|
|
105821
|
-
return { rows: [row$1("do-not-disturb", "bell-off", on === null ?
|
|
105890
|
+
return { rows: [row$1("do-not-disturb", "bell-off", on === null ? NOT_REPORTED : on ? require_sleep.t("Do not disturb on", "Non disturbare attivo") : require_sleep.t("Do not disturb off", "Non disturbare spento"), [{
|
|
105822
105891
|
kind: "toggle",
|
|
105823
105892
|
id: "do-not-disturb.toggle",
|
|
105824
105893
|
label: require_sleep.t("Do not disturb", "Non disturbare"),
|
|
@@ -105838,7 +105907,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
|
|
|
105838
105907
|
* is absent from the facts, never a zero (D393).
|
|
105839
105908
|
*/
|
|
105840
105909
|
var has$3 = (ctx, f) => ctx.features.includes(f);
|
|
105841
|
-
var unknownText =
|
|
105910
|
+
var unknownText = NOT_REPORTED;
|
|
105842
105911
|
var pct$2 = (n) => require_sleep.t(`${Math.round(n)}%`, `${Math.round(n)}%`);
|
|
105843
105912
|
var unit = (n) => Math.min(1, Math.max(0, n / 100));
|
|
105844
105913
|
/** Battery as a fact, unless the device is also bound to the `battery` cap (it already says so). */
|
|
@@ -107252,13 +107321,13 @@ function sensorFragment(value, id, icon, en, it, text) {
|
|
|
107252
107321
|
tiles: { right: [tile$1(en, it, text)] }
|
|
107253
107322
|
};
|
|
107254
107323
|
}
|
|
107255
|
-
var temperatureContribution = contribution("temperature-sensor", TemperatureSensorStatusSchema, (slice) => measured(sensorFragment(slice?.temperature ?? null, "temperature", "thermometer", "Temperature", "Temperatura", formatDegrees(slice?.temperature ?? 0)), slice?.temperature == null ?
|
|
107256
|
-
var humidityContribution = contribution("humidity-sensor", HumiditySensorStatusSchema, (slice) => measured(sensorFragment(slice?.humidity ?? null, "humidity", "droplets", "Humidity", "Umidità", `${Math.round(slice?.humidity ?? 0)}%`), slice?.humidity == null ?
|
|
107324
|
+
var temperatureContribution = contribution("temperature-sensor", TemperatureSensorStatusSchema, (slice) => measured(sensorFragment(slice?.temperature ?? null, "temperature", "thermometer", "Temperature", "Temperatura", formatDegrees(slice?.temperature ?? 0)), slice?.temperature == null ? emptyMeasurement("temperature") : temperatureMeasurement(slice.temperature, slice.lastFetchedAt)));
|
|
107325
|
+
var humidityContribution = contribution("humidity-sensor", HumiditySensorStatusSchema, (slice) => measured(sensorFragment(slice?.humidity ?? null, "humidity", "droplets", "Humidity", "Umidità", `${Math.round(slice?.humidity ?? 0)}%`), slice?.humidity == null ? emptyMeasurement("humidity") : humidityMeasurement(slice.humidity, slice.lastFetchedAt)));
|
|
107257
107326
|
var pressureContribution = contribution("pressure-sensor", PressureSensorStatusSchema, (slice) => sensorFragment(slice?.pressure ?? null, "pressure", "gauge", "Pressure", "Pressione", `${Math.round(slice?.pressure ?? 0)} hPa`));
|
|
107258
107327
|
var illuminanceContribution = contribution("ambient-light-sensor", AmbientLightSensorStatusSchema, (slice) => sensorFragment(slice?.illuminance ?? null, "illuminance", "sun", "Light", "Luce", `${Math.round(slice?.illuminance ?? 0)} lx`));
|
|
107259
107328
|
var numericContribution = contribution("numeric-sensor", NumericSensorStatusSchema, (slice) => sensorFragment(slice?.value ?? null, "reading", "gauge", "Value", "Valore", String(Number((slice?.value ?? 0).toFixed(2)))));
|
|
107260
107329
|
var enumContribution = contribution("enum-sensor", EnumSensorStatusSchema, (slice) => {
|
|
107261
|
-
if (slice === void 0 || slice.value === "") return { reading: reading("sensor", "unknown") };
|
|
107330
|
+
if (slice === void 0 || slice.value === "") return measured({ reading: reading("sensor", "unknown") }, emptyMeasurement("text"));
|
|
107262
107331
|
if (slice.timestamp === true) return { reading: reading("sensor", "on") };
|
|
107263
107332
|
return measured(sensorFragment(slice.value, "reading", "gauge", "State", "Stato", slice.value), textMeasurement(slice.value, slice.lastFetchedAt));
|
|
107264
107333
|
});
|
|
@@ -107384,7 +107453,7 @@ function circuitControl(circuit) {
|
|
|
107384
107453
|
return picker(`heat-pump.${circuit.id}.mode`, require_sleep.t("Mode", "Modalità"), circuit.operationMode, method, args);
|
|
107385
107454
|
}
|
|
107386
107455
|
/** A circuit with no reading is still a row: it shows that nothing is known, not nothing. */
|
|
107387
|
-
var UNKNOWN_STATUS =
|
|
107456
|
+
var UNKNOWN_STATUS = NOT_REPORTED;
|
|
107388
107457
|
function circuitRow(circuit) {
|
|
107389
107458
|
const control = circuitControl(circuit);
|
|
107390
107459
|
const status = thermalStatusText(circuit.targetTemp, circuit.currentTemp) ?? UNKNOWN_STATUS;
|
|
@@ -107846,7 +107915,7 @@ var runningStateContribution = contribution("running-state", RunningStateStatusS
|
|
|
107846
107915
|
};
|
|
107847
107916
|
});
|
|
107848
107917
|
var powerMeterContribution = contribution("power-meter", PowerMeterStatusSchema, (slice) => {
|
|
107849
|
-
if (slice?.power === void 0) return {};
|
|
107918
|
+
if (slice?.power === void 0) return { measurement: emptyMeasurement("power") };
|
|
107850
107919
|
const detail = [];
|
|
107851
107920
|
if (slice.energy !== void 0) detail.push({
|
|
107852
107921
|
label: require_sleep.t("Energy", "Energia"),
|
|
@@ -107934,14 +108003,14 @@ var contactContribution = contribution("contact", ContactStatusSchema, (slice) =
|
|
|
107934
108003
|
const row = {
|
|
107935
108004
|
id: "contact",
|
|
107936
108005
|
icon: slice?.entryOpen === true ? "door-open" : "door-closed",
|
|
107937
|
-
status: slice === void 0 ?
|
|
108006
|
+
status: slice === void 0 ? NOT_REPORTED : slice.entryOpen ? require_sleep.t("Open", "Aperto") : require_sleep.t("Closed", "Chiuso"),
|
|
107938
108007
|
controls: []
|
|
107939
108008
|
};
|
|
107940
108009
|
return measured({
|
|
107941
108010
|
reading: reading("contact", slice === void 0 ? "unknown" : slice.entryOpen ? "on" : "off"),
|
|
107942
108011
|
rows: [row],
|
|
107943
108012
|
...slice === void 0 ? {} : { scene: { mode: slice.entryOpen ? "open" : "closed" } }
|
|
107944
|
-
}, slice === void 0 ?
|
|
108013
|
+
}, slice === void 0 ? emptyMeasurement("contact") : contactMeasurement(slice.entryOpen, slice.lastChangedAt > 0 ? slice.lastChangedAt : null));
|
|
107945
108014
|
});
|
|
107946
108015
|
var motionTriggerContribution = contribution("motion-trigger", MotionTriggerStatusSchema, (slice) => {
|
|
107947
108016
|
const on = slice?.enabled ?? null;
|
|
@@ -107956,7 +108025,7 @@ var motionTriggerContribution = contribution("motion-trigger", MotionTriggerStat
|
|
|
107956
108025
|
return { rows: [{
|
|
107957
108026
|
id: "motion-trigger",
|
|
107958
108027
|
icon: "activity",
|
|
107959
|
-
status: on === null ?
|
|
108028
|
+
status: on === null ? NOT_REPORTED : on ? require_sleep.t("Follows motion", "Segue il movimento") : require_sleep.t("Ignores motion", "Ignora il movimento"),
|
|
107960
108029
|
controls: [toggle]
|
|
107961
108030
|
}] };
|
|
107962
108031
|
});
|
|
@@ -108445,14 +108514,14 @@ var HERO_LAYOUT_BY_TYPE = {
|
|
|
108445
108514
|
[require_composed_stable_id.DeviceType.Dryer]: APPLIANCE_LAYOUT,
|
|
108446
108515
|
[require_composed_stable_id.DeviceType.Gateway]: HERO_LAYOUT_DEFAULT
|
|
108447
108516
|
};
|
|
108448
|
-
function isDeviceType$
|
|
108517
|
+
function isDeviceType$2(type) {
|
|
108449
108518
|
return Object.values(require_composed_stable_id.DeviceType).includes(type);
|
|
108450
108519
|
}
|
|
108451
108520
|
/** The layout of a type; a type this build does not know gets the default. */
|
|
108452
108521
|
function resolveHeroLayout(type, role = null) {
|
|
108453
108522
|
if (type === require_composed_stable_id.DeviceType.Switch && role === require_composed_stable_id.DeviceRole.SwitchHeater) return HEATER_LAYOUT;
|
|
108454
108523
|
const live = require_implemented_methods.canonicalStoredDeviceType(type);
|
|
108455
|
-
return isDeviceType$
|
|
108524
|
+
return isDeviceType$2(live) ? HERO_LAYOUT_BY_TYPE[live] : HERO_LAYOUT_DEFAULT;
|
|
108456
108525
|
}
|
|
108457
108526
|
//#endregion
|
|
108458
108527
|
//#region src/device/hero/hero-look.ts
|
|
@@ -108478,9 +108547,8 @@ function look(icon, tone, background, animation) {
|
|
|
108478
108547
|
animation
|
|
108479
108548
|
};
|
|
108480
108549
|
}
|
|
108481
|
-
/**
|
|
108550
|
+
/** Unreachable: identical for every look. */
|
|
108482
108551
|
var OFFLINE = look("wifi-off", "muted", "plain", "none");
|
|
108483
|
-
var UNKNOWN = look("circle-question-mark", "muted", "plain", "none");
|
|
108484
108552
|
var ALERT = look("triangle-alert", "danger", "alert-wash", "pulse");
|
|
108485
108553
|
function lookOf(spec) {
|
|
108486
108554
|
const at = (s) => look(spec.icon, s[0], s[1], s[2]);
|
|
@@ -108492,7 +108560,7 @@ function lookOf(spec) {
|
|
|
108492
108560
|
standby: at(spec.standby),
|
|
108493
108561
|
alert: spec.alert ?? ALERT,
|
|
108494
108562
|
offline: OFFLINE,
|
|
108495
|
-
unknown:
|
|
108563
|
+
unknown: look(spec.icon, "muted", "plain", "none")
|
|
108496
108564
|
};
|
|
108497
108565
|
}
|
|
108498
108566
|
var MUTED = [
|
|
@@ -109241,10 +109309,10 @@ var HERO_LOOK_BY_ROLE = {
|
|
|
109241
109309
|
[require_composed_stable_id.DeviceRole.GenericNotifier]: "inherit",
|
|
109242
109310
|
[require_composed_stable_id.DeviceRole.IrTransmitter]: "inherit"
|
|
109243
109311
|
};
|
|
109244
|
-
function isDeviceType(type) {
|
|
109312
|
+
function isDeviceType$1(type) {
|
|
109245
109313
|
return Object.values(require_composed_stable_id.DeviceType).includes(type);
|
|
109246
109314
|
}
|
|
109247
|
-
function isDeviceRole(role) {
|
|
109315
|
+
function isDeviceRole$1(role) {
|
|
109248
109316
|
return Object.values(require_composed_stable_id.DeviceRole).includes(role);
|
|
109249
109317
|
}
|
|
109250
109318
|
/**
|
|
@@ -109252,14 +109320,14 @@ function isDeviceRole(role) {
|
|
|
109252
109320
|
* A climate device that is on draws its MODE (`mode` is the scene's); a role never loses to it.
|
|
109253
109321
|
*/
|
|
109254
109322
|
function resolveHeroLook(role, type, state, mode = null) {
|
|
109255
|
-
const byRole = role !== null && isDeviceRole(role) ? HERO_LOOK_BY_ROLE[role] : void 0;
|
|
109323
|
+
const byRole = role !== null && isDeviceRole$1(role) ? HERO_LOOK_BY_ROLE[role] : void 0;
|
|
109256
109324
|
if (byRole !== void 0 && byRole !== "inherit") return byRole[state];
|
|
109257
109325
|
if (mode !== null && (state === "on" || state === "running") && MODE_LOOK_TYPES.includes(type)) {
|
|
109258
109326
|
const byMode = HERO_MODE_LOOK[mode];
|
|
109259
109327
|
if (byMode !== null) return byMode;
|
|
109260
109328
|
}
|
|
109261
109329
|
if (require_implemented_methods.isAirConditioner(type, role)) return CLIMATE_LOOK[state];
|
|
109262
|
-
return ((isDeviceType(type) ? HERO_LOOK_BY_TYPE[type] : void 0) ?? HERO_LOOK_DEFAULT)[state];
|
|
109330
|
+
return ((isDeviceType$1(type) ? HERO_LOOK_BY_TYPE[type] : void 0) ?? HERO_LOOK_DEFAULT)[state];
|
|
109263
109331
|
}
|
|
109264
109332
|
/** Every look the model declares, for the exhaustiveness guard and its spec. */
|
|
109265
109333
|
function allHeroLooks() {
|
|
@@ -109344,7 +109412,7 @@ var STATE_TEXT = {
|
|
|
109344
109412
|
standby: require_sleep.t("Standby", "In standby"),
|
|
109345
109413
|
alert: require_sleep.t("Alert", "Allarme"),
|
|
109346
109414
|
offline: require_sleep.t("Offline", "Non raggiungibile"),
|
|
109347
|
-
unknown:
|
|
109415
|
+
unknown: NOT_REPORTED
|
|
109348
109416
|
};
|
|
109349
109417
|
function pickReading(readings) {
|
|
109350
109418
|
for (const source of STATE_SOURCE_ORDER) {
|
|
@@ -121026,6 +121094,155 @@ function applianceExport(ecosystem, deviceType) {
|
|
|
121026
121094
|
return APPLIANCE_EXPORT[ecosystem][deviceType];
|
|
121027
121095
|
}
|
|
121028
121096
|
//#endregion
|
|
121097
|
+
//#region src/device/device-icon.ts
|
|
121098
|
+
/**
|
|
121099
|
+
* device-icon — THE icon of a device, from what it IS: its {@link DeviceType},
|
|
121100
|
+
* refined by its {@link DeviceRole}. One table for every surface: the admin's
|
|
121101
|
+
* rows, cards, page header, lists and pickers draw it through ui-library's
|
|
121102
|
+
* glyph table, the viewer through its catalog nodes. The value is a key of the
|
|
121103
|
+
* icon catalog (D854), never a glyph.
|
|
121104
|
+
*
|
|
121105
|
+
* Exhaustive over both enums (`satisfies Record<…>`): a new type or role fails
|
|
121106
|
+
* the build until it has an icon. Nothing here reads a name, a provider or a
|
|
121107
|
+
* capability — an icon picked from those would be invented.
|
|
121108
|
+
*
|
|
121109
|
+
* Precedence: a known role → its icon; otherwise the type's icon; a type this
|
|
121110
|
+
* build does not know → the generic type's icon. An operator's per-device or
|
|
121111
|
+
* per-role display override is the caller's level above this one.
|
|
121112
|
+
*/
|
|
121113
|
+
/** The icon of each device type. */
|
|
121114
|
+
var DEVICE_TYPE_ICON = {
|
|
121115
|
+
[require_composed_stable_id.DeviceType.Camera]: "camera",
|
|
121116
|
+
[require_composed_stable_id.DeviceType.Hub]: "network",
|
|
121117
|
+
[require_composed_stable_id.DeviceType.Light]: "lightbulb",
|
|
121118
|
+
[require_composed_stable_id.DeviceType.Siren]: "siren",
|
|
121119
|
+
[require_composed_stable_id.DeviceType.Switch]: "toggle-left",
|
|
121120
|
+
[require_composed_stable_id.DeviceType.Sensor]: "activity",
|
|
121121
|
+
[require_composed_stable_id.DeviceType.Climate]: "thermometer",
|
|
121122
|
+
[require_composed_stable_id.DeviceType.HeatPump]: "flame",
|
|
121123
|
+
[require_composed_stable_id.DeviceType.Button]: "circle-dot",
|
|
121124
|
+
[require_composed_stable_id.DeviceType.EventEmitter]: "zap",
|
|
121125
|
+
[require_composed_stable_id.DeviceType.Update]: "refresh-cw",
|
|
121126
|
+
[require_composed_stable_id.DeviceType.Generic]: "box",
|
|
121127
|
+
[require_composed_stable_id.DeviceType.Notifier]: "bell",
|
|
121128
|
+
[require_composed_stable_id.DeviceType.Script]: "scroll-text",
|
|
121129
|
+
[require_composed_stable_id.DeviceType.Automation]: "workflow",
|
|
121130
|
+
[require_composed_stable_id.DeviceType.Lock]: "lock",
|
|
121131
|
+
[require_composed_stable_id.DeviceType.Cover]: "blinds",
|
|
121132
|
+
[require_composed_stable_id.DeviceType.Valve]: "pipette",
|
|
121133
|
+
[require_composed_stable_id.DeviceType.Humidifier]: "waves",
|
|
121134
|
+
[require_composed_stable_id.DeviceType.WaterHeater]: "bath",
|
|
121135
|
+
[require_composed_stable_id.DeviceType.Fan]: "fan",
|
|
121136
|
+
[require_composed_stable_id.DeviceType.MediaPlayer]: "monitor-play",
|
|
121137
|
+
[require_composed_stable_id.DeviceType.AlarmPanel]: "shield-alert",
|
|
121138
|
+
[require_composed_stable_id.DeviceType.Control]: "sliders-horizontal",
|
|
121139
|
+
[require_composed_stable_id.DeviceType.Presence]: "map-pin",
|
|
121140
|
+
[require_composed_stable_id.DeviceType.Weather]: "cloud-sun",
|
|
121141
|
+
[require_composed_stable_id.DeviceType.Vacuum]: "bot",
|
|
121142
|
+
[require_composed_stable_id.DeviceType.LawnMower]: "tractor",
|
|
121143
|
+
[require_composed_stable_id.DeviceType.Container]: "box",
|
|
121144
|
+
[require_composed_stable_id.DeviceType.Image]: "image",
|
|
121145
|
+
[require_composed_stable_id.DeviceType.PetFeeder]: "bone",
|
|
121146
|
+
[require_composed_stable_id.DeviceType.PetFountain]: "droplets",
|
|
121147
|
+
[require_composed_stable_id.DeviceType.Dishwasher]: "waves",
|
|
121148
|
+
[require_composed_stable_id.DeviceType.Washer]: "washing-machine",
|
|
121149
|
+
[require_composed_stable_id.DeviceType.Dryer]: "wind",
|
|
121150
|
+
[require_composed_stable_id.DeviceType.Gateway]: "router"
|
|
121151
|
+
};
|
|
121152
|
+
/** The icon of each role: what the device is FOR, which reads better than its type. */
|
|
121153
|
+
var DEVICE_ROLE_ICON = {
|
|
121154
|
+
[require_composed_stable_id.DeviceRole.Siren]: "siren",
|
|
121155
|
+
[require_composed_stable_id.DeviceRole.Floodlight]: "lightbulb",
|
|
121156
|
+
[require_composed_stable_id.DeviceRole.Spotlight]: "flashlight",
|
|
121157
|
+
[require_composed_stable_id.DeviceRole.PirSensor]: "radar",
|
|
121158
|
+
[require_composed_stable_id.DeviceRole.Chime]: "bell",
|
|
121159
|
+
[require_composed_stable_id.DeviceRole.Autotrack]: "crosshair",
|
|
121160
|
+
[require_composed_stable_id.DeviceRole.Nightvision]: "moon",
|
|
121161
|
+
[require_composed_stable_id.DeviceRole.PrivacyMask]: "eye-off",
|
|
121162
|
+
[require_composed_stable_id.DeviceRole.Doorbell]: "door-closed",
|
|
121163
|
+
[require_composed_stable_id.DeviceRole.CoverBlind]: "blinds",
|
|
121164
|
+
[require_composed_stable_id.DeviceRole.CoverShutter]: "blinds",
|
|
121165
|
+
[require_composed_stable_id.DeviceRole.CoverAwning]: "blinds",
|
|
121166
|
+
[require_composed_stable_id.DeviceRole.CoverCurtain]: "blinds",
|
|
121167
|
+
[require_composed_stable_id.DeviceRole.CoverGarage]: "door-closed",
|
|
121168
|
+
[require_composed_stable_id.DeviceRole.CoverGate]: "door-closed",
|
|
121169
|
+
[require_composed_stable_id.DeviceRole.CoverDoor]: "door-open",
|
|
121170
|
+
[require_composed_stable_id.DeviceRole.CoverWindow]: "blinds",
|
|
121171
|
+
[require_composed_stable_id.DeviceRole.BinaryHelper]: "toggle-left",
|
|
121172
|
+
[require_composed_stable_id.DeviceRole.Outlet]: "plug",
|
|
121173
|
+
[require_composed_stable_id.DeviceRole.SwitchHeater]: "flame",
|
|
121174
|
+
[require_composed_stable_id.DeviceRole.SwitchFan]: "fan",
|
|
121175
|
+
[require_composed_stable_id.DeviceRole.SwitchLight]: "lightbulb",
|
|
121176
|
+
[require_composed_stable_id.DeviceRole.ClimateAc]: "air-vent",
|
|
121177
|
+
[require_composed_stable_id.DeviceRole.ClimateThermostat]: "thermometer",
|
|
121178
|
+
[require_composed_stable_id.DeviceRole.ClimateFloor]: "waves",
|
|
121179
|
+
[require_composed_stable_id.DeviceRole.ClimateRadiator]: "heater",
|
|
121180
|
+
[require_composed_stable_id.DeviceRole.ClimateHeater]: "flame",
|
|
121181
|
+
[require_composed_stable_id.DeviceRole.ClimateHeatPumpCircuit]: "refresh-cw",
|
|
121182
|
+
[require_composed_stable_id.DeviceRole.MotionSensor]: "footprints",
|
|
121183
|
+
[require_composed_stable_id.DeviceRole.ContactSensor]: "door-open",
|
|
121184
|
+
[require_composed_stable_id.DeviceRole.LeakSensor]: "droplet",
|
|
121185
|
+
[require_composed_stable_id.DeviceRole.SmokeSensor]: "alarm-smoke",
|
|
121186
|
+
[require_composed_stable_id.DeviceRole.COSensor]: "wind",
|
|
121187
|
+
[require_composed_stable_id.DeviceRole.GasSensor]: "flame",
|
|
121188
|
+
[require_composed_stable_id.DeviceRole.TamperSensor]: "shield-alert",
|
|
121189
|
+
[require_composed_stable_id.DeviceRole.VibrationSensor]: "vibrate",
|
|
121190
|
+
[require_composed_stable_id.DeviceRole.ConnectivitySensor]: "wifi",
|
|
121191
|
+
[require_composed_stable_id.DeviceRole.SoundSensor]: "volume-2",
|
|
121192
|
+
[require_composed_stable_id.DeviceRole.BinarySensor]: "toggle-left",
|
|
121193
|
+
[require_composed_stable_id.DeviceRole.TemperatureSensor]: "thermometer",
|
|
121194
|
+
[require_composed_stable_id.DeviceRole.HumiditySensor]: "droplets",
|
|
121195
|
+
[require_composed_stable_id.DeviceRole.AmbientLightSensor]: "sun",
|
|
121196
|
+
[require_composed_stable_id.DeviceRole.PressureSensor]: "gauge",
|
|
121197
|
+
[require_composed_stable_id.DeviceRole.WindSensor]: "wind",
|
|
121198
|
+
[require_composed_stable_id.DeviceRole.RainSensor]: "cloud-rain",
|
|
121199
|
+
[require_composed_stable_id.DeviceRole.UvSensor]: "sun-medium",
|
|
121200
|
+
[require_composed_stable_id.DeviceRole.SolarRadiationSensor]: "sunrise",
|
|
121201
|
+
[require_composed_stable_id.DeviceRole.SoilMoistureSensor]: "sprout",
|
|
121202
|
+
[require_composed_stable_id.DeviceRole.PowerSensor]: "zap",
|
|
121203
|
+
[require_composed_stable_id.DeviceRole.EnergySensor]: "zap",
|
|
121204
|
+
[require_composed_stable_id.DeviceRole.VoltageSensor]: "zap",
|
|
121205
|
+
[require_composed_stable_id.DeviceRole.CurrentSensor]: "zap",
|
|
121206
|
+
[require_composed_stable_id.DeviceRole.AirQualitySensor]: "wind",
|
|
121207
|
+
[require_composed_stable_id.DeviceRole.BatterySensor]: "gauge",
|
|
121208
|
+
[require_composed_stable_id.DeviceRole.NumericSensor]: "hash",
|
|
121209
|
+
[require_composed_stable_id.DeviceRole.EnumSensor]: "list",
|
|
121210
|
+
[require_composed_stable_id.DeviceRole.DateTimeSensor]: "clock",
|
|
121211
|
+
[require_composed_stable_id.DeviceRole.GenericSensor]: "gauge",
|
|
121212
|
+
[require_composed_stable_id.DeviceRole.NumericControl]: "sliders-horizontal",
|
|
121213
|
+
[require_composed_stable_id.DeviceRole.SelectControl]: "list-checks",
|
|
121214
|
+
[require_composed_stable_id.DeviceRole.TextControl]: "type",
|
|
121215
|
+
[require_composed_stable_id.DeviceRole.DateTimeControl]: "clock",
|
|
121216
|
+
[require_composed_stable_id.DeviceRole.MobilePushNotifier]: "smartphone",
|
|
121217
|
+
[require_composed_stable_id.DeviceRole.MessagingNotifier]: "message-square",
|
|
121218
|
+
[require_composed_stable_id.DeviceRole.EmailNotifier]: "mail",
|
|
121219
|
+
[require_composed_stable_id.DeviceRole.GenericNotifier]: "bell",
|
|
121220
|
+
[require_composed_stable_id.DeviceRole.IrTransmitter]: "radio-tower"
|
|
121221
|
+
};
|
|
121222
|
+
var TYPE_VALUES = new Set(Object.values(require_composed_stable_id.DeviceType));
|
|
121223
|
+
var ROLE_VALUES = new Set(Object.values(require_composed_stable_id.DeviceRole));
|
|
121224
|
+
function isDeviceType(value) {
|
|
121225
|
+
return TYPE_VALUES.has(value);
|
|
121226
|
+
}
|
|
121227
|
+
function isDeviceRole(value) {
|
|
121228
|
+
return ROLE_VALUES.has(value);
|
|
121229
|
+
}
|
|
121230
|
+
/** The icon of a device type alone; a type this build does not know draws the generic one. */
|
|
121231
|
+
function deviceTypeIconKey(type) {
|
|
121232
|
+
return isDeviceType(type) ? DEVICE_TYPE_ICON[type] : DEVICE_TYPE_ICON[require_composed_stable_id.DeviceType.Generic];
|
|
121233
|
+
}
|
|
121234
|
+
/** The icon of a role alone, or `null` for a role this build does not know. */
|
|
121235
|
+
function deviceRoleIconKey(role) {
|
|
121236
|
+
return isDeviceRole(role) ? DEVICE_ROLE_ICON[role] : null;
|
|
121237
|
+
}
|
|
121238
|
+
/**
|
|
121239
|
+
* The icon of a device: its role's when the role is known, else its type's.
|
|
121240
|
+
* An unknown role never borrows another role's icon — it is drawn as its type.
|
|
121241
|
+
*/
|
|
121242
|
+
function deviceIconKey(type, role) {
|
|
121243
|
+
return (role === null || role === void 0 ? null : deviceRoleIconKey(role)) ?? deviceTypeIconKey(type);
|
|
121244
|
+
}
|
|
121245
|
+
//#endregion
|
|
121029
121246
|
//#region src/device/path-util.ts
|
|
121030
121247
|
/** Returns true when `x` is a non-null, non-array plain object. */
|
|
121031
121248
|
function isRecord$1(x) {
|
|
@@ -139983,6 +140200,7 @@ exports.DEVICE_RAMP = DEVICE_RAMP;
|
|
|
139983
140200
|
exports.DEVICE_REFRESH_REFUSAL_PREFIX = DEVICE_REFRESH_REFUSAL_PREFIX;
|
|
139984
140201
|
exports.DEVICE_RESTORE_RETRY_CONCURRENCY = DEVICE_RESTORE_RETRY_CONCURRENCY;
|
|
139985
140202
|
exports.DEVICE_RESTORE_RETRY_DELAYS_MS = DEVICE_RESTORE_RETRY_DELAYS_MS;
|
|
140203
|
+
exports.DEVICE_ROLE_ICON = DEVICE_ROLE_ICON;
|
|
139986
140204
|
exports.DEVICE_RUNS_MAX_PAGE = DEVICE_RUNS_MAX_PAGE;
|
|
139987
140205
|
exports.DEVICE_SAN_CREDENTIAL_PREFIX = DEVICE_SAN_CREDENTIAL_PREFIX;
|
|
139988
140206
|
exports.DEVICE_SAN_USER_PREFIX = DEVICE_SAN_USER_PREFIX;
|
|
@@ -140007,6 +140225,7 @@ exports.DEVICE_TOMBSTONE_RETENTION_MS = DEVICE_TOMBSTONE_RETENTION_MS;
|
|
|
140007
140225
|
exports.DEVICE_TRANSITIONS_MAX_PAGE = DEVICE_TRANSITIONS_MAX_PAGE;
|
|
140008
140226
|
exports.DEVICE_TRANSITIONS_RECORD_BATCH_MAX = DEVICE_TRANSITIONS_RECORD_BATCH_MAX;
|
|
140009
140227
|
exports.DEVICE_TYPE_CONTROL_KIND = DEVICE_TYPE_CONTROL_KIND;
|
|
140228
|
+
exports.DEVICE_TYPE_ICON = DEVICE_TYPE_ICON;
|
|
140010
140229
|
exports.DEVICE_TYPE_INFO = DEVICE_TYPE_INFO;
|
|
140011
140230
|
exports.DISPLAY_PREFERENCES = require_sleep.DISPLAY_PREFERENCES;
|
|
140012
140231
|
exports.DISPLAY_PRESETS = DISPLAY_PRESETS;
|
|
@@ -140874,6 +141093,7 @@ exports.NODE_COLOR_IDS = require_node_color.NODE_COLOR_IDS;
|
|
|
140874
141093
|
exports.NOTIFICATION_FIELDS = NOTIFICATION_FIELDS;
|
|
140875
141094
|
exports.NOTIFICATION_OUTPUT_CAP = NOTIFICATION_OUTPUT_CAP;
|
|
140876
141095
|
exports.NOT_A_HERO_FACT = NOT_A_HERO_FACT;
|
|
141096
|
+
exports.NOT_REPORTED = NOT_REPORTED;
|
|
140877
141097
|
exports.NO_MEASURED_CAPACITY = NO_MEASURED_CAPACITY;
|
|
140878
141098
|
exports.NUMERIC_AGGREGATES = require_implemented_methods.NUMERIC_AGGREGATES;
|
|
140879
141099
|
exports.NativeCropBboxSchema = NativeCropBboxSchema;
|
|
@@ -142348,17 +142568,20 @@ exports.deviceExportCapability = deviceExportCapability;
|
|
|
142348
142568
|
exports.deviceExportStatusInstanceOf = statusInstanceOf;
|
|
142349
142569
|
exports.deviceExtensionCapability = deviceExtensionCapability;
|
|
142350
142570
|
exports.deviceHistoryCapability = deviceHistoryCapability;
|
|
142571
|
+
exports.deviceIconKey = deviceIconKey;
|
|
142351
142572
|
exports.deviceManagerCapability = deviceManagerCapability;
|
|
142352
142573
|
exports.deviceMatchesProfile = deviceMatchesProfile;
|
|
142353
142574
|
exports.deviceOpsCapability = require_sleep.deviceOpsCapability;
|
|
142354
142575
|
exports.deviceProviderCapability = deviceProviderCapability;
|
|
142355
142576
|
exports.deviceRefusalFromMessage = deviceRefusalFromMessage;
|
|
142356
142577
|
exports.deviceRemovalHookCapability = deviceRemovalHookCapability;
|
|
142578
|
+
exports.deviceRoleIconKey = deviceRoleIconKey;
|
|
142357
142579
|
exports.deviceRunsCapability = deviceRunsCapability;
|
|
142358
142580
|
exports.deviceSelectorMatches = deviceSelectorMatches;
|
|
142359
142581
|
exports.deviceStateCapability = deviceStateCapability;
|
|
142360
142582
|
exports.deviceStatusCapability = deviceStatusCapability;
|
|
142361
142583
|
exports.deviceTransitionsCapability = deviceTransitionsCapability;
|
|
142584
|
+
exports.deviceTypeIconKey = deviceTypeIconKey;
|
|
142362
142585
|
exports.diffStepSettings = diffStepSettings;
|
|
142363
142586
|
exports.disarmRoseMemory = require_implemented_methods.disarmRoseMemory;
|
|
142364
142587
|
exports.dishwasherCapability = dishwasherCapability;
|
|
@@ -142384,6 +142607,7 @@ exports.embeddingRequirementsUnavailableError = embeddingRequirementsUnavailable
|
|
|
142384
142607
|
exports.emitDownForOwnedCaps = require_sleep.emitDownForOwnedCaps;
|
|
142385
142608
|
exports.emitReadiness = require_sleep.emitReadiness;
|
|
142386
142609
|
exports.emitsCollectionSelector = emitsCollectionSelector;
|
|
142610
|
+
exports.emptyMeasurement = emptyMeasurement;
|
|
142387
142611
|
exports.encodeCardsToComposition = encodeCardsToComposition;
|
|
142388
142612
|
exports.encodeFlipperParsed = encodeFlipperParsed;
|
|
142389
142613
|
exports.encodeProfileFromStreamShape = encodeProfileFromStreamShape;
|
|
@@ -142641,6 +142865,7 @@ exports.isLocationEnabled = isLocationEnabled;
|
|
|
142641
142865
|
exports.isMediaOwnerType = isMediaOwnerType;
|
|
142642
142866
|
exports.isModelScopedStepSettingKey = isModelScopedStepSettingKey;
|
|
142643
142867
|
exports.isNode = isNode;
|
|
142868
|
+
exports.isNotReported = isNotReported;
|
|
142644
142869
|
exports.isOauthLandingReason = isOauthLandingReason;
|
|
142645
142870
|
exports.isObjectInput = isObjectInput;
|
|
142646
142871
|
exports.isOccupancyRule = isOccupancyRule;
|