@camstack/types 1.2.529 → 1.2.530
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 +12 -0
- package/dist/addon.js +1 -1
- package/dist/addon.mjs +1 -1
- package/dist/capabilities/capability-definition.d.ts +15 -0
- package/dist/capabilities/climate-control.cap.d.ts +26 -1
- package/dist/capabilities/enum-sensor.cap.d.ts +1 -1
- package/dist/capabilities/hero-layout.cap.d.ts +158 -17
- package/dist/capabilities/water-heater.cap.d.ts +5 -1
- package/dist/device/hero/climate-view.d.ts +45 -0
- package/dist/device/hero/hero-contribution-kit.d.ts +27 -0
- package/dist/device/hero/hero-contributions-access.d.ts +2 -0
- package/dist/device/hero/hero-contributions-actuators.d.ts +2 -0
- package/dist/device/hero/hero-contributions-climate.d.ts +3 -0
- package/dist/device/hero/hero-contributions-devices.d.ts +2 -0
- package/dist/device/hero/hero-contributions-groups.d.ts +2 -0
- package/dist/device/hero/hero-contributions-sensors.d.ts +2 -0
- package/dist/device/hero/hero-contributions.d.ts +2 -5
- package/dist/device/hero/hero-fragment.d.ts +11 -1
- package/dist/device/hero/hero-look.d.ts +80 -14
- package/dist/device/hero/hero-model.d.ts +224 -34
- package/dist/device/hero/hero-row.d.ts +30 -5
- package/dist/device/hero/media-player-view.d.ts +6 -0
- package/dist/generated/addon-cap-facts.d.ts +1 -1
- package/dist/generated/runtime-state-durability.d.ts +6 -1
- package/dist/index.js +2488 -216
- package/dist/index.mjs +2488 -216
- package/dist/{sleep-CqvzKIq2.mjs → sleep-CfYvHNFz.mjs} +16 -0
- package/dist/{sleep-DX_umr22.js → sleep-CqsZMKxq.js} +16 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_sleep = require("./sleep-
|
|
2
|
+
const require_sleep = require("./sleep-CqsZMKxq.js");
|
|
3
3
|
const require_event_category = require("./event-category-BC4RRerT.js");
|
|
4
4
|
const require_device_type = require("./device-type-BaYa0UGS.js");
|
|
5
5
|
const require_composition = require("./composition-BjHGoicU.js");
|
|
@@ -41648,6 +41648,12 @@ var ClimateControlStatusSchema = zod.z.object({
|
|
|
41648
41648
|
maxTemp: zod.z.number().nullable().optional().meta(require_sleep.readingMeta("temperature")),
|
|
41649
41649
|
/** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
|
|
41650
41650
|
tempStep: zod.z.number().positive().nullable().optional().meta(require_sleep.readingMeta("temperature")),
|
|
41651
|
+
/**
|
|
41652
|
+
* The last non-off mode the device reported. Kept by the device-state mirror on every
|
|
41653
|
+
* write (providers never set it), so "turn on" can return to it. Absent until the device
|
|
41654
|
+
* has reported a running mode.
|
|
41655
|
+
*/
|
|
41656
|
+
lastActiveMode: HvacModeSchema.exclude(["off"]).optional(),
|
|
41651
41657
|
/** Ms epoch when the slice was last updated (push or command). */
|
|
41652
41658
|
lastFetchedAt: zod.z.number()
|
|
41653
41659
|
});
|
|
@@ -41732,7 +41738,8 @@ var climateControlCapability = {
|
|
|
41732
41738
|
* See `RuntimeStateDurability`. Enforced by
|
|
41733
41739
|
* `scripts/check-runtime-state-durability.ts`.
|
|
41734
41740
|
*/
|
|
41735
|
-
durability: "
|
|
41741
|
+
durability: "restored",
|
|
41742
|
+
restoredStateFields: ["lastActiveMode"],
|
|
41736
41743
|
/**
|
|
41737
41744
|
* History (D850): recorded series. Celsius by contract; setpoints keep every change (`minIntervalMs: 0`).
|
|
41738
41745
|
*/
|
|
@@ -43087,7 +43094,7 @@ function irSourceProblem(source) {
|
|
|
43087
43094
|
throw err;
|
|
43088
43095
|
}
|
|
43089
43096
|
}
|
|
43090
|
-
function same(a, b) {
|
|
43097
|
+
function same$1(a, b) {
|
|
43091
43098
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
43092
43099
|
}
|
|
43093
43100
|
/** The `digits` source that declares this channel number, or null. */
|
|
@@ -43101,7 +43108,7 @@ function findChannelSource(sources, number) {
|
|
|
43101
43108
|
* the number reach the same source; nothing else is guessed.
|
|
43102
43109
|
*/
|
|
43103
43110
|
function resolveRemoteSource(sources, query) {
|
|
43104
|
-
const byName = sources.find((source) => same(source.name, query));
|
|
43111
|
+
const byName = sources.find((source) => same$1(source.name, query));
|
|
43105
43112
|
if (byName !== void 0) return byName;
|
|
43106
43113
|
const byId = sources.find((source) => source.id === query.trim());
|
|
43107
43114
|
if (byId !== void 0) return byId;
|
|
@@ -53602,7 +53609,7 @@ var enumSensorCapability = {
|
|
|
53602
53609
|
} } },
|
|
53603
53610
|
/** Clock fields: written, but excluded from the compare that decides
|
|
53604
53611
|
* whether persisting is worth a SQLite commit. */
|
|
53605
|
-
volatileStateFields: ["lastFetchedAt"]
|
|
53612
|
+
volatileStateFields: ["lastFetchedAt", "timestamp"]
|
|
53606
53613
|
};
|
|
53607
53614
|
//#endregion
|
|
53608
53615
|
//#region src/capabilities/event-emitter.cap.ts
|
|
@@ -55273,22 +55280,51 @@ var HERO_ROW_IDS = [
|
|
|
55273
55280
|
"volume",
|
|
55274
55281
|
"source",
|
|
55275
55282
|
"contact",
|
|
55276
|
-
"motion-trigger"
|
|
55283
|
+
"motion-trigger",
|
|
55284
|
+
"lock",
|
|
55285
|
+
"alarm",
|
|
55286
|
+
"fan",
|
|
55287
|
+
"vacuum",
|
|
55288
|
+
"mower",
|
|
55289
|
+
"feeder",
|
|
55290
|
+
"fountain",
|
|
55291
|
+
"pump-cycle",
|
|
55292
|
+
"automation",
|
|
55293
|
+
"script",
|
|
55294
|
+
"do-not-disturb",
|
|
55295
|
+
"brightness",
|
|
55296
|
+
"color",
|
|
55297
|
+
"cover",
|
|
55298
|
+
"valve",
|
|
55299
|
+
"humidifier",
|
|
55300
|
+
"update",
|
|
55301
|
+
"button",
|
|
55302
|
+
"climate-mode",
|
|
55303
|
+
"climate-fan",
|
|
55304
|
+
"setpoint",
|
|
55305
|
+
"channel",
|
|
55306
|
+
"control"
|
|
55277
55307
|
];
|
|
55278
55308
|
var HeroRowIdSchema = zod.z.enum(HERO_ROW_IDS);
|
|
55279
|
-
|
|
55280
|
-
var HeroArgsSchema = zod.z.record(zod.z.string(), zod.z.union([
|
|
55309
|
+
var HeroArgValueSchema = zod.z.lazy(() => zod.z.union([
|
|
55281
55310
|
zod.z.string(),
|
|
55282
55311
|
zod.z.number(),
|
|
55283
|
-
zod.z.boolean()
|
|
55312
|
+
zod.z.boolean(),
|
|
55313
|
+
zod.z.record(zod.z.string(), HeroArgValueSchema)
|
|
55284
55314
|
]));
|
|
55315
|
+
var HeroArgsSchema = zod.z.record(zod.z.string(), HeroArgValueSchema);
|
|
55285
55316
|
/** A cap method called on the hero's device. */
|
|
55286
55317
|
var HeroCallSchema = zod.z.object({
|
|
55287
55318
|
cap: zod.z.string(),
|
|
55288
55319
|
method: zod.z.string(),
|
|
55289
55320
|
args: HeroArgsSchema
|
|
55290
55321
|
});
|
|
55291
|
-
var HeroConfirmSchema = zod.z.enum([
|
|
55322
|
+
var HeroConfirmSchema = zod.z.enum([
|
|
55323
|
+
"off-while-running",
|
|
55324
|
+
"unlock",
|
|
55325
|
+
"install",
|
|
55326
|
+
"press"
|
|
55327
|
+
]);
|
|
55292
55328
|
var HeroActionSchema = zod.z.object({
|
|
55293
55329
|
/** Unique within the model; the `gated` list and the specs name it. */
|
|
55294
55330
|
id: zod.z.string(),
|
|
@@ -55384,7 +55420,11 @@ var HeroConsumptionSlotSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
|
|
|
55384
55420
|
})]);
|
|
55385
55421
|
var HeroOwnPowerSlotSchema = zod.z.object({
|
|
55386
55422
|
/** Which cap the power is switched through; the renderer never needs it. */
|
|
55387
|
-
source: zod.z.enum([
|
|
55423
|
+
source: zod.z.enum([
|
|
55424
|
+
"switch",
|
|
55425
|
+
"media-player",
|
|
55426
|
+
"climate-control"
|
|
55427
|
+
]),
|
|
55388
55428
|
/** `null` = unknown, never off. */
|
|
55389
55429
|
on: zod.z.boolean().nullable(),
|
|
55390
55430
|
assumed: zod.z.boolean(),
|
|
@@ -55421,7 +55461,23 @@ var HeroFactSchema = zod.z.object({
|
|
|
55421
55461
|
"remaining",
|
|
55422
55462
|
"volume",
|
|
55423
55463
|
"source",
|
|
55424
|
-
"consumables"
|
|
55464
|
+
"consumables",
|
|
55465
|
+
"since",
|
|
55466
|
+
"speed",
|
|
55467
|
+
"progress",
|
|
55468
|
+
"level",
|
|
55469
|
+
"last-run",
|
|
55470
|
+
"event",
|
|
55471
|
+
"members",
|
|
55472
|
+
"failures",
|
|
55473
|
+
"reading",
|
|
55474
|
+
"climate",
|
|
55475
|
+
"temperature",
|
|
55476
|
+
"humidity",
|
|
55477
|
+
"pressure",
|
|
55478
|
+
"air-quality",
|
|
55479
|
+
"illuminance",
|
|
55480
|
+
"valve"
|
|
55425
55481
|
]),
|
|
55426
55482
|
icon: IconKeySchema.nullable(),
|
|
55427
55483
|
text: HeroTextSchema,
|
|
@@ -88080,6 +88136,11 @@ var WaterHeaterStatusSchema = zod.z.object({
|
|
|
88080
88136
|
minTemp: zod.z.number().nullable().meta(require_sleep.readingMeta("temperature")),
|
|
88081
88137
|
/** HA `max_temp` attribute. Null when not reported. */
|
|
88082
88138
|
maxTemp: zod.z.number().nullable().meta(require_sleep.readingMeta("temperature")),
|
|
88139
|
+
/**
|
|
88140
|
+
* The last operation mode other than `off` the device reported. Kept by the device-state
|
|
88141
|
+
* mirror on every write (providers never set it), so "turn on" can return to it.
|
|
88142
|
+
*/
|
|
88143
|
+
lastActiveMode: zod.z.string().optional(),
|
|
88083
88144
|
/** Ms epoch when the slice was last updated. */
|
|
88084
88145
|
lastChangedAt: zod.z.number()
|
|
88085
88146
|
});
|
|
@@ -88127,7 +88188,8 @@ var waterHeaterCapability = {
|
|
|
88127
88188
|
* See `RuntimeStateDurability`. Enforced by
|
|
88128
88189
|
* `scripts/check-runtime-state-durability.ts`.
|
|
88129
88190
|
*/
|
|
88130
|
-
durability: "
|
|
88191
|
+
durability: "restored",
|
|
88192
|
+
restoredStateFields: ["lastActiveMode"],
|
|
88131
88193
|
/**
|
|
88132
88194
|
* History (D850): recorded series. The schema carries no unit; providers publish Celsius. Setpoint keeps every change.
|
|
88133
88195
|
*/
|
|
@@ -94487,7 +94549,7 @@ var ACTUATOR_TEMPLATE_IDS = [
|
|
|
94487
94549
|
"media-player",
|
|
94488
94550
|
"climate"
|
|
94489
94551
|
];
|
|
94490
|
-
function row$
|
|
94552
|
+
function row$2(cap, method, requires = null, confirm = false) {
|
|
94491
94553
|
return {
|
|
94492
94554
|
cap,
|
|
94493
94555
|
method,
|
|
@@ -94497,41 +94559,41 @@ function row$1(cap, method, requires = null, confirm = false) {
|
|
|
94497
94559
|
}
|
|
94498
94560
|
/** The first row's cap is the type's own: always offered, members without it are skipped. */
|
|
94499
94561
|
var ACTUATOR_METHODS = {
|
|
94500
|
-
switch: [row$
|
|
94562
|
+
switch: [row$2("switch", "setState")],
|
|
94501
94563
|
light: [
|
|
94502
|
-
row$
|
|
94503
|
-
row$
|
|
94504
|
-
row$
|
|
94564
|
+
row$2("switch", "setState"),
|
|
94565
|
+
row$2("brightness", "setBrightness"),
|
|
94566
|
+
row$2("color", "setColor")
|
|
94505
94567
|
],
|
|
94506
94568
|
fan: [
|
|
94507
|
-
row$
|
|
94508
|
-
row$
|
|
94509
|
-
row$
|
|
94510
|
-
row$
|
|
94511
|
-
row$
|
|
94569
|
+
row$2("switch", "setState"),
|
|
94570
|
+
row$2("fan-control", "setPercentage", require_device_type.DeviceFeature.FanSpeed),
|
|
94571
|
+
row$2("fan-control", "setPreset", require_device_type.DeviceFeature.FanPreset),
|
|
94572
|
+
row$2("fan-control", "setDirection", require_device_type.DeviceFeature.FanDirection),
|
|
94573
|
+
row$2("fan-control", "setOscillating", require_device_type.DeviceFeature.FanOscillating)
|
|
94512
94574
|
],
|
|
94513
94575
|
cover: [
|
|
94514
|
-
row$
|
|
94515
|
-
row$
|
|
94516
|
-
row$
|
|
94517
|
-
row$
|
|
94518
|
-
row$
|
|
94576
|
+
row$2("cover", "open"),
|
|
94577
|
+
row$2("cover", "close"),
|
|
94578
|
+
row$2("cover", "stop", require_device_type.DeviceFeature.CoverStoppable),
|
|
94579
|
+
row$2("cover", "setPosition", require_device_type.DeviceFeature.CoverPositionable),
|
|
94580
|
+
row$2("cover", "setTiltPosition", require_device_type.DeviceFeature.CoverTilt)
|
|
94519
94581
|
],
|
|
94520
94582
|
valve: [
|
|
94521
|
-
row$
|
|
94522
|
-
row$
|
|
94523
|
-
row$
|
|
94583
|
+
row$2("valve", "open"),
|
|
94584
|
+
row$2("valve", "close"),
|
|
94585
|
+
row$2("valve", "setPosition", require_device_type.DeviceFeature.ValvePositionable)
|
|
94524
94586
|
],
|
|
94525
|
-
lock: [row$
|
|
94587
|
+
lock: [row$2("lock-control", "lock"), row$2("lock-control", "unlock", null, true)],
|
|
94526
94588
|
"media-player": [
|
|
94527
|
-
row$
|
|
94528
|
-
row$
|
|
94529
|
-
row$
|
|
94589
|
+
row$2("media-player", "play"),
|
|
94590
|
+
row$2("media-player", "pause"),
|
|
94591
|
+
row$2("media-player", "setVolume", require_device_type.DeviceFeature.MediaPlayerVolume)
|
|
94530
94592
|
],
|
|
94531
94593
|
climate: [
|
|
94532
|
-
row$
|
|
94533
|
-
row$
|
|
94534
|
-
row$
|
|
94594
|
+
row$2("climate-control", "setMode"),
|
|
94595
|
+
row$2("climate-control", "setTarget"),
|
|
94596
|
+
row$2("climate-control", "setFanMode", require_device_type.DeviceFeature.ClimateFanMode)
|
|
94535
94597
|
]
|
|
94536
94598
|
};
|
|
94537
94599
|
function actuatorMethodRow(templateId, cap, method) {
|
|
@@ -100108,6 +100170,1684 @@ function resolveMutate(router, method) {
|
|
|
100108
100170
|
return typeof mutate === "function" ? mutate : null;
|
|
100109
100171
|
}
|
|
100110
100172
|
//#endregion
|
|
100173
|
+
//#region src/device/hero/hero-contribution-kit.ts
|
|
100174
|
+
/** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
|
|
100175
|
+
function contribution(cap, schema, build) {
|
|
100176
|
+
return {
|
|
100177
|
+
cap,
|
|
100178
|
+
contribute: (raw, ctx) => {
|
|
100179
|
+
const parsed = schema.safeParse(raw);
|
|
100180
|
+
return build(parsed.success ? parsed.data : void 0, ctx);
|
|
100181
|
+
}
|
|
100182
|
+
};
|
|
100183
|
+
}
|
|
100184
|
+
function action(id, label, icon, cap, method, args = {}, emphasis = "normal", confirm = null) {
|
|
100185
|
+
return {
|
|
100186
|
+
id,
|
|
100187
|
+
label,
|
|
100188
|
+
icon,
|
|
100189
|
+
call: {
|
|
100190
|
+
cap,
|
|
100191
|
+
method,
|
|
100192
|
+
args
|
|
100193
|
+
},
|
|
100194
|
+
emphasis,
|
|
100195
|
+
confirm
|
|
100196
|
+
};
|
|
100197
|
+
}
|
|
100198
|
+
var asAction = (a) => ({
|
|
100199
|
+
kind: "action",
|
|
100200
|
+
action: a
|
|
100201
|
+
});
|
|
100202
|
+
function reading(source, state, assumed = false, title) {
|
|
100203
|
+
return title === void 0 ? {
|
|
100204
|
+
source,
|
|
100205
|
+
state,
|
|
100206
|
+
assumed
|
|
100207
|
+
} : {
|
|
100208
|
+
source,
|
|
100209
|
+
state,
|
|
100210
|
+
assumed,
|
|
100211
|
+
title
|
|
100212
|
+
};
|
|
100213
|
+
}
|
|
100214
|
+
function fact(id, icon, text, tone = "muted") {
|
|
100215
|
+
return {
|
|
100216
|
+
id,
|
|
100217
|
+
icon,
|
|
100218
|
+
text,
|
|
100219
|
+
tone
|
|
100220
|
+
};
|
|
100221
|
+
}
|
|
100222
|
+
function row$1(id, icon, status, controls = []) {
|
|
100223
|
+
return {
|
|
100224
|
+
id,
|
|
100225
|
+
icon,
|
|
100226
|
+
status,
|
|
100227
|
+
controls: [...controls]
|
|
100228
|
+
};
|
|
100229
|
+
}
|
|
100230
|
+
/** "5 min" / "3 h" / "2 d" since `at`; `null` when the moment is unknown (0) or in the future. */
|
|
100231
|
+
function elapsedText(at, now) {
|
|
100232
|
+
if (at <= 0 || at > now) return null;
|
|
100233
|
+
const min = Math.floor((now - at) / 6e4);
|
|
100234
|
+
if (min < 1) return require_sleep.t("just now", "adesso");
|
|
100235
|
+
if (min < 60) return require_sleep.t(`${min} min ago`, `${min} min fa`);
|
|
100236
|
+
const h = Math.floor(min / 60);
|
|
100237
|
+
if (h < 48) return require_sleep.t(`${h} h ago`, `${h} h fa`);
|
|
100238
|
+
const d = Math.floor(h / 24);
|
|
100239
|
+
return require_sleep.t(`${d} d ago`, `${d} g fa`);
|
|
100240
|
+
}
|
|
100241
|
+
/** Joins words with " · ", skipping what is not there. */
|
|
100242
|
+
function joinText(parts) {
|
|
100243
|
+
const present = parts.filter((p) => p !== null);
|
|
100244
|
+
if (present.length === 0) return null;
|
|
100245
|
+
return require_sleep.t(present.map((p) => p.en).join(" · "), present.map((p) => p.it).join(" · "));
|
|
100246
|
+
}
|
|
100247
|
+
//#endregion
|
|
100248
|
+
//#region src/device/hero/hero-contributions-access.ts
|
|
100249
|
+
/**
|
|
100250
|
+
* What the access and automation caps add to a hero (D1023): a lock, an alarm
|
|
100251
|
+
* panel, an automation, a script and a media player's do-not-disturb. Every
|
|
100252
|
+
* contribution is typed against the cap's own status schema; a slice that does
|
|
100253
|
+
* not parse reads as "not answered" and the state is `unknown`, never `off`
|
|
100254
|
+
* (D315/D393). Nothing is guessed: with an unknown state the actions the cap
|
|
100255
|
+
* offers are offered separately.
|
|
100256
|
+
*/
|
|
100257
|
+
var LOCK_WORDS = {
|
|
100258
|
+
locked: {
|
|
100259
|
+
state: "on",
|
|
100260
|
+
title: require_sleep.t("Locked", "Chiusa"),
|
|
100261
|
+
door: "closed"
|
|
100262
|
+
},
|
|
100263
|
+
unlocked: {
|
|
100264
|
+
state: "standby",
|
|
100265
|
+
title: require_sleep.t("Unlocked", "Aperta"),
|
|
100266
|
+
door: "open"
|
|
100267
|
+
},
|
|
100268
|
+
locking: {
|
|
100269
|
+
state: "running",
|
|
100270
|
+
title: require_sleep.t("Locking", "In chiusura"),
|
|
100271
|
+
door: "closed"
|
|
100272
|
+
},
|
|
100273
|
+
unlocking: {
|
|
100274
|
+
state: "running",
|
|
100275
|
+
title: require_sleep.t("Unlocking", "In apertura"),
|
|
100276
|
+
door: "open"
|
|
100277
|
+
},
|
|
100278
|
+
jammed: {
|
|
100279
|
+
state: "alert",
|
|
100280
|
+
title: require_sleep.t("Jammed", "Bloccata"),
|
|
100281
|
+
door: null
|
|
100282
|
+
},
|
|
100283
|
+
"door-open": {
|
|
100284
|
+
state: "standby",
|
|
100285
|
+
title: require_sleep.t("Door open", "Porta aperta"),
|
|
100286
|
+
door: "open"
|
|
100287
|
+
}
|
|
100288
|
+
};
|
|
100289
|
+
var lockAction = (primary) => action("lock.lock", require_sleep.t("Lock", "Chiudi"), "lock", "lock-control", "lock", {}, primary ? "primary" : "normal");
|
|
100290
|
+
var unlockAction = (primary) => action("lock.unlock", require_sleep.t("Unlock", "Apri"), "lock-open", "lock-control", "unlock", {}, primary ? "primary" : "normal", "unlock");
|
|
100291
|
+
function lockControls(state, latch) {
|
|
100292
|
+
const open = asAction(action("lock.open", require_sleep.t("Open latch", "Apri il chiavistello"), "door-open", "lock-control", "open", {}, "normal", "unlock"));
|
|
100293
|
+
switch (state) {
|
|
100294
|
+
case "locked": return [asAction(unlockAction(true)), ...latch ? [open] : []];
|
|
100295
|
+
case "unlocked": return [asAction(lockAction(true)), ...latch ? [open] : []];
|
|
100296
|
+
case "jammed": return [asAction(unlockAction(false)), asAction(lockAction(false))];
|
|
100297
|
+
case null: return [asAction(lockAction(false)), asAction(unlockAction(false))];
|
|
100298
|
+
default: return [];
|
|
100299
|
+
}
|
|
100300
|
+
}
|
|
100301
|
+
var lockContribution = contribution("lock-control", LockControlStatusSchema, (slice, ctx) => {
|
|
100302
|
+
const state = slice?.state ?? null;
|
|
100303
|
+
const words = state === null ? null : LOCK_WORDS[state];
|
|
100304
|
+
const since = slice === void 0 ? null : elapsedText(slice.lastChangedAt, ctx.now);
|
|
100305
|
+
const title = words?.title ?? require_sleep.t("Unknown", "Sconosciuto");
|
|
100306
|
+
return {
|
|
100307
|
+
reading: reading("lock-control", words?.state ?? "unknown", false, words?.title),
|
|
100308
|
+
rows: [row$1("lock", state === "locked" || state === "locking" ? "lock" : "lock-open", joinText([title, since]), lockControls(state, ctx.features.includes(require_device_type.DeviceFeature.LockOpen)))],
|
|
100309
|
+
...since === null || words === null ? {} : { facts: [fact("since", "clock", since, "muted")] },
|
|
100310
|
+
...words?.door == null ? {} : { scene: { mode: words.door } }
|
|
100311
|
+
};
|
|
100312
|
+
});
|
|
100313
|
+
var ALARM_WORDS = {
|
|
100314
|
+
disarmed: {
|
|
100315
|
+
state: "off",
|
|
100316
|
+
title: require_sleep.t("Disarmed", "Disinserito")
|
|
100317
|
+
},
|
|
100318
|
+
armed_home: {
|
|
100319
|
+
state: "on",
|
|
100320
|
+
title: require_sleep.t("Armed home", "Inserito in casa")
|
|
100321
|
+
},
|
|
100322
|
+
armed_away: {
|
|
100323
|
+
state: "on",
|
|
100324
|
+
title: require_sleep.t("Armed away", "Inserito fuori casa")
|
|
100325
|
+
},
|
|
100326
|
+
armed_night: {
|
|
100327
|
+
state: "on",
|
|
100328
|
+
title: require_sleep.t("Armed night", "Inserito notte")
|
|
100329
|
+
},
|
|
100330
|
+
armed_vacation: {
|
|
100331
|
+
state: "on",
|
|
100332
|
+
title: require_sleep.t("Armed vacation", "Inserito vacanza")
|
|
100333
|
+
},
|
|
100334
|
+
armed_custom_bypass: {
|
|
100335
|
+
state: "on",
|
|
100336
|
+
title: require_sleep.t("Armed with bypass", "Inserito con esclusioni")
|
|
100337
|
+
},
|
|
100338
|
+
arming: {
|
|
100339
|
+
state: "standby",
|
|
100340
|
+
title: require_sleep.t("Arming", "Inserimento")
|
|
100341
|
+
},
|
|
100342
|
+
disarming: {
|
|
100343
|
+
state: "standby",
|
|
100344
|
+
title: require_sleep.t("Disarming", "Disinserimento")
|
|
100345
|
+
},
|
|
100346
|
+
pending: {
|
|
100347
|
+
state: "standby",
|
|
100348
|
+
title: require_sleep.t("Entry delay", "Ritardo di ingresso")
|
|
100349
|
+
},
|
|
100350
|
+
triggered: {
|
|
100351
|
+
state: "alert",
|
|
100352
|
+
title: require_sleep.t("Triggered", "Allarme in corso")
|
|
100353
|
+
}
|
|
100354
|
+
};
|
|
100355
|
+
var ARM_LABELS = {
|
|
100356
|
+
home: require_sleep.t("Arm home", "Inserisci in casa"),
|
|
100357
|
+
away: require_sleep.t("Arm away", "Inserisci fuori casa"),
|
|
100358
|
+
night: require_sleep.t("Arm night", "Inserisci notte"),
|
|
100359
|
+
vacation: require_sleep.t("Arm vacation", "Inserisci vacanza"),
|
|
100360
|
+
custom_bypass: require_sleep.t("Arm with bypass", "Inserisci con esclusioni")
|
|
100361
|
+
};
|
|
100362
|
+
var ALARM_MODES = [
|
|
100363
|
+
"home",
|
|
100364
|
+
"away",
|
|
100365
|
+
"night",
|
|
100366
|
+
"vacation",
|
|
100367
|
+
"custom_bypass"
|
|
100368
|
+
];
|
|
100369
|
+
function alarmControls(state, modes, requiresCode) {
|
|
100370
|
+
if (requiresCode) return [];
|
|
100371
|
+
const disarm = asAction(action("alarm.disarm", require_sleep.t("Disarm", "Disinserisci"), "shield-off", "alarm-panel", "disarm", {}, "primary"));
|
|
100372
|
+
const arm = (primaryFirst) => modes.map((mode, i) => asAction(action(`alarm.arm.${mode}`, ARM_LABELS[mode], "shield-check", "alarm-panel", "arm", { mode }, primaryFirst && i === 0 ? "primary" : "normal")));
|
|
100373
|
+
switch (state) {
|
|
100374
|
+
case "disarmed": return arm(true);
|
|
100375
|
+
case "arming":
|
|
100376
|
+
case "disarming": return [];
|
|
100377
|
+
case null: return [];
|
|
100378
|
+
default: return [disarm];
|
|
100379
|
+
}
|
|
100380
|
+
}
|
|
100381
|
+
var ACCESS_FAMILY_CONTRIBUTIONS = {
|
|
100382
|
+
"lock-control": lockContribution,
|
|
100383
|
+
"alarm-panel": contribution("alarm-panel", AlarmPanelStatusSchema, (slice, ctx) => {
|
|
100384
|
+
const state = slice?.state ?? null;
|
|
100385
|
+
const words = state === null ? null : ALARM_WORDS[state];
|
|
100386
|
+
const since = slice === void 0 ? null : elapsedText(slice.lastChangedAt, ctx.now);
|
|
100387
|
+
const modes = slice === void 0 ? ALARM_MODES : slice.availableModes;
|
|
100388
|
+
return {
|
|
100389
|
+
reading: reading("alarm-panel", words?.state ?? "unknown", false, words?.title),
|
|
100390
|
+
rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? require_sleep.t("Unknown", "Sconosciuto"), since]), alarmControls(state, modes, slice?.requiresCode ?? false))],
|
|
100391
|
+
...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] }
|
|
100392
|
+
};
|
|
100393
|
+
}),
|
|
100394
|
+
"automation-control": contribution("automation-control", AutomationControlStatusSchema, (slice, ctx) => {
|
|
100395
|
+
const failed = slice?.lastError != null;
|
|
100396
|
+
const state = slice === void 0 ? "unknown" : failed ? "alert" : slice.isRunning ? "running" : slice.enabled ? "on" : "off";
|
|
100397
|
+
const title = slice === void 0 ? void 0 : failed ? require_sleep.t("Failed", "In errore") : slice.isRunning ? require_sleep.t("Running", "In esecuzione") : slice.enabled ? require_sleep.t("Enabled", "Attiva") : require_sleep.t("Disabled", "Disattivata");
|
|
100398
|
+
const last = slice === void 0 ? null : elapsedText(slice.lastTriggeredAt, ctx.now);
|
|
100399
|
+
const run = action("automation.run", require_sleep.t("Run now", "Esegui ora"), "play", "automation-control", "trigger", {}, "primary");
|
|
100400
|
+
const toggle = {
|
|
100401
|
+
kind: "toggle",
|
|
100402
|
+
id: "automation.enabled",
|
|
100403
|
+
label: require_sleep.t("Enabled", "Attiva"),
|
|
100404
|
+
on: slice?.enabled ?? null,
|
|
100405
|
+
turnOn: action("automation.enable", require_sleep.t("Enable", "Attiva"), "play", "automation-control", "enable"),
|
|
100406
|
+
turnOff: action("automation.disable", require_sleep.t("Disable", "Disattiva"), "square", "automation-control", "disable")
|
|
100407
|
+
};
|
|
100408
|
+
return {
|
|
100409
|
+
reading: reading("automation-control", state, false, title),
|
|
100410
|
+
rows: [row$1("automation", "workflow", joinText([
|
|
100411
|
+
title ?? require_sleep.t("Unknown", "Sconosciuto"),
|
|
100412
|
+
last === null ? null : require_sleep.t(`Ran ${last.en}`, `Eseguita ${last.it}`),
|
|
100413
|
+
slice?.lastError == null ? null : require_sleep.t(slice.lastError, slice.lastError)
|
|
100414
|
+
]), [asAction(run), toggle])],
|
|
100415
|
+
...last === null ? {} : { facts: [fact("last-run", "clock", last, failed ? "danger" : "muted")] }
|
|
100416
|
+
};
|
|
100417
|
+
}),
|
|
100418
|
+
"script-runner": contribution("script-runner", ScriptRunnerStatusSchema, (slice, ctx) => {
|
|
100419
|
+
const failed = slice?.lastRunSuccess === false;
|
|
100420
|
+
const state = slice === void 0 ? "unknown" : slice.isRunning ? "running" : failed ? "alert" : "idle";
|
|
100421
|
+
const title = slice === void 0 ? void 0 : slice.isRunning ? require_sleep.t("Running", "In esecuzione") : failed ? require_sleep.t("Failed", "In errore") : require_sleep.t("Ready", "Pronto");
|
|
100422
|
+
const last = slice === void 0 ? null : elapsedText(slice.lastRunAt, ctx.now);
|
|
100423
|
+
const control = slice?.isRunning === true ? action("script.stop", require_sleep.t("Stop", "Ferma"), "square", "script-runner", "stop", {}, "primary") : action("script.run", require_sleep.t("Run", "Esegui"), "play", "script-runner", "run", {}, "primary");
|
|
100424
|
+
return {
|
|
100425
|
+
reading: reading("script-runner", state, false, title),
|
|
100426
|
+
rows: [row$1("script", "scroll-text", joinText([
|
|
100427
|
+
title ?? require_sleep.t("Unknown", "Sconosciuto"),
|
|
100428
|
+
last === null ? null : require_sleep.t(`Ran ${last.en}`, `Eseguito ${last.it}`),
|
|
100429
|
+
slice?.lastError == null ? null : require_sleep.t(slice.lastError, slice.lastError)
|
|
100430
|
+
]), [asAction(control)])],
|
|
100431
|
+
...last === null ? {} : { facts: [fact("last-run", "clock", last, failed ? "danger" : "muted")] }
|
|
100432
|
+
};
|
|
100433
|
+
}),
|
|
100434
|
+
"do-not-disturb": contribution("do-not-disturb", DoNotDisturbStatusSchema, (slice) => {
|
|
100435
|
+
const on = slice?.enabled ?? null;
|
|
100436
|
+
return { rows: [row$1("do-not-disturb", "bell-off", on === null ? require_sleep.t("Unknown", "Sconosciuto") : on ? require_sleep.t("Do not disturb on", "Non disturbare attivo") : require_sleep.t("Do not disturb off", "Non disturbare spento"), [{
|
|
100437
|
+
kind: "toggle",
|
|
100438
|
+
id: "do-not-disturb.toggle",
|
|
100439
|
+
label: require_sleep.t("Do not disturb", "Non disturbare"),
|
|
100440
|
+
on,
|
|
100441
|
+
turnOn: action("do-not-disturb.on", require_sleep.t("Turn on", "Attiva"), "bell-off", "do-not-disturb", "setEnabled", { enabled: true }),
|
|
100442
|
+
turnOff: action("do-not-disturb.off", require_sleep.t("Turn off", "Disattiva"), "bell", "do-not-disturb", "setEnabled", { enabled: false })
|
|
100443
|
+
}])] };
|
|
100444
|
+
})
|
|
100445
|
+
};
|
|
100446
|
+
//#endregion
|
|
100447
|
+
//#region src/device/hero/hero-contributions-devices.ts
|
|
100448
|
+
/**
|
|
100449
|
+
* What the household-device caps add to a hero (D1023): a fan, a robot vacuum,
|
|
100450
|
+
* a robot mower, a pet feeder, a pet fountain and its pump cycle. Typed against
|
|
100451
|
+
* each cap's own status schema; a slice that does not parse is "not answered"
|
|
100452
|
+
* (`unknown`, never `off`, D315/D393). A measurement the device did not report
|
|
100453
|
+
* is absent from the facts, never a zero (D393).
|
|
100454
|
+
*/
|
|
100455
|
+
var has$3 = (ctx, f) => ctx.features.includes(f);
|
|
100456
|
+
var unknownText = require_sleep.t("Unknown", "Sconosciuto");
|
|
100457
|
+
var pct$1 = (n) => require_sleep.t(`${Math.round(n)}%`, `${Math.round(n)}%`);
|
|
100458
|
+
var unit = (n) => Math.min(1, Math.max(0, n / 100));
|
|
100459
|
+
/** Battery as a fact, unless the device is also bound to the `battery` cap (it already says so). */
|
|
100460
|
+
function ownBattery(level, ctx) {
|
|
100461
|
+
if (level === null || ctx.caps.includes("battery")) return [];
|
|
100462
|
+
const tone = level <= 20 ? "danger" : level <= 40 ? "warning" : "success";
|
|
100463
|
+
return [fact("battery", "battery", require_sleep.t(`Battery ${Math.round(level)}%`, `Batteria ${Math.round(level)}%`), tone)];
|
|
100464
|
+
}
|
|
100465
|
+
var fanContribution = contribution("fan-control", FanControlStatusSchema, (slice, ctx) => {
|
|
100466
|
+
const speed = slice?.speed ?? null;
|
|
100467
|
+
const state = speed === null ? "unknown" : speed > 0 ? "running" : "off";
|
|
100468
|
+
const controls = [];
|
|
100469
|
+
if (speed !== null || has$3(ctx, require_device_type.DeviceFeature.FanSpeed)) controls.push({
|
|
100470
|
+
kind: "slider",
|
|
100471
|
+
id: "fan.speed",
|
|
100472
|
+
label: require_sleep.t("Speed", "Velocità"),
|
|
100473
|
+
value: speed,
|
|
100474
|
+
min: 0,
|
|
100475
|
+
max: 100,
|
|
100476
|
+
step: slice?.percentageStep ?? 1,
|
|
100477
|
+
unit: "%",
|
|
100478
|
+
call: {
|
|
100479
|
+
cap: "fan-control",
|
|
100480
|
+
method: "setPercentage",
|
|
100481
|
+
args: {}
|
|
100482
|
+
},
|
|
100483
|
+
valueArg: "speed"
|
|
100484
|
+
});
|
|
100485
|
+
if (slice !== void 0 && slice.availablePresets.length > 0) controls.push({
|
|
100486
|
+
kind: "picker",
|
|
100487
|
+
id: "fan.preset",
|
|
100488
|
+
label: require_sleep.t("Mode", "Modalità"),
|
|
100489
|
+
current: slice.preset === "" ? null : slice.preset,
|
|
100490
|
+
options: [...slice.availablePresets],
|
|
100491
|
+
call: {
|
|
100492
|
+
cap: "fan-control",
|
|
100493
|
+
method: "setPreset",
|
|
100494
|
+
args: {}
|
|
100495
|
+
},
|
|
100496
|
+
valueArg: "preset"
|
|
100497
|
+
});
|
|
100498
|
+
if (slice?.oscillating != null || has$3(ctx, require_device_type.DeviceFeature.FanOscillating)) controls.push({
|
|
100499
|
+
kind: "toggle",
|
|
100500
|
+
id: "fan.oscillating",
|
|
100501
|
+
label: require_sleep.t("Oscillate", "Oscilla"),
|
|
100502
|
+
on: slice?.oscillating ?? null,
|
|
100503
|
+
turnOn: action("fan.oscillate.on", require_sleep.t("Oscillate", "Oscilla"), "refresh-cw", "fan-control", "setOscillating", { oscillating: true }),
|
|
100504
|
+
turnOff: action("fan.oscillate.off", require_sleep.t("Hold still", "Fermo"), "square", "fan-control", "setOscillating", { oscillating: false })
|
|
100505
|
+
});
|
|
100506
|
+
if (slice?.direction != null || has$3(ctx, require_device_type.DeviceFeature.FanDirection)) controls.push({
|
|
100507
|
+
kind: "picker",
|
|
100508
|
+
id: "fan.direction",
|
|
100509
|
+
label: require_sleep.t("Direction", "Direzione"),
|
|
100510
|
+
current: slice?.direction ?? null,
|
|
100511
|
+
options: ["forward", "reverse"],
|
|
100512
|
+
call: {
|
|
100513
|
+
cap: "fan-control",
|
|
100514
|
+
method: "setDirection",
|
|
100515
|
+
args: {}
|
|
100516
|
+
},
|
|
100517
|
+
valueArg: "direction"
|
|
100518
|
+
});
|
|
100519
|
+
const speedText = speed === null ? null : pct$1(speed);
|
|
100520
|
+
const preset = slice?.preset ?? "";
|
|
100521
|
+
const status = speed === null ? unknownText : joinText([speed === 0 ? require_sleep.t("Off", "Spento") : require_sleep.t(`Speed ${speed}%`, `Velocità ${speed}%`), preset === "" ? null : require_sleep.t(preset, preset)]);
|
|
100522
|
+
return {
|
|
100523
|
+
reading: reading("fan-control", state),
|
|
100524
|
+
rows: [{
|
|
100525
|
+
id: "fan",
|
|
100526
|
+
icon: "fan",
|
|
100527
|
+
status,
|
|
100528
|
+
controls
|
|
100529
|
+
}],
|
|
100530
|
+
...speedText === null ? {} : {
|
|
100531
|
+
facts: [fact("speed", "fan", speedText, speed === 0 ? "muted" : "primary")],
|
|
100532
|
+
tiles: { right: [{
|
|
100533
|
+
label: require_sleep.t("Speed", "Velocità"),
|
|
100534
|
+
value: speedText
|
|
100535
|
+
}] },
|
|
100536
|
+
scene: { level: unit(speed ?? 0) }
|
|
100537
|
+
}
|
|
100538
|
+
};
|
|
100539
|
+
});
|
|
100540
|
+
var VACUUM_WORDS = {
|
|
100541
|
+
idle: {
|
|
100542
|
+
state: "idle",
|
|
100543
|
+
title: require_sleep.t("Idle", "Inattivo")
|
|
100544
|
+
},
|
|
100545
|
+
cleaning: {
|
|
100546
|
+
state: "running",
|
|
100547
|
+
title: require_sleep.t("Cleaning", "Pulisce")
|
|
100548
|
+
},
|
|
100549
|
+
paused: {
|
|
100550
|
+
state: "standby",
|
|
100551
|
+
title: require_sleep.t("Paused", "In pausa")
|
|
100552
|
+
},
|
|
100553
|
+
returning: {
|
|
100554
|
+
state: "running",
|
|
100555
|
+
title: require_sleep.t("Returning to base", "Torna alla base")
|
|
100556
|
+
},
|
|
100557
|
+
docked: {
|
|
100558
|
+
state: "idle",
|
|
100559
|
+
title: require_sleep.t("Docked", "In base")
|
|
100560
|
+
},
|
|
100561
|
+
drying: {
|
|
100562
|
+
state: "running",
|
|
100563
|
+
title: require_sleep.t("Drying", "Asciuga")
|
|
100564
|
+
},
|
|
100565
|
+
error: {
|
|
100566
|
+
state: "alert",
|
|
100567
|
+
title: require_sleep.t("Error", "Errore")
|
|
100568
|
+
}
|
|
100569
|
+
};
|
|
100570
|
+
function robotAction(cap, prefix, id, en, it, icon, method, primary = false) {
|
|
100571
|
+
return asAction(action(`${prefix}.${id}`, require_sleep.t(en, it), icon, cap, method, {}, primary ? "primary" : "normal"));
|
|
100572
|
+
}
|
|
100573
|
+
var vac = (id, en, it, icon, method, primary = false) => robotAction("vacuum-control", "vacuum", id, en, it, icon, method, primary);
|
|
100574
|
+
function vacuumControls(state) {
|
|
100575
|
+
const start = (primary) => vac("start", "Start", "Avvia", "play", "start", primary);
|
|
100576
|
+
const resume = vac("resume", "Resume", "Riprendi", "play", "start", true);
|
|
100577
|
+
const pause = (primary) => vac("pause", "Pause", "Pausa", "pause", "pause", primary);
|
|
100578
|
+
const base = vac("base", "Return to base", "Torna alla base", "house", "returnToBase");
|
|
100579
|
+
switch (state) {
|
|
100580
|
+
case "cleaning": return [pause(true), base];
|
|
100581
|
+
case "paused": return [resume, base];
|
|
100582
|
+
case "returning":
|
|
100583
|
+
case "drying": return [vac("stop", "Stop", "Ferma", "square", "stop")];
|
|
100584
|
+
case "idle": return [start(true), base];
|
|
100585
|
+
case "docked": return [start(true)];
|
|
100586
|
+
case "error": return [base];
|
|
100587
|
+
case null: return [
|
|
100588
|
+
start(false),
|
|
100589
|
+
pause(false),
|
|
100590
|
+
base
|
|
100591
|
+
];
|
|
100592
|
+
}
|
|
100593
|
+
}
|
|
100594
|
+
var vacuumContribution = contribution("vacuum-control", VacuumControlStatusSchema, (slice, ctx) => {
|
|
100595
|
+
const state = slice?.state ?? null;
|
|
100596
|
+
const words = state === null ? null : VACUUM_WORDS[state];
|
|
100597
|
+
const title = state === "error" && slice?.errorLabel ? require_sleep.t(slice.errorLabel, slice.errorLabel) : words?.title;
|
|
100598
|
+
const controls = vacuumControls(state);
|
|
100599
|
+
if (slice !== void 0 && slice.availableFanSpeeds.length > 0) controls.push({
|
|
100600
|
+
kind: "picker",
|
|
100601
|
+
id: "vacuum.suction",
|
|
100602
|
+
label: require_sleep.t("Suction", "Aspirazione"),
|
|
100603
|
+
current: slice.fanSpeed,
|
|
100604
|
+
options: [...slice.availableFanSpeeds],
|
|
100605
|
+
call: {
|
|
100606
|
+
cap: "vacuum-control",
|
|
100607
|
+
method: "setFanSpeed",
|
|
100608
|
+
args: {}
|
|
100609
|
+
},
|
|
100610
|
+
valueArg: "speed"
|
|
100611
|
+
});
|
|
100612
|
+
if (state !== null) controls.push(vac("locate", "Locate", "Trova", "map-pin", "locate"));
|
|
100613
|
+
const progress = state === "cleaning" ? slice?.progress ?? null : null;
|
|
100614
|
+
return {
|
|
100615
|
+
reading: reading("vacuum-control", words?.state ?? "unknown", false, title),
|
|
100616
|
+
rows: [{
|
|
100617
|
+
id: "vacuum",
|
|
100618
|
+
icon: "bot",
|
|
100619
|
+
status: title ?? unknownText,
|
|
100620
|
+
controls
|
|
100621
|
+
}],
|
|
100622
|
+
facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$1(progress), "primary")]],
|
|
100623
|
+
...progress === null ? {} : {
|
|
100624
|
+
tiles: { right: [{
|
|
100625
|
+
label: require_sleep.t("Progress", "Avanzamento"),
|
|
100626
|
+
value: pct$1(progress)
|
|
100627
|
+
}] },
|
|
100628
|
+
scene: { level: unit(progress) }
|
|
100629
|
+
}
|
|
100630
|
+
};
|
|
100631
|
+
});
|
|
100632
|
+
var MOWER_WORDS = {
|
|
100633
|
+
idle: {
|
|
100634
|
+
state: "idle",
|
|
100635
|
+
title: require_sleep.t("Idle", "Inattivo")
|
|
100636
|
+
},
|
|
100637
|
+
mowing: {
|
|
100638
|
+
state: "running",
|
|
100639
|
+
title: require_sleep.t("Mowing", "Taglia")
|
|
100640
|
+
},
|
|
100641
|
+
paused: {
|
|
100642
|
+
state: "standby",
|
|
100643
|
+
title: require_sleep.t("Paused", "In pausa")
|
|
100644
|
+
},
|
|
100645
|
+
docked: {
|
|
100646
|
+
state: "idle",
|
|
100647
|
+
title: require_sleep.t("Docked", "In base")
|
|
100648
|
+
},
|
|
100649
|
+
error: {
|
|
100650
|
+
state: "alert",
|
|
100651
|
+
title: require_sleep.t("Error", "Errore")
|
|
100652
|
+
}
|
|
100653
|
+
};
|
|
100654
|
+
var mow = (id, en, it, icon, method, primary = false) => robotAction("lawn-mower-control", "mower", id, en, it, icon, method, primary);
|
|
100655
|
+
function mowerControls(activity) {
|
|
100656
|
+
const start = (primary) => mow("start", "Start mowing", "Avvia il taglio", "play", "startMowing", primary);
|
|
100657
|
+
const pause = (primary) => mow("pause", "Pause", "Pausa", "pause", "pause", primary);
|
|
100658
|
+
const dock = mow("dock", "Return to base", "Torna alla base", "house", "dock");
|
|
100659
|
+
switch (activity) {
|
|
100660
|
+
case "mowing": return [pause(true), dock];
|
|
100661
|
+
case "paused": return [mow("resume", "Resume", "Riprendi", "play", "startMowing", true), dock];
|
|
100662
|
+
case "idle": return [start(true), dock];
|
|
100663
|
+
case "docked": return [start(true)];
|
|
100664
|
+
case "error": return [dock];
|
|
100665
|
+
case null: return [
|
|
100666
|
+
start(false),
|
|
100667
|
+
pause(false),
|
|
100668
|
+
dock
|
|
100669
|
+
];
|
|
100670
|
+
}
|
|
100671
|
+
}
|
|
100672
|
+
var mowerContribution = contribution("lawn-mower-control", LawnMowerControlStatusSchema, (slice, ctx) => {
|
|
100673
|
+
const activity = slice?.activity ?? null;
|
|
100674
|
+
const words = activity === null ? null : MOWER_WORDS[activity];
|
|
100675
|
+
const title = activity === "error" && slice?.currentCodeLabel ? require_sleep.t(slice.currentCodeLabel, slice.currentCodeLabel) : words?.title;
|
|
100676
|
+
const progress = activity === "mowing" ? slice?.progress ?? null : null;
|
|
100677
|
+
return {
|
|
100678
|
+
reading: reading("lawn-mower-control", words?.state ?? "unknown", false, title),
|
|
100679
|
+
rows: [{
|
|
100680
|
+
id: "mower",
|
|
100681
|
+
icon: "sprout",
|
|
100682
|
+
status: title ?? unknownText,
|
|
100683
|
+
controls: mowerControls(activity)
|
|
100684
|
+
}],
|
|
100685
|
+
facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$1(progress), "primary")]],
|
|
100686
|
+
...progress === null ? {} : {
|
|
100687
|
+
tiles: { right: [{
|
|
100688
|
+
label: require_sleep.t("Progress", "Avanzamento"),
|
|
100689
|
+
value: pct$1(progress)
|
|
100690
|
+
}] },
|
|
100691
|
+
scene: { level: unit(progress) }
|
|
100692
|
+
}
|
|
100693
|
+
};
|
|
100694
|
+
});
|
|
100695
|
+
function feederWords(slice) {
|
|
100696
|
+
if (slice === void 0) return null;
|
|
100697
|
+
if (slice.status === "offline") return {
|
|
100698
|
+
state: "offline",
|
|
100699
|
+
title: require_sleep.t("Offline", "Non raggiungibile")
|
|
100700
|
+
};
|
|
100701
|
+
if (slice.error !== null) return {
|
|
100702
|
+
state: "alert",
|
|
100703
|
+
title: require_sleep.t(slice.error, slice.error)
|
|
100704
|
+
};
|
|
100705
|
+
if (slice.feeding) return {
|
|
100706
|
+
state: "running",
|
|
100707
|
+
title: require_sleep.t("Dispensing", "Eroga")
|
|
100708
|
+
};
|
|
100709
|
+
if (slice.eating) return {
|
|
100710
|
+
state: "running",
|
|
100711
|
+
title: require_sleep.t("Pet is eating", "Sta mangiando")
|
|
100712
|
+
};
|
|
100713
|
+
if (slice.lowFood) return {
|
|
100714
|
+
state: "standby",
|
|
100715
|
+
title: require_sleep.t("Food is low", "Cibo in esaurimento")
|
|
100716
|
+
};
|
|
100717
|
+
return {
|
|
100718
|
+
state: "idle",
|
|
100719
|
+
title: require_sleep.t("Ready", "Pronto")
|
|
100720
|
+
};
|
|
100721
|
+
}
|
|
100722
|
+
/** The manual portion the card offers: the last one given, else the hardware minimum. */
|
|
100723
|
+
function feedArgs(slice) {
|
|
100724
|
+
if (slice.isDualHopper) return {
|
|
100725
|
+
hopper1: slice.lastFeedHopper1 ?? 4,
|
|
100726
|
+
hopper2: slice.lastFeedHopper2 ?? 4
|
|
100727
|
+
};
|
|
100728
|
+
return { grams: slice.lastFeedGrams ?? 4 };
|
|
100729
|
+
}
|
|
100730
|
+
function feederControls(slice) {
|
|
100731
|
+
return [
|
|
100732
|
+
asAction(slice.feeding ? action("feeder.cancel", require_sleep.t("Cancel", "Annulla"), "square", "pet-feeder", "cancelFeed", {}, "primary") : action("feeder.feed", slice.isDualHopper ? require_sleep.t("Feed", "Eroga") : require_sleep.t(`Feed ${slice.lastFeedGrams ?? 4} g`, `Eroga ${slice.lastFeedGrams ?? 4} g`), "bone", "pet-feeder", "feed", feedArgs(slice), "primary")),
|
|
100733
|
+
asAction(action("feeder.call", require_sleep.t("Call pet", "Chiama"), "volume-2", "pet-feeder", "callPet")),
|
|
100734
|
+
{
|
|
100735
|
+
kind: "toggle",
|
|
100736
|
+
id: "feeder.child-lock",
|
|
100737
|
+
label: require_sleep.t("Child lock", "Blocco bambini"),
|
|
100738
|
+
on: slice.childLock,
|
|
100739
|
+
turnOn: action("feeder.child-lock.on", require_sleep.t("Lock", "Blocca"), "lock", "pet-feeder", "setChildLock", { on: true }),
|
|
100740
|
+
turnOff: action("feeder.child-lock.off", require_sleep.t("Unlock", "Sblocca"), "lock-open", "pet-feeder", "setChildLock", { on: false })
|
|
100741
|
+
}
|
|
100742
|
+
];
|
|
100743
|
+
}
|
|
100744
|
+
var feederContribution = contribution("pet-feeder", PetFeederStatusSchema, (slice, ctx) => {
|
|
100745
|
+
const words = feederWords(slice);
|
|
100746
|
+
const last = slice?.lastFeedGrams ?? null;
|
|
100747
|
+
return {
|
|
100748
|
+
reading: reading("pet-feeder", words?.state ?? "unknown", false, words?.title),
|
|
100749
|
+
rows: [{
|
|
100750
|
+
id: "feeder",
|
|
100751
|
+
icon: "bone",
|
|
100752
|
+
status: words?.title ?? unknownText,
|
|
100753
|
+
controls: slice === void 0 ? [] : feederControls(slice)
|
|
100754
|
+
}],
|
|
100755
|
+
facts: [
|
|
100756
|
+
...slice?.lowFood === true ? [fact("level", "bone", require_sleep.t("Food low", "Cibo in esaurimento"), "warning")] : [],
|
|
100757
|
+
...last === null ? [] : [fact("last-run", "clock", require_sleep.t(`Last ${last} g`, `Ultimo ${last} g`))],
|
|
100758
|
+
...ownBattery(slice?.powerSource === "battery" ? slice.batteryPower : null, ctx)
|
|
100759
|
+
],
|
|
100760
|
+
...last === null ? {} : { tiles: { right: [{
|
|
100761
|
+
label: require_sleep.t("Last portion", "Ultima porzione"),
|
|
100762
|
+
value: require_sleep.t(`${last} g`, `${last} g`)
|
|
100763
|
+
}] } }
|
|
100764
|
+
};
|
|
100765
|
+
});
|
|
100766
|
+
var fountainContribution = contribution("pet-fountain", PetFountainStatusSchema, (slice) => {
|
|
100767
|
+
const pump = slice?.pumpRunning ?? null;
|
|
100768
|
+
const fault = slice?.error ?? null;
|
|
100769
|
+
const empty = slice?.empty === true;
|
|
100770
|
+
const state = slice === void 0 ? "unknown" : fault !== null || empty ? "alert" : pump === null ? "unknown" : pump ? "running" : "off";
|
|
100771
|
+
const title = slice === void 0 ? void 0 : fault !== null ? require_sleep.t(fault, fault) : empty ? require_sleep.t("Tank empty", "Serbatoio vuoto") : pump === null ? void 0 : pump ? require_sleep.t("Pump running", "Pompa attiva") : require_sleep.t("Pump off", "Pompa spenta");
|
|
100772
|
+
const level = slice?.waterLevel ?? null;
|
|
100773
|
+
const control = {
|
|
100774
|
+
kind: "toggle",
|
|
100775
|
+
id: "fountain.pump",
|
|
100776
|
+
label: require_sleep.t("Pump", "Pompa"),
|
|
100777
|
+
on: pump,
|
|
100778
|
+
turnOn: action("fountain.pump.on", require_sleep.t("Pump on", "Accendi la pompa"), "droplets", "pet-fountain", "setPump", { on: true }, "primary"),
|
|
100779
|
+
turnOff: action("fountain.pump.off", require_sleep.t("Pump off", "Spegni la pompa"), "square", "pet-fountain", "setPump", { on: false })
|
|
100780
|
+
};
|
|
100781
|
+
return {
|
|
100782
|
+
reading: reading("pet-fountain", state, false, title),
|
|
100783
|
+
rows: [{
|
|
100784
|
+
id: "fountain",
|
|
100785
|
+
icon: "droplets",
|
|
100786
|
+
status: title ?? unknownText,
|
|
100787
|
+
controls: slice === void 0 ? [] : [control]
|
|
100788
|
+
}],
|
|
100789
|
+
...level === null ? {} : {
|
|
100790
|
+
facts: [fact("level", "droplets", require_sleep.t(`Water ${Math.round(level)}%`, `Acqua ${Math.round(level)}%`), level <= 20 ? "warning" : "primary")],
|
|
100791
|
+
tiles: { right: [{
|
|
100792
|
+
label: require_sleep.t("Water", "Acqua"),
|
|
100793
|
+
value: pct$1(level)
|
|
100794
|
+
}] },
|
|
100795
|
+
scene: { level: unit(level) }
|
|
100796
|
+
}
|
|
100797
|
+
};
|
|
100798
|
+
});
|
|
100799
|
+
var minutesOf = (seconds) => Math.max(0, Math.round(seconds / 60));
|
|
100800
|
+
var DEVICES_FAMILY_CONTRIBUTIONS = {
|
|
100801
|
+
"fan-control": fanContribution,
|
|
100802
|
+
"vacuum-control": vacuumContribution,
|
|
100803
|
+
"lawn-mower-control": mowerContribution,
|
|
100804
|
+
"pet-feeder": feederContribution,
|
|
100805
|
+
"pet-fountain": fountainContribution,
|
|
100806
|
+
"pump-cycle": contribution("pump-cycle", PumpCycleStatusSchema, (slice) => {
|
|
100807
|
+
const enabled = slice?.enabled ?? null;
|
|
100808
|
+
const cycle = slice?.onTime != null && slice.offTime != null ? require_sleep.t(`${minutesOf(slice.onTime)} min on · ${minutesOf(slice.offTime)} min off`, `${minutesOf(slice.onTime)} min acceso · ${minutesOf(slice.offTime)} min spento`) : null;
|
|
100809
|
+
return { rows: [row$1("pump-cycle", "timer", enabled === null ? unknownText : enabled ? joinText([require_sleep.t("Cycling", "A cicli"), cycle]) : require_sleep.t("Runs continuously", "Sempre attiva"), [{
|
|
100810
|
+
kind: "toggle",
|
|
100811
|
+
id: "pump-cycle.enabled",
|
|
100812
|
+
label: require_sleep.t("Pump cycle", "Ciclo pompa"),
|
|
100813
|
+
on: enabled,
|
|
100814
|
+
turnOn: action("pump-cycle.on", require_sleep.t("Cycle the pump", "Attiva il ciclo"), "timer", "pump-cycle", "setEnabled", { on: true }),
|
|
100815
|
+
turnOff: action("pump-cycle.off", require_sleep.t("Run continuously", "Sempre attiva"), "timer-off", "pump-cycle", "setEnabled", { on: false })
|
|
100816
|
+
}])] };
|
|
100817
|
+
})
|
|
100818
|
+
};
|
|
100819
|
+
//#endregion
|
|
100820
|
+
//#region src/device/hero/hero-contributions-actuators.ts
|
|
100821
|
+
/**
|
|
100822
|
+
* What the moving and dimming caps add to a hero (D1023): a light's brightness
|
|
100823
|
+
* and colour, a cover, a valve and a humidifier. Moving a cover or a valve is
|
|
100824
|
+
* an ACTION the person presses, never a toggle that fires by itself; a slice
|
|
100825
|
+
* that does not parse reads `unknown`, never closed or off (D315/D393).
|
|
100826
|
+
*/
|
|
100827
|
+
var has$2 = (ctx, f) => ctx.features.includes(f);
|
|
100828
|
+
var pct = (n) => require_sleep.t(`${Math.round(n)}%`, `${Math.round(n)}%`);
|
|
100829
|
+
var brightnessContribution = contribution("brightness", BrightnessStatusSchema, (slice) => {
|
|
100830
|
+
const level = slice?.level ?? null;
|
|
100831
|
+
return {
|
|
100832
|
+
...level === null ? {} : { reading: reading("brightness", level > 0 ? "on" : "off") },
|
|
100833
|
+
...level === null ? {} : {
|
|
100834
|
+
facts: [fact("level", "sun-dim", pct(level), level > 0 ? "primary" : "muted")],
|
|
100835
|
+
scene: { level: level / 100 }
|
|
100836
|
+
},
|
|
100837
|
+
rows: [row$1("brightness", "sun-dim", level === null ? null : require_sleep.t(`Brightness ${Math.round(level)}%`, `Luminosità ${Math.round(level)}%`), [{
|
|
100838
|
+
kind: "slider",
|
|
100839
|
+
id: "brightness.level",
|
|
100840
|
+
label: require_sleep.t("Brightness", "Luminosità"),
|
|
100841
|
+
value: level,
|
|
100842
|
+
min: 0,
|
|
100843
|
+
max: 100,
|
|
100844
|
+
step: 1,
|
|
100845
|
+
unit: "%",
|
|
100846
|
+
call: {
|
|
100847
|
+
cap: "brightness",
|
|
100848
|
+
method: "setBrightness",
|
|
100849
|
+
args: {}
|
|
100850
|
+
},
|
|
100851
|
+
valueArg: "level"
|
|
100852
|
+
}])]
|
|
100853
|
+
};
|
|
100854
|
+
});
|
|
100855
|
+
/**
|
|
100856
|
+
* Preset colours as actions: `setColor` takes a nested `{ mode, … }` argument, which a
|
|
100857
|
+
* hero action carries (D1023). Only the modes the bulb declares are offered, each a
|
|
100858
|
+
* valid `setColor` input; a bulb that declares none is shown, not set.
|
|
100859
|
+
*/
|
|
100860
|
+
var WHITE_PRESETS = [
|
|
100861
|
+
{
|
|
100862
|
+
id: "color.warm",
|
|
100863
|
+
en: "Warm white",
|
|
100864
|
+
it: "Bianco caldo",
|
|
100865
|
+
icon: "sun",
|
|
100866
|
+
mired: 370
|
|
100867
|
+
},
|
|
100868
|
+
{
|
|
100869
|
+
id: "color.neutral",
|
|
100870
|
+
en: "Neutral white",
|
|
100871
|
+
it: "Bianco neutro",
|
|
100872
|
+
icon: "lightbulb",
|
|
100873
|
+
mired: 250
|
|
100874
|
+
},
|
|
100875
|
+
{
|
|
100876
|
+
id: "color.cool",
|
|
100877
|
+
en: "Cool white",
|
|
100878
|
+
it: "Bianco freddo",
|
|
100879
|
+
icon: "snowflake",
|
|
100880
|
+
mired: 154
|
|
100881
|
+
}
|
|
100882
|
+
];
|
|
100883
|
+
var HUE_PRESETS = [
|
|
100884
|
+
{
|
|
100885
|
+
id: "color.red",
|
|
100886
|
+
en: "Red",
|
|
100887
|
+
it: "Rosso",
|
|
100888
|
+
hue: 0
|
|
100889
|
+
},
|
|
100890
|
+
{
|
|
100891
|
+
id: "color.amber",
|
|
100892
|
+
en: "Amber",
|
|
100893
|
+
it: "Ambra",
|
|
100894
|
+
hue: 40
|
|
100895
|
+
},
|
|
100896
|
+
{
|
|
100897
|
+
id: "color.green",
|
|
100898
|
+
en: "Green",
|
|
100899
|
+
it: "Verde",
|
|
100900
|
+
hue: 120
|
|
100901
|
+
},
|
|
100902
|
+
{
|
|
100903
|
+
id: "color.cyan",
|
|
100904
|
+
en: "Cyan",
|
|
100905
|
+
it: "Ciano",
|
|
100906
|
+
hue: 180
|
|
100907
|
+
},
|
|
100908
|
+
{
|
|
100909
|
+
id: "color.blue",
|
|
100910
|
+
en: "Blue",
|
|
100911
|
+
it: "Blu",
|
|
100912
|
+
hue: 240
|
|
100913
|
+
},
|
|
100914
|
+
{
|
|
100915
|
+
id: "color.purple",
|
|
100916
|
+
en: "Purple",
|
|
100917
|
+
it: "Viola",
|
|
100918
|
+
hue: 280
|
|
100919
|
+
}
|
|
100920
|
+
];
|
|
100921
|
+
function colorControls(ctx, current) {
|
|
100922
|
+
const controls = [];
|
|
100923
|
+
if (has$2(ctx, require_device_type.DeviceFeature.LightColorMired)) for (const p of WHITE_PRESETS) controls.push(asAction(action(p.id, require_sleep.t(p.en, p.it), p.icon, "color", "setColor", { color: {
|
|
100924
|
+
mode: "mired",
|
|
100925
|
+
colorTemperature: p.mired
|
|
100926
|
+
} })));
|
|
100927
|
+
if (has$2(ctx, require_device_type.DeviceFeature.LightColorHsv)) {
|
|
100928
|
+
const s = current?.s ?? 100;
|
|
100929
|
+
const v = current?.v ?? 100;
|
|
100930
|
+
for (const p of HUE_PRESETS) controls.push(asAction(action(p.id, require_sleep.t(p.en, p.it), "palette", "color", "setColor", { color: {
|
|
100931
|
+
mode: "hsv",
|
|
100932
|
+
hsv: {
|
|
100933
|
+
h: p.hue,
|
|
100934
|
+
s,
|
|
100935
|
+
v
|
|
100936
|
+
}
|
|
100937
|
+
} })));
|
|
100938
|
+
}
|
|
100939
|
+
return controls;
|
|
100940
|
+
}
|
|
100941
|
+
var colorContribution = contribution("color", ColorStatusSchema, (slice, ctx) => {
|
|
100942
|
+
let words = null;
|
|
100943
|
+
if (slice !== void 0) {
|
|
100944
|
+
if (slice.mode === "mired" && slice.colorTemperature !== void 0 && slice.colorTemperature > 0) {
|
|
100945
|
+
const kelvin = Math.round(1e6 / slice.colorTemperature);
|
|
100946
|
+
words = require_sleep.t(`${kelvin} K`, `${kelvin} K`);
|
|
100947
|
+
} else if (slice.mode === "rgb" && slice.rgb !== void 0) {
|
|
100948
|
+
const c = `RGB ${slice.rgb.r}, ${slice.rgb.g}, ${slice.rgb.b}`;
|
|
100949
|
+
words = require_sleep.t(c, c);
|
|
100950
|
+
} else if (slice.mode === "hsv" && slice.hsv !== void 0) words = require_sleep.t(`Hue ${Math.round(slice.hsv.h)}°`, `Tonalità ${Math.round(slice.hsv.h)}°`);
|
|
100951
|
+
}
|
|
100952
|
+
return {
|
|
100953
|
+
...words === null ? {} : { facts: [fact("reading", "palette", words)] },
|
|
100954
|
+
rows: [row$1("color", "palette", words, colorControls(ctx, slice?.mode === "hsv" && slice.hsv !== void 0 ? slice.hsv : null))]
|
|
100955
|
+
};
|
|
100956
|
+
});
|
|
100957
|
+
function travelWords(state, position) {
|
|
100958
|
+
const partial = position !== null && position > 0 && position < 100;
|
|
100959
|
+
const at = position === null ? null : Math.round(position);
|
|
100960
|
+
switch (state) {
|
|
100961
|
+
case "open": return {
|
|
100962
|
+
state: "on",
|
|
100963
|
+
title: partial ? require_sleep.t(`${at}% open`, `Aperto al ${at}%`) : require_sleep.t("Open", "Aperto"),
|
|
100964
|
+
mode: "open"
|
|
100965
|
+
};
|
|
100966
|
+
case "closed": return {
|
|
100967
|
+
state: "off",
|
|
100968
|
+
title: require_sleep.t("Closed", "Chiuso"),
|
|
100969
|
+
mode: "closed"
|
|
100970
|
+
};
|
|
100971
|
+
case "opening": return {
|
|
100972
|
+
state: "running",
|
|
100973
|
+
title: require_sleep.t("Opening", "In apertura"),
|
|
100974
|
+
mode: "open"
|
|
100975
|
+
};
|
|
100976
|
+
case "closing": return {
|
|
100977
|
+
state: "running",
|
|
100978
|
+
title: require_sleep.t("Closing", "In chiusura"),
|
|
100979
|
+
mode: "closed"
|
|
100980
|
+
};
|
|
100981
|
+
case "stopped": return {
|
|
100982
|
+
state: "idle",
|
|
100983
|
+
title: at === null ? require_sleep.t("Stopped", "Fermo") : require_sleep.t(`Stopped at ${at}%`, `Fermo al ${at}%`),
|
|
100984
|
+
mode: position === null ? null : position > 0 ? "open" : "closed"
|
|
100985
|
+
};
|
|
100986
|
+
}
|
|
100987
|
+
}
|
|
100988
|
+
/** Open / stop / close are actions; the one that makes sense next carries the emphasis. */
|
|
100989
|
+
function travelActions(s, state, moving) {
|
|
100990
|
+
const emphasis = (wanted) => wanted ? "primary" : "normal";
|
|
100991
|
+
const open = action(`${s.cap}.open`, require_sleep.t("Open", "Apri"), "arrow-up", s.cap, "open", {}, emphasis(state === "closed" || state === "closing"));
|
|
100992
|
+
const stop = action(`${s.cap}.stop`, require_sleep.t("Stop", "Ferma"), "square", s.cap, "stop", {}, emphasis(moving));
|
|
100993
|
+
const close = action(`${s.cap}.close`, require_sleep.t("Close", "Chiudi"), "arrow-down", s.cap, "close", {}, emphasis(state === "open" || state === "opening"));
|
|
100994
|
+
return s.stoppable || moving ? [
|
|
100995
|
+
open,
|
|
100996
|
+
stop,
|
|
100997
|
+
close
|
|
100998
|
+
] : [open, close];
|
|
100999
|
+
}
|
|
101000
|
+
function positionSlider(s, position) {
|
|
101001
|
+
return {
|
|
101002
|
+
kind: "slider",
|
|
101003
|
+
id: `${s.cap}.position`,
|
|
101004
|
+
label: require_sleep.t("Position", "Posizione"),
|
|
101005
|
+
value: position,
|
|
101006
|
+
min: 0,
|
|
101007
|
+
max: 100,
|
|
101008
|
+
step: 1,
|
|
101009
|
+
unit: "%",
|
|
101010
|
+
call: {
|
|
101011
|
+
cap: s.cap,
|
|
101012
|
+
method: "setPosition",
|
|
101013
|
+
args: {}
|
|
101014
|
+
},
|
|
101015
|
+
valueArg: "position"
|
|
101016
|
+
};
|
|
101017
|
+
}
|
|
101018
|
+
function travelFragment(s, state, position, tilt, ctx) {
|
|
101019
|
+
if (state === void 0) return {
|
|
101020
|
+
reading: reading(s.source, "unknown"),
|
|
101021
|
+
rows: [row$1(s.rowId, "arrow-up", null, travelActions(s, void 0, false).map(asAction))]
|
|
101022
|
+
};
|
|
101023
|
+
const words = travelWords(state, position);
|
|
101024
|
+
const controls = travelActions(s, state, state === "opening" || state === "closing").map(asAction);
|
|
101025
|
+
if (position !== null || s.positionable) controls.push(positionSlider(s, position));
|
|
101026
|
+
if (s.cap === "cover" && (tilt !== null || has$2(ctx, require_device_type.DeviceFeature.CoverTilt))) controls.push({
|
|
101027
|
+
kind: "slider",
|
|
101028
|
+
id: "cover.tilt",
|
|
101029
|
+
label: require_sleep.t("Tilt", "Inclinazione"),
|
|
101030
|
+
value: tilt,
|
|
101031
|
+
min: 0,
|
|
101032
|
+
max: 100,
|
|
101033
|
+
step: 1,
|
|
101034
|
+
unit: "%",
|
|
101035
|
+
call: {
|
|
101036
|
+
cap: "cover",
|
|
101037
|
+
method: "setTiltPosition",
|
|
101038
|
+
args: {}
|
|
101039
|
+
},
|
|
101040
|
+
valueArg: "tiltPosition"
|
|
101041
|
+
});
|
|
101042
|
+
return {
|
|
101043
|
+
reading: reading(s.source, words.state, false, words.title),
|
|
101044
|
+
...position === null ? {} : { facts: [fact("level", "arrow-up-down", pct(position))] },
|
|
101045
|
+
scene: {
|
|
101046
|
+
...words.mode === null ? {} : { mode: words.mode },
|
|
101047
|
+
...position === null ? {} : { level: position / 100 }
|
|
101048
|
+
},
|
|
101049
|
+
rows: [row$1(s.rowId, "arrow-up-down", joinText([words.title, position !== null && state !== "open" ? pct(position) : null]), controls)]
|
|
101050
|
+
};
|
|
101051
|
+
}
|
|
101052
|
+
var ACTUATORS_FAMILY_CONTRIBUTIONS = {
|
|
101053
|
+
brightness: brightnessContribution,
|
|
101054
|
+
color: colorContribution,
|
|
101055
|
+
cover: contribution("cover", CoverStatusSchema, (slice, ctx) => travelFragment({
|
|
101056
|
+
cap: "cover",
|
|
101057
|
+
rowId: "cover",
|
|
101058
|
+
source: "cover",
|
|
101059
|
+
stoppable: has$2(ctx, require_device_type.DeviceFeature.CoverStoppable),
|
|
101060
|
+
positionable: has$2(ctx, require_device_type.DeviceFeature.CoverPositionable)
|
|
101061
|
+
}, slice?.state, slice?.position ?? null, slice?.tiltPosition ?? null, ctx)),
|
|
101062
|
+
valve: contribution("valve", ValveStatusSchema, (slice, ctx) => travelFragment({
|
|
101063
|
+
cap: "valve",
|
|
101064
|
+
rowId: "valve",
|
|
101065
|
+
source: "valve",
|
|
101066
|
+
stoppable: false,
|
|
101067
|
+
positionable: has$2(ctx, require_device_type.DeviceFeature.ValvePositionable)
|
|
101068
|
+
}, slice?.state, slice?.position ?? null, null, ctx)),
|
|
101069
|
+
humidifier: contribution("humidifier", HumidifierStatusSchema, (slice) => {
|
|
101070
|
+
if (slice === void 0) return { reading: reading("humidifier", "unknown") };
|
|
101071
|
+
const action_ = slice.action;
|
|
101072
|
+
let state = "off";
|
|
101073
|
+
let title = require_sleep.t("Off", "Spento");
|
|
101074
|
+
if (slice.on) if (action_ === "humidifying") {
|
|
101075
|
+
state = "running";
|
|
101076
|
+
title = require_sleep.t("Humidifying", "Umidifica");
|
|
101077
|
+
} else if (action_ === "drying") {
|
|
101078
|
+
state = "running";
|
|
101079
|
+
title = require_sleep.t("Drying", "Deumidifica");
|
|
101080
|
+
} else if (action_ === "idle") {
|
|
101081
|
+
state = "idle";
|
|
101082
|
+
title = require_sleep.t("Idle", "In attesa");
|
|
101083
|
+
} else {
|
|
101084
|
+
state = "on";
|
|
101085
|
+
title = require_sleep.t("On", "Acceso");
|
|
101086
|
+
}
|
|
101087
|
+
const controls = [{
|
|
101088
|
+
kind: "toggle",
|
|
101089
|
+
id: "humidifier.power",
|
|
101090
|
+
label: require_sleep.t("Power", "Accensione"),
|
|
101091
|
+
on: slice.on,
|
|
101092
|
+
turnOn: action("humidifier.on", require_sleep.t("Turn on", "Accendi"), "power", "humidifier", "setOn", { on: true }),
|
|
101093
|
+
turnOff: action("humidifier.off", require_sleep.t("Turn off", "Spegni"), "power-off", "humidifier", "setOn", { on: false })
|
|
101094
|
+
}];
|
|
101095
|
+
if (slice.targetHumidity !== null) controls.push({
|
|
101096
|
+
kind: "slider",
|
|
101097
|
+
id: "humidifier.target",
|
|
101098
|
+
label: require_sleep.t("Target", "Obiettivo"),
|
|
101099
|
+
value: slice.targetHumidity,
|
|
101100
|
+
min: slice.minHumidity ?? 0,
|
|
101101
|
+
max: slice.maxHumidity ?? 100,
|
|
101102
|
+
step: 1,
|
|
101103
|
+
unit: "%",
|
|
101104
|
+
call: {
|
|
101105
|
+
cap: "humidifier",
|
|
101106
|
+
method: "setTargetHumidity",
|
|
101107
|
+
args: {}
|
|
101108
|
+
},
|
|
101109
|
+
valueArg: "humidity"
|
|
101110
|
+
});
|
|
101111
|
+
if (slice.availableModes.length > 0) controls.push({
|
|
101112
|
+
kind: "picker",
|
|
101113
|
+
id: "humidifier.mode",
|
|
101114
|
+
label: require_sleep.t("Mode", "Modalità"),
|
|
101115
|
+
current: slice.mode,
|
|
101116
|
+
options: [...slice.availableModes],
|
|
101117
|
+
call: {
|
|
101118
|
+
cap: "humidifier",
|
|
101119
|
+
method: "setMode",
|
|
101120
|
+
args: {}
|
|
101121
|
+
},
|
|
101122
|
+
valueArg: "mode"
|
|
101123
|
+
});
|
|
101124
|
+
const now = slice.currentHumidity;
|
|
101125
|
+
return {
|
|
101126
|
+
reading: reading("humidifier", state, false, title),
|
|
101127
|
+
...now === null ? {} : { facts: [fact("level", "droplets", pct(now), "info")] },
|
|
101128
|
+
...slice.targetHumidity === null ? {} : { tiles: { right: [{
|
|
101129
|
+
label: require_sleep.t("Target", "Obiettivo"),
|
|
101130
|
+
value: pct(slice.targetHumidity)
|
|
101131
|
+
}] } },
|
|
101132
|
+
...now === null ? {} : { scene: { level: now / 100 } },
|
|
101133
|
+
rows: [row$1("humidifier", "droplets", joinText([title, slice.mode === null ? null : require_sleep.t(slice.mode, slice.mode)]), controls)]
|
|
101134
|
+
};
|
|
101135
|
+
})
|
|
101136
|
+
};
|
|
101137
|
+
var GROUPS_FAMILY_CONTRIBUTIONS = {
|
|
101138
|
+
"group-active": contribution("group-active", GroupActiveSchema, (slice) => {
|
|
101139
|
+
if (slice === void 0) return { reading: reading("group-active", "unknown") };
|
|
101140
|
+
return { reading: reading("group-active", slice.active ? "on" : "off", false, slice.active ? require_sleep.t("Active", "Attivo") : require_sleep.t("Inactive", "Non attivo")) };
|
|
101141
|
+
}),
|
|
101142
|
+
"group-status": contribution("group-status", GroupStatusSchema, (slice) => {
|
|
101143
|
+
if (slice === void 0) return {};
|
|
101144
|
+
const text = slice.excluded === 0 ? require_sleep.t(`${slice.total} members`, `${slice.total} membri`) : require_sleep.t(`${slice.included} of ${slice.total} reporting`, `${slice.included} di ${slice.total} rispondono`);
|
|
101145
|
+
return {
|
|
101146
|
+
facts: [fact("members", "users", text, slice.excluded === 0 ? "muted" : "warning")],
|
|
101147
|
+
tiles: { left: [{
|
|
101148
|
+
label: require_sleep.t("Members", "Membri"),
|
|
101149
|
+
value: text
|
|
101150
|
+
}] }
|
|
101151
|
+
};
|
|
101152
|
+
}),
|
|
101153
|
+
"group-commands": contribution("group-commands", GroupCommandsSchema, (slice) => {
|
|
101154
|
+
if (slice === void 0) return {};
|
|
101155
|
+
const failed = slice.results.filter((r) => !r.ok).length;
|
|
101156
|
+
if (failed === 0) return {};
|
|
101157
|
+
const total = slice.results.length;
|
|
101158
|
+
return { facts: [fact("failures", "triangle-alert", require_sleep.t(`${failed} of ${total} failed`, `${failed} di ${total} falliti`), "danger")] };
|
|
101159
|
+
}),
|
|
101160
|
+
"event-emitter": contribution("event-emitter", EventEmitterStatusSchema, (slice, ctx) => {
|
|
101161
|
+
if (slice === void 0) return { reading: reading("event-emitter", "unknown") };
|
|
101162
|
+
const last = slice.lastEvent;
|
|
101163
|
+
const ago = last === null ? null : elapsedText(last.timestamp, ctx.now);
|
|
101164
|
+
return {
|
|
101165
|
+
reading: reading("event-emitter", "idle", false, require_sleep.t("Listening", "In ascolto")),
|
|
101166
|
+
...last === null ? {} : { facts: [fact("event", "radio-tower", ago === null ? require_sleep.t(last.eventType, last.eventType) : require_sleep.t(`${last.eventType} · ${ago.en}`, `${last.eventType} · ${ago.it}`), "primary")] },
|
|
101167
|
+
tiles: { right: [{
|
|
101168
|
+
label: require_sleep.t("Events", "Eventi"),
|
|
101169
|
+
value: require_sleep.t(`${slice.eventCountSinceStart}`, `${slice.eventCountSinceStart}`)
|
|
101170
|
+
}] }
|
|
101171
|
+
};
|
|
101172
|
+
})
|
|
101173
|
+
};
|
|
101174
|
+
//#endregion
|
|
101175
|
+
//#region src/device/hero/hero-contributions-sensors.ts
|
|
101176
|
+
/**
|
|
101177
|
+
* What the sensing caps add to a hero (D1023): the alarm sensors (smoke, flood,
|
|
101178
|
+
* gas, tamper, vibration), motion, presence, the doorbell, the generic binary
|
|
101179
|
+
* and meter, the weather station, a firmware update, an image and the two
|
|
101180
|
+
* caps a person acts on directly (a button, a control).
|
|
101181
|
+
*
|
|
101182
|
+
* A sensor's title is its READING ("Clear" / "Detected"), never a power word:
|
|
101183
|
+
* the generic On / Off belong to something that can be switched. A slice that
|
|
101184
|
+
* does not parse is "not answered" and reads `unknown`, never clear (D315/D393);
|
|
101185
|
+
* a measurement the device did not report is absent, never a zero (D393).
|
|
101186
|
+
*/
|
|
101187
|
+
/** The recency of a transition as the top line's "since" fact; absent when never observed. */
|
|
101188
|
+
function sinceFact(at, now, tone = "muted") {
|
|
101189
|
+
if (at === null) return [];
|
|
101190
|
+
const ago = elapsedText(at, now);
|
|
101191
|
+
return ago === null ? [] : [fact("since", "clock", ago, tone)];
|
|
101192
|
+
}
|
|
101193
|
+
function detection(spec) {
|
|
101194
|
+
return contribution(spec.cap, spec.schema, (slice, ctx) => {
|
|
101195
|
+
if (slice === void 0) return { reading: reading(spec.source, "unknown") };
|
|
101196
|
+
const tripped = spec.flag(slice);
|
|
101197
|
+
const changed = spec.changedAt(slice);
|
|
101198
|
+
return {
|
|
101199
|
+
reading: reading(spec.source, tripped ? spec.yesState : "idle", false, tripped ? spec.words.yes : spec.words.no),
|
|
101200
|
+
facts: sinceFact(changed === 0 ? null : changed, ctx.now, tripped ? "danger" : "muted")
|
|
101201
|
+
};
|
|
101202
|
+
});
|
|
101203
|
+
}
|
|
101204
|
+
var detected = {
|
|
101205
|
+
yes: require_sleep.t("Detected", "Rilevato"),
|
|
101206
|
+
no: require_sleep.t("Clear", "Libero")
|
|
101207
|
+
};
|
|
101208
|
+
var smokeContribution = detection({
|
|
101209
|
+
cap: "smoke",
|
|
101210
|
+
source: "smoke",
|
|
101211
|
+
schema: SmokeStatusSchema,
|
|
101212
|
+
words: {
|
|
101213
|
+
yes: require_sleep.t("Smoke detected", "Fumo rilevato"),
|
|
101214
|
+
no: require_sleep.t("Clear", "Nessun fumo")
|
|
101215
|
+
},
|
|
101216
|
+
yesState: "alert",
|
|
101217
|
+
flag: (s) => s.detected,
|
|
101218
|
+
changedAt: (s) => s.lastChangedAt
|
|
101219
|
+
});
|
|
101220
|
+
var floodContribution = detection({
|
|
101221
|
+
cap: "flood",
|
|
101222
|
+
source: "flood",
|
|
101223
|
+
schema: FloodStatusSchema,
|
|
101224
|
+
words: {
|
|
101225
|
+
yes: require_sleep.t("Leak detected", "Perdita rilevata"),
|
|
101226
|
+
no: require_sleep.t("Dry", "Asciutto")
|
|
101227
|
+
},
|
|
101228
|
+
yesState: "alert",
|
|
101229
|
+
flag: (s) => s.flooded,
|
|
101230
|
+
changedAt: (s) => s.lastChangedAt
|
|
101231
|
+
});
|
|
101232
|
+
var gasContribution = detection({
|
|
101233
|
+
cap: "gas",
|
|
101234
|
+
source: "gas",
|
|
101235
|
+
schema: GasStatusSchema,
|
|
101236
|
+
words: {
|
|
101237
|
+
yes: require_sleep.t("Gas detected", "Gas rilevato"),
|
|
101238
|
+
no: require_sleep.t("Clear", "Nessun gas")
|
|
101239
|
+
},
|
|
101240
|
+
yesState: "alert",
|
|
101241
|
+
flag: (s) => s.detected,
|
|
101242
|
+
changedAt: (s) => s.lastChangedAt
|
|
101243
|
+
});
|
|
101244
|
+
var tamperContribution = detection({
|
|
101245
|
+
cap: "tamper",
|
|
101246
|
+
source: "tamper",
|
|
101247
|
+
schema: TamperStatusSchema,
|
|
101248
|
+
words: {
|
|
101249
|
+
yes: require_sleep.t("Tampered", "Manomesso"),
|
|
101250
|
+
no: require_sleep.t("Secure", "Integro")
|
|
101251
|
+
},
|
|
101252
|
+
yesState: "alert",
|
|
101253
|
+
flag: (s) => s.tampered,
|
|
101254
|
+
changedAt: (s) => s.lastChangedAt
|
|
101255
|
+
});
|
|
101256
|
+
var vibrationContribution = detection({
|
|
101257
|
+
cap: "vibration",
|
|
101258
|
+
source: "vibration",
|
|
101259
|
+
schema: VibrationStatusSchema,
|
|
101260
|
+
words: {
|
|
101261
|
+
yes: require_sleep.t("Vibration", "Vibrazione"),
|
|
101262
|
+
no: require_sleep.t("Still", "Fermo")
|
|
101263
|
+
},
|
|
101264
|
+
yesState: "on",
|
|
101265
|
+
flag: (s) => s.detected,
|
|
101266
|
+
changedAt: (s) => s.lastChangedAt
|
|
101267
|
+
});
|
|
101268
|
+
var binaryContribution = detection({
|
|
101269
|
+
cap: "binary",
|
|
101270
|
+
source: "binary",
|
|
101271
|
+
schema: BinaryStatusSchema,
|
|
101272
|
+
words: {
|
|
101273
|
+
yes: require_sleep.t("Active", "Attivo"),
|
|
101274
|
+
no: require_sleep.t("Inactive", "Inattivo")
|
|
101275
|
+
},
|
|
101276
|
+
yesState: "on",
|
|
101277
|
+
flag: (s) => s.on,
|
|
101278
|
+
changedAt: (s) => s.lastChangedAt
|
|
101279
|
+
});
|
|
101280
|
+
var motionContribution = contribution("motion", MotionStatusSchema, (slice, ctx) => {
|
|
101281
|
+
if (slice === void 0) return { reading: reading("motion", "unknown") };
|
|
101282
|
+
const last = slice.lastDetectedAt;
|
|
101283
|
+
const ago = last === null ? null : elapsedText(last, ctx.now);
|
|
101284
|
+
return {
|
|
101285
|
+
reading: reading("motion", slice.detected ? "on" : "idle", false, slice.detected ? detected.yes : require_sleep.t("Clear", "Nessun movimento")),
|
|
101286
|
+
...ago === null ? {} : { facts: [fact("since", "clock", require_sleep.t(`Last motion ${ago.en}`, `Ultimo movimento ${ago.it}`), slice.detected ? "primary" : "muted")] }
|
|
101287
|
+
};
|
|
101288
|
+
});
|
|
101289
|
+
var presenceContribution = contribution("presence", PresenceStatusSchema, (slice, ctx) => {
|
|
101290
|
+
if (slice === void 0) return { reading: reading("presence", "unknown") };
|
|
101291
|
+
const zone = slice.state;
|
|
101292
|
+
const home = zone === "home";
|
|
101293
|
+
const away = zone === "not_home";
|
|
101294
|
+
const title = home ? require_sleep.t("Home", "A casa") : away ? require_sleep.t("Away", "Fuori casa") : require_sleep.t(zone, zone);
|
|
101295
|
+
const facts = [];
|
|
101296
|
+
if (slice.location !== null && slice.location !== "") facts.push(fact("reading", "map-pin", require_sleep.t(slice.location, slice.location)));
|
|
101297
|
+
facts.push(...sinceFact(slice.lastChangedAt === 0 ? null : slice.lastChangedAt, ctx.now));
|
|
101298
|
+
return {
|
|
101299
|
+
reading: reading("presence", away ? "off" : "on", false, title),
|
|
101300
|
+
facts
|
|
101301
|
+
};
|
|
101302
|
+
});
|
|
101303
|
+
/** A ring this recent still reads as "ringing". */
|
|
101304
|
+
var RINGING_MS = 3e4;
|
|
101305
|
+
var doorbellContribution = contribution("doorbell", DoorbellStatusSchema, (slice, ctx) => {
|
|
101306
|
+
if (slice === void 0) return { reading: reading("doorbell", "unknown") };
|
|
101307
|
+
const last = slice.lastPressedAt;
|
|
101308
|
+
const ago = last === null ? null : elapsedText(last, ctx.now);
|
|
101309
|
+
const ringing = last !== null && ctx.now >= last && ctx.now - last < RINGING_MS;
|
|
101310
|
+
const title = ringing ? require_sleep.t("Ringing", "Suona") : ago === null ? require_sleep.t("No ring yet", "Nessun squillo") : require_sleep.t(`Last ring ${ago.en}`, `Ultimo squillo ${ago.it}`);
|
|
101311
|
+
const count = slice.pressCountSinceStart;
|
|
101312
|
+
return {
|
|
101313
|
+
...ctx.caps.includes("motion") && !ringing ? {} : { reading: reading("doorbell", ringing ? "on" : "idle", false, title) },
|
|
101314
|
+
facts: [...ctx.caps.includes("motion") && !ringing ? [fact("event", "bell", title)] : [], ...count > 0 ? [fact("event", "bell-ring", require_sleep.t(`${count} ring${count === 1 ? "" : "s"}`, `${count} squilli`))] : []]
|
|
101315
|
+
};
|
|
101316
|
+
});
|
|
101317
|
+
var number = (n) => `${Number(n.toFixed(2))}`;
|
|
101318
|
+
var meterContribution = contribution("meter", MeterStatusSchema, (slice, ctx) => {
|
|
101319
|
+
if (slice === void 0 || slice.value === null) return { reading: reading("meter", "unknown") };
|
|
101320
|
+
const value = number(slice.value);
|
|
101321
|
+
return {
|
|
101322
|
+
reading: reading("meter", "idle", false, require_sleep.t(value, value)),
|
|
101323
|
+
facts: sinceFact(slice.lastFetchedAt === 0 ? null : slice.lastFetchedAt, ctx.now)
|
|
101324
|
+
};
|
|
101325
|
+
});
|
|
101326
|
+
var CONDITION_WORDS = {
|
|
101327
|
+
sunny: require_sleep.t("Sunny", "Soleggiato"),
|
|
101328
|
+
"clear-night": require_sleep.t("Clear night", "Notte serena"),
|
|
101329
|
+
cloudy: require_sleep.t("Cloudy", "Nuvoloso"),
|
|
101330
|
+
partlycloudy: require_sleep.t("Partly cloudy", "Parzialmente nuvoloso"),
|
|
101331
|
+
rainy: require_sleep.t("Rain", "Pioggia"),
|
|
101332
|
+
pouring: require_sleep.t("Heavy rain", "Pioggia forte"),
|
|
101333
|
+
snowy: require_sleep.t("Snow", "Neve"),
|
|
101334
|
+
"snowy-rainy": require_sleep.t("Sleet", "Nevischio"),
|
|
101335
|
+
fog: require_sleep.t("Fog", "Nebbia"),
|
|
101336
|
+
windy: require_sleep.t("Windy", "Ventoso"),
|
|
101337
|
+
"windy-variant": require_sleep.t("Windy", "Ventoso"),
|
|
101338
|
+
lightning: require_sleep.t("Thunderstorm", "Temporale"),
|
|
101339
|
+
"lightning-rainy": require_sleep.t("Thunderstorm", "Temporale"),
|
|
101340
|
+
hail: require_sleep.t("Hail", "Grandine"),
|
|
101341
|
+
exceptional: require_sleep.t("Exceptional", "Eccezionale")
|
|
101342
|
+
};
|
|
101343
|
+
var weatherContribution = contribution("weather", WeatherStatusSchema, (slice, ctx) => {
|
|
101344
|
+
if (slice === void 0) return { reading: reading("weather", "unknown") };
|
|
101345
|
+
const { condition, temperature, humidity, pressure, windSpeed } = slice;
|
|
101346
|
+
const celsius = temperature === null ? null : `${number(temperature)}°C`;
|
|
101347
|
+
const word = condition === null ? null : CONDITION_WORDS[condition] ?? require_sleep.t(condition, condition);
|
|
101348
|
+
const title = word ?? (celsius === null ? null : require_sleep.t(celsius, celsius));
|
|
101349
|
+
if (title === null) return { reading: reading("weather", "unknown") };
|
|
101350
|
+
const facts = [];
|
|
101351
|
+
if (celsius !== null && word !== null) facts.push(fact("reading", "thermometer", require_sleep.t(celsius, celsius), "primary"));
|
|
101352
|
+
if (humidity !== null) facts.push(fact("reading", "droplets", require_sleep.t(`${Math.round(humidity)}%`, `${Math.round(humidity)}%`)));
|
|
101353
|
+
if (windSpeed !== null) facts.push(fact("reading", "wind", require_sleep.t(`${number(windSpeed)} m/s`, `${number(windSpeed)} m/s`)));
|
|
101354
|
+
if (pressure !== null) facts.push(fact("reading", "gauge", require_sleep.t(`${Math.round(pressure)} hPa`, `${Math.round(pressure)} hPa`)));
|
|
101355
|
+
facts.push(...sinceFact(slice.lastFetchedAt === 0 ? null : slice.lastFetchedAt, ctx.now));
|
|
101356
|
+
const left = [];
|
|
101357
|
+
if (humidity !== null) left.push({
|
|
101358
|
+
label: require_sleep.t("Humidity", "Umidità"),
|
|
101359
|
+
value: require_sleep.t(`${Math.round(humidity)}%`, `${Math.round(humidity)}%`)
|
|
101360
|
+
});
|
|
101361
|
+
if (pressure !== null) left.push({
|
|
101362
|
+
label: require_sleep.t("Pressure", "Pressione"),
|
|
101363
|
+
value: require_sleep.t(`${Math.round(pressure)} hPa`, `${Math.round(pressure)} hPa`)
|
|
101364
|
+
});
|
|
101365
|
+
const right = windSpeed === null ? [] : [{
|
|
101366
|
+
label: require_sleep.t("Wind", "Vento"),
|
|
101367
|
+
value: require_sleep.t(`${number(windSpeed)} m/s`, `${number(windSpeed)} m/s`)
|
|
101368
|
+
}];
|
|
101369
|
+
return {
|
|
101370
|
+
reading: reading("weather", "on", false, title),
|
|
101371
|
+
facts,
|
|
101372
|
+
tiles: {
|
|
101373
|
+
left,
|
|
101374
|
+
right
|
|
101375
|
+
}
|
|
101376
|
+
};
|
|
101377
|
+
});
|
|
101378
|
+
var updateContribution = contribution("update", UpdateStatusSchema, (slice) => {
|
|
101379
|
+
if (slice === void 0) return { reading: reading("update", "unknown") };
|
|
101380
|
+
const { currentVersion, availableVersion, inProgress, updatable } = slice;
|
|
101381
|
+
const pending = availableVersion !== null && availableVersion !== "" && availableVersion !== currentVersion;
|
|
101382
|
+
if (!pending && currentVersion === null && !inProgress) return { reading: reading("update", "unknown") };
|
|
101383
|
+
const state = inProgress ? "running" : pending ? "standby" : "idle";
|
|
101384
|
+
const title = inProgress ? require_sleep.t("Updating", "Aggiornamento in corso") : pending ? require_sleep.t("Update available", "Aggiornamento disponibile") : require_sleep.t("Up to date", "Aggiornato");
|
|
101385
|
+
const versions = currentVersion === null ? pending ? require_sleep.t(`${availableVersion}`, `${availableVersion}`) : null : pending ? require_sleep.t(`${currentVersion} → ${availableVersion}`, `${currentVersion} → ${availableVersion}`) : require_sleep.t(`Version ${currentVersion}`, `Versione ${currentVersion}`);
|
|
101386
|
+
const install = pending && updatable && !inProgress ? [asAction(action("update.install", require_sleep.t("Install", "Installa"), "download", "update", "installUpdate", {}, "primary", "install"))] : [];
|
|
101387
|
+
return {
|
|
101388
|
+
reading: reading("update", state, false, title),
|
|
101389
|
+
facts: versions === null ? [] : [fact("reading", "download", versions, pending ? "warning" : "muted")],
|
|
101390
|
+
rows: [row$1("update", "download", versions, install)]
|
|
101391
|
+
};
|
|
101392
|
+
});
|
|
101393
|
+
var imageContribution = contribution("image", ImageStatusSchema, (slice, ctx) => {
|
|
101394
|
+
if (slice === void 0) return { reading: reading("image", "unknown") };
|
|
101395
|
+
if (slice.url === null) return { reading: reading("image", "idle", false, require_sleep.t("No image yet", "Nessuna immagine")) };
|
|
101396
|
+
const ago = slice.lastUpdated === null ? null : elapsedText(slice.lastUpdated, ctx.now);
|
|
101397
|
+
return {
|
|
101398
|
+
reading: reading("image", "on", false, ago === null ? require_sleep.t("Image", "Immagine") : require_sleep.t(`Updated ${ago.en}`, `Aggiornata ${ago.it}`)),
|
|
101399
|
+
artworkUrl: slice.url
|
|
101400
|
+
};
|
|
101401
|
+
});
|
|
101402
|
+
/** A button has no state to read: it is always ready, so it is never `unknown`. */
|
|
101403
|
+
var buttonContribution = {
|
|
101404
|
+
cap: "button",
|
|
101405
|
+
contribute: () => ({
|
|
101406
|
+
reading: reading("button", "idle", false, require_sleep.t("Ready", "Pronto")),
|
|
101407
|
+
rows: [row$1("button", "pointer", null, [asAction(action("button.press", require_sleep.t("Press", "Premi"), "pointer", "button", "press", {}, "primary", "press"))])]
|
|
101408
|
+
})
|
|
101409
|
+
};
|
|
101410
|
+
var controlContribution = contribution("control", ControlStatusSchema, (slice, ctx) => {
|
|
101411
|
+
if (slice === void 0) return { reading: reading("control", "unknown") };
|
|
101412
|
+
const text = typeof slice.value === "number" ? number(slice.value) : slice.value;
|
|
101413
|
+
return {
|
|
101414
|
+
reading: reading("control", "on", false, require_sleep.t(text, text)),
|
|
101415
|
+
facts: sinceFact(slice.lastChangedAt === 0 ? null : slice.lastChangedAt, ctx.now),
|
|
101416
|
+
rows: controlRows(slice)
|
|
101417
|
+
};
|
|
101418
|
+
});
|
|
101419
|
+
var CONTROL_LABEL = require_sleep.t("Value", "Valore");
|
|
101420
|
+
/** A number with known bounds is a slider, a choice a picker; text and dates stay read-only. */
|
|
101421
|
+
function controlRows(slice) {
|
|
101422
|
+
if (slice.kind === "numeric" && typeof slice.value === "number") {
|
|
101423
|
+
if (slice.min === void 0 || slice.max === void 0) return [];
|
|
101424
|
+
return [row$1("control", "sliders-horizontal", null, [{
|
|
101425
|
+
kind: "slider",
|
|
101426
|
+
id: "control.value",
|
|
101427
|
+
label: CONTROL_LABEL,
|
|
101428
|
+
value: slice.value,
|
|
101429
|
+
min: slice.min,
|
|
101430
|
+
max: slice.max,
|
|
101431
|
+
step: slice.step ?? 1,
|
|
101432
|
+
unit: "",
|
|
101433
|
+
call: {
|
|
101434
|
+
cap: "control",
|
|
101435
|
+
method: "setValue",
|
|
101436
|
+
args: { control: { kind: "numeric" } }
|
|
101437
|
+
},
|
|
101438
|
+
valueArg: "control.value"
|
|
101439
|
+
}])];
|
|
101440
|
+
}
|
|
101441
|
+
if (slice.kind === "select" && typeof slice.value === "string") return [row$1("control", "sliders-horizontal", null, [{
|
|
101442
|
+
kind: "picker",
|
|
101443
|
+
id: "control.value",
|
|
101444
|
+
label: CONTROL_LABEL,
|
|
101445
|
+
current: slice.value,
|
|
101446
|
+
options: slice.options,
|
|
101447
|
+
call: {
|
|
101448
|
+
cap: "control",
|
|
101449
|
+
method: "setValue",
|
|
101450
|
+
args: { control: { kind: "select" } }
|
|
101451
|
+
},
|
|
101452
|
+
valueArg: "control.value"
|
|
101453
|
+
}])];
|
|
101454
|
+
return [];
|
|
101455
|
+
}
|
|
101456
|
+
var SENSORS_FAMILY_CONTRIBUTIONS = {
|
|
101457
|
+
smoke: smokeContribution,
|
|
101458
|
+
flood: floodContribution,
|
|
101459
|
+
gas: gasContribution,
|
|
101460
|
+
tamper: tamperContribution,
|
|
101461
|
+
vibration: vibrationContribution,
|
|
101462
|
+
binary: binaryContribution,
|
|
101463
|
+
motion: motionContribution,
|
|
101464
|
+
presence: presenceContribution,
|
|
101465
|
+
doorbell: doorbellContribution,
|
|
101466
|
+
meter: meterContribution,
|
|
101467
|
+
weather: weatherContribution,
|
|
101468
|
+
update: updateContribution,
|
|
101469
|
+
image: imageContribution,
|
|
101470
|
+
button: buttonContribution,
|
|
101471
|
+
control: controlContribution
|
|
101472
|
+
};
|
|
101473
|
+
//#endregion
|
|
101474
|
+
//#region src/device/hero/climate-view.ts
|
|
101475
|
+
var MODE_LABEL = {
|
|
101476
|
+
off: require_sleep.t("Off", "Spento"),
|
|
101477
|
+
heat: require_sleep.t("Heating", "Riscalda"),
|
|
101478
|
+
cool: require_sleep.t("Cooling", "Freddo"),
|
|
101479
|
+
auto: require_sleep.t("Auto", "Auto"),
|
|
101480
|
+
heat_cool: require_sleep.t("Heat/Cool", "Caldo/Freddo"),
|
|
101481
|
+
fan_only: require_sleep.t("Fan only", "Solo ventola"),
|
|
101482
|
+
dry: require_sleep.t("Drying", "Deumidifica")
|
|
101483
|
+
};
|
|
101484
|
+
var SCENE_MODE = {
|
|
101485
|
+
off: null,
|
|
101486
|
+
heat: "heat",
|
|
101487
|
+
cool: "cool",
|
|
101488
|
+
auto: "auto",
|
|
101489
|
+
heat_cool: "auto",
|
|
101490
|
+
fan_only: "fan",
|
|
101491
|
+
dry: "dry"
|
|
101492
|
+
};
|
|
101493
|
+
/** Without a remembered mode, "turn on" picks the first of these the device accepts. */
|
|
101494
|
+
var ON_MODE_PREFERENCE = [
|
|
101495
|
+
"auto",
|
|
101496
|
+
"heat_cool",
|
|
101497
|
+
"heat",
|
|
101498
|
+
"cool"
|
|
101499
|
+
];
|
|
101500
|
+
/** 22 -> "22", 22.3 -> "22.3": a trailing zero is noise on a thermostat. */
|
|
101501
|
+
function formatDegrees(value) {
|
|
101502
|
+
return `${Number(value.toFixed(1))}°`;
|
|
101503
|
+
}
|
|
101504
|
+
/** "Turn on" returns to the mode the device last ran when it still accepts it, else the fixed order. */
|
|
101505
|
+
function onModeOf(available, last) {
|
|
101506
|
+
const candidates = available.filter((m) => m !== "off");
|
|
101507
|
+
if (last !== void 0 && candidates.includes(last)) return last;
|
|
101508
|
+
for (const preferred of ON_MODE_PREFERENCE) if (candidates.includes(preferred)) return preferred;
|
|
101509
|
+
return candidates[0] ?? null;
|
|
101510
|
+
}
|
|
101511
|
+
function deriveClimateView(slice) {
|
|
101512
|
+
const range = rangeFrom(slice.minTemp, slice.maxTemp, slice.tempStep);
|
|
101513
|
+
const level = levelWithin(slice.target, range);
|
|
101514
|
+
return {
|
|
101515
|
+
mode: slice.mode,
|
|
101516
|
+
isOff: slice.mode === "off",
|
|
101517
|
+
modeLabel: MODE_LABEL[slice.mode],
|
|
101518
|
+
target: slice.target,
|
|
101519
|
+
measured: slice.currentTemp,
|
|
101520
|
+
targetRange: slice.targetLow !== null && slice.targetHigh !== null ? {
|
|
101521
|
+
low: slice.targetLow,
|
|
101522
|
+
high: slice.targetHigh
|
|
101523
|
+
} : null,
|
|
101524
|
+
targetHumidity: slice.targetHumidity,
|
|
101525
|
+
humidity: slice.currentHumidity,
|
|
101526
|
+
range,
|
|
101527
|
+
availableModes: slice.availableModes,
|
|
101528
|
+
sceneMode: SCENE_MODE[slice.mode],
|
|
101529
|
+
level,
|
|
101530
|
+
onMode: onModeOf(slice.availableModes, slice.lastActiveMode)
|
|
101531
|
+
};
|
|
101532
|
+
}
|
|
101533
|
+
/** "22° (22.3°)": the setpoint and, in brackets, what is measured. The mode is the headline, not repeated here. */
|
|
101534
|
+
function thermalStatusText(target, measured) {
|
|
101535
|
+
const goal = target === null ? "" : typeof target === "string" ? target : formatDegrees(target);
|
|
101536
|
+
const now = measured === null ? "" : formatDegrees(measured);
|
|
101537
|
+
const temps = goal !== "" && now !== "" ? `${goal} (${now})` : goal !== "" ? goal : now;
|
|
101538
|
+
return temps === "" ? null : require_sleep.t(temps, temps);
|
|
101539
|
+
}
|
|
101540
|
+
function climateStatusText(view) {
|
|
101541
|
+
const range = view.targetRange;
|
|
101542
|
+
return thermalStatusText(view.target !== null ? view.target : range === null ? null : `${Number(range.low.toFixed(1))}–${formatDegrees(range.high)}`, view.measured);
|
|
101543
|
+
}
|
|
101544
|
+
/** The setpoint inside its range, 0..1. */
|
|
101545
|
+
function levelWithin(value, range) {
|
|
101546
|
+
if (value === null || range === null) return null;
|
|
101547
|
+
return Math.min(1, Math.max(0, (value - range.min) / (range.max - range.min)));
|
|
101548
|
+
}
|
|
101549
|
+
function rangeFrom(min, max, step) {
|
|
101550
|
+
if (min === null || min === void 0) return null;
|
|
101551
|
+
if (max === null || max === void 0 || max <= min) return null;
|
|
101552
|
+
return {
|
|
101553
|
+
min,
|
|
101554
|
+
max,
|
|
101555
|
+
step: step ?? 1
|
|
101556
|
+
};
|
|
101557
|
+
}
|
|
101558
|
+
//#endregion
|
|
101559
|
+
//#region src/device/hero/hero-contributions-climate.ts
|
|
101560
|
+
/**
|
|
101561
|
+
* The climate family's contributions to a hero (D1023): `climate-control`,
|
|
101562
|
+
* `water-heater`, `heating-valve`, and the read-only sensors. Capabilities
|
|
101563
|
+
* contribute, types never do (D14). A slice that is absent or does not parse is
|
|
101564
|
+
* "not answered": the state reads unknown, no row is drawn (D315, D393).
|
|
101565
|
+
*/
|
|
101566
|
+
var same = (text) => require_sleep.t(text, text);
|
|
101567
|
+
function tile(en, it, value) {
|
|
101568
|
+
return {
|
|
101569
|
+
label: require_sleep.t(en, it),
|
|
101570
|
+
value: same(value)
|
|
101571
|
+
};
|
|
101572
|
+
}
|
|
101573
|
+
function setpointSlider(id, cap, method, valueArg, value, range) {
|
|
101574
|
+
return {
|
|
101575
|
+
kind: "slider",
|
|
101576
|
+
id,
|
|
101577
|
+
label: require_sleep.t("Target", "Obiettivo"),
|
|
101578
|
+
value,
|
|
101579
|
+
min: range.min,
|
|
101580
|
+
max: range.max,
|
|
101581
|
+
step: range.step,
|
|
101582
|
+
unit: "°",
|
|
101583
|
+
call: {
|
|
101584
|
+
cap,
|
|
101585
|
+
method,
|
|
101586
|
+
args: {}
|
|
101587
|
+
},
|
|
101588
|
+
valueArg
|
|
101589
|
+
};
|
|
101590
|
+
}
|
|
101591
|
+
function setpointRow(status, slider) {
|
|
101592
|
+
return slider === null ? [] : [{
|
|
101593
|
+
id: "setpoint",
|
|
101594
|
+
icon: "thermometer",
|
|
101595
|
+
status,
|
|
101596
|
+
controls: [slider]
|
|
101597
|
+
}];
|
|
101598
|
+
}
|
|
101599
|
+
var climateContribution = contribution("climate-control", ClimateControlStatusSchema, (slice, ctx) => {
|
|
101600
|
+
if (slice === void 0) return { reading: reading("climate-control", "unknown") };
|
|
101601
|
+
const view = deriveClimateView(slice);
|
|
101602
|
+
const status = climateStatusText(view);
|
|
101603
|
+
const facts = [];
|
|
101604
|
+
if (status !== null) facts.push(fact("climate", "thermometer", status));
|
|
101605
|
+
if (view.humidity !== null) facts.push(fact("humidity", "droplets", same(`${Math.round(view.humidity)}%`)));
|
|
101606
|
+
if (view.targetHumidity !== null) facts.push(fact("humidity", "droplets", same(`→ ${Math.round(view.targetHumidity)}%`)));
|
|
101607
|
+
const left = [];
|
|
101608
|
+
const right = [];
|
|
101609
|
+
if (view.measured !== null) left.push(tile("Indoor", "In casa", formatDegrees(view.measured)));
|
|
101610
|
+
if (view.humidity !== null) left.push(tile("Humidity", "Umidità", `${Math.round(view.humidity)}%`));
|
|
101611
|
+
const modeControls = [{
|
|
101612
|
+
kind: "picker",
|
|
101613
|
+
id: "climate.mode",
|
|
101614
|
+
label: require_sleep.t("Mode", "Modalità"),
|
|
101615
|
+
current: view.mode,
|
|
101616
|
+
options: [...view.availableModes],
|
|
101617
|
+
call: {
|
|
101618
|
+
cap: "climate-control",
|
|
101619
|
+
method: "setMode",
|
|
101620
|
+
args: {}
|
|
101621
|
+
},
|
|
101622
|
+
valueArg: "mode"
|
|
101623
|
+
}];
|
|
101624
|
+
if (slice.availablePresets.length > 0) modeControls.push({
|
|
101625
|
+
kind: "picker",
|
|
101626
|
+
id: "climate.preset",
|
|
101627
|
+
label: require_sleep.t("Preset", "Preset"),
|
|
101628
|
+
current: slice.preset === "" ? null : slice.preset,
|
|
101629
|
+
options: [...slice.availablePresets],
|
|
101630
|
+
call: {
|
|
101631
|
+
cap: "climate-control",
|
|
101632
|
+
method: "setPreset",
|
|
101633
|
+
args: {}
|
|
101634
|
+
},
|
|
101635
|
+
valueArg: "preset"
|
|
101636
|
+
});
|
|
101637
|
+
const fanControls = [];
|
|
101638
|
+
if (slice.availableFanModes.length > 0) fanControls.push({
|
|
101639
|
+
kind: "picker",
|
|
101640
|
+
id: "climate.fan",
|
|
101641
|
+
label: require_sleep.t("Fan", "Ventola"),
|
|
101642
|
+
current: slice.fanMode === "" ? null : slice.fanMode,
|
|
101643
|
+
options: [...slice.availableFanModes],
|
|
101644
|
+
call: {
|
|
101645
|
+
cap: "climate-control",
|
|
101646
|
+
method: "setFanMode",
|
|
101647
|
+
args: {}
|
|
101648
|
+
},
|
|
101649
|
+
valueArg: "fanMode"
|
|
101650
|
+
});
|
|
101651
|
+
const swing = (id, en, it, method, on, feature) => ctx.features.includes(feature) ? [{
|
|
101652
|
+
kind: "toggle",
|
|
101653
|
+
id,
|
|
101654
|
+
label: require_sleep.t(en, it),
|
|
101655
|
+
on,
|
|
101656
|
+
turnOn: action(`${id}.on`, require_sleep.t(en, it), "wind", "climate-control", method, { on: true }),
|
|
101657
|
+
turnOff: action(`${id}.off`, require_sleep.t(en, it), "wind", "climate-control", method, { on: false })
|
|
101658
|
+
}] : [];
|
|
101659
|
+
fanControls.push(...swing("climate.swing-vertical", "Swing vertical", "Oscillazione verticale", "setSwingVertical", slice.swingVertical, require_device_type.DeviceFeature.ClimateSwingVertical), ...swing("climate.swing-horizontal", "Swing horizontal", "Oscillazione orizzontale", "setSwingHorizontal", slice.swingHorizontal, require_device_type.DeviceFeature.ClimateSwingHorizontal));
|
|
101660
|
+
const rows = [{
|
|
101661
|
+
id: "climate-mode",
|
|
101662
|
+
icon: "thermometer",
|
|
101663
|
+
status: view.modeLabel,
|
|
101664
|
+
controls: modeControls
|
|
101665
|
+
}];
|
|
101666
|
+
if (fanControls.length > 0) rows.push({
|
|
101667
|
+
id: "climate-fan",
|
|
101668
|
+
icon: "fan",
|
|
101669
|
+
status: slice.fanMode === "" ? null : same(slice.fanMode),
|
|
101670
|
+
controls: fanControls
|
|
101671
|
+
});
|
|
101672
|
+
rows.push(...setpointRow(view.target === null ? null : same(formatDegrees(view.target)), view.range === null || view.target === null ? null : setpointSlider("climate.target", "climate-control", "setTarget", "target", view.target, view.range)));
|
|
101673
|
+
const sceneMode = view.sceneMode;
|
|
101674
|
+
return {
|
|
101675
|
+
reading: reading("climate-control", view.isOff ? "off" : "on"),
|
|
101676
|
+
title: view.modeLabel,
|
|
101677
|
+
facts,
|
|
101678
|
+
...left.length === 0 && right.length === 0 ? {} : { tiles: {
|
|
101679
|
+
left,
|
|
101680
|
+
right
|
|
101681
|
+
} },
|
|
101682
|
+
scene: {
|
|
101683
|
+
...sceneMode === null ? {} : { mode: sceneMode },
|
|
101684
|
+
...view.level === null ? {} : { level: view.level }
|
|
101685
|
+
},
|
|
101686
|
+
...view.onMode === null ? {} : { ownPower: {
|
|
101687
|
+
source: "climate-control",
|
|
101688
|
+
on: !view.isOff,
|
|
101689
|
+
assumed: false,
|
|
101690
|
+
turnOn: action("own-power.on", require_sleep.t("Turn on", "Accendi"), "power", "climate-control", "setMode", { mode: view.onMode }),
|
|
101691
|
+
turnOff: action("own-power.off", require_sleep.t("Turn off", "Spegni"), "power-off", "climate-control", "setMode", { mode: "off" })
|
|
101692
|
+
} },
|
|
101693
|
+
rows
|
|
101694
|
+
};
|
|
101695
|
+
});
|
|
101696
|
+
var WATER_ON_PREFERENCE = [
|
|
101697
|
+
"eco",
|
|
101698
|
+
"electric",
|
|
101699
|
+
"heat_pump",
|
|
101700
|
+
"performance"
|
|
101701
|
+
];
|
|
101702
|
+
function capitalised(word) {
|
|
101703
|
+
return same(word.charAt(0).toUpperCase() + word.slice(1).replace(/_/g, " "));
|
|
101704
|
+
}
|
|
101705
|
+
var waterHeaterContribution = contribution("water-heater", WaterHeaterStatusSchema, (slice) => {
|
|
101706
|
+
if (slice === void 0 || slice.operationMode === null) return { reading: reading("climate-control", "unknown") };
|
|
101707
|
+
const isOff = slice.operationMode === "off";
|
|
101708
|
+
const label = capitalised(slice.operationMode);
|
|
101709
|
+
const status = thermalStatusText(slice.targetTemp, slice.currentTemp);
|
|
101710
|
+
const range = rangeFrom(slice.minTemp, slice.maxTemp, 1);
|
|
101711
|
+
const candidates = slice.availableModes.filter((m) => m !== "off");
|
|
101712
|
+
const last = slice.lastActiveMode;
|
|
101713
|
+
const onMode = last !== void 0 && candidates.includes(last) ? last : WATER_ON_PREFERENCE.find((m) => candidates.includes(m)) ?? candidates[0] ?? null;
|
|
101714
|
+
const modeControls = [{
|
|
101715
|
+
kind: "picker",
|
|
101716
|
+
id: "water-heater.mode",
|
|
101717
|
+
label: require_sleep.t("Mode", "Modalità"),
|
|
101718
|
+
current: slice.operationMode,
|
|
101719
|
+
options: [...slice.availableModes],
|
|
101720
|
+
call: {
|
|
101721
|
+
cap: "water-heater",
|
|
101722
|
+
method: "setOperationMode",
|
|
101723
|
+
args: {}
|
|
101724
|
+
},
|
|
101725
|
+
valueArg: "mode"
|
|
101726
|
+
}];
|
|
101727
|
+
if (slice.away !== null) modeControls.push({
|
|
101728
|
+
kind: "toggle",
|
|
101729
|
+
id: "water-heater.away",
|
|
101730
|
+
label: require_sleep.t("Away", "Assente"),
|
|
101731
|
+
on: slice.away,
|
|
101732
|
+
turnOn: action("water-heater.away.on", require_sleep.t("Away", "Assente"), "house", "water-heater", "setAway", { on: true }),
|
|
101733
|
+
turnOff: action("water-heater.away.off", require_sleep.t("Away", "Assente"), "house", "water-heater", "setAway", { on: false })
|
|
101734
|
+
});
|
|
101735
|
+
const rows = [{
|
|
101736
|
+
id: "climate-mode",
|
|
101737
|
+
icon: "flame",
|
|
101738
|
+
status: label,
|
|
101739
|
+
controls: modeControls
|
|
101740
|
+
}, ...setpointRow(slice.targetTemp === null ? null : same(formatDegrees(slice.targetTemp)), range === null || slice.targetTemp === null ? null : setpointSlider("water-heater.target", "water-heater", "setTargetTemp", "temp", slice.targetTemp, range))];
|
|
101741
|
+
const level = levelWithin(slice.targetTemp, range);
|
|
101742
|
+
return {
|
|
101743
|
+
reading: reading("climate-control", isOff ? "off" : "on"),
|
|
101744
|
+
title: label,
|
|
101745
|
+
facts: status === null ? [] : [fact("climate", "flame", status)],
|
|
101746
|
+
...slice.currentTemp === null ? {} : { tiles: { left: [tile("Water", "Acqua", formatDegrees(slice.currentTemp))] } },
|
|
101747
|
+
scene: {
|
|
101748
|
+
...isOff ? {} : { mode: "heat" },
|
|
101749
|
+
...level === null ? {} : { level }
|
|
101750
|
+
},
|
|
101751
|
+
...onMode === null ? {} : { ownPower: {
|
|
101752
|
+
source: "climate-control",
|
|
101753
|
+
on: !isOff,
|
|
101754
|
+
assumed: false,
|
|
101755
|
+
turnOn: action("own-power.on", require_sleep.t("Turn on", "Accendi"), "power", "water-heater", "setOperationMode", { mode: onMode }),
|
|
101756
|
+
turnOff: action("own-power.off", require_sleep.t("Turn off", "Spegni"), "power-off", "water-heater", "setOperationMode", { mode: "off" })
|
|
101757
|
+
} },
|
|
101758
|
+
rows
|
|
101759
|
+
};
|
|
101760
|
+
});
|
|
101761
|
+
var heatingValveContribution = contribution("heating-valve", HeatingValveStatusSchema, (slice) => {
|
|
101762
|
+
const position = slice?.position ?? null;
|
|
101763
|
+
if (position === null) return { reading: reading("sensor", "unknown") };
|
|
101764
|
+
const text = same(`${Math.round(position)}%`);
|
|
101765
|
+
return {
|
|
101766
|
+
reading: reading("sensor", position > 0 ? "running" : "idle"),
|
|
101767
|
+
facts: [fact("valve", "gauge", require_sleep.t(`Valve ${text.en}`, `Valvola ${text.it}`))],
|
|
101768
|
+
tiles: { right: [tile("Valve", "Valvola", text.en)] },
|
|
101769
|
+
scene: { level: position / 100 }
|
|
101770
|
+
};
|
|
101771
|
+
});
|
|
101772
|
+
/** One reading fact plus its tile; a value that did not answer says nothing and the state stays unknown. */
|
|
101773
|
+
function sensorFragment(value, id, icon, en, it, text) {
|
|
101774
|
+
if (value === null) return { reading: reading("sensor", "unknown") };
|
|
101775
|
+
return {
|
|
101776
|
+
reading: reading("sensor", "on"),
|
|
101777
|
+
title: same(text),
|
|
101778
|
+
facts: [fact(id, icon, same(text))],
|
|
101779
|
+
tiles: { right: [tile(en, it, text)] }
|
|
101780
|
+
};
|
|
101781
|
+
}
|
|
101782
|
+
var temperatureContribution = contribution("temperature-sensor", TemperatureSensorStatusSchema, (slice) => sensorFragment(slice?.temperature ?? null, "temperature", "thermometer", "Temperature", "Temperatura", formatDegrees(slice?.temperature ?? 0)));
|
|
101783
|
+
var humidityContribution = contribution("humidity-sensor", HumiditySensorStatusSchema, (slice) => sensorFragment(slice?.humidity ?? null, "humidity", "droplets", "Humidity", "Umidità", `${Math.round(slice?.humidity ?? 0)}%`));
|
|
101784
|
+
var pressureContribution = contribution("pressure-sensor", PressureSensorStatusSchema, (slice) => sensorFragment(slice?.pressure ?? null, "pressure", "gauge", "Pressure", "Pressione", `${Math.round(slice?.pressure ?? 0)} hPa`));
|
|
101785
|
+
var illuminanceContribution = contribution("ambient-light-sensor", AmbientLightSensorStatusSchema, (slice) => sensorFragment(slice?.illuminance ?? null, "illuminance", "sun", "Light", "Luce", `${Math.round(slice?.illuminance ?? 0)} lx`));
|
|
101786
|
+
var numericContribution = contribution("numeric-sensor", NumericSensorStatusSchema, (slice) => sensorFragment(slice?.value ?? null, "reading", "gauge", "Value", "Valore", String(Number((slice?.value ?? 0).toFixed(2)))));
|
|
101787
|
+
var enumContribution = contribution("enum-sensor", EnumSensorStatusSchema, (slice) => {
|
|
101788
|
+
if (slice === void 0 || slice.value === "") return { reading: reading("sensor", "unknown") };
|
|
101789
|
+
if (slice.timestamp === true) return { reading: reading("sensor", "on") };
|
|
101790
|
+
return sensorFragment(slice.value, "reading", "gauge", "State", "Stato", slice.value);
|
|
101791
|
+
});
|
|
101792
|
+
/** Index bands: the headline of an air-quality sensor is a word, not a number. */
|
|
101793
|
+
function airQualityWord(aqi) {
|
|
101794
|
+
if (aqi <= 50) return require_sleep.t("Good", "Buona");
|
|
101795
|
+
if (aqi <= 100) return require_sleep.t("Moderate", "Discreta");
|
|
101796
|
+
if (aqi <= 150) return require_sleep.t("Poor", "Scadente");
|
|
101797
|
+
return require_sleep.t("Unhealthy", "Malsana");
|
|
101798
|
+
}
|
|
101799
|
+
/** The climate family, in the order their fragments are merged (a valve's level outranks a setpoint's). */
|
|
101800
|
+
var CLIMATE_FAMILY_CONTRIBUTIONS = {
|
|
101801
|
+
"heating-valve": heatingValveContribution,
|
|
101802
|
+
"climate-control": climateContribution,
|
|
101803
|
+
"water-heater": waterHeaterContribution,
|
|
101804
|
+
"temperature-sensor": temperatureContribution,
|
|
101805
|
+
"humidity-sensor": humidityContribution,
|
|
101806
|
+
"pressure-sensor": pressureContribution,
|
|
101807
|
+
"air-quality-sensor": contribution("air-quality-sensor", AirQualitySensorStatusSchema, (slice) => {
|
|
101808
|
+
if (slice === void 0) return { reading: reading("sensor", "unknown") };
|
|
101809
|
+
const parts = [];
|
|
101810
|
+
if (slice.aqi !== void 0) parts.push({
|
|
101811
|
+
label: "AQI",
|
|
101812
|
+
value: String(Math.round(slice.aqi))
|
|
101813
|
+
});
|
|
101814
|
+
if (slice.co2 !== void 0) parts.push({
|
|
101815
|
+
label: "CO₂",
|
|
101816
|
+
value: `${Math.round(slice.co2)} ppm`
|
|
101817
|
+
});
|
|
101818
|
+
if (slice.pm25 !== void 0) parts.push({
|
|
101819
|
+
label: "PM2.5",
|
|
101820
|
+
value: `${Math.round(slice.pm25)} µg/m³`
|
|
101821
|
+
});
|
|
101822
|
+
if (slice.voc !== void 0) parts.push({
|
|
101823
|
+
label: "VOC",
|
|
101824
|
+
value: `${Math.round(slice.voc)} ppb`
|
|
101825
|
+
});
|
|
101826
|
+
if (slice.pm10 !== void 0) parts.push({
|
|
101827
|
+
label: "PM10",
|
|
101828
|
+
value: `${Math.round(slice.pm10)} µg/m³`
|
|
101829
|
+
});
|
|
101830
|
+
if (parts.length === 0) return { reading: reading("sensor", "unknown") };
|
|
101831
|
+
return {
|
|
101832
|
+
reading: reading("sensor", "on"),
|
|
101833
|
+
...slice.aqi === void 0 ? {} : { title: airQualityWord(slice.aqi) },
|
|
101834
|
+
facts: parts.map((p) => fact("air-quality", "wind", same(`${p.label} ${p.value}`))),
|
|
101835
|
+
tiles: { right: parts.slice(0, 2).map((p) => tile(p.label, p.label, p.value)) }
|
|
101836
|
+
};
|
|
101837
|
+
}),
|
|
101838
|
+
"carbon-monoxide": contribution("carbon-monoxide", CarbonMonoxideStatusSchema, (slice) => {
|
|
101839
|
+
if (slice === void 0) return { reading: reading("sensor", "unknown") };
|
|
101840
|
+
return {
|
|
101841
|
+
reading: reading("sensor", slice.detected ? "alert" : "idle"),
|
|
101842
|
+
title: slice.detected ? require_sleep.t("CO detected", "CO rilevato") : require_sleep.t("Air clear", "Aria libera"),
|
|
101843
|
+
facts: [fact("reading", slice.detected ? "triangle-alert" : "shield-check", slice.detected ? require_sleep.t("CO detected", "CO rilevato") : require_sleep.t("Air clear", "Aria libera"), slice.detected ? "danger" : "muted")]
|
|
101844
|
+
};
|
|
101845
|
+
}),
|
|
101846
|
+
"ambient-light-sensor": illuminanceContribution,
|
|
101847
|
+
"numeric-sensor": numericContribution,
|
|
101848
|
+
"enum-sensor": enumContribution
|
|
101849
|
+
};
|
|
101850
|
+
//#endregion
|
|
100111
101851
|
//#region src/device/hero/media-player-view.ts
|
|
100112
101852
|
/** The position to show at `nowMs`: the reported one, advanced while playing when it is stamped. */
|
|
100113
101853
|
function projectedPositionMs(status, nowMs) {
|
|
@@ -100182,6 +101922,7 @@ var UNKNOWN_VIEW = {
|
|
|
100182
101922
|
artworkUrl: null,
|
|
100183
101923
|
mute: false,
|
|
100184
101924
|
source: null,
|
|
101925
|
+
channel: null,
|
|
100185
101926
|
shuffle: false,
|
|
100186
101927
|
repeat: false,
|
|
100187
101928
|
shuffleReadOnly: false,
|
|
@@ -100246,6 +101987,13 @@ function derivePowerGatedView(status, features, extras) {
|
|
|
100246
101987
|
runningReading
|
|
100247
101988
|
};
|
|
100248
101989
|
}
|
|
101990
|
+
/** The channel being watched: only a media item the device itself calls a channel. */
|
|
101991
|
+
function channelOf(status) {
|
|
101992
|
+
const media = status.currentMedia;
|
|
101993
|
+
if (media === null || media === void 0 || media.type !== "channel") return null;
|
|
101994
|
+
const title = media.title.trim();
|
|
101995
|
+
return title === "" ? null : title;
|
|
101996
|
+
}
|
|
100249
101997
|
function deriveFromStatus(status, features) {
|
|
100250
101998
|
const has = (f) => features?.includes(f) ?? false;
|
|
100251
101999
|
const canSwitchPower = has(require_device_type.DeviceFeature.MediaPlayerPower);
|
|
@@ -100287,55 +102035,24 @@ function deriveFromStatus(status, features) {
|
|
|
100287
102035
|
options,
|
|
100288
102036
|
selectable: has(require_device_type.DeviceFeature.MediaPlayerSelectSource) && options.length > 1
|
|
100289
102037
|
} : null,
|
|
102038
|
+
channel: has(require_device_type.DeviceFeature.MediaPlayerChannelStep) ? { current: channelOf(status) } : null,
|
|
100290
102039
|
shuffle: has(require_device_type.DeviceFeature.MediaPlayerShuffle) && status.shuffle !== null,
|
|
100291
102040
|
repeat: has(require_device_type.DeviceFeature.MediaPlayerRepeat) && status.repeat !== null
|
|
100292
102041
|
};
|
|
100293
102042
|
}
|
|
100294
102043
|
//#endregion
|
|
100295
102044
|
//#region src/device/hero/hero-contributions.ts
|
|
100296
|
-
/**
|
|
100297
|
-
|
|
100298
|
-
|
|
100299
|
-
|
|
100300
|
-
|
|
100301
|
-
|
|
100302
|
-
|
|
100303
|
-
|
|
100304
|
-
|
|
100305
|
-
|
|
100306
|
-
|
|
100307
|
-
return {
|
|
100308
|
-
id,
|
|
100309
|
-
label,
|
|
100310
|
-
icon,
|
|
100311
|
-
call: {
|
|
100312
|
-
cap,
|
|
100313
|
-
method,
|
|
100314
|
-
args
|
|
100315
|
-
},
|
|
100316
|
-
emphasis,
|
|
100317
|
-
confirm
|
|
100318
|
-
};
|
|
100319
|
-
}
|
|
100320
|
-
var asAction = (a) => ({
|
|
100321
|
-
kind: "action",
|
|
100322
|
-
action: a
|
|
100323
|
-
});
|
|
100324
|
-
function reading(source, state, assumed = false) {
|
|
100325
|
-
return {
|
|
100326
|
-
source,
|
|
100327
|
-
state,
|
|
100328
|
-
assumed
|
|
100329
|
-
};
|
|
100330
|
-
}
|
|
100331
|
-
function fact(id, icon, text, tone = "muted") {
|
|
100332
|
-
return {
|
|
100333
|
-
id,
|
|
100334
|
-
icon,
|
|
100335
|
-
text,
|
|
100336
|
-
tone
|
|
100337
|
-
};
|
|
100338
|
-
}
|
|
102045
|
+
/**
|
|
102046
|
+
* What each capability contributes to a hero (D1023). The map is typed against
|
|
102047
|
+
* the cap's own status schema: a slice is parsed at the boundary, and one that
|
|
102048
|
+
* does not parse reads as "not answered", never as a value.
|
|
102049
|
+
*
|
|
102050
|
+
* Capabilities contribute, device types never do (D14): nothing here looks at a
|
|
102051
|
+
* vendor. A type only chooses which ROWS its layout carries and how it looks.
|
|
102052
|
+
* `HERO_CAP_COVERAGE` (the second file of this directory) says, for every
|
|
102053
|
+
* device cap, whether it contributes and why it does not; the guard
|
|
102054
|
+
* `scripts/check-cap-hero-contributions.ts` keeps it complete.
|
|
102055
|
+
*/
|
|
100339
102056
|
function minutesLeft(seconds) {
|
|
100340
102057
|
const m = Math.ceil(seconds / 60);
|
|
100341
102058
|
return require_sleep.t(`${m} min left`, `${m} min rimanenti`);
|
|
@@ -100693,6 +102410,15 @@ var HERO_CAP_CONTRIBUTIONS = [
|
|
|
100693
102410
|
status: null,
|
|
100694
102411
|
controls: volume
|
|
100695
102412
|
});
|
|
102413
|
+
if (view.channel !== null) {
|
|
102414
|
+
const channel = view.channel.current;
|
|
102415
|
+
rows.push({
|
|
102416
|
+
id: "channel",
|
|
102417
|
+
icon: "tv",
|
|
102418
|
+
status: channel === null ? null : require_sleep.t(channel, channel),
|
|
102419
|
+
controls: [asAction(action("channel.down", require_sleep.t("Channel down", "Canale giù"), "chevron-down", "media-player", "channelDown")), asAction(action("channel.up", require_sleep.t("Channel up", "Canale su"), "chevron-up", "media-player", "channelUp"))]
|
|
102420
|
+
});
|
|
102421
|
+
}
|
|
100696
102422
|
if (view.source !== null) {
|
|
100697
102423
|
const current = view.source.current === "" ? null : view.source.current;
|
|
100698
102424
|
rows.push({
|
|
@@ -100753,7 +102479,13 @@ var HERO_CAP_CONTRIBUTIONS = [
|
|
|
100753
102479
|
powerSourceContribution,
|
|
100754
102480
|
remoteContribution,
|
|
100755
102481
|
consumablesContribution,
|
|
100756
|
-
dishwasherContribution
|
|
102482
|
+
dishwasherContribution,
|
|
102483
|
+
...Object.values(ACCESS_FAMILY_CONTRIBUTIONS),
|
|
102484
|
+
...Object.values(DEVICES_FAMILY_CONTRIBUTIONS),
|
|
102485
|
+
...Object.values(GROUPS_FAMILY_CONTRIBUTIONS),
|
|
102486
|
+
...Object.values(ACTUATORS_FAMILY_CONTRIBUTIONS),
|
|
102487
|
+
...Object.values(SENSORS_FAMILY_CONTRIBUTIONS),
|
|
102488
|
+
...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS)
|
|
100757
102489
|
];
|
|
100758
102490
|
//#endregion
|
|
100759
102491
|
//#region src/device/hero/hero-layout.ts
|
|
@@ -100774,7 +102506,9 @@ var MEDIA_PLAYER_LAYOUT = { rows: [
|
|
|
100774
102506
|
"now-playing",
|
|
100775
102507
|
"playback",
|
|
100776
102508
|
"volume",
|
|
100777
|
-
"
|
|
102509
|
+
"channel",
|
|
102510
|
+
"source",
|
|
102511
|
+
"do-not-disturb"
|
|
100778
102512
|
] };
|
|
100779
102513
|
var APPLIANCE_LAYOUT = { rows: ["cycle"] };
|
|
100780
102514
|
/** Its Home Connect PowerState is a secondary row action, never the own-power slot. */
|
|
@@ -100783,40 +102517,66 @@ var DISHWASHER_LAYOUT = { rows: [
|
|
|
100783
102517
|
"program",
|
|
100784
102518
|
"appliance-power"
|
|
100785
102519
|
] };
|
|
102520
|
+
var CLIMATE_LAYOUT = { rows: [
|
|
102521
|
+
"climate-mode",
|
|
102522
|
+
"climate-fan",
|
|
102523
|
+
"setpoint"
|
|
102524
|
+
] };
|
|
100786
102525
|
var SWITCH_LAYOUT = { rows: ["motion-trigger"] };
|
|
102526
|
+
var LOCK_LAYOUT = { rows: ["lock"] };
|
|
102527
|
+
var ALARM_LAYOUT = { rows: ["alarm"] };
|
|
102528
|
+
var FAN_LAYOUT = { rows: ["fan"] };
|
|
102529
|
+
var VACUUM_LAYOUT = { rows: ["vacuum"] };
|
|
102530
|
+
var MOWER_LAYOUT = { rows: ["mower"] };
|
|
102531
|
+
var FEEDER_LAYOUT = { rows: ["feeder"] };
|
|
102532
|
+
var FOUNTAIN_LAYOUT = { rows: ["fountain", "pump-cycle"] };
|
|
102533
|
+
var AUTOMATION_LAYOUT = { rows: ["automation"] };
|
|
102534
|
+
var SCRIPT_LAYOUT = { rows: ["script"] };
|
|
102535
|
+
var LIGHT_LAYOUT = { rows: [
|
|
102536
|
+
"brightness",
|
|
102537
|
+
"color",
|
|
102538
|
+
"contact",
|
|
102539
|
+
"motion-trigger"
|
|
102540
|
+
] };
|
|
102541
|
+
var COVER_LAYOUT = { rows: ["cover"] };
|
|
102542
|
+
var VALVE_LAYOUT = { rows: ["valve"] };
|
|
102543
|
+
var HUMIDIFIER_LAYOUT = { rows: ["humidifier"] };
|
|
102544
|
+
var UPDATE_LAYOUT = { rows: ["update"] };
|
|
102545
|
+
var CONTROL_LAYOUT = { rows: ["control"] };
|
|
102546
|
+
var BUTTON_LAYOUT = { rows: ["button"] };
|
|
100787
102547
|
var HERO_LAYOUT_BY_TYPE = {
|
|
100788
102548
|
[require_device_type.DeviceType.Camera]: HERO_LAYOUT_DEFAULT,
|
|
100789
102549
|
[require_device_type.DeviceType.Hub]: HERO_LAYOUT_DEFAULT,
|
|
100790
|
-
[require_device_type.DeviceType.Light]:
|
|
102550
|
+
[require_device_type.DeviceType.Light]: LIGHT_LAYOUT,
|
|
100791
102551
|
[require_device_type.DeviceType.Siren]: HERO_LAYOUT_DEFAULT,
|
|
100792
102552
|
[require_device_type.DeviceType.Switch]: SWITCH_LAYOUT,
|
|
100793
102553
|
[require_device_type.DeviceType.Sensor]: HERO_LAYOUT_DEFAULT,
|
|
100794
|
-
[require_device_type.DeviceType.Thermostat]:
|
|
100795
|
-
[require_device_type.DeviceType.Climate]:
|
|
100796
|
-
[require_device_type.DeviceType.Button]:
|
|
102554
|
+
[require_device_type.DeviceType.Thermostat]: CLIMATE_LAYOUT,
|
|
102555
|
+
[require_device_type.DeviceType.Climate]: CLIMATE_LAYOUT,
|
|
102556
|
+
[require_device_type.DeviceType.Button]: BUTTON_LAYOUT,
|
|
100797
102557
|
[require_device_type.DeviceType.EventEmitter]: HERO_LAYOUT_DEFAULT,
|
|
100798
|
-
[require_device_type.DeviceType.Update]:
|
|
102558
|
+
[require_device_type.DeviceType.Update]: UPDATE_LAYOUT,
|
|
100799
102559
|
[require_device_type.DeviceType.Generic]: HERO_LAYOUT_DEFAULT,
|
|
100800
102560
|
[require_device_type.DeviceType.Notifier]: HERO_LAYOUT_DEFAULT,
|
|
100801
|
-
[require_device_type.DeviceType.Script]:
|
|
100802
|
-
[require_device_type.DeviceType.Automation]:
|
|
100803
|
-
[require_device_type.DeviceType.Lock]:
|
|
100804
|
-
[require_device_type.DeviceType.Cover]:
|
|
100805
|
-
[require_device_type.DeviceType.Valve]:
|
|
100806
|
-
[require_device_type.DeviceType.Humidifier]:
|
|
100807
|
-
[require_device_type.DeviceType.WaterHeater]:
|
|
100808
|
-
[require_device_type.DeviceType.Fan]:
|
|
102561
|
+
[require_device_type.DeviceType.Script]: SCRIPT_LAYOUT,
|
|
102562
|
+
[require_device_type.DeviceType.Automation]: AUTOMATION_LAYOUT,
|
|
102563
|
+
[require_device_type.DeviceType.Lock]: LOCK_LAYOUT,
|
|
102564
|
+
[require_device_type.DeviceType.Cover]: COVER_LAYOUT,
|
|
102565
|
+
[require_device_type.DeviceType.Valve]: VALVE_LAYOUT,
|
|
102566
|
+
[require_device_type.DeviceType.Humidifier]: HUMIDIFIER_LAYOUT,
|
|
102567
|
+
[require_device_type.DeviceType.WaterHeater]: CLIMATE_LAYOUT,
|
|
102568
|
+
[require_device_type.DeviceType.Fan]: FAN_LAYOUT,
|
|
100809
102569
|
[require_device_type.DeviceType.MediaPlayer]: MEDIA_PLAYER_LAYOUT,
|
|
100810
|
-
[require_device_type.DeviceType.AlarmPanel]:
|
|
100811
|
-
[require_device_type.DeviceType.Control]:
|
|
102570
|
+
[require_device_type.DeviceType.AlarmPanel]: ALARM_LAYOUT,
|
|
102571
|
+
[require_device_type.DeviceType.Control]: CONTROL_LAYOUT,
|
|
100812
102572
|
[require_device_type.DeviceType.Presence]: HERO_LAYOUT_DEFAULT,
|
|
100813
102573
|
[require_device_type.DeviceType.Weather]: HERO_LAYOUT_DEFAULT,
|
|
100814
|
-
[require_device_type.DeviceType.Vacuum]:
|
|
100815
|
-
[require_device_type.DeviceType.LawnMower]:
|
|
102574
|
+
[require_device_type.DeviceType.Vacuum]: VACUUM_LAYOUT,
|
|
102575
|
+
[require_device_type.DeviceType.LawnMower]: MOWER_LAYOUT,
|
|
100816
102576
|
[require_device_type.DeviceType.Container]: HERO_LAYOUT_DEFAULT,
|
|
100817
102577
|
[require_device_type.DeviceType.Image]: HERO_LAYOUT_DEFAULT,
|
|
100818
|
-
[require_device_type.DeviceType.PetFeeder]:
|
|
100819
|
-
[require_device_type.DeviceType.PetFountain]:
|
|
102578
|
+
[require_device_type.DeviceType.PetFeeder]: FEEDER_LAYOUT,
|
|
102579
|
+
[require_device_type.DeviceType.PetFountain]: FOUNTAIN_LAYOUT,
|
|
100820
102580
|
[require_device_type.DeviceType.Dishwasher]: DISHWASHER_LAYOUT,
|
|
100821
102581
|
[require_device_type.DeviceType.Washer]: APPLIANCE_LAYOUT,
|
|
100822
102582
|
[require_device_type.DeviceType.Heater]: HEATER_LAYOUT,
|
|
@@ -101005,25 +102765,413 @@ var DISHWASHER_LOOK = lookOf({
|
|
|
101005
102765
|
idle: INFO,
|
|
101006
102766
|
standby: WARN
|
|
101007
102767
|
});
|
|
101008
|
-
|
|
101009
|
-
|
|
102768
|
+
/** A sensor that reads Clear or Detected: calm when clear, an alarm when it trips. */
|
|
102769
|
+
function sensorLook(icon, alertIcon = icon) {
|
|
102770
|
+
return lookOf({
|
|
102771
|
+
icon,
|
|
102772
|
+
on: [
|
|
102773
|
+
"primary",
|
|
102774
|
+
"glow",
|
|
102775
|
+
"halo"
|
|
102776
|
+
],
|
|
102777
|
+
off: MUTED,
|
|
102778
|
+
running: [
|
|
102779
|
+
"primary",
|
|
102780
|
+
"glow",
|
|
102781
|
+
"halo"
|
|
102782
|
+
],
|
|
102783
|
+
idle: [
|
|
102784
|
+
"success",
|
|
102785
|
+
"plain",
|
|
102786
|
+
"none"
|
|
102787
|
+
],
|
|
102788
|
+
standby: WARN,
|
|
102789
|
+
alert: look(alertIcon, "danger", "alert-wash", "pulse")
|
|
102790
|
+
});
|
|
102791
|
+
}
|
|
102792
|
+
var LEAK_LOOK = sensorLook("droplets");
|
|
102793
|
+
var SMOKE_LOOK = sensorLook("flame");
|
|
102794
|
+
var GAS_LOOK = sensorLook("wind");
|
|
102795
|
+
var TAMPER_LOOK = sensorLook("shield-alert");
|
|
102796
|
+
var VIBRATION_LOOK = sensorLook("vibrate");
|
|
102797
|
+
var MOTION_LOOK = sensorLook("radar", "triangle-alert");
|
|
102798
|
+
var DOORBELL_LOOK = sensorLook("bell-ring");
|
|
102799
|
+
/** A camera is a camera: never a power glyph, whatever its motion reads. */
|
|
102800
|
+
var CAMERA_LOOK = sensorLook("video", "triangle-alert");
|
|
102801
|
+
/** A bulb glows while lit. */
|
|
102802
|
+
var LIGHT_LOOK = lookOf({
|
|
102803
|
+
icon: "lightbulb",
|
|
101010
102804
|
on: [
|
|
101011
|
-
"
|
|
102805
|
+
"warning",
|
|
102806
|
+
"glow",
|
|
102807
|
+
"glow"
|
|
102808
|
+
],
|
|
102809
|
+
off: MUTED,
|
|
102810
|
+
running: [
|
|
102811
|
+
"warning",
|
|
102812
|
+
"glow",
|
|
102813
|
+
"glow"
|
|
102814
|
+
],
|
|
102815
|
+
idle: INFO,
|
|
102816
|
+
standby: WARN
|
|
102817
|
+
});
|
|
102818
|
+
/** Closed is a position, not an absence of power: the blind keeps its glyph and goes quiet. */
|
|
102819
|
+
var COVER_LOOK = lookOf({
|
|
102820
|
+
icon: "blinds",
|
|
102821
|
+
on: [
|
|
102822
|
+
"primary",
|
|
102823
|
+
"plain",
|
|
102824
|
+
"none"
|
|
102825
|
+
],
|
|
102826
|
+
off: MUTED,
|
|
102827
|
+
running: [
|
|
102828
|
+
"primary",
|
|
102829
|
+
"plain",
|
|
102830
|
+
"pulse"
|
|
102831
|
+
],
|
|
102832
|
+
idle: INFO,
|
|
102833
|
+
standby: WARN
|
|
102834
|
+
});
|
|
102835
|
+
var VALVE_LOOK = lookOf({
|
|
102836
|
+
icon: "droplet",
|
|
102837
|
+
on: [
|
|
102838
|
+
"primary",
|
|
101012
102839
|
"water",
|
|
101013
102840
|
"wave"
|
|
101014
102841
|
],
|
|
101015
102842
|
off: MUTED,
|
|
101016
102843
|
running: [
|
|
101017
|
-
"
|
|
102844
|
+
"primary",
|
|
101018
102845
|
"water",
|
|
102846
|
+
"pulse"
|
|
102847
|
+
],
|
|
102848
|
+
idle: INFO,
|
|
102849
|
+
standby: WARN
|
|
102850
|
+
});
|
|
102851
|
+
var HUMIDIFIER_LOOK = lookOf({
|
|
102852
|
+
icon: "droplets",
|
|
102853
|
+
on: [
|
|
102854
|
+
"info",
|
|
102855
|
+
"mist",
|
|
102856
|
+
"breathe"
|
|
102857
|
+
],
|
|
102858
|
+
off: MUTED,
|
|
102859
|
+
running: [
|
|
102860
|
+
"info",
|
|
102861
|
+
"mist",
|
|
101019
102862
|
"wave"
|
|
101020
102863
|
],
|
|
101021
102864
|
idle: INFO,
|
|
101022
|
-
standby: WARN
|
|
101023
|
-
alert: look("droplets", "danger", "alert-wash", "pulse")
|
|
102865
|
+
standby: WARN
|
|
101024
102866
|
});
|
|
101025
|
-
var
|
|
101026
|
-
icon: "
|
|
102867
|
+
var CONTROL_LOOK = lookOf({
|
|
102868
|
+
icon: "sliders-horizontal",
|
|
102869
|
+
on: [
|
|
102870
|
+
"primary",
|
|
102871
|
+
"plain",
|
|
102872
|
+
"none"
|
|
102873
|
+
],
|
|
102874
|
+
off: MUTED,
|
|
102875
|
+
running: [
|
|
102876
|
+
"primary",
|
|
102877
|
+
"plain",
|
|
102878
|
+
"pulse"
|
|
102879
|
+
],
|
|
102880
|
+
idle: INFO,
|
|
102881
|
+
standby: WARN
|
|
102882
|
+
});
|
|
102883
|
+
var PRESENCE_LOOK = lookOf({
|
|
102884
|
+
icon: "map-pin",
|
|
102885
|
+
on: [
|
|
102886
|
+
"success",
|
|
102887
|
+
"plain",
|
|
102888
|
+
"none"
|
|
102889
|
+
],
|
|
102890
|
+
off: MUTED,
|
|
102891
|
+
running: [
|
|
102892
|
+
"primary",
|
|
102893
|
+
"plain",
|
|
102894
|
+
"pulse"
|
|
102895
|
+
],
|
|
102896
|
+
idle: INFO,
|
|
102897
|
+
standby: WARN
|
|
102898
|
+
});
|
|
102899
|
+
var WEATHER_LOOK = lookOf({
|
|
102900
|
+
icon: "cloud-sun",
|
|
102901
|
+
on: [
|
|
102902
|
+
"info",
|
|
102903
|
+
"sky",
|
|
102904
|
+
"none"
|
|
102905
|
+
],
|
|
102906
|
+
off: MUTED,
|
|
102907
|
+
running: [
|
|
102908
|
+
"info",
|
|
102909
|
+
"sky",
|
|
102910
|
+
"none"
|
|
102911
|
+
],
|
|
102912
|
+
idle: INFO,
|
|
102913
|
+
standby: WARN
|
|
102914
|
+
});
|
|
102915
|
+
/** An update waits (warning), runs (pulse) or is done (calm). */
|
|
102916
|
+
var UPDATE_LOOK = lookOf({
|
|
102917
|
+
icon: "download",
|
|
102918
|
+
on: [
|
|
102919
|
+
"success",
|
|
102920
|
+
"plain",
|
|
102921
|
+
"none"
|
|
102922
|
+
],
|
|
102923
|
+
off: MUTED,
|
|
102924
|
+
running: [
|
|
102925
|
+
"primary",
|
|
102926
|
+
"plain",
|
|
102927
|
+
"pulse"
|
|
102928
|
+
],
|
|
102929
|
+
idle: [
|
|
102930
|
+
"success",
|
|
102931
|
+
"plain",
|
|
102932
|
+
"none"
|
|
102933
|
+
],
|
|
102934
|
+
standby: [
|
|
102935
|
+
"warning",
|
|
102936
|
+
"plain",
|
|
102937
|
+
"pulse"
|
|
102938
|
+
]
|
|
102939
|
+
});
|
|
102940
|
+
var BUTTON_LOOK = lookOf({
|
|
102941
|
+
icon: "pointer",
|
|
102942
|
+
on: [
|
|
102943
|
+
"primary",
|
|
102944
|
+
"plain",
|
|
102945
|
+
"none"
|
|
102946
|
+
],
|
|
102947
|
+
off: MUTED,
|
|
102948
|
+
running: [
|
|
102949
|
+
"primary",
|
|
102950
|
+
"plain",
|
|
102951
|
+
"pulse"
|
|
102952
|
+
],
|
|
102953
|
+
idle: INFO,
|
|
102954
|
+
standby: WARN
|
|
102955
|
+
});
|
|
102956
|
+
var IMAGE_LOOK = lookOf({
|
|
102957
|
+
icon: "image",
|
|
102958
|
+
on: [
|
|
102959
|
+
"primary",
|
|
102960
|
+
"plain",
|
|
102961
|
+
"none"
|
|
102962
|
+
],
|
|
102963
|
+
off: MUTED,
|
|
102964
|
+
running: [
|
|
102965
|
+
"primary",
|
|
102966
|
+
"plain",
|
|
102967
|
+
"pulse"
|
|
102968
|
+
],
|
|
102969
|
+
idle: INFO,
|
|
102970
|
+
standby: WARN
|
|
102971
|
+
});
|
|
102972
|
+
/** A lock is secure when locked, and says so when it is not. */
|
|
102973
|
+
var LOCK_LOOK = {
|
|
102974
|
+
...lookOf({
|
|
102975
|
+
icon: "lock",
|
|
102976
|
+
on: [
|
|
102977
|
+
"success",
|
|
102978
|
+
"plain",
|
|
102979
|
+
"none"
|
|
102980
|
+
],
|
|
102981
|
+
off: MUTED,
|
|
102982
|
+
running: [
|
|
102983
|
+
"primary",
|
|
102984
|
+
"plain",
|
|
102985
|
+
"pulse"
|
|
102986
|
+
],
|
|
102987
|
+
idle: INFO,
|
|
102988
|
+
standby: WARN
|
|
102989
|
+
}),
|
|
102990
|
+
standby: look("lock-open", "warning", "plain", "none"),
|
|
102991
|
+
off: look("lock-open", "muted", "plain", "none")
|
|
102992
|
+
};
|
|
102993
|
+
/** The shield glows while armed, blinks red in alarm and goes quiet when disarmed. */
|
|
102994
|
+
var ALARM_LOOK = {
|
|
102995
|
+
...lookOf({
|
|
102996
|
+
icon: "shield-check",
|
|
102997
|
+
on: [
|
|
102998
|
+
"success",
|
|
102999
|
+
"glow",
|
|
103000
|
+
"halo"
|
|
103001
|
+
],
|
|
103002
|
+
off: MUTED,
|
|
103003
|
+
running: [
|
|
103004
|
+
"primary",
|
|
103005
|
+
"plain",
|
|
103006
|
+
"pulse"
|
|
103007
|
+
],
|
|
103008
|
+
idle: INFO,
|
|
103009
|
+
standby: WARN
|
|
103010
|
+
}),
|
|
103011
|
+
off: look("shield-off", "muted", "plain", "none"),
|
|
103012
|
+
standby: look("shield", "warning", "plain", "pulse"),
|
|
103013
|
+
alert: look("shield-alert", "danger", "alert-wash", "blink")
|
|
103014
|
+
};
|
|
103015
|
+
/** Blades turn only while air moves. */
|
|
103016
|
+
var FAN_LOOK = lookOf({
|
|
103017
|
+
icon: "fan",
|
|
103018
|
+
on: [
|
|
103019
|
+
"success",
|
|
103020
|
+
"plain",
|
|
103021
|
+
"none"
|
|
103022
|
+
],
|
|
103023
|
+
off: MUTED,
|
|
103024
|
+
running: [
|
|
103025
|
+
"primary",
|
|
103026
|
+
"mist",
|
|
103027
|
+
"spin"
|
|
103028
|
+
],
|
|
103029
|
+
idle: INFO,
|
|
103030
|
+
standby: WARN
|
|
103031
|
+
});
|
|
103032
|
+
var VACUUM_LOOK = lookOf({
|
|
103033
|
+
icon: "bot",
|
|
103034
|
+
on: [
|
|
103035
|
+
"success",
|
|
103036
|
+
"plain",
|
|
103037
|
+
"none"
|
|
103038
|
+
],
|
|
103039
|
+
off: MUTED,
|
|
103040
|
+
running: [
|
|
103041
|
+
"primary",
|
|
103042
|
+
"plain",
|
|
103043
|
+
"pulse"
|
|
103044
|
+
],
|
|
103045
|
+
idle: INFO,
|
|
103046
|
+
standby: WARN
|
|
103047
|
+
});
|
|
103048
|
+
var MOWER_LOOK = lookOf({
|
|
103049
|
+
icon: "sprout",
|
|
103050
|
+
on: [
|
|
103051
|
+
"success",
|
|
103052
|
+
"plain",
|
|
103053
|
+
"none"
|
|
103054
|
+
],
|
|
103055
|
+
off: MUTED,
|
|
103056
|
+
running: [
|
|
103057
|
+
"primary",
|
|
103058
|
+
"plain",
|
|
103059
|
+
"pulse"
|
|
103060
|
+
],
|
|
103061
|
+
idle: INFO,
|
|
103062
|
+
standby: WARN
|
|
103063
|
+
});
|
|
103064
|
+
var FEEDER_LOOK = lookOf({
|
|
103065
|
+
icon: "bone",
|
|
103066
|
+
on: [
|
|
103067
|
+
"success",
|
|
103068
|
+
"plain",
|
|
103069
|
+
"none"
|
|
103070
|
+
],
|
|
103071
|
+
off: MUTED,
|
|
103072
|
+
running: [
|
|
103073
|
+
"primary",
|
|
103074
|
+
"plain",
|
|
103075
|
+
"pulse"
|
|
103076
|
+
],
|
|
103077
|
+
idle: INFO,
|
|
103078
|
+
standby: WARN
|
|
103079
|
+
});
|
|
103080
|
+
var FOUNTAIN_LOOK = lookOf({
|
|
103081
|
+
icon: "droplets",
|
|
103082
|
+
on: [
|
|
103083
|
+
"success",
|
|
103084
|
+
"plain",
|
|
103085
|
+
"none"
|
|
103086
|
+
],
|
|
103087
|
+
off: MUTED,
|
|
103088
|
+
running: [
|
|
103089
|
+
"primary",
|
|
103090
|
+
"water",
|
|
103091
|
+
"wave"
|
|
103092
|
+
],
|
|
103093
|
+
idle: INFO,
|
|
103094
|
+
standby: WARN
|
|
103095
|
+
});
|
|
103096
|
+
var AUTOMATION_LOOK = lookOf({
|
|
103097
|
+
icon: "workflow",
|
|
103098
|
+
on: [
|
|
103099
|
+
"success",
|
|
103100
|
+
"plain",
|
|
103101
|
+
"none"
|
|
103102
|
+
],
|
|
103103
|
+
off: MUTED,
|
|
103104
|
+
running: [
|
|
103105
|
+
"primary",
|
|
103106
|
+
"plain",
|
|
103107
|
+
"pulse"
|
|
103108
|
+
],
|
|
103109
|
+
idle: INFO,
|
|
103110
|
+
standby: WARN
|
|
103111
|
+
});
|
|
103112
|
+
var SCRIPT_LOOK = lookOf({
|
|
103113
|
+
icon: "scroll-text",
|
|
103114
|
+
on: [
|
|
103115
|
+
"success",
|
|
103116
|
+
"plain",
|
|
103117
|
+
"none"
|
|
103118
|
+
],
|
|
103119
|
+
off: MUTED,
|
|
103120
|
+
running: [
|
|
103121
|
+
"primary",
|
|
103122
|
+
"plain",
|
|
103123
|
+
"pulse"
|
|
103124
|
+
],
|
|
103125
|
+
idle: INFO,
|
|
103126
|
+
standby: WARN
|
|
103127
|
+
});
|
|
103128
|
+
var EVENT_EMITTER_LOOK = lookOf({
|
|
103129
|
+
icon: "radio-tower",
|
|
103130
|
+
on: [
|
|
103131
|
+
"success",
|
|
103132
|
+
"plain",
|
|
103133
|
+
"none"
|
|
103134
|
+
],
|
|
103135
|
+
off: MUTED,
|
|
103136
|
+
running: [
|
|
103137
|
+
"primary",
|
|
103138
|
+
"plain",
|
|
103139
|
+
"pulse"
|
|
103140
|
+
],
|
|
103141
|
+
idle: INFO,
|
|
103142
|
+
standby: WARN
|
|
103143
|
+
});
|
|
103144
|
+
/** A reading device: the value is the headline, the look only says what kind of reading it is. */
|
|
103145
|
+
function readingLook(icon, tone) {
|
|
103146
|
+
return lookOf({
|
|
103147
|
+
icon,
|
|
103148
|
+
on: [
|
|
103149
|
+
tone,
|
|
103150
|
+
"plain",
|
|
103151
|
+
"none"
|
|
103152
|
+
],
|
|
103153
|
+
off: MUTED,
|
|
103154
|
+
running: [
|
|
103155
|
+
tone,
|
|
103156
|
+
"plain",
|
|
103157
|
+
"none"
|
|
103158
|
+
],
|
|
103159
|
+
idle: [
|
|
103160
|
+
tone,
|
|
103161
|
+
"plain",
|
|
103162
|
+
"none"
|
|
103163
|
+
],
|
|
103164
|
+
standby: MUTED
|
|
103165
|
+
});
|
|
103166
|
+
}
|
|
103167
|
+
var READING_SENSOR_LOOK = readingLook("gauge", "info");
|
|
103168
|
+
var TEMPERATURE_LOOK = readingLook("thermometer", "info");
|
|
103169
|
+
var HUMIDITY_LOOK = readingLook("droplets", "info");
|
|
103170
|
+
var AIR_QUALITY_LOOK = readingLook("wind", "success");
|
|
103171
|
+
var LIGHT_SENSOR_LOOK = readingLook("sun", "warning");
|
|
103172
|
+
/** Carbon monoxide: calm is a shield, detected is the alarm. */
|
|
103173
|
+
var CO_LOOK = lookOf({
|
|
103174
|
+
icon: "shield-check",
|
|
101027
103175
|
on: [
|
|
101028
103176
|
"danger",
|
|
101029
103177
|
"alert-wash",
|
|
@@ -101035,43 +103183,109 @@ var SMOKE_LOOK = lookOf({
|
|
|
101035
103183
|
"alert-wash",
|
|
101036
103184
|
"pulse"
|
|
101037
103185
|
],
|
|
103186
|
+
idle: [
|
|
103187
|
+
"success",
|
|
103188
|
+
"plain",
|
|
103189
|
+
"none"
|
|
103190
|
+
],
|
|
103191
|
+
standby: MUTED,
|
|
103192
|
+
alert: look("triangle-alert", "danger", "alert-wash", "pulse")
|
|
103193
|
+
});
|
|
103194
|
+
/** Heating and cooling devices: the mode (see {@link HERO_MODE_LOOK}) picks the picture while on. */
|
|
103195
|
+
var THERMOSTAT_LOOK = lookOf({
|
|
103196
|
+
icon: "thermometer",
|
|
103197
|
+
on: [
|
|
103198
|
+
"primary",
|
|
103199
|
+
"plain",
|
|
103200
|
+
"none"
|
|
103201
|
+
],
|
|
103202
|
+
off: MUTED,
|
|
103203
|
+
running: [
|
|
103204
|
+
"warning",
|
|
103205
|
+
"heat-rise",
|
|
103206
|
+
"rise"
|
|
103207
|
+
],
|
|
103208
|
+
idle: INFO,
|
|
103209
|
+
standby: MUTED
|
|
103210
|
+
});
|
|
103211
|
+
var CLIMATE_LOOK = lookOf({
|
|
103212
|
+
icon: "snowflake",
|
|
103213
|
+
on: [
|
|
103214
|
+
"primary",
|
|
103215
|
+
"plain",
|
|
103216
|
+
"none"
|
|
103217
|
+
],
|
|
103218
|
+
off: MUTED,
|
|
103219
|
+
running: [
|
|
103220
|
+
"primary",
|
|
103221
|
+
"plain",
|
|
103222
|
+
"none"
|
|
103223
|
+
],
|
|
103224
|
+
idle: INFO,
|
|
103225
|
+
standby: MUTED
|
|
103226
|
+
});
|
|
103227
|
+
var WATER_HEATER_LOOK = lookOf({
|
|
103228
|
+
icon: "thermometer-sun",
|
|
103229
|
+
on: [
|
|
103230
|
+
"warning",
|
|
103231
|
+
"heat-rise",
|
|
103232
|
+
"rise"
|
|
103233
|
+
],
|
|
103234
|
+
off: MUTED,
|
|
103235
|
+
running: [
|
|
103236
|
+
"warning",
|
|
103237
|
+
"heat-rise",
|
|
103238
|
+
"rise"
|
|
103239
|
+
],
|
|
101038
103240
|
idle: INFO,
|
|
101039
|
-
standby:
|
|
101040
|
-
alert: look("flame", "danger", "alert-wash", "pulse")
|
|
103241
|
+
standby: MUTED
|
|
101041
103242
|
});
|
|
103243
|
+
/** What a climate device draws while it is on, by mode: warm air rises, cold falls, drops dry, the fan spins. */
|
|
103244
|
+
var HERO_MODE_LOOK = {
|
|
103245
|
+
heat: look("flame", "warning", "heat-rise", "rise"),
|
|
103246
|
+
cool: look("snowflake", "info", "cool-fall", "fall"),
|
|
103247
|
+
dry: look("droplets", "info", "water", "wave"),
|
|
103248
|
+
fan: look("fan", "primary", "plain", "spin"),
|
|
103249
|
+
auto: look("thermometer", "success", "glow", "glow"),
|
|
103250
|
+
playing: null,
|
|
103251
|
+
paused: null,
|
|
103252
|
+
open: null,
|
|
103253
|
+
closed: null
|
|
103254
|
+
};
|
|
103255
|
+
var MODE_LOOK_TYPES = [require_device_type.DeviceType.Climate, require_device_type.DeviceType.Thermostat];
|
|
101042
103256
|
var HERO_LOOK_BY_TYPE = {
|
|
101043
|
-
[require_device_type.DeviceType.Camera]:
|
|
103257
|
+
[require_device_type.DeviceType.Camera]: CAMERA_LOOK,
|
|
101044
103258
|
[require_device_type.DeviceType.Hub]: HERO_LOOK_DEFAULT,
|
|
101045
|
-
[require_device_type.DeviceType.Light]:
|
|
103259
|
+
[require_device_type.DeviceType.Light]: LIGHT_LOOK,
|
|
101046
103260
|
[require_device_type.DeviceType.Siren]: HERO_LOOK_DEFAULT,
|
|
101047
103261
|
[require_device_type.DeviceType.Switch]: SWITCH_LOOK,
|
|
101048
|
-
[require_device_type.DeviceType.Sensor]:
|
|
101049
|
-
[require_device_type.DeviceType.Thermostat]:
|
|
101050
|
-
[require_device_type.DeviceType.Climate]:
|
|
101051
|
-
[require_device_type.DeviceType.Button]:
|
|
101052
|
-
[require_device_type.DeviceType.EventEmitter]:
|
|
101053
|
-
[require_device_type.DeviceType.Update]:
|
|
103262
|
+
[require_device_type.DeviceType.Sensor]: READING_SENSOR_LOOK,
|
|
103263
|
+
[require_device_type.DeviceType.Thermostat]: THERMOSTAT_LOOK,
|
|
103264
|
+
[require_device_type.DeviceType.Climate]: CLIMATE_LOOK,
|
|
103265
|
+
[require_device_type.DeviceType.Button]: BUTTON_LOOK,
|
|
103266
|
+
[require_device_type.DeviceType.EventEmitter]: EVENT_EMITTER_LOOK,
|
|
103267
|
+
[require_device_type.DeviceType.Update]: UPDATE_LOOK,
|
|
101054
103268
|
[require_device_type.DeviceType.Generic]: HERO_LOOK_DEFAULT,
|
|
101055
103269
|
[require_device_type.DeviceType.Notifier]: HERO_LOOK_DEFAULT,
|
|
101056
|
-
[require_device_type.DeviceType.Script]:
|
|
101057
|
-
[require_device_type.DeviceType.Automation]:
|
|
101058
|
-
[require_device_type.DeviceType.Lock]:
|
|
101059
|
-
[require_device_type.DeviceType.Cover]:
|
|
101060
|
-
[require_device_type.DeviceType.Valve]:
|
|
101061
|
-
[require_device_type.DeviceType.Humidifier]:
|
|
101062
|
-
[require_device_type.DeviceType.WaterHeater]:
|
|
101063
|
-
[require_device_type.DeviceType.Fan]:
|
|
103270
|
+
[require_device_type.DeviceType.Script]: SCRIPT_LOOK,
|
|
103271
|
+
[require_device_type.DeviceType.Automation]: AUTOMATION_LOOK,
|
|
103272
|
+
[require_device_type.DeviceType.Lock]: LOCK_LOOK,
|
|
103273
|
+
[require_device_type.DeviceType.Cover]: COVER_LOOK,
|
|
103274
|
+
[require_device_type.DeviceType.Valve]: VALVE_LOOK,
|
|
103275
|
+
[require_device_type.DeviceType.Humidifier]: HUMIDIFIER_LOOK,
|
|
103276
|
+
[require_device_type.DeviceType.WaterHeater]: WATER_HEATER_LOOK,
|
|
103277
|
+
[require_device_type.DeviceType.Fan]: FAN_LOOK,
|
|
101064
103278
|
[require_device_type.DeviceType.MediaPlayer]: MEDIA_PLAYER_LOOK,
|
|
101065
|
-
[require_device_type.DeviceType.AlarmPanel]:
|
|
101066
|
-
[require_device_type.DeviceType.Control]:
|
|
101067
|
-
[require_device_type.DeviceType.Presence]:
|
|
101068
|
-
[require_device_type.DeviceType.Weather]:
|
|
101069
|
-
[require_device_type.DeviceType.Vacuum]:
|
|
101070
|
-
[require_device_type.DeviceType.LawnMower]:
|
|
103279
|
+
[require_device_type.DeviceType.AlarmPanel]: ALARM_LOOK,
|
|
103280
|
+
[require_device_type.DeviceType.Control]: CONTROL_LOOK,
|
|
103281
|
+
[require_device_type.DeviceType.Presence]: PRESENCE_LOOK,
|
|
103282
|
+
[require_device_type.DeviceType.Weather]: WEATHER_LOOK,
|
|
103283
|
+
[require_device_type.DeviceType.Vacuum]: VACUUM_LOOK,
|
|
103284
|
+
[require_device_type.DeviceType.LawnMower]: MOWER_LOOK,
|
|
101071
103285
|
[require_device_type.DeviceType.Container]: HERO_LOOK_DEFAULT,
|
|
101072
|
-
[require_device_type.DeviceType.Image]:
|
|
101073
|
-
[require_device_type.DeviceType.PetFeeder]:
|
|
101074
|
-
[require_device_type.DeviceType.PetFountain]:
|
|
103286
|
+
[require_device_type.DeviceType.Image]: IMAGE_LOOK,
|
|
103287
|
+
[require_device_type.DeviceType.PetFeeder]: FEEDER_LOOK,
|
|
103288
|
+
[require_device_type.DeviceType.PetFountain]: FOUNTAIN_LOOK,
|
|
101075
103289
|
[require_device_type.DeviceType.Dishwasher]: DISHWASHER_LOOK,
|
|
101076
103290
|
[require_device_type.DeviceType.Washer]: WASHER_LOOK,
|
|
101077
103291
|
[require_device_type.DeviceType.Heater]: HEATER_LOOK,
|
|
@@ -101083,12 +103297,12 @@ var HERO_LOOK_BY_ROLE = {
|
|
|
101083
103297
|
[require_device_type.DeviceRole.Siren]: "inherit",
|
|
101084
103298
|
[require_device_type.DeviceRole.Floodlight]: "inherit",
|
|
101085
103299
|
[require_device_type.DeviceRole.Spotlight]: "inherit",
|
|
101086
|
-
[require_device_type.DeviceRole.PirSensor]:
|
|
103300
|
+
[require_device_type.DeviceRole.PirSensor]: MOTION_LOOK,
|
|
101087
103301
|
[require_device_type.DeviceRole.Chime]: "inherit",
|
|
101088
103302
|
[require_device_type.DeviceRole.Autotrack]: "inherit",
|
|
101089
103303
|
[require_device_type.DeviceRole.Nightvision]: "inherit",
|
|
101090
103304
|
[require_device_type.DeviceRole.PrivacyMask]: "inherit",
|
|
101091
|
-
[require_device_type.DeviceRole.Doorbell]:
|
|
103305
|
+
[require_device_type.DeviceRole.Doorbell]: DOORBELL_LOOK,
|
|
101092
103306
|
[require_device_type.DeviceRole.CoverBlind]: "inherit",
|
|
101093
103307
|
[require_device_type.DeviceRole.CoverShutter]: "inherit",
|
|
101094
103308
|
[require_device_type.DeviceRole.CoverAwning]: "inherit",
|
|
@@ -101099,21 +103313,21 @@ var HERO_LOOK_BY_ROLE = {
|
|
|
101099
103313
|
[require_device_type.DeviceRole.CoverWindow]: "inherit",
|
|
101100
103314
|
[require_device_type.DeviceRole.BinaryHelper]: "inherit",
|
|
101101
103315
|
[require_device_type.DeviceRole.Outlet]: "inherit",
|
|
101102
|
-
[require_device_type.DeviceRole.MotionSensor]:
|
|
103316
|
+
[require_device_type.DeviceRole.MotionSensor]: MOTION_LOOK,
|
|
101103
103317
|
[require_device_type.DeviceRole.ContactSensor]: "inherit",
|
|
101104
103318
|
[require_device_type.DeviceRole.LeakSensor]: LEAK_LOOK,
|
|
101105
103319
|
[require_device_type.DeviceRole.SmokeSensor]: SMOKE_LOOK,
|
|
101106
|
-
[require_device_type.DeviceRole.COSensor]:
|
|
101107
|
-
[require_device_type.DeviceRole.GasSensor]:
|
|
101108
|
-
[require_device_type.DeviceRole.TamperSensor]:
|
|
101109
|
-
[require_device_type.DeviceRole.VibrationSensor]:
|
|
103320
|
+
[require_device_type.DeviceRole.COSensor]: CO_LOOK,
|
|
103321
|
+
[require_device_type.DeviceRole.GasSensor]: GAS_LOOK,
|
|
103322
|
+
[require_device_type.DeviceRole.TamperSensor]: TAMPER_LOOK,
|
|
103323
|
+
[require_device_type.DeviceRole.VibrationSensor]: VIBRATION_LOOK,
|
|
101110
103324
|
[require_device_type.DeviceRole.ConnectivitySensor]: "inherit",
|
|
101111
103325
|
[require_device_type.DeviceRole.SoundSensor]: "inherit",
|
|
101112
103326
|
[require_device_type.DeviceRole.BinarySensor]: "inherit",
|
|
101113
|
-
[require_device_type.DeviceRole.TemperatureSensor]:
|
|
101114
|
-
[require_device_type.DeviceRole.HumiditySensor]:
|
|
101115
|
-
[require_device_type.DeviceRole.AmbientLightSensor]:
|
|
101116
|
-
[require_device_type.DeviceRole.PressureSensor]:
|
|
103327
|
+
[require_device_type.DeviceRole.TemperatureSensor]: TEMPERATURE_LOOK,
|
|
103328
|
+
[require_device_type.DeviceRole.HumiditySensor]: HUMIDITY_LOOK,
|
|
103329
|
+
[require_device_type.DeviceRole.AmbientLightSensor]: LIGHT_SENSOR_LOOK,
|
|
103330
|
+
[require_device_type.DeviceRole.PressureSensor]: READING_SENSOR_LOOK,
|
|
101117
103331
|
[require_device_type.DeviceRole.WindSensor]: "inherit",
|
|
101118
103332
|
[require_device_type.DeviceRole.RainSensor]: "inherit",
|
|
101119
103333
|
[require_device_type.DeviceRole.UvSensor]: "inherit",
|
|
@@ -101123,7 +103337,7 @@ var HERO_LOOK_BY_ROLE = {
|
|
|
101123
103337
|
[require_device_type.DeviceRole.EnergySensor]: "inherit",
|
|
101124
103338
|
[require_device_type.DeviceRole.VoltageSensor]: "inherit",
|
|
101125
103339
|
[require_device_type.DeviceRole.CurrentSensor]: "inherit",
|
|
101126
|
-
[require_device_type.DeviceRole.AirQualitySensor]:
|
|
103340
|
+
[require_device_type.DeviceRole.AirQualitySensor]: AIR_QUALITY_LOOK,
|
|
101127
103341
|
[require_device_type.DeviceRole.BatterySensor]: "inherit",
|
|
101128
103342
|
[require_device_type.DeviceRole.NumericSensor]: "inherit",
|
|
101129
103343
|
[require_device_type.DeviceRole.EnumSensor]: "inherit",
|
|
@@ -101145,10 +103359,17 @@ function isDeviceType(type) {
|
|
|
101145
103359
|
function isDeviceRole(role) {
|
|
101146
103360
|
return Object.values(require_device_type.DeviceRole).includes(role);
|
|
101147
103361
|
}
|
|
101148
|
-
/**
|
|
101149
|
-
|
|
103362
|
+
/**
|
|
103363
|
+
* The look of a (role, type) pair, for a state. Role beats type beats the generic default.
|
|
103364
|
+
* A climate device that is on draws its MODE (`mode` is the scene's); a role never loses to it.
|
|
103365
|
+
*/
|
|
103366
|
+
function resolveHeroLook(role, type, state, mode = null) {
|
|
101150
103367
|
const byRole = role !== null && isDeviceRole(role) ? HERO_LOOK_BY_ROLE[role] : void 0;
|
|
101151
103368
|
if (byRole !== void 0 && byRole !== "inherit") return byRole[state];
|
|
103369
|
+
if (mode !== null && (state === "on" || state === "running") && MODE_LOOK_TYPES.includes(type)) {
|
|
103370
|
+
const byMode = HERO_MODE_LOOK[mode];
|
|
103371
|
+
if (byMode !== null) return byMode;
|
|
103372
|
+
}
|
|
101152
103373
|
return ((isDeviceType(type) ? HERO_LOOK_BY_TYPE[type] : void 0) ?? HERO_LOOK_DEFAULT)[state];
|
|
101153
103374
|
}
|
|
101154
103375
|
/** Every look the model declares, for the exhaustiveness guard and its spec. */
|
|
@@ -101162,7 +103383,11 @@ function allHeroLooks() {
|
|
|
101162
103383
|
//#endregion
|
|
101163
103384
|
//#region src/device/hero/own-power.ts
|
|
101164
103385
|
/** The media player's offer outranks a bound switch: the player's own state is the device's. */
|
|
101165
|
-
var OWN_POWER_SOURCE_ORDER = [
|
|
103386
|
+
var OWN_POWER_SOURCE_ORDER = [
|
|
103387
|
+
"media-player",
|
|
103388
|
+
"climate-control",
|
|
103389
|
+
"switch"
|
|
103390
|
+
];
|
|
101166
103391
|
function resolveOwnPower(offers) {
|
|
101167
103392
|
for (const source of OWN_POWER_SOURCE_ORDER) {
|
|
101168
103393
|
const offer = offers.find((o) => o.source === source);
|
|
@@ -101186,9 +103411,41 @@ function resolveOwnPower(offers) {
|
|
|
101186
103411
|
var STATE_SOURCE_ORDER = [
|
|
101187
103412
|
"media-player",
|
|
101188
103413
|
"dishwasher",
|
|
103414
|
+
"lock-control",
|
|
103415
|
+
"alarm-panel",
|
|
103416
|
+
"vacuum-control",
|
|
103417
|
+
"lawn-mower-control",
|
|
103418
|
+
"fan-control",
|
|
103419
|
+
"pet-feeder",
|
|
103420
|
+
"pet-fountain",
|
|
103421
|
+
"automation-control",
|
|
103422
|
+
"script-runner",
|
|
103423
|
+
"event-emitter",
|
|
101189
103424
|
"running-state",
|
|
101190
103425
|
"switch",
|
|
101191
|
-
"contact"
|
|
103426
|
+
"contact",
|
|
103427
|
+
"group-active",
|
|
103428
|
+
"cover",
|
|
103429
|
+
"valve",
|
|
103430
|
+
"humidifier",
|
|
103431
|
+
"brightness",
|
|
103432
|
+
"smoke",
|
|
103433
|
+
"flood",
|
|
103434
|
+
"gas",
|
|
103435
|
+
"tamper",
|
|
103436
|
+
"vibration",
|
|
103437
|
+
"doorbell",
|
|
103438
|
+
"motion",
|
|
103439
|
+
"presence",
|
|
103440
|
+
"update",
|
|
103441
|
+
"weather",
|
|
103442
|
+
"image",
|
|
103443
|
+
"control",
|
|
103444
|
+
"meter",
|
|
103445
|
+
"binary",
|
|
103446
|
+
"button",
|
|
103447
|
+
"climate-control",
|
|
103448
|
+
"sensor"
|
|
101192
103449
|
];
|
|
101193
103450
|
var STATE_TEXT = {
|
|
101194
103451
|
on: require_sleep.t("On", "Acceso"),
|
|
@@ -101201,6 +103458,10 @@ var STATE_TEXT = {
|
|
|
101201
103458
|
unknown: require_sleep.t("Unknown", "Sconosciuto")
|
|
101202
103459
|
};
|
|
101203
103460
|
function pickReading(readings) {
|
|
103461
|
+
for (const source of STATE_SOURCE_ORDER) {
|
|
103462
|
+
const alarm = readings.find((r) => r.source === source && r.state === "alert");
|
|
103463
|
+
if (alarm !== void 0) return alarm;
|
|
103464
|
+
}
|
|
101204
103465
|
for (const source of STATE_SOURCE_ORDER) {
|
|
101205
103466
|
const found = readings.find((r) => r.source === source && r.state !== "unknown");
|
|
101206
103467
|
if (found !== void 0) return found;
|
|
@@ -101215,21 +103476,25 @@ function runningOf(input) {
|
|
|
101215
103476
|
function stateOf(input, readings) {
|
|
101216
103477
|
if (!input.device.online) return {
|
|
101217
103478
|
state: "offline",
|
|
101218
|
-
assumed: false
|
|
103479
|
+
assumed: false,
|
|
103480
|
+
title: STATE_TEXT.offline
|
|
101219
103481
|
};
|
|
101220
103482
|
const picked = pickReading(readings);
|
|
101221
103483
|
if (picked === null) return {
|
|
101222
103484
|
state: "unknown",
|
|
101223
|
-
assumed: false
|
|
103485
|
+
assumed: false,
|
|
103486
|
+
title: STATE_TEXT.unknown
|
|
101224
103487
|
};
|
|
101225
103488
|
const switchOff = readings.some((r) => r.source === "switch" && r.state === "off");
|
|
101226
103489
|
if (picked.source === "running-state" && picked.state === "idle" && switchOff) return {
|
|
101227
103490
|
state: "off",
|
|
101228
|
-
assumed: false
|
|
103491
|
+
assumed: false,
|
|
103492
|
+
title: STATE_TEXT.off
|
|
101229
103493
|
};
|
|
101230
103494
|
return {
|
|
101231
103495
|
state: picked.state,
|
|
101232
|
-
assumed: picked.assumed
|
|
103496
|
+
assumed: picked.assumed,
|
|
103497
|
+
title: picked.title ?? STATE_TEXT[picked.state]
|
|
101233
103498
|
};
|
|
101234
103499
|
}
|
|
101235
103500
|
function provenanceOf(cap, fragment) {
|
|
@@ -101278,15 +103543,17 @@ function buildHeroModel(input) {
|
|
|
101278
103543
|
features: input.features,
|
|
101279
103544
|
now: input.now,
|
|
101280
103545
|
running: runningOf(input),
|
|
101281
|
-
remoteCommands: input.remoteCommands
|
|
103546
|
+
remoteCommands: input.remoteCommands,
|
|
103547
|
+
caps: input.caps
|
|
101282
103548
|
};
|
|
101283
103549
|
const contributed = HERO_CAP_CONTRIBUTIONS.filter((c) => input.caps.includes(c.cap)).map((c) => ({
|
|
101284
103550
|
cap: c.cap,
|
|
101285
103551
|
fragment: c.contribute(input.slices[c.cap], ctx)
|
|
101286
103552
|
}));
|
|
101287
103553
|
const fragments = contributed.map((c) => c.fragment);
|
|
101288
|
-
const { state, assumed } = stateOf(input, fragments.flatMap((f) => f.reading === void 0 ? [] : [f.reading]));
|
|
101289
|
-
const
|
|
103554
|
+
const { state, assumed, title } = stateOf(input, fragments.flatMap((f) => f.reading === void 0 ? [] : [f.reading]));
|
|
103555
|
+
const scene = sceneOf(device.role, device.type, fragments);
|
|
103556
|
+
const look = resolveHeroLook(device.role, device.type, state, scene.mode);
|
|
101290
103557
|
const artworkUrl = fragments.find((f) => f.artworkUrl !== void 0)?.artworkUrl;
|
|
101291
103558
|
const background = artworkUrl === void 0 || state === "offline" ? {
|
|
101292
103559
|
kind: "state",
|
|
@@ -101310,7 +103577,8 @@ function buildHeroModel(input) {
|
|
|
101310
103577
|
const powerSupply = fragments.find((f) => f.powerSupply !== void 0)?.powerSupply ?? null;
|
|
101311
103578
|
const remote = fragments.find((f) => f.remote !== void 0)?.remote ?? null;
|
|
101312
103579
|
const badges = fragments.flatMap((f) => f.badges ?? []);
|
|
101313
|
-
const
|
|
103580
|
+
const headline = state === "offline" || state === "unknown" ? void 0 : fragments.find((f) => f.title !== void 0)?.title;
|
|
103581
|
+
const facts = fragments.flatMap((f) => f.facts ?? []).filter((f) => headline === void 0 || f.text.en !== headline.en);
|
|
101314
103582
|
const sideTiles = {
|
|
101315
103583
|
left: tilesOf(fragments, "left"),
|
|
101316
103584
|
right: tilesOf(fragments, "right")
|
|
@@ -101332,10 +103600,10 @@ function buildHeroModel(input) {
|
|
|
101332
103600
|
stateAssumed: assumed,
|
|
101333
103601
|
look,
|
|
101334
103602
|
background,
|
|
101335
|
-
scene
|
|
103603
|
+
scene,
|
|
101336
103604
|
facts,
|
|
101337
103605
|
sideTiles,
|
|
101338
|
-
title:
|
|
103606
|
+
title: headline ?? title,
|
|
101339
103607
|
badges,
|
|
101340
103608
|
remote,
|
|
101341
103609
|
consumables: fragments.find((f) => f.consumables !== void 0)?.consumables ?? null,
|
|
@@ -101363,28 +103631,28 @@ var LATER_PHASE = "a hero fact, contributed when its type migrates to the templa
|
|
|
101363
103631
|
var NOT_A_HERO_FACT = "plumbing or configuration; reachable from the device page tabs";
|
|
101364
103632
|
var HERO_CAP_COVERAGE = {
|
|
101365
103633
|
accessories: { none: NOT_A_HERO_FACT },
|
|
101366
|
-
"air-quality-sensor":
|
|
101367
|
-
"alarm-panel":
|
|
101368
|
-
"ambient-light-sensor":
|
|
103634
|
+
"air-quality-sensor": "contributes",
|
|
103635
|
+
"alarm-panel": "contributes",
|
|
103636
|
+
"ambient-light-sensor": "contributes",
|
|
101369
103637
|
"audio-analysis": { none: NOT_A_HERO_FACT },
|
|
101370
103638
|
"audio-metrics": { none: NOT_A_HERO_FACT },
|
|
101371
|
-
"automation-control":
|
|
103639
|
+
"automation-control": "contributes",
|
|
101372
103640
|
battery: "contributes",
|
|
101373
|
-
binary:
|
|
101374
|
-
brightness:
|
|
101375
|
-
button:
|
|
103641
|
+
binary: "contributes",
|
|
103642
|
+
brightness: "contributes",
|
|
103643
|
+
button: "contributes",
|
|
101376
103644
|
"camera-credentials": { none: NOT_A_HERO_FACT },
|
|
101377
103645
|
"camera-grid-layout": { none: NOT_A_HERO_FACT },
|
|
101378
103646
|
"camera-pipeline-config": { none: NOT_A_HERO_FACT },
|
|
101379
103647
|
"camera-streams": { none: NOT_A_HERO_FACT },
|
|
101380
|
-
"carbon-monoxide":
|
|
101381
|
-
"climate-control":
|
|
101382
|
-
color:
|
|
103648
|
+
"carbon-monoxide": "contributes",
|
|
103649
|
+
"climate-control": "contributes",
|
|
103650
|
+
color: "contributes",
|
|
101383
103651
|
connectivity: { none: NOT_A_HERO_FACT },
|
|
101384
103652
|
consumables: "contributes",
|
|
101385
103653
|
contact: "contributes",
|
|
101386
|
-
control:
|
|
101387
|
-
cover:
|
|
103654
|
+
control: "contributes",
|
|
103655
|
+
cover: "contributes",
|
|
101388
103656
|
"day-night": { none: NOT_A_HERO_FACT },
|
|
101389
103657
|
"detection-pipeline": { none: NOT_A_HERO_FACT },
|
|
101390
103658
|
"device-admin-link": { none: NOT_A_HERO_FACT },
|
|
@@ -101395,29 +103663,29 @@ var HERO_CAP_COVERAGE = {
|
|
|
101395
103663
|
"device-transitions": { none: "audit log of what changed and who asked; reachable from the device page history" },
|
|
101396
103664
|
"device-status": { none: NOT_A_HERO_FACT },
|
|
101397
103665
|
dishwasher: "contributes",
|
|
101398
|
-
"do-not-disturb":
|
|
101399
|
-
doorbell:
|
|
101400
|
-
"enum-sensor":
|
|
101401
|
-
"event-emitter":
|
|
101402
|
-
"fan-control":
|
|
103666
|
+
"do-not-disturb": "contributes",
|
|
103667
|
+
doorbell: "contributes",
|
|
103668
|
+
"enum-sensor": "contributes",
|
|
103669
|
+
"event-emitter": "contributes",
|
|
103670
|
+
"fan-control": "contributes",
|
|
101403
103671
|
"feature-probe": { none: NOT_A_HERO_FACT },
|
|
101404
|
-
flood:
|
|
101405
|
-
gas:
|
|
101406
|
-
"group-active":
|
|
101407
|
-
"group-commands":
|
|
101408
|
-
"group-status":
|
|
101409
|
-
"heating-valve":
|
|
101410
|
-
humidifier:
|
|
101411
|
-
"humidity-sensor":
|
|
101412
|
-
image:
|
|
103672
|
+
flood: "contributes",
|
|
103673
|
+
gas: "contributes",
|
|
103674
|
+
"group-active": "contributes",
|
|
103675
|
+
"group-commands": "contributes",
|
|
103676
|
+
"group-status": "contributes",
|
|
103677
|
+
"heating-valve": "contributes",
|
|
103678
|
+
humidifier: "contributes",
|
|
103679
|
+
"humidity-sensor": "contributes",
|
|
103680
|
+
image: "contributes",
|
|
101413
103681
|
"image-settings": { none: NOT_A_HERO_FACT },
|
|
101414
103682
|
intercom: { none: NOT_A_HERO_FACT },
|
|
101415
|
-
"ir-transmitter": { none:
|
|
101416
|
-
"lawn-mower-control":
|
|
101417
|
-
"lock-control":
|
|
103683
|
+
"ir-transmitter": { none: "a transport on a board: it sends raw timings for a remote and reports no state (D957); the appliance it drives shows its own state and the remote button" },
|
|
103684
|
+
"lawn-mower-control": "contributes",
|
|
103685
|
+
"lock-control": "contributes",
|
|
101418
103686
|
"media-player": "contributes",
|
|
101419
|
-
meter:
|
|
101420
|
-
motion:
|
|
103687
|
+
meter: "contributes",
|
|
103688
|
+
motion: "contributes",
|
|
101421
103689
|
"motion-detection": { none: NOT_A_HERO_FACT },
|
|
101422
103690
|
"motion-trigger": "contributes",
|
|
101423
103691
|
"motion-zones": { none: NOT_A_HERO_FACT },
|
|
@@ -101425,19 +103693,19 @@ var HERO_CAP_COVERAGE = {
|
|
|
101425
103693
|
navigation: { none: NOT_A_HERO_FACT },
|
|
101426
103694
|
"network-link": "contributes",
|
|
101427
103695
|
notifier: { none: NOT_A_HERO_FACT },
|
|
101428
|
-
"numeric-sensor":
|
|
103696
|
+
"numeric-sensor": "contributes",
|
|
101429
103697
|
osd: { none: NOT_A_HERO_FACT },
|
|
101430
|
-
"pet-feeder":
|
|
101431
|
-
"pet-fountain":
|
|
103698
|
+
"pet-feeder": "contributes",
|
|
103699
|
+
"pet-fountain": "contributes",
|
|
101432
103700
|
"pipeline-analytics": { none: NOT_A_HERO_FACT },
|
|
101433
103701
|
"power-meter": "contributes",
|
|
101434
103702
|
"power-source": "contributes",
|
|
101435
|
-
presence:
|
|
101436
|
-
"pressure-sensor":
|
|
103703
|
+
presence: "contributes",
|
|
103704
|
+
"pressure-sensor": "contributes",
|
|
101437
103705
|
"privacy-mask": { none: NOT_A_HERO_FACT },
|
|
101438
103706
|
ptz: { none: NOT_A_HERO_FACT },
|
|
101439
103707
|
"ptz-autotrack": { none: NOT_A_HERO_FACT },
|
|
101440
|
-
"pump-cycle":
|
|
103708
|
+
"pump-cycle": "contributes",
|
|
101441
103709
|
reboot: { none: NOT_A_HERO_FACT },
|
|
101442
103710
|
recording: { none: NOT_A_HERO_FACT },
|
|
101443
103711
|
"recording-onboard": { none: NOT_A_HERO_FACT },
|
|
@@ -101445,23 +103713,23 @@ var HERO_CAP_COVERAGE = {
|
|
|
101445
103713
|
remote: "contributes",
|
|
101446
103714
|
"running-state": "contributes",
|
|
101447
103715
|
"scene-monitor": { none: NOT_A_HERO_FACT },
|
|
101448
|
-
"script-runner":
|
|
101449
|
-
smoke:
|
|
103716
|
+
"script-runner": "contributes",
|
|
103717
|
+
smoke: "contributes",
|
|
101450
103718
|
snapshot: { none: NOT_A_HERO_FACT },
|
|
101451
103719
|
"stream-catalog": { none: NOT_A_HERO_FACT },
|
|
101452
103720
|
"stream-params": { none: NOT_A_HERO_FACT },
|
|
101453
103721
|
"stream-signals": { none: NOT_A_HERO_FACT },
|
|
101454
103722
|
switch: "contributes",
|
|
101455
|
-
tamper:
|
|
101456
|
-
"temperature-sensor":
|
|
103723
|
+
tamper: "contributes",
|
|
103724
|
+
"temperature-sensor": "contributes",
|
|
101457
103725
|
"timed-run": "contributes",
|
|
101458
|
-
update:
|
|
101459
|
-
"vacuum-control":
|
|
101460
|
-
valve:
|
|
101461
|
-
vibration:
|
|
103726
|
+
update: "contributes",
|
|
103727
|
+
"vacuum-control": "contributes",
|
|
103728
|
+
valve: "contributes",
|
|
103729
|
+
vibration: "contributes",
|
|
101462
103730
|
videoclips: { none: NOT_A_HERO_FACT },
|
|
101463
|
-
"water-heater":
|
|
101464
|
-
weather:
|
|
103731
|
+
"water-heater": "contributes",
|
|
103732
|
+
weather: "contributes",
|
|
101465
103733
|
"webrtc-session": { none: NOT_A_HERO_FACT },
|
|
101466
103734
|
"zone-analytics": { none: NOT_A_HERO_FACT },
|
|
101467
103735
|
"zone-rules": { none: NOT_A_HERO_FACT },
|
|
@@ -117392,7 +119660,7 @@ function getCapsByProviderKind(kind) {
|
|
|
117392
119660
|
//#region src/generated/runtime-state-durability.ts
|
|
117393
119661
|
/**
|
|
117394
119662
|
* Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
|
|
117395
|
-
* `runtimeState`. 81 caps:
|
|
119663
|
+
* `runtimeState`. 81 caps: 41 `restored`, 40 `session`.
|
|
117396
119664
|
*
|
|
117397
119665
|
* A cap absent from this map has no runtime-state slice at all. A cap PRESENT
|
|
117398
119666
|
* with `durability: 'session'` has one and has decided not to keep it.
|
|
@@ -117439,8 +119707,9 @@ var RUNTIME_STATE_POLICY = {
|
|
|
117439
119707
|
volatileFields: ["lastChangedAt"]
|
|
117440
119708
|
},
|
|
117441
119709
|
"climate-control": {
|
|
117442
|
-
durability: "
|
|
117443
|
-
volatileFields: []
|
|
119710
|
+
durability: "restored",
|
|
119711
|
+
volatileFields: [],
|
|
119712
|
+
restoredFields: ["lastActiveMode"]
|
|
117444
119713
|
},
|
|
117445
119714
|
"color": {
|
|
117446
119715
|
durability: "session",
|
|
@@ -117492,7 +119761,7 @@ var RUNTIME_STATE_POLICY = {
|
|
|
117492
119761
|
},
|
|
117493
119762
|
"enum-sensor": {
|
|
117494
119763
|
durability: "restored",
|
|
117495
|
-
volatileFields: ["lastFetchedAt"]
|
|
119764
|
+
volatileFields: ["lastFetchedAt", "timestamp"]
|
|
117496
119765
|
},
|
|
117497
119766
|
"event-emitter": {
|
|
117498
119767
|
durability: "session",
|
|
@@ -117703,8 +119972,9 @@ var RUNTIME_STATE_POLICY = {
|
|
|
117703
119972
|
volatileFields: ["lastChangedAt"]
|
|
117704
119973
|
},
|
|
117705
119974
|
"water-heater": {
|
|
117706
|
-
durability: "
|
|
117707
|
-
volatileFields: []
|
|
119975
|
+
durability: "restored",
|
|
119976
|
+
volatileFields: [],
|
|
119977
|
+
restoredFields: ["lastActiveMode"]
|
|
117708
119978
|
},
|
|
117709
119979
|
"weather": {
|
|
117710
119980
|
durability: "session",
|
|
@@ -117750,6 +120020,7 @@ var RESTORED_CAP_NAMES = [
|
|
|
117750
120020
|
"battery",
|
|
117751
120021
|
"binary",
|
|
117752
120022
|
"carbon-monoxide",
|
|
120023
|
+
"climate-control",
|
|
117753
120024
|
"connectivity",
|
|
117754
120025
|
"consumables",
|
|
117755
120026
|
"contact",
|
|
@@ -117781,6 +120052,7 @@ var RESTORED_CAP_NAMES = [
|
|
|
117781
120052
|
"tamper",
|
|
117782
120053
|
"temperature-sensor",
|
|
117783
120054
|
"vibration",
|
|
120055
|
+
"water-heater",
|
|
117784
120056
|
"zone-rules",
|
|
117785
120057
|
"zones"
|
|
117786
120058
|
];
|