@camstack/server 1.2.815 → 1.2.817
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 +13 -0
- package/dist/api/core/cap-providers.js +2 -43
- package/dist/api/trpc/generated-cap-routers.js +14 -17
- package/dist/core/addon/addon-registry.service.js +3 -3
- package/dist/core/addon/instance-lifecycle.js +79 -4
- package/package.json +18 -9
- package/system/dist/{agent-https-eMihTWJ4.mjs → agent-https-8yyIi2Mv.mjs} +1 -1
- package/system/dist/{agent-https-Dwbpz4K6.js → agent-https-CSHd24Sz.js} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/alerts/alerts.addon.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +8 -4
- package/system/dist/builtins/camera-grid/index.mjs +8 -4
- package/system/dist/builtins/composer/composer.addon.js +3 -3
- package/system/dist/builtins/composer/composer.addon.mjs +3 -3
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +1 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +16 -8
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +16 -8
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +64 -5
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +64 -5
- package/system/dist/builtins/device-manager/last-active-mode.d.ts +1 -0
- package/system/dist/builtins/device-manager/runtime-state-persist-gate.d.ts +9 -0
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +4 -4
- package/system/dist/builtins/keychain/index.mjs +4 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +3 -3
- package/system/dist/builtins/loki-logging/index.mjs +3 -3
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +1 -1
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
- package/system/dist/builtins/storage-orchestrator/location-store.d.ts +5 -14
- package/system/dist/builtins/storage-orchestrator/record-kinds.d.ts +0 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +35 -75
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +35 -75
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +9 -32
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{capture-engine-uxR5sOQN.js → capture-engine-Cius-WCQ.js} +1 -1
- package/system/dist/{capture-engine-CYPDOIF6.mjs → capture-engine-D2eAoc9W.mjs} +1 -1
- package/system/dist/{composition-sources-DkvntZci.js → composition-sources-AJ8V5KOI.js} +1 -1
- package/system/dist/{composition-sources-CU3p3INI.mjs → composition-sources-CdcDO-Ut.mjs} +1 -1
- package/system/dist/{constants-BP-Txn_J.js → constants-BVIwtt_O.js} +1 -1
- package/system/dist/{constants-DMFJ6Fky.mjs → constants-GPP-Z7D3.mjs} +1 -1
- package/system/dist/{device-ca-D-0zxmFi.js → device-ca-BFJn5TzU.js} +1 -1
- package/system/dist/{device-ca-tmcd_VBC.mjs → device-ca-WLUZEMzG.mjs} +1 -1
- package/system/dist/{dist-DmCVWvtK.mjs → dist-QnMV8AH-.mjs} +2455 -207
- package/system/dist/{dist-CznnwtQ8.js → dist-X-i__4Xc.js} +2454 -212
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-FTf16-JR.js → hub-mdns-ciao-DxC8z6eX.js} +2 -2
- package/system/dist/{hub-mdns-ciao-DbwyiHD5.mjs → hub-mdns-ciao-awDw9o6E.mjs} +2 -2
- package/system/dist/index.js +8 -8
- package/system/dist/index.mjs +8 -8
- package/system/dist/{legacy-integration-rows-door-CASQgifG.mjs → legacy-integration-rows-door-COW5hMUZ.mjs} +1 -1
- package/system/dist/{legacy-integration-rows-door-gW0xpMJI.js → legacy-integration-rows-door-Cbb1WKDb.js} +1 -1
- package/system/dist/migrations/hub/2026-11-08-storage-locations-write-set.d.ts +3 -0
- package/system/dist/{restore-archive-DlaC_gyl.mjs → restore-archive-Dp13UUld.mjs} +1 -1
- package/system/dist/{restore-archive-B9TEFWRE.js → restore-archive-q01U_u2A.js} +1 -1
- package/system/dist/{wal-maintenance-Da2Rozz6.js → wal-maintenance-F8p6X7gc.js} +0 -0
- package/system/dist/{wal-maintenance-Cn164tp0.mjs → wal-maintenance-PzTcTuqZ.mjs} +0 -0
- package/system/package.json +1 -1
|
@@ -1211,7 +1211,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
1211
1211
|
return DeviceRole;
|
|
1212
1212
|
}({});
|
|
1213
1213
|
//#endregion
|
|
1214
|
-
//#region ../types/dist/sleep-
|
|
1214
|
+
//#region ../types/dist/sleep-CS5Xp1iQ.mjs
|
|
1215
1215
|
/**
|
|
1216
1216
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
1217
1217
|
* window to float samples (D455).
|
|
@@ -11399,7 +11399,8 @@ var CALLER_STAMPED_CAPABILITIES = [
|
|
|
11399
11399
|
"device-manager",
|
|
11400
11400
|
"core-blocks",
|
|
11401
11401
|
"migrations",
|
|
11402
|
-
"device-transitions"
|
|
11402
|
+
"device-transitions",
|
|
11403
|
+
"integration-instances"
|
|
11403
11404
|
];
|
|
11404
11405
|
/** A copy of `input` without the caller stamp. Anything that is not a plain object passes through. */
|
|
11405
11406
|
function withoutCallerStamp(input) {
|
|
@@ -11939,6 +11940,18 @@ Object.freeze({
|
|
|
11939
11940
|
{
|
|
11940
11941
|
"path": "tempStep",
|
|
11941
11942
|
"valueType": "number"
|
|
11943
|
+
},
|
|
11944
|
+
{
|
|
11945
|
+
"path": "lastActiveMode",
|
|
11946
|
+
"valueType": "enum",
|
|
11947
|
+
"enumValues": [
|
|
11948
|
+
"heat",
|
|
11949
|
+
"cool",
|
|
11950
|
+
"auto",
|
|
11951
|
+
"heat_cool",
|
|
11952
|
+
"fan_only",
|
|
11953
|
+
"dry"
|
|
11954
|
+
]
|
|
11942
11955
|
}
|
|
11943
11956
|
],
|
|
11944
11957
|
"color": [
|
|
@@ -13363,6 +13376,10 @@ Object.freeze({
|
|
|
13363
13376
|
{
|
|
13364
13377
|
"path": "maxTemp",
|
|
13365
13378
|
"valueType": "number"
|
|
13379
|
+
},
|
|
13380
|
+
{
|
|
13381
|
+
"path": "lastActiveMode",
|
|
13382
|
+
"valueType": "string"
|
|
13366
13383
|
}
|
|
13367
13384
|
],
|
|
13368
13385
|
"weather": [
|
|
@@ -20744,18 +20761,6 @@ var StorageLocationSchema = zod.z.object({
|
|
|
20744
20761
|
createdAt: zod.z.number(),
|
|
20745
20762
|
updatedAt: zod.z.number()
|
|
20746
20763
|
});
|
|
20747
|
-
/**
|
|
20748
|
-
* The retired `isDefault` key, DECLARED rather than dropped.
|
|
20749
|
-
*
|
|
20750
|
-
* A key removed from a non-strict `z.object` is stripped in silence (D380,
|
|
20751
|
-
* D381): a reader that still needs the old value gets `undefined` and cannot
|
|
20752
|
-
* tell "absent" from "never sent". The one reader that legitimately needs it —
|
|
20753
|
-
* the location store's boot migration, which turns the old default flag into
|
|
20754
|
-
* the `enabled` write set — parses THIS schema against the raw row instead, so
|
|
20755
|
-
* the migration is explicit and the live schema stays clean. Nothing else in
|
|
20756
|
-
* the repo may read it; `scripts/check-no-storage-default.ts` enforces that.
|
|
20757
|
-
*/
|
|
20758
|
-
var LegacyStorageLocationDefaultSchema = zod.z.object({ isDefault: zod.z.boolean().optional() });
|
|
20759
20764
|
function isLocationEnabled(location) {
|
|
20760
20765
|
return mayWriteToLocation({
|
|
20761
20766
|
...location,
|
|
@@ -50674,6 +50679,12 @@ var ClimateControlStatusSchema = zod.z.object({
|
|
|
50674
50679
|
maxTemp: zod.z.number().nullable().optional().meta(readingMeta("temperature")),
|
|
50675
50680
|
/** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
|
|
50676
50681
|
tempStep: zod.z.number().positive().nullable().optional().meta(readingMeta("temperature")),
|
|
50682
|
+
/**
|
|
50683
|
+
* The last non-off mode the device reported. Kept by the device-state mirror on every
|
|
50684
|
+
* write (providers never set it), so "turn on" can return to it. Absent until the device
|
|
50685
|
+
* has reported a running mode.
|
|
50686
|
+
*/
|
|
50687
|
+
lastActiveMode: HvacModeSchema.exclude(["off"]).optional(),
|
|
50677
50688
|
/** Ms epoch when the slice was last updated (push or command). */
|
|
50678
50689
|
lastFetchedAt: zod.z.number()
|
|
50679
50690
|
});
|
|
@@ -50758,7 +50769,8 @@ var climateControlCapability = {
|
|
|
50758
50769
|
* See `RuntimeStateDurability`. Enforced by
|
|
50759
50770
|
* `scripts/check-runtime-state-durability.ts`.
|
|
50760
50771
|
*/
|
|
50761
|
-
durability: "
|
|
50772
|
+
durability: "restored",
|
|
50773
|
+
restoredStateFields: ["lastActiveMode"],
|
|
50762
50774
|
/**
|
|
50763
50775
|
* History (D850): recorded series. Celsius by contract; setpoints keep every change (`minIntervalMs: 0`).
|
|
50764
50776
|
*/
|
|
@@ -52050,7 +52062,7 @@ function irSourceProblem(source) {
|
|
|
52050
52062
|
throw err;
|
|
52051
52063
|
}
|
|
52052
52064
|
}
|
|
52053
|
-
function same(a, b) {
|
|
52065
|
+
function same$1(a, b) {
|
|
52054
52066
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
52055
52067
|
}
|
|
52056
52068
|
/** The `digits` source that declares this channel number, or null. */
|
|
@@ -52064,7 +52076,7 @@ function findChannelSource(sources, number) {
|
|
|
52064
52076
|
* the number reach the same source; nothing else is guessed.
|
|
52065
52077
|
*/
|
|
52066
52078
|
function resolveRemoteSource(sources, query) {
|
|
52067
|
-
const byName = sources.find((source) => same(source.name, query));
|
|
52079
|
+
const byName = sources.find((source) => same$1(source.name, query));
|
|
52068
52080
|
if (byName !== void 0) return byName;
|
|
52069
52081
|
const byId = sources.find((source) => source.id === query.trim());
|
|
52070
52082
|
if (byId !== void 0) return byId;
|
|
@@ -61724,7 +61736,7 @@ var enumSensorCapability = {
|
|
|
61724
61736
|
} } },
|
|
61725
61737
|
/** Clock fields: written, but excluded from the compare that decides
|
|
61726
61738
|
* whether persisting is worth a SQLite commit. */
|
|
61727
|
-
volatileStateFields: ["lastFetchedAt"]
|
|
61739
|
+
volatileStateFields: ["lastFetchedAt", "timestamp"]
|
|
61728
61740
|
};
|
|
61729
61741
|
/**
|
|
61730
61742
|
* Generic stateless event emitter. Installed on a `DeviceType.EventEmitter`
|
|
@@ -63301,21 +63313,50 @@ var HeroRowIdSchema = zod.z.enum([
|
|
|
63301
63313
|
"volume",
|
|
63302
63314
|
"source",
|
|
63303
63315
|
"contact",
|
|
63304
|
-
"motion-trigger"
|
|
63316
|
+
"motion-trigger",
|
|
63317
|
+
"lock",
|
|
63318
|
+
"alarm",
|
|
63319
|
+
"fan",
|
|
63320
|
+
"vacuum",
|
|
63321
|
+
"mower",
|
|
63322
|
+
"feeder",
|
|
63323
|
+
"fountain",
|
|
63324
|
+
"pump-cycle",
|
|
63325
|
+
"automation",
|
|
63326
|
+
"script",
|
|
63327
|
+
"do-not-disturb",
|
|
63328
|
+
"brightness",
|
|
63329
|
+
"color",
|
|
63330
|
+
"cover",
|
|
63331
|
+
"valve",
|
|
63332
|
+
"humidifier",
|
|
63333
|
+
"update",
|
|
63334
|
+
"button",
|
|
63335
|
+
"climate-mode",
|
|
63336
|
+
"climate-fan",
|
|
63337
|
+
"setpoint",
|
|
63338
|
+
"channel",
|
|
63339
|
+
"control"
|
|
63305
63340
|
]);
|
|
63306
|
-
|
|
63307
|
-
var HeroArgsSchema = zod.z.record(zod.z.string(), zod.z.union([
|
|
63341
|
+
var HeroArgValueSchema = zod.z.lazy(() => zod.z.union([
|
|
63308
63342
|
zod.z.string(),
|
|
63309
63343
|
zod.z.number(),
|
|
63310
|
-
zod.z.boolean()
|
|
63344
|
+
zod.z.boolean(),
|
|
63345
|
+
zod.z.record(zod.z.string(), HeroArgValueSchema)
|
|
63311
63346
|
]));
|
|
63347
|
+
var HeroArgsSchema = zod.z.record(zod.z.string(), HeroArgValueSchema);
|
|
63312
63348
|
/** A cap method called on the hero's device. */
|
|
63313
63349
|
var HeroCallSchema = zod.z.object({
|
|
63314
63350
|
cap: zod.z.string(),
|
|
63315
63351
|
method: zod.z.string(),
|
|
63316
63352
|
args: HeroArgsSchema
|
|
63317
63353
|
});
|
|
63318
|
-
var HeroConfirmSchema = zod.z.enum([
|
|
63354
|
+
var HeroConfirmSchema = zod.z.enum([
|
|
63355
|
+
"off-while-running",
|
|
63356
|
+
"unlock",
|
|
63357
|
+
"install",
|
|
63358
|
+
"press"
|
|
63359
|
+
]);
|
|
63319
63360
|
var HeroActionSchema = zod.z.object({
|
|
63320
63361
|
/** Unique within the model; the `gated` list and the specs name it. */
|
|
63321
63362
|
id: zod.z.string(),
|
|
@@ -63411,7 +63452,11 @@ var HeroConsumptionSlotSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
|
|
|
63411
63452
|
})]);
|
|
63412
63453
|
var HeroOwnPowerSlotSchema = zod.z.object({
|
|
63413
63454
|
/** Which cap the power is switched through; the renderer never needs it. */
|
|
63414
|
-
source: zod.z.enum([
|
|
63455
|
+
source: zod.z.enum([
|
|
63456
|
+
"switch",
|
|
63457
|
+
"media-player",
|
|
63458
|
+
"climate-control"
|
|
63459
|
+
]),
|
|
63415
63460
|
/** `null` = unknown, never off. */
|
|
63416
63461
|
on: zod.z.boolean().nullable(),
|
|
63417
63462
|
assumed: zod.z.boolean(),
|
|
@@ -63448,7 +63493,23 @@ var HeroFactSchema = zod.z.object({
|
|
|
63448
63493
|
"remaining",
|
|
63449
63494
|
"volume",
|
|
63450
63495
|
"source",
|
|
63451
|
-
"consumables"
|
|
63496
|
+
"consumables",
|
|
63497
|
+
"since",
|
|
63498
|
+
"speed",
|
|
63499
|
+
"progress",
|
|
63500
|
+
"level",
|
|
63501
|
+
"last-run",
|
|
63502
|
+
"event",
|
|
63503
|
+
"members",
|
|
63504
|
+
"failures",
|
|
63505
|
+
"reading",
|
|
63506
|
+
"climate",
|
|
63507
|
+
"temperature",
|
|
63508
|
+
"humidity",
|
|
63509
|
+
"pressure",
|
|
63510
|
+
"air-quality",
|
|
63511
|
+
"illuminance",
|
|
63512
|
+
"valve"
|
|
63452
63513
|
]),
|
|
63453
63514
|
icon: IconKeySchema.nullable(),
|
|
63454
63515
|
text: HeroTextSchema,
|
|
@@ -64011,7 +64072,7 @@ var imageSettingsCapability = {
|
|
|
64011
64072
|
*
|
|
64012
64073
|
* Phase E of the API consolidation: previously a hand-written core
|
|
64013
64074
|
* router. Cap conversion lets `useIntegrationsList`,
|
|
64014
|
-
* `
|
|
64075
|
+
* `useIntegrationsTestConnection` and
|
|
64015
64076
|
* friends flow through the same codegen pipeline as every other cap.
|
|
64016
64077
|
*/
|
|
64017
64078
|
var IntegrationWithStateSchema = zod.z.object({
|
|
@@ -64097,7 +64158,7 @@ var AvailableIntegrationTypeSchema = zod.z.object({
|
|
|
64097
64158
|
*
|
|
64098
64159
|
* - `validated` — a provider-declared test ran and the remote ACCEPTED.
|
|
64099
64160
|
* - `rejected` — a provider-declared test ran and the remote REFUSED.
|
|
64100
|
-
* The only status that blocks `
|
|
64161
|
+
* The only status that blocks `integrationInstances.createInstance`.
|
|
64101
64162
|
* - `inconclusive` — a test IS declared but could not complete (timeout,
|
|
64102
64163
|
* DNS, 5xx). Nothing was observed; not a failure.
|
|
64103
64164
|
* - `unsupported` — this integration declares NO test. Nothing was
|
|
@@ -64127,16 +64188,6 @@ var TestConnectionResultSchema = zod.z.object({
|
|
|
64127
64188
|
/** Human detail from a `validated` result ("3 devices on this account"). */
|
|
64128
64189
|
detail: zod.z.string().optional()
|
|
64129
64190
|
});
|
|
64130
|
-
var CreateIntegrationInputSchema = zod.z.object({
|
|
64131
|
-
addonId: zod.z.string(),
|
|
64132
|
-
name: zod.z.string(),
|
|
64133
|
-
info: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
64134
|
-
/** `stableId` of the discovery candidate the form was seeded from (D984). */
|
|
64135
|
-
originStableId: zod.z.string().optional(),
|
|
64136
|
-
settings: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
64137
|
-
/** The instance kind being created, for a provider with several; omitted = its only testable kind. */
|
|
64138
|
-
kind: zod.z.string().min(1).optional()
|
|
64139
|
-
});
|
|
64140
64191
|
var UpdateIntegrationInputSchema = zod.z.object({
|
|
64141
64192
|
id: zod.z.string(),
|
|
64142
64193
|
name: zod.z.string().optional(),
|
|
@@ -64160,10 +64211,6 @@ var integrationsCapability = {
|
|
|
64160
64211
|
list: method(zod.z.void(), zod.z.array(IntegrationWithStateSchema)),
|
|
64161
64212
|
get: method(zod.z.object({ id: zod.z.string() }), IntegrationWithStateSchema),
|
|
64162
64213
|
getByAddonId: method(zod.z.object({ addonId: zod.z.string() }), IntegrationLiteSchema.nullable()),
|
|
64163
|
-
create: method(CreateIntegrationInputSchema, IntegrationLiteSchema, {
|
|
64164
|
-
kind: "mutation",
|
|
64165
|
-
auth: "admin"
|
|
64166
|
-
}),
|
|
64167
64214
|
update: method(UpdateIntegrationInputSchema, IntegrationLiteSchema, {
|
|
64168
64215
|
kind: "mutation",
|
|
64169
64216
|
auth: "admin"
|
|
@@ -64389,7 +64436,15 @@ var integrationInstancesCapability = {
|
|
|
64389
64436
|
* registry row of an instance that brings devices, so discovery stops offering a candidate
|
|
64390
64437
|
* that already has its integration (D984). Ignored by an instance with no registry row.
|
|
64391
64438
|
*/
|
|
64392
|
-
originStableId: zod.z.string().min(1).optional()
|
|
64439
|
+
originStableId: zod.z.string().min(1).optional(),
|
|
64440
|
+
/**
|
|
64441
|
+
* The seed variant: the HUB or an addon states the integration it owns (a fixed builtin's
|
|
64442
|
+
* row, a migration's row), not an operator creating one. It brings the registry `info`
|
|
64443
|
+
* (`{ fixed: true }`), makes the row whatever the kind's role, and is accepted only from a
|
|
64444
|
+
* caller the transport stamped as the addon itself (`callerAddonId`): an admin session
|
|
64445
|
+
* cannot send it, and the wizard never does. `values` are the settings it is seeded with.
|
|
64446
|
+
*/
|
|
64447
|
+
seed: zod.z.object({ info: zod.z.record(zod.z.string(), zod.z.unknown()) }).optional()
|
|
64393
64448
|
}), zod.z.object({ id: zod.z.string() }), {
|
|
64394
64449
|
kind: "mutation",
|
|
64395
64450
|
auth: "admin"
|
|
@@ -92608,6 +92663,11 @@ var WaterHeaterStatusSchema = zod.z.object({
|
|
|
92608
92663
|
minTemp: zod.z.number().nullable().meta(readingMeta("temperature")),
|
|
92609
92664
|
/** HA `max_temp` attribute. Null when not reported. */
|
|
92610
92665
|
maxTemp: zod.z.number().nullable().meta(readingMeta("temperature")),
|
|
92666
|
+
/**
|
|
92667
|
+
* The last operation mode other than `off` the device reported. Kept by the device-state
|
|
92668
|
+
* mirror on every write (providers never set it), so "turn on" can return to it.
|
|
92669
|
+
*/
|
|
92670
|
+
lastActiveMode: zod.z.string().optional(),
|
|
92611
92671
|
/** Ms epoch when the slice was last updated. */
|
|
92612
92672
|
lastChangedAt: zod.z.number()
|
|
92613
92673
|
});
|
|
@@ -92655,7 +92715,8 @@ var waterHeaterCapability = {
|
|
|
92655
92715
|
* See `RuntimeStateDurability`. Enforced by
|
|
92656
92716
|
* `scripts/check-runtime-state-durability.ts`.
|
|
92657
92717
|
*/
|
|
92658
|
-
durability: "
|
|
92718
|
+
durability: "restored",
|
|
92719
|
+
restoredStateFields: ["lastActiveMode"],
|
|
92659
92720
|
/**
|
|
92660
92721
|
* History (D850): recorded series. The schema carries no unit; providers publish Celsius. Setpoint keeps every change.
|
|
92661
92722
|
*/
|
|
@@ -95293,7 +95354,7 @@ var ACTUATOR_TEMPLATE_IDS = [
|
|
|
95293
95354
|
"media-player",
|
|
95294
95355
|
"climate"
|
|
95295
95356
|
];
|
|
95296
|
-
function row$
|
|
95357
|
+
function row$2(cap, method, requires = null, confirm = false) {
|
|
95297
95358
|
return {
|
|
95298
95359
|
cap,
|
|
95299
95360
|
method,
|
|
@@ -95303,41 +95364,41 @@ function row$1(cap, method, requires = null, confirm = false) {
|
|
|
95303
95364
|
}
|
|
95304
95365
|
/** The first row's cap is the type's own: always offered, members without it are skipped. */
|
|
95305
95366
|
var ACTUATOR_METHODS = {
|
|
95306
|
-
switch: [row$
|
|
95367
|
+
switch: [row$2("switch", "setState")],
|
|
95307
95368
|
light: [
|
|
95308
|
-
row$
|
|
95309
|
-
row$
|
|
95310
|
-
row$
|
|
95369
|
+
row$2("switch", "setState"),
|
|
95370
|
+
row$2("brightness", "setBrightness"),
|
|
95371
|
+
row$2("color", "setColor")
|
|
95311
95372
|
],
|
|
95312
95373
|
fan: [
|
|
95313
|
-
row$
|
|
95314
|
-
row$
|
|
95315
|
-
row$
|
|
95316
|
-
row$
|
|
95317
|
-
row$
|
|
95374
|
+
row$2("switch", "setState"),
|
|
95375
|
+
row$2("fan-control", "setPercentage", DeviceFeature.FanSpeed),
|
|
95376
|
+
row$2("fan-control", "setPreset", DeviceFeature.FanPreset),
|
|
95377
|
+
row$2("fan-control", "setDirection", DeviceFeature.FanDirection),
|
|
95378
|
+
row$2("fan-control", "setOscillating", DeviceFeature.FanOscillating)
|
|
95318
95379
|
],
|
|
95319
95380
|
cover: [
|
|
95320
|
-
row$
|
|
95321
|
-
row$
|
|
95322
|
-
row$
|
|
95323
|
-
row$
|
|
95324
|
-
row$
|
|
95381
|
+
row$2("cover", "open"),
|
|
95382
|
+
row$2("cover", "close"),
|
|
95383
|
+
row$2("cover", "stop", DeviceFeature.CoverStoppable),
|
|
95384
|
+
row$2("cover", "setPosition", DeviceFeature.CoverPositionable),
|
|
95385
|
+
row$2("cover", "setTiltPosition", DeviceFeature.CoverTilt)
|
|
95325
95386
|
],
|
|
95326
95387
|
valve: [
|
|
95327
|
-
row$
|
|
95328
|
-
row$
|
|
95329
|
-
row$
|
|
95388
|
+
row$2("valve", "open"),
|
|
95389
|
+
row$2("valve", "close"),
|
|
95390
|
+
row$2("valve", "setPosition", DeviceFeature.ValvePositionable)
|
|
95330
95391
|
],
|
|
95331
|
-
lock: [row$
|
|
95392
|
+
lock: [row$2("lock-control", "lock"), row$2("lock-control", "unlock", null, true)],
|
|
95332
95393
|
"media-player": [
|
|
95333
|
-
row$
|
|
95334
|
-
row$
|
|
95335
|
-
row$
|
|
95394
|
+
row$2("media-player", "play"),
|
|
95395
|
+
row$2("media-player", "pause"),
|
|
95396
|
+
row$2("media-player", "setVolume", DeviceFeature.MediaPlayerVolume)
|
|
95336
95397
|
],
|
|
95337
95398
|
climate: [
|
|
95338
|
-
row$
|
|
95339
|
-
row$
|
|
95340
|
-
row$
|
|
95399
|
+
row$2("climate-control", "setMode"),
|
|
95400
|
+
row$2("climate-control", "setTarget"),
|
|
95401
|
+
row$2("climate-control", "setFanMode", DeviceFeature.ClimateFanMode)
|
|
95341
95402
|
]
|
|
95342
95403
|
};
|
|
95343
95404
|
/**
|
|
@@ -97490,6 +97551,1670 @@ function resolveMutate(router, method) {
|
|
|
97490
97551
|
const mutate = proc.mutate;
|
|
97491
97552
|
return typeof mutate === "function" ? mutate : null;
|
|
97492
97553
|
}
|
|
97554
|
+
/** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
|
|
97555
|
+
function contribution(cap, schema, build) {
|
|
97556
|
+
return {
|
|
97557
|
+
cap,
|
|
97558
|
+
contribute: (raw, ctx) => {
|
|
97559
|
+
const parsed = schema.safeParse(raw);
|
|
97560
|
+
return build(parsed.success ? parsed.data : void 0, ctx);
|
|
97561
|
+
}
|
|
97562
|
+
};
|
|
97563
|
+
}
|
|
97564
|
+
function action(id, label, icon, cap, method, args = {}, emphasis = "normal", confirm = null) {
|
|
97565
|
+
return {
|
|
97566
|
+
id,
|
|
97567
|
+
label,
|
|
97568
|
+
icon,
|
|
97569
|
+
call: {
|
|
97570
|
+
cap,
|
|
97571
|
+
method,
|
|
97572
|
+
args
|
|
97573
|
+
},
|
|
97574
|
+
emphasis,
|
|
97575
|
+
confirm
|
|
97576
|
+
};
|
|
97577
|
+
}
|
|
97578
|
+
var asAction = (a) => ({
|
|
97579
|
+
kind: "action",
|
|
97580
|
+
action: a
|
|
97581
|
+
});
|
|
97582
|
+
function reading(source, state, assumed = false, title) {
|
|
97583
|
+
return title === void 0 ? {
|
|
97584
|
+
source,
|
|
97585
|
+
state,
|
|
97586
|
+
assumed
|
|
97587
|
+
} : {
|
|
97588
|
+
source,
|
|
97589
|
+
state,
|
|
97590
|
+
assumed,
|
|
97591
|
+
title
|
|
97592
|
+
};
|
|
97593
|
+
}
|
|
97594
|
+
function fact(id, icon, text, tone = "muted") {
|
|
97595
|
+
return {
|
|
97596
|
+
id,
|
|
97597
|
+
icon,
|
|
97598
|
+
text,
|
|
97599
|
+
tone
|
|
97600
|
+
};
|
|
97601
|
+
}
|
|
97602
|
+
function row$1(id, icon, status, controls = []) {
|
|
97603
|
+
return {
|
|
97604
|
+
id,
|
|
97605
|
+
icon,
|
|
97606
|
+
status,
|
|
97607
|
+
controls: [...controls]
|
|
97608
|
+
};
|
|
97609
|
+
}
|
|
97610
|
+
/** "5 min" / "3 h" / "2 d" since `at`; `null` when the moment is unknown (0) or in the future. */
|
|
97611
|
+
function elapsedText(at, now) {
|
|
97612
|
+
if (at <= 0 || at > now) return null;
|
|
97613
|
+
const min = Math.floor((now - at) / 6e4);
|
|
97614
|
+
if (min < 1) return t("just now", "adesso");
|
|
97615
|
+
if (min < 60) return t(`${min} min ago`, `${min} min fa`);
|
|
97616
|
+
const h = Math.floor(min / 60);
|
|
97617
|
+
if (h < 48) return t(`${h} h ago`, `${h} h fa`);
|
|
97618
|
+
const d = Math.floor(h / 24);
|
|
97619
|
+
return t(`${d} d ago`, `${d} g fa`);
|
|
97620
|
+
}
|
|
97621
|
+
/** Joins words with " · ", skipping what is not there. */
|
|
97622
|
+
function joinText(parts) {
|
|
97623
|
+
const present = parts.filter((p) => p !== null);
|
|
97624
|
+
if (present.length === 0) return null;
|
|
97625
|
+
return t(present.map((p) => p.en).join(" · "), present.map((p) => p.it).join(" · "));
|
|
97626
|
+
}
|
|
97627
|
+
/**
|
|
97628
|
+
* What the access and automation caps add to a hero (D1023): a lock, an alarm
|
|
97629
|
+
* panel, an automation, a script and a media player's do-not-disturb. Every
|
|
97630
|
+
* contribution is typed against the cap's own status schema; a slice that does
|
|
97631
|
+
* not parse reads as "not answered" and the state is `unknown`, never `off`
|
|
97632
|
+
* (D315/D393). Nothing is guessed: with an unknown state the actions the cap
|
|
97633
|
+
* offers are offered separately.
|
|
97634
|
+
*/
|
|
97635
|
+
var LOCK_WORDS = {
|
|
97636
|
+
locked: {
|
|
97637
|
+
state: "on",
|
|
97638
|
+
title: t("Locked", "Chiusa"),
|
|
97639
|
+
door: "closed"
|
|
97640
|
+
},
|
|
97641
|
+
unlocked: {
|
|
97642
|
+
state: "standby",
|
|
97643
|
+
title: t("Unlocked", "Aperta"),
|
|
97644
|
+
door: "open"
|
|
97645
|
+
},
|
|
97646
|
+
locking: {
|
|
97647
|
+
state: "running",
|
|
97648
|
+
title: t("Locking", "In chiusura"),
|
|
97649
|
+
door: "closed"
|
|
97650
|
+
},
|
|
97651
|
+
unlocking: {
|
|
97652
|
+
state: "running",
|
|
97653
|
+
title: t("Unlocking", "In apertura"),
|
|
97654
|
+
door: "open"
|
|
97655
|
+
},
|
|
97656
|
+
jammed: {
|
|
97657
|
+
state: "alert",
|
|
97658
|
+
title: t("Jammed", "Bloccata"),
|
|
97659
|
+
door: null
|
|
97660
|
+
},
|
|
97661
|
+
"door-open": {
|
|
97662
|
+
state: "standby",
|
|
97663
|
+
title: t("Door open", "Porta aperta"),
|
|
97664
|
+
door: "open"
|
|
97665
|
+
}
|
|
97666
|
+
};
|
|
97667
|
+
var lockAction = (primary) => action("lock.lock", t("Lock", "Chiudi"), "lock", "lock-control", "lock", {}, primary ? "primary" : "normal");
|
|
97668
|
+
var unlockAction = (primary) => action("lock.unlock", t("Unlock", "Apri"), "lock-open", "lock-control", "unlock", {}, primary ? "primary" : "normal", "unlock");
|
|
97669
|
+
function lockControls(state, latch) {
|
|
97670
|
+
const open = asAction(action("lock.open", t("Open latch", "Apri il chiavistello"), "door-open", "lock-control", "open", {}, "normal", "unlock"));
|
|
97671
|
+
switch (state) {
|
|
97672
|
+
case "locked": return [asAction(unlockAction(true)), ...latch ? [open] : []];
|
|
97673
|
+
case "unlocked": return [asAction(lockAction(true)), ...latch ? [open] : []];
|
|
97674
|
+
case "jammed": return [asAction(unlockAction(false)), asAction(lockAction(false))];
|
|
97675
|
+
case null: return [asAction(lockAction(false)), asAction(unlockAction(false))];
|
|
97676
|
+
default: return [];
|
|
97677
|
+
}
|
|
97678
|
+
}
|
|
97679
|
+
var lockContribution = contribution("lock-control", LockControlStatusSchema, (slice, ctx) => {
|
|
97680
|
+
const state = slice?.state ?? null;
|
|
97681
|
+
const words = state === null ? null : LOCK_WORDS[state];
|
|
97682
|
+
const since = slice === void 0 ? null : elapsedText(slice.lastChangedAt, ctx.now);
|
|
97683
|
+
const title = words?.title ?? t("Unknown", "Sconosciuto");
|
|
97684
|
+
return {
|
|
97685
|
+
reading: reading("lock-control", words?.state ?? "unknown", false, words?.title),
|
|
97686
|
+
rows: [row$1("lock", state === "locked" || state === "locking" ? "lock" : "lock-open", joinText([title, since]), lockControls(state, ctx.features.includes(DeviceFeature.LockOpen)))],
|
|
97687
|
+
...since === null || words === null ? {} : { facts: [fact("since", "clock", since, "muted")] },
|
|
97688
|
+
...words?.door == null ? {} : { scene: { mode: words.door } }
|
|
97689
|
+
};
|
|
97690
|
+
});
|
|
97691
|
+
var ALARM_WORDS = {
|
|
97692
|
+
disarmed: {
|
|
97693
|
+
state: "off",
|
|
97694
|
+
title: t("Disarmed", "Disinserito")
|
|
97695
|
+
},
|
|
97696
|
+
armed_home: {
|
|
97697
|
+
state: "on",
|
|
97698
|
+
title: t("Armed home", "Inserito in casa")
|
|
97699
|
+
},
|
|
97700
|
+
armed_away: {
|
|
97701
|
+
state: "on",
|
|
97702
|
+
title: t("Armed away", "Inserito fuori casa")
|
|
97703
|
+
},
|
|
97704
|
+
armed_night: {
|
|
97705
|
+
state: "on",
|
|
97706
|
+
title: t("Armed night", "Inserito notte")
|
|
97707
|
+
},
|
|
97708
|
+
armed_vacation: {
|
|
97709
|
+
state: "on",
|
|
97710
|
+
title: t("Armed vacation", "Inserito vacanza")
|
|
97711
|
+
},
|
|
97712
|
+
armed_custom_bypass: {
|
|
97713
|
+
state: "on",
|
|
97714
|
+
title: t("Armed with bypass", "Inserito con esclusioni")
|
|
97715
|
+
},
|
|
97716
|
+
arming: {
|
|
97717
|
+
state: "standby",
|
|
97718
|
+
title: t("Arming", "Inserimento")
|
|
97719
|
+
},
|
|
97720
|
+
disarming: {
|
|
97721
|
+
state: "standby",
|
|
97722
|
+
title: t("Disarming", "Disinserimento")
|
|
97723
|
+
},
|
|
97724
|
+
pending: {
|
|
97725
|
+
state: "standby",
|
|
97726
|
+
title: t("Entry delay", "Ritardo di ingresso")
|
|
97727
|
+
},
|
|
97728
|
+
triggered: {
|
|
97729
|
+
state: "alert",
|
|
97730
|
+
title: t("Triggered", "Allarme in corso")
|
|
97731
|
+
}
|
|
97732
|
+
};
|
|
97733
|
+
var ARM_LABELS = {
|
|
97734
|
+
home: t("Arm home", "Inserisci in casa"),
|
|
97735
|
+
away: t("Arm away", "Inserisci fuori casa"),
|
|
97736
|
+
night: t("Arm night", "Inserisci notte"),
|
|
97737
|
+
vacation: t("Arm vacation", "Inserisci vacanza"),
|
|
97738
|
+
custom_bypass: t("Arm with bypass", "Inserisci con esclusioni")
|
|
97739
|
+
};
|
|
97740
|
+
var ALARM_MODES = [
|
|
97741
|
+
"home",
|
|
97742
|
+
"away",
|
|
97743
|
+
"night",
|
|
97744
|
+
"vacation",
|
|
97745
|
+
"custom_bypass"
|
|
97746
|
+
];
|
|
97747
|
+
function alarmControls(state, modes, requiresCode) {
|
|
97748
|
+
if (requiresCode) return [];
|
|
97749
|
+
const disarm = asAction(action("alarm.disarm", t("Disarm", "Disinserisci"), "shield-off", "alarm-panel", "disarm", {}, "primary"));
|
|
97750
|
+
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")));
|
|
97751
|
+
switch (state) {
|
|
97752
|
+
case "disarmed": return arm(true);
|
|
97753
|
+
case "arming":
|
|
97754
|
+
case "disarming": return [];
|
|
97755
|
+
case null: return [];
|
|
97756
|
+
default: return [disarm];
|
|
97757
|
+
}
|
|
97758
|
+
}
|
|
97759
|
+
var ACCESS_FAMILY_CONTRIBUTIONS = {
|
|
97760
|
+
"lock-control": lockContribution,
|
|
97761
|
+
"alarm-panel": contribution("alarm-panel", AlarmPanelStatusSchema, (slice, ctx) => {
|
|
97762
|
+
const state = slice?.state ?? null;
|
|
97763
|
+
const words = state === null ? null : ALARM_WORDS[state];
|
|
97764
|
+
const since = slice === void 0 ? null : elapsedText(slice.lastChangedAt, ctx.now);
|
|
97765
|
+
const modes = slice === void 0 ? ALARM_MODES : slice.availableModes;
|
|
97766
|
+
return {
|
|
97767
|
+
reading: reading("alarm-panel", words?.state ?? "unknown", false, words?.title),
|
|
97768
|
+
rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? t("Unknown", "Sconosciuto"), since]), alarmControls(state, modes, slice?.requiresCode ?? false))],
|
|
97769
|
+
...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] }
|
|
97770
|
+
};
|
|
97771
|
+
}),
|
|
97772
|
+
"automation-control": contribution("automation-control", AutomationControlStatusSchema, (slice, ctx) => {
|
|
97773
|
+
const failed = slice?.lastError != null;
|
|
97774
|
+
const state = slice === void 0 ? "unknown" : failed ? "alert" : slice.isRunning ? "running" : slice.enabled ? "on" : "off";
|
|
97775
|
+
const title = slice === void 0 ? void 0 : failed ? t("Failed", "In errore") : slice.isRunning ? t("Running", "In esecuzione") : slice.enabled ? t("Enabled", "Attiva") : t("Disabled", "Disattivata");
|
|
97776
|
+
const last = slice === void 0 ? null : elapsedText(slice.lastTriggeredAt, ctx.now);
|
|
97777
|
+
const run = action("automation.run", t("Run now", "Esegui ora"), "play", "automation-control", "trigger", {}, "primary");
|
|
97778
|
+
const toggle = {
|
|
97779
|
+
kind: "toggle",
|
|
97780
|
+
id: "automation.enabled",
|
|
97781
|
+
label: t("Enabled", "Attiva"),
|
|
97782
|
+
on: slice?.enabled ?? null,
|
|
97783
|
+
turnOn: action("automation.enable", t("Enable", "Attiva"), "play", "automation-control", "enable"),
|
|
97784
|
+
turnOff: action("automation.disable", t("Disable", "Disattiva"), "square", "automation-control", "disable")
|
|
97785
|
+
};
|
|
97786
|
+
return {
|
|
97787
|
+
reading: reading("automation-control", state, false, title),
|
|
97788
|
+
rows: [row$1("automation", "workflow", joinText([
|
|
97789
|
+
title ?? t("Unknown", "Sconosciuto"),
|
|
97790
|
+
last === null ? null : t(`Ran ${last.en}`, `Eseguita ${last.it}`),
|
|
97791
|
+
slice?.lastError == null ? null : t(slice.lastError, slice.lastError)
|
|
97792
|
+
]), [asAction(run), toggle])],
|
|
97793
|
+
...last === null ? {} : { facts: [fact("last-run", "clock", last, failed ? "danger" : "muted")] }
|
|
97794
|
+
};
|
|
97795
|
+
}),
|
|
97796
|
+
"script-runner": contribution("script-runner", ScriptRunnerStatusSchema, (slice, ctx) => {
|
|
97797
|
+
const failed = slice?.lastRunSuccess === false;
|
|
97798
|
+
const state = slice === void 0 ? "unknown" : slice.isRunning ? "running" : failed ? "alert" : "idle";
|
|
97799
|
+
const title = slice === void 0 ? void 0 : slice.isRunning ? t("Running", "In esecuzione") : failed ? t("Failed", "In errore") : t("Ready", "Pronto");
|
|
97800
|
+
const last = slice === void 0 ? null : elapsedText(slice.lastRunAt, ctx.now);
|
|
97801
|
+
const control = slice?.isRunning === true ? action("script.stop", t("Stop", "Ferma"), "square", "script-runner", "stop", {}, "primary") : action("script.run", t("Run", "Esegui"), "play", "script-runner", "run", {}, "primary");
|
|
97802
|
+
return {
|
|
97803
|
+
reading: reading("script-runner", state, false, title),
|
|
97804
|
+
rows: [row$1("script", "scroll-text", joinText([
|
|
97805
|
+
title ?? t("Unknown", "Sconosciuto"),
|
|
97806
|
+
last === null ? null : t(`Ran ${last.en}`, `Eseguito ${last.it}`),
|
|
97807
|
+
slice?.lastError == null ? null : t(slice.lastError, slice.lastError)
|
|
97808
|
+
]), [asAction(control)])],
|
|
97809
|
+
...last === null ? {} : { facts: [fact("last-run", "clock", last, failed ? "danger" : "muted")] }
|
|
97810
|
+
};
|
|
97811
|
+
}),
|
|
97812
|
+
"do-not-disturb": contribution("do-not-disturb", DoNotDisturbStatusSchema, (slice) => {
|
|
97813
|
+
const on = slice?.enabled ?? null;
|
|
97814
|
+
return { rows: [row$1("do-not-disturb", "bell-off", on === null ? t("Unknown", "Sconosciuto") : on ? t("Do not disturb on", "Non disturbare attivo") : t("Do not disturb off", "Non disturbare spento"), [{
|
|
97815
|
+
kind: "toggle",
|
|
97816
|
+
id: "do-not-disturb.toggle",
|
|
97817
|
+
label: t("Do not disturb", "Non disturbare"),
|
|
97818
|
+
on,
|
|
97819
|
+
turnOn: action("do-not-disturb.on", t("Turn on", "Attiva"), "bell-off", "do-not-disturb", "setEnabled", { enabled: true }),
|
|
97820
|
+
turnOff: action("do-not-disturb.off", t("Turn off", "Disattiva"), "bell", "do-not-disturb", "setEnabled", { enabled: false })
|
|
97821
|
+
}])] };
|
|
97822
|
+
})
|
|
97823
|
+
};
|
|
97824
|
+
/**
|
|
97825
|
+
* What the household-device caps add to a hero (D1023): a fan, a robot vacuum,
|
|
97826
|
+
* a robot mower, a pet feeder, a pet fountain and its pump cycle. Typed against
|
|
97827
|
+
* each cap's own status schema; a slice that does not parse is "not answered"
|
|
97828
|
+
* (`unknown`, never `off`, D315/D393). A measurement the device did not report
|
|
97829
|
+
* is absent from the facts, never a zero (D393).
|
|
97830
|
+
*/
|
|
97831
|
+
var has$3 = (ctx, f) => ctx.features.includes(f);
|
|
97832
|
+
var unknownText = t("Unknown", "Sconosciuto");
|
|
97833
|
+
var pct$1 = (n) => t(`${Math.round(n)}%`, `${Math.round(n)}%`);
|
|
97834
|
+
var unit = (n) => Math.min(1, Math.max(0, n / 100));
|
|
97835
|
+
/** Battery as a fact, unless the device is also bound to the `battery` cap (it already says so). */
|
|
97836
|
+
function ownBattery(level, ctx) {
|
|
97837
|
+
if (level === null || ctx.caps.includes("battery")) return [];
|
|
97838
|
+
const tone = level <= 20 ? "danger" : level <= 40 ? "warning" : "success";
|
|
97839
|
+
return [fact("battery", "battery", t(`Battery ${Math.round(level)}%`, `Batteria ${Math.round(level)}%`), tone)];
|
|
97840
|
+
}
|
|
97841
|
+
var fanContribution = contribution("fan-control", FanControlStatusSchema, (slice, ctx) => {
|
|
97842
|
+
const speed = slice?.speed ?? null;
|
|
97843
|
+
const state = speed === null ? "unknown" : speed > 0 ? "running" : "off";
|
|
97844
|
+
const controls = [];
|
|
97845
|
+
if (speed !== null || has$3(ctx, DeviceFeature.FanSpeed)) controls.push({
|
|
97846
|
+
kind: "slider",
|
|
97847
|
+
id: "fan.speed",
|
|
97848
|
+
label: t("Speed", "Velocità"),
|
|
97849
|
+
value: speed,
|
|
97850
|
+
min: 0,
|
|
97851
|
+
max: 100,
|
|
97852
|
+
step: slice?.percentageStep ?? 1,
|
|
97853
|
+
unit: "%",
|
|
97854
|
+
call: {
|
|
97855
|
+
cap: "fan-control",
|
|
97856
|
+
method: "setPercentage",
|
|
97857
|
+
args: {}
|
|
97858
|
+
},
|
|
97859
|
+
valueArg: "speed"
|
|
97860
|
+
});
|
|
97861
|
+
if (slice !== void 0 && slice.availablePresets.length > 0) controls.push({
|
|
97862
|
+
kind: "picker",
|
|
97863
|
+
id: "fan.preset",
|
|
97864
|
+
label: t("Mode", "Modalità"),
|
|
97865
|
+
current: slice.preset === "" ? null : slice.preset,
|
|
97866
|
+
options: [...slice.availablePresets],
|
|
97867
|
+
call: {
|
|
97868
|
+
cap: "fan-control",
|
|
97869
|
+
method: "setPreset",
|
|
97870
|
+
args: {}
|
|
97871
|
+
},
|
|
97872
|
+
valueArg: "preset"
|
|
97873
|
+
});
|
|
97874
|
+
if (slice?.oscillating != null || has$3(ctx, DeviceFeature.FanOscillating)) controls.push({
|
|
97875
|
+
kind: "toggle",
|
|
97876
|
+
id: "fan.oscillating",
|
|
97877
|
+
label: t("Oscillate", "Oscilla"),
|
|
97878
|
+
on: slice?.oscillating ?? null,
|
|
97879
|
+
turnOn: action("fan.oscillate.on", t("Oscillate", "Oscilla"), "refresh-cw", "fan-control", "setOscillating", { oscillating: true }),
|
|
97880
|
+
turnOff: action("fan.oscillate.off", t("Hold still", "Fermo"), "square", "fan-control", "setOscillating", { oscillating: false })
|
|
97881
|
+
});
|
|
97882
|
+
if (slice?.direction != null || has$3(ctx, DeviceFeature.FanDirection)) controls.push({
|
|
97883
|
+
kind: "picker",
|
|
97884
|
+
id: "fan.direction",
|
|
97885
|
+
label: t("Direction", "Direzione"),
|
|
97886
|
+
current: slice?.direction ?? null,
|
|
97887
|
+
options: ["forward", "reverse"],
|
|
97888
|
+
call: {
|
|
97889
|
+
cap: "fan-control",
|
|
97890
|
+
method: "setDirection",
|
|
97891
|
+
args: {}
|
|
97892
|
+
},
|
|
97893
|
+
valueArg: "direction"
|
|
97894
|
+
});
|
|
97895
|
+
const speedText = speed === null ? null : pct$1(speed);
|
|
97896
|
+
const preset = slice?.preset ?? "";
|
|
97897
|
+
const status = speed === null ? unknownText : joinText([speed === 0 ? t("Off", "Spento") : t(`Speed ${speed}%`, `Velocità ${speed}%`), preset === "" ? null : t(preset, preset)]);
|
|
97898
|
+
return {
|
|
97899
|
+
reading: reading("fan-control", state),
|
|
97900
|
+
rows: [{
|
|
97901
|
+
id: "fan",
|
|
97902
|
+
icon: "fan",
|
|
97903
|
+
status,
|
|
97904
|
+
controls
|
|
97905
|
+
}],
|
|
97906
|
+
...speedText === null ? {} : {
|
|
97907
|
+
facts: [fact("speed", "fan", speedText, speed === 0 ? "muted" : "primary")],
|
|
97908
|
+
tiles: { right: [{
|
|
97909
|
+
label: t("Speed", "Velocità"),
|
|
97910
|
+
value: speedText
|
|
97911
|
+
}] },
|
|
97912
|
+
scene: { level: unit(speed ?? 0) }
|
|
97913
|
+
}
|
|
97914
|
+
};
|
|
97915
|
+
});
|
|
97916
|
+
var VACUUM_WORDS = {
|
|
97917
|
+
idle: {
|
|
97918
|
+
state: "idle",
|
|
97919
|
+
title: t("Idle", "Inattivo")
|
|
97920
|
+
},
|
|
97921
|
+
cleaning: {
|
|
97922
|
+
state: "running",
|
|
97923
|
+
title: t("Cleaning", "Pulisce")
|
|
97924
|
+
},
|
|
97925
|
+
paused: {
|
|
97926
|
+
state: "standby",
|
|
97927
|
+
title: t("Paused", "In pausa")
|
|
97928
|
+
},
|
|
97929
|
+
returning: {
|
|
97930
|
+
state: "running",
|
|
97931
|
+
title: t("Returning to base", "Torna alla base")
|
|
97932
|
+
},
|
|
97933
|
+
docked: {
|
|
97934
|
+
state: "idle",
|
|
97935
|
+
title: t("Docked", "In base")
|
|
97936
|
+
},
|
|
97937
|
+
drying: {
|
|
97938
|
+
state: "running",
|
|
97939
|
+
title: t("Drying", "Asciuga")
|
|
97940
|
+
},
|
|
97941
|
+
error: {
|
|
97942
|
+
state: "alert",
|
|
97943
|
+
title: t("Error", "Errore")
|
|
97944
|
+
}
|
|
97945
|
+
};
|
|
97946
|
+
function robotAction(cap, prefix, id, en, it, icon, method, primary = false) {
|
|
97947
|
+
return asAction(action(`${prefix}.${id}`, t(en, it), icon, cap, method, {}, primary ? "primary" : "normal"));
|
|
97948
|
+
}
|
|
97949
|
+
var vac = (id, en, it, icon, method, primary = false) => robotAction("vacuum-control", "vacuum", id, en, it, icon, method, primary);
|
|
97950
|
+
function vacuumControls(state) {
|
|
97951
|
+
const start = (primary) => vac("start", "Start", "Avvia", "play", "start", primary);
|
|
97952
|
+
const resume = vac("resume", "Resume", "Riprendi", "play", "start", true);
|
|
97953
|
+
const pause = (primary) => vac("pause", "Pause", "Pausa", "pause", "pause", primary);
|
|
97954
|
+
const base = vac("base", "Return to base", "Torna alla base", "house", "returnToBase");
|
|
97955
|
+
switch (state) {
|
|
97956
|
+
case "cleaning": return [pause(true), base];
|
|
97957
|
+
case "paused": return [resume, base];
|
|
97958
|
+
case "returning":
|
|
97959
|
+
case "drying": return [vac("stop", "Stop", "Ferma", "square", "stop")];
|
|
97960
|
+
case "idle": return [start(true), base];
|
|
97961
|
+
case "docked": return [start(true)];
|
|
97962
|
+
case "error": return [base];
|
|
97963
|
+
case null: return [
|
|
97964
|
+
start(false),
|
|
97965
|
+
pause(false),
|
|
97966
|
+
base
|
|
97967
|
+
];
|
|
97968
|
+
}
|
|
97969
|
+
}
|
|
97970
|
+
var vacuumContribution = contribution("vacuum-control", VacuumControlStatusSchema, (slice, ctx) => {
|
|
97971
|
+
const state = slice?.state ?? null;
|
|
97972
|
+
const words = state === null ? null : VACUUM_WORDS[state];
|
|
97973
|
+
const title = state === "error" && slice?.errorLabel ? t(slice.errorLabel, slice.errorLabel) : words?.title;
|
|
97974
|
+
const controls = vacuumControls(state);
|
|
97975
|
+
if (slice !== void 0 && slice.availableFanSpeeds.length > 0) controls.push({
|
|
97976
|
+
kind: "picker",
|
|
97977
|
+
id: "vacuum.suction",
|
|
97978
|
+
label: t("Suction", "Aspirazione"),
|
|
97979
|
+
current: slice.fanSpeed,
|
|
97980
|
+
options: [...slice.availableFanSpeeds],
|
|
97981
|
+
call: {
|
|
97982
|
+
cap: "vacuum-control",
|
|
97983
|
+
method: "setFanSpeed",
|
|
97984
|
+
args: {}
|
|
97985
|
+
},
|
|
97986
|
+
valueArg: "speed"
|
|
97987
|
+
});
|
|
97988
|
+
if (state !== null) controls.push(vac("locate", "Locate", "Trova", "map-pin", "locate"));
|
|
97989
|
+
const progress = state === "cleaning" ? slice?.progress ?? null : null;
|
|
97990
|
+
return {
|
|
97991
|
+
reading: reading("vacuum-control", words?.state ?? "unknown", false, title),
|
|
97992
|
+
rows: [{
|
|
97993
|
+
id: "vacuum",
|
|
97994
|
+
icon: "bot",
|
|
97995
|
+
status: title ?? unknownText,
|
|
97996
|
+
controls
|
|
97997
|
+
}],
|
|
97998
|
+
facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$1(progress), "primary")]],
|
|
97999
|
+
...progress === null ? {} : {
|
|
98000
|
+
tiles: { right: [{
|
|
98001
|
+
label: t("Progress", "Avanzamento"),
|
|
98002
|
+
value: pct$1(progress)
|
|
98003
|
+
}] },
|
|
98004
|
+
scene: { level: unit(progress) }
|
|
98005
|
+
}
|
|
98006
|
+
};
|
|
98007
|
+
});
|
|
98008
|
+
var MOWER_WORDS = {
|
|
98009
|
+
idle: {
|
|
98010
|
+
state: "idle",
|
|
98011
|
+
title: t("Idle", "Inattivo")
|
|
98012
|
+
},
|
|
98013
|
+
mowing: {
|
|
98014
|
+
state: "running",
|
|
98015
|
+
title: t("Mowing", "Taglia")
|
|
98016
|
+
},
|
|
98017
|
+
paused: {
|
|
98018
|
+
state: "standby",
|
|
98019
|
+
title: t("Paused", "In pausa")
|
|
98020
|
+
},
|
|
98021
|
+
docked: {
|
|
98022
|
+
state: "idle",
|
|
98023
|
+
title: t("Docked", "In base")
|
|
98024
|
+
},
|
|
98025
|
+
error: {
|
|
98026
|
+
state: "alert",
|
|
98027
|
+
title: t("Error", "Errore")
|
|
98028
|
+
}
|
|
98029
|
+
};
|
|
98030
|
+
var mow = (id, en, it, icon, method, primary = false) => robotAction("lawn-mower-control", "mower", id, en, it, icon, method, primary);
|
|
98031
|
+
function mowerControls(activity) {
|
|
98032
|
+
const start = (primary) => mow("start", "Start mowing", "Avvia il taglio", "play", "startMowing", primary);
|
|
98033
|
+
const pause = (primary) => mow("pause", "Pause", "Pausa", "pause", "pause", primary);
|
|
98034
|
+
const dock = mow("dock", "Return to base", "Torna alla base", "house", "dock");
|
|
98035
|
+
switch (activity) {
|
|
98036
|
+
case "mowing": return [pause(true), dock];
|
|
98037
|
+
case "paused": return [mow("resume", "Resume", "Riprendi", "play", "startMowing", true), dock];
|
|
98038
|
+
case "idle": return [start(true), dock];
|
|
98039
|
+
case "docked": return [start(true)];
|
|
98040
|
+
case "error": return [dock];
|
|
98041
|
+
case null: return [
|
|
98042
|
+
start(false),
|
|
98043
|
+
pause(false),
|
|
98044
|
+
dock
|
|
98045
|
+
];
|
|
98046
|
+
}
|
|
98047
|
+
}
|
|
98048
|
+
var mowerContribution = contribution("lawn-mower-control", LawnMowerControlStatusSchema, (slice, ctx) => {
|
|
98049
|
+
const activity = slice?.activity ?? null;
|
|
98050
|
+
const words = activity === null ? null : MOWER_WORDS[activity];
|
|
98051
|
+
const title = activity === "error" && slice?.currentCodeLabel ? t(slice.currentCodeLabel, slice.currentCodeLabel) : words?.title;
|
|
98052
|
+
const progress = activity === "mowing" ? slice?.progress ?? null : null;
|
|
98053
|
+
return {
|
|
98054
|
+
reading: reading("lawn-mower-control", words?.state ?? "unknown", false, title),
|
|
98055
|
+
rows: [{
|
|
98056
|
+
id: "mower",
|
|
98057
|
+
icon: "sprout",
|
|
98058
|
+
status: title ?? unknownText,
|
|
98059
|
+
controls: mowerControls(activity)
|
|
98060
|
+
}],
|
|
98061
|
+
facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$1(progress), "primary")]],
|
|
98062
|
+
...progress === null ? {} : {
|
|
98063
|
+
tiles: { right: [{
|
|
98064
|
+
label: t("Progress", "Avanzamento"),
|
|
98065
|
+
value: pct$1(progress)
|
|
98066
|
+
}] },
|
|
98067
|
+
scene: { level: unit(progress) }
|
|
98068
|
+
}
|
|
98069
|
+
};
|
|
98070
|
+
});
|
|
98071
|
+
function feederWords(slice) {
|
|
98072
|
+
if (slice === void 0) return null;
|
|
98073
|
+
if (slice.status === "offline") return {
|
|
98074
|
+
state: "offline",
|
|
98075
|
+
title: t("Offline", "Non raggiungibile")
|
|
98076
|
+
};
|
|
98077
|
+
if (slice.error !== null) return {
|
|
98078
|
+
state: "alert",
|
|
98079
|
+
title: t(slice.error, slice.error)
|
|
98080
|
+
};
|
|
98081
|
+
if (slice.feeding) return {
|
|
98082
|
+
state: "running",
|
|
98083
|
+
title: t("Dispensing", "Eroga")
|
|
98084
|
+
};
|
|
98085
|
+
if (slice.eating) return {
|
|
98086
|
+
state: "running",
|
|
98087
|
+
title: t("Pet is eating", "Sta mangiando")
|
|
98088
|
+
};
|
|
98089
|
+
if (slice.lowFood) return {
|
|
98090
|
+
state: "standby",
|
|
98091
|
+
title: t("Food is low", "Cibo in esaurimento")
|
|
98092
|
+
};
|
|
98093
|
+
return {
|
|
98094
|
+
state: "idle",
|
|
98095
|
+
title: t("Ready", "Pronto")
|
|
98096
|
+
};
|
|
98097
|
+
}
|
|
98098
|
+
/** The manual portion the card offers: the last one given, else the hardware minimum. */
|
|
98099
|
+
function feedArgs(slice) {
|
|
98100
|
+
if (slice.isDualHopper) return {
|
|
98101
|
+
hopper1: slice.lastFeedHopper1 ?? 4,
|
|
98102
|
+
hopper2: slice.lastFeedHopper2 ?? 4
|
|
98103
|
+
};
|
|
98104
|
+
return { grams: slice.lastFeedGrams ?? 4 };
|
|
98105
|
+
}
|
|
98106
|
+
function feederControls(slice) {
|
|
98107
|
+
return [
|
|
98108
|
+
asAction(slice.feeding ? action("feeder.cancel", t("Cancel", "Annulla"), "square", "pet-feeder", "cancelFeed", {}, "primary") : action("feeder.feed", slice.isDualHopper ? t("Feed", "Eroga") : t(`Feed ${slice.lastFeedGrams ?? 4} g`, `Eroga ${slice.lastFeedGrams ?? 4} g`), "bone", "pet-feeder", "feed", feedArgs(slice), "primary")),
|
|
98109
|
+
asAction(action("feeder.call", t("Call pet", "Chiama"), "volume-2", "pet-feeder", "callPet")),
|
|
98110
|
+
{
|
|
98111
|
+
kind: "toggle",
|
|
98112
|
+
id: "feeder.child-lock",
|
|
98113
|
+
label: t("Child lock", "Blocco bambini"),
|
|
98114
|
+
on: slice.childLock,
|
|
98115
|
+
turnOn: action("feeder.child-lock.on", t("Lock", "Blocca"), "lock", "pet-feeder", "setChildLock", { on: true }),
|
|
98116
|
+
turnOff: action("feeder.child-lock.off", t("Unlock", "Sblocca"), "lock-open", "pet-feeder", "setChildLock", { on: false })
|
|
98117
|
+
}
|
|
98118
|
+
];
|
|
98119
|
+
}
|
|
98120
|
+
var feederContribution = contribution("pet-feeder", PetFeederStatusSchema, (slice, ctx) => {
|
|
98121
|
+
const words = feederWords(slice);
|
|
98122
|
+
const last = slice?.lastFeedGrams ?? null;
|
|
98123
|
+
return {
|
|
98124
|
+
reading: reading("pet-feeder", words?.state ?? "unknown", false, words?.title),
|
|
98125
|
+
rows: [{
|
|
98126
|
+
id: "feeder",
|
|
98127
|
+
icon: "bone",
|
|
98128
|
+
status: words?.title ?? unknownText,
|
|
98129
|
+
controls: slice === void 0 ? [] : feederControls(slice)
|
|
98130
|
+
}],
|
|
98131
|
+
facts: [
|
|
98132
|
+
...slice?.lowFood === true ? [fact("level", "bone", t("Food low", "Cibo in esaurimento"), "warning")] : [],
|
|
98133
|
+
...last === null ? [] : [fact("last-run", "clock", t(`Last ${last} g`, `Ultimo ${last} g`))],
|
|
98134
|
+
...ownBattery(slice?.powerSource === "battery" ? slice.batteryPower : null, ctx)
|
|
98135
|
+
],
|
|
98136
|
+
...last === null ? {} : { tiles: { right: [{
|
|
98137
|
+
label: t("Last portion", "Ultima porzione"),
|
|
98138
|
+
value: t(`${last} g`, `${last} g`)
|
|
98139
|
+
}] } }
|
|
98140
|
+
};
|
|
98141
|
+
});
|
|
98142
|
+
var fountainContribution = contribution("pet-fountain", PetFountainStatusSchema, (slice) => {
|
|
98143
|
+
const pump = slice?.pumpRunning ?? null;
|
|
98144
|
+
const fault = slice?.error ?? null;
|
|
98145
|
+
const empty = slice?.empty === true;
|
|
98146
|
+
const state = slice === void 0 ? "unknown" : fault !== null || empty ? "alert" : pump === null ? "unknown" : pump ? "running" : "off";
|
|
98147
|
+
const title = slice === void 0 ? void 0 : fault !== null ? t(fault, fault) : empty ? t("Tank empty", "Serbatoio vuoto") : pump === null ? void 0 : pump ? t("Pump running", "Pompa attiva") : t("Pump off", "Pompa spenta");
|
|
98148
|
+
const level = slice?.waterLevel ?? null;
|
|
98149
|
+
const control = {
|
|
98150
|
+
kind: "toggle",
|
|
98151
|
+
id: "fountain.pump",
|
|
98152
|
+
label: t("Pump", "Pompa"),
|
|
98153
|
+
on: pump,
|
|
98154
|
+
turnOn: action("fountain.pump.on", t("Pump on", "Accendi la pompa"), "droplets", "pet-fountain", "setPump", { on: true }, "primary"),
|
|
98155
|
+
turnOff: action("fountain.pump.off", t("Pump off", "Spegni la pompa"), "square", "pet-fountain", "setPump", { on: false })
|
|
98156
|
+
};
|
|
98157
|
+
return {
|
|
98158
|
+
reading: reading("pet-fountain", state, false, title),
|
|
98159
|
+
rows: [{
|
|
98160
|
+
id: "fountain",
|
|
98161
|
+
icon: "droplets",
|
|
98162
|
+
status: title ?? unknownText,
|
|
98163
|
+
controls: slice === void 0 ? [] : [control]
|
|
98164
|
+
}],
|
|
98165
|
+
...level === null ? {} : {
|
|
98166
|
+
facts: [fact("level", "droplets", t(`Water ${Math.round(level)}%`, `Acqua ${Math.round(level)}%`), level <= 20 ? "warning" : "primary")],
|
|
98167
|
+
tiles: { right: [{
|
|
98168
|
+
label: t("Water", "Acqua"),
|
|
98169
|
+
value: pct$1(level)
|
|
98170
|
+
}] },
|
|
98171
|
+
scene: { level: unit(level) }
|
|
98172
|
+
}
|
|
98173
|
+
};
|
|
98174
|
+
});
|
|
98175
|
+
var minutesOf = (seconds) => Math.max(0, Math.round(seconds / 60));
|
|
98176
|
+
var DEVICES_FAMILY_CONTRIBUTIONS = {
|
|
98177
|
+
"fan-control": fanContribution,
|
|
98178
|
+
"vacuum-control": vacuumContribution,
|
|
98179
|
+
"lawn-mower-control": mowerContribution,
|
|
98180
|
+
"pet-feeder": feederContribution,
|
|
98181
|
+
"pet-fountain": fountainContribution,
|
|
98182
|
+
"pump-cycle": contribution("pump-cycle", PumpCycleStatusSchema, (slice) => {
|
|
98183
|
+
const enabled = slice?.enabled ?? null;
|
|
98184
|
+
const cycle = slice?.onTime != null && slice.offTime != null ? t(`${minutesOf(slice.onTime)} min on · ${minutesOf(slice.offTime)} min off`, `${minutesOf(slice.onTime)} min acceso · ${minutesOf(slice.offTime)} min spento`) : null;
|
|
98185
|
+
return { rows: [row$1("pump-cycle", "timer", enabled === null ? unknownText : enabled ? joinText([t("Cycling", "A cicli"), cycle]) : t("Runs continuously", "Sempre attiva"), [{
|
|
98186
|
+
kind: "toggle",
|
|
98187
|
+
id: "pump-cycle.enabled",
|
|
98188
|
+
label: t("Pump cycle", "Ciclo pompa"),
|
|
98189
|
+
on: enabled,
|
|
98190
|
+
turnOn: action("pump-cycle.on", t("Cycle the pump", "Attiva il ciclo"), "timer", "pump-cycle", "setEnabled", { on: true }),
|
|
98191
|
+
turnOff: action("pump-cycle.off", t("Run continuously", "Sempre attiva"), "timer-off", "pump-cycle", "setEnabled", { on: false })
|
|
98192
|
+
}])] };
|
|
98193
|
+
})
|
|
98194
|
+
};
|
|
98195
|
+
/**
|
|
98196
|
+
* What the moving and dimming caps add to a hero (D1023): a light's brightness
|
|
98197
|
+
* and colour, a cover, a valve and a humidifier. Moving a cover or a valve is
|
|
98198
|
+
* an ACTION the person presses, never a toggle that fires by itself; a slice
|
|
98199
|
+
* that does not parse reads `unknown`, never closed or off (D315/D393).
|
|
98200
|
+
*/
|
|
98201
|
+
var has$2 = (ctx, f) => ctx.features.includes(f);
|
|
98202
|
+
var pct = (n) => t(`${Math.round(n)}%`, `${Math.round(n)}%`);
|
|
98203
|
+
var brightnessContribution = contribution("brightness", BrightnessStatusSchema, (slice) => {
|
|
98204
|
+
const level = slice?.level ?? null;
|
|
98205
|
+
return {
|
|
98206
|
+
...level === null ? {} : { reading: reading("brightness", level > 0 ? "on" : "off") },
|
|
98207
|
+
...level === null ? {} : {
|
|
98208
|
+
facts: [fact("level", "sun-dim", pct(level), level > 0 ? "primary" : "muted")],
|
|
98209
|
+
scene: { level: level / 100 }
|
|
98210
|
+
},
|
|
98211
|
+
rows: [row$1("brightness", "sun-dim", level === null ? null : t(`Brightness ${Math.round(level)}%`, `Luminosità ${Math.round(level)}%`), [{
|
|
98212
|
+
kind: "slider",
|
|
98213
|
+
id: "brightness.level",
|
|
98214
|
+
label: t("Brightness", "Luminosità"),
|
|
98215
|
+
value: level,
|
|
98216
|
+
min: 0,
|
|
98217
|
+
max: 100,
|
|
98218
|
+
step: 1,
|
|
98219
|
+
unit: "%",
|
|
98220
|
+
call: {
|
|
98221
|
+
cap: "brightness",
|
|
98222
|
+
method: "setBrightness",
|
|
98223
|
+
args: {}
|
|
98224
|
+
},
|
|
98225
|
+
valueArg: "level"
|
|
98226
|
+
}])]
|
|
98227
|
+
};
|
|
98228
|
+
});
|
|
98229
|
+
/**
|
|
98230
|
+
* Preset colours as actions: `setColor` takes a nested `{ mode, … }` argument, which a
|
|
98231
|
+
* hero action carries (D1023). Only the modes the bulb declares are offered, each a
|
|
98232
|
+
* valid `setColor` input; a bulb that declares none is shown, not set.
|
|
98233
|
+
*/
|
|
98234
|
+
var WHITE_PRESETS = [
|
|
98235
|
+
{
|
|
98236
|
+
id: "color.warm",
|
|
98237
|
+
en: "Warm white",
|
|
98238
|
+
it: "Bianco caldo",
|
|
98239
|
+
icon: "sun",
|
|
98240
|
+
mired: 370
|
|
98241
|
+
},
|
|
98242
|
+
{
|
|
98243
|
+
id: "color.neutral",
|
|
98244
|
+
en: "Neutral white",
|
|
98245
|
+
it: "Bianco neutro",
|
|
98246
|
+
icon: "lightbulb",
|
|
98247
|
+
mired: 250
|
|
98248
|
+
},
|
|
98249
|
+
{
|
|
98250
|
+
id: "color.cool",
|
|
98251
|
+
en: "Cool white",
|
|
98252
|
+
it: "Bianco freddo",
|
|
98253
|
+
icon: "snowflake",
|
|
98254
|
+
mired: 154
|
|
98255
|
+
}
|
|
98256
|
+
];
|
|
98257
|
+
var HUE_PRESETS = [
|
|
98258
|
+
{
|
|
98259
|
+
id: "color.red",
|
|
98260
|
+
en: "Red",
|
|
98261
|
+
it: "Rosso",
|
|
98262
|
+
hue: 0
|
|
98263
|
+
},
|
|
98264
|
+
{
|
|
98265
|
+
id: "color.amber",
|
|
98266
|
+
en: "Amber",
|
|
98267
|
+
it: "Ambra",
|
|
98268
|
+
hue: 40
|
|
98269
|
+
},
|
|
98270
|
+
{
|
|
98271
|
+
id: "color.green",
|
|
98272
|
+
en: "Green",
|
|
98273
|
+
it: "Verde",
|
|
98274
|
+
hue: 120
|
|
98275
|
+
},
|
|
98276
|
+
{
|
|
98277
|
+
id: "color.cyan",
|
|
98278
|
+
en: "Cyan",
|
|
98279
|
+
it: "Ciano",
|
|
98280
|
+
hue: 180
|
|
98281
|
+
},
|
|
98282
|
+
{
|
|
98283
|
+
id: "color.blue",
|
|
98284
|
+
en: "Blue",
|
|
98285
|
+
it: "Blu",
|
|
98286
|
+
hue: 240
|
|
98287
|
+
},
|
|
98288
|
+
{
|
|
98289
|
+
id: "color.purple",
|
|
98290
|
+
en: "Purple",
|
|
98291
|
+
it: "Viola",
|
|
98292
|
+
hue: 280
|
|
98293
|
+
}
|
|
98294
|
+
];
|
|
98295
|
+
function colorControls(ctx, current) {
|
|
98296
|
+
const controls = [];
|
|
98297
|
+
if (has$2(ctx, DeviceFeature.LightColorMired)) for (const p of WHITE_PRESETS) controls.push(asAction(action(p.id, t(p.en, p.it), p.icon, "color", "setColor", { color: {
|
|
98298
|
+
mode: "mired",
|
|
98299
|
+
colorTemperature: p.mired
|
|
98300
|
+
} })));
|
|
98301
|
+
if (has$2(ctx, DeviceFeature.LightColorHsv)) {
|
|
98302
|
+
const s = current?.s ?? 100;
|
|
98303
|
+
const v = current?.v ?? 100;
|
|
98304
|
+
for (const p of HUE_PRESETS) controls.push(asAction(action(p.id, t(p.en, p.it), "palette", "color", "setColor", { color: {
|
|
98305
|
+
mode: "hsv",
|
|
98306
|
+
hsv: {
|
|
98307
|
+
h: p.hue,
|
|
98308
|
+
s,
|
|
98309
|
+
v
|
|
98310
|
+
}
|
|
98311
|
+
} })));
|
|
98312
|
+
}
|
|
98313
|
+
return controls;
|
|
98314
|
+
}
|
|
98315
|
+
var colorContribution = contribution("color", ColorStatusSchema, (slice, ctx) => {
|
|
98316
|
+
let words = null;
|
|
98317
|
+
if (slice !== void 0) {
|
|
98318
|
+
if (slice.mode === "mired" && slice.colorTemperature !== void 0 && slice.colorTemperature > 0) {
|
|
98319
|
+
const kelvin = Math.round(1e6 / slice.colorTemperature);
|
|
98320
|
+
words = t(`${kelvin} K`, `${kelvin} K`);
|
|
98321
|
+
} else if (slice.mode === "rgb" && slice.rgb !== void 0) {
|
|
98322
|
+
const c = `RGB ${slice.rgb.r}, ${slice.rgb.g}, ${slice.rgb.b}`;
|
|
98323
|
+
words = t(c, c);
|
|
98324
|
+
} else if (slice.mode === "hsv" && slice.hsv !== void 0) words = t(`Hue ${Math.round(slice.hsv.h)}°`, `Tonalità ${Math.round(slice.hsv.h)}°`);
|
|
98325
|
+
}
|
|
98326
|
+
return {
|
|
98327
|
+
...words === null ? {} : { facts: [fact("reading", "palette", words)] },
|
|
98328
|
+
rows: [row$1("color", "palette", words, colorControls(ctx, slice?.mode === "hsv" && slice.hsv !== void 0 ? slice.hsv : null))]
|
|
98329
|
+
};
|
|
98330
|
+
});
|
|
98331
|
+
function travelWords(state, position) {
|
|
98332
|
+
const partial = position !== null && position > 0 && position < 100;
|
|
98333
|
+
const at = position === null ? null : Math.round(position);
|
|
98334
|
+
switch (state) {
|
|
98335
|
+
case "open": return {
|
|
98336
|
+
state: "on",
|
|
98337
|
+
title: partial ? t(`${at}% open`, `Aperto al ${at}%`) : t("Open", "Aperto"),
|
|
98338
|
+
mode: "open"
|
|
98339
|
+
};
|
|
98340
|
+
case "closed": return {
|
|
98341
|
+
state: "off",
|
|
98342
|
+
title: t("Closed", "Chiuso"),
|
|
98343
|
+
mode: "closed"
|
|
98344
|
+
};
|
|
98345
|
+
case "opening": return {
|
|
98346
|
+
state: "running",
|
|
98347
|
+
title: t("Opening", "In apertura"),
|
|
98348
|
+
mode: "open"
|
|
98349
|
+
};
|
|
98350
|
+
case "closing": return {
|
|
98351
|
+
state: "running",
|
|
98352
|
+
title: t("Closing", "In chiusura"),
|
|
98353
|
+
mode: "closed"
|
|
98354
|
+
};
|
|
98355
|
+
case "stopped": return {
|
|
98356
|
+
state: "idle",
|
|
98357
|
+
title: at === null ? t("Stopped", "Fermo") : t(`Stopped at ${at}%`, `Fermo al ${at}%`),
|
|
98358
|
+
mode: position === null ? null : position > 0 ? "open" : "closed"
|
|
98359
|
+
};
|
|
98360
|
+
}
|
|
98361
|
+
}
|
|
98362
|
+
/** Open / stop / close are actions; the one that makes sense next carries the emphasis. */
|
|
98363
|
+
function travelActions(s, state, moving) {
|
|
98364
|
+
const emphasis = (wanted) => wanted ? "primary" : "normal";
|
|
98365
|
+
const open = action(`${s.cap}.open`, t("Open", "Apri"), "arrow-up", s.cap, "open", {}, emphasis(state === "closed" || state === "closing"));
|
|
98366
|
+
const stop = action(`${s.cap}.stop`, t("Stop", "Ferma"), "square", s.cap, "stop", {}, emphasis(moving));
|
|
98367
|
+
const close = action(`${s.cap}.close`, t("Close", "Chiudi"), "arrow-down", s.cap, "close", {}, emphasis(state === "open" || state === "opening"));
|
|
98368
|
+
return s.stoppable || moving ? [
|
|
98369
|
+
open,
|
|
98370
|
+
stop,
|
|
98371
|
+
close
|
|
98372
|
+
] : [open, close];
|
|
98373
|
+
}
|
|
98374
|
+
function positionSlider(s, position) {
|
|
98375
|
+
return {
|
|
98376
|
+
kind: "slider",
|
|
98377
|
+
id: `${s.cap}.position`,
|
|
98378
|
+
label: t("Position", "Posizione"),
|
|
98379
|
+
value: position,
|
|
98380
|
+
min: 0,
|
|
98381
|
+
max: 100,
|
|
98382
|
+
step: 1,
|
|
98383
|
+
unit: "%",
|
|
98384
|
+
call: {
|
|
98385
|
+
cap: s.cap,
|
|
98386
|
+
method: "setPosition",
|
|
98387
|
+
args: {}
|
|
98388
|
+
},
|
|
98389
|
+
valueArg: "position"
|
|
98390
|
+
};
|
|
98391
|
+
}
|
|
98392
|
+
function travelFragment(s, state, position, tilt, ctx) {
|
|
98393
|
+
if (state === void 0) return {
|
|
98394
|
+
reading: reading(s.source, "unknown"),
|
|
98395
|
+
rows: [row$1(s.rowId, "arrow-up", null, travelActions(s, void 0, false).map(asAction))]
|
|
98396
|
+
};
|
|
98397
|
+
const words = travelWords(state, position);
|
|
98398
|
+
const controls = travelActions(s, state, state === "opening" || state === "closing").map(asAction);
|
|
98399
|
+
if (position !== null || s.positionable) controls.push(positionSlider(s, position));
|
|
98400
|
+
if (s.cap === "cover" && (tilt !== null || has$2(ctx, DeviceFeature.CoverTilt))) controls.push({
|
|
98401
|
+
kind: "slider",
|
|
98402
|
+
id: "cover.tilt",
|
|
98403
|
+
label: t("Tilt", "Inclinazione"),
|
|
98404
|
+
value: tilt,
|
|
98405
|
+
min: 0,
|
|
98406
|
+
max: 100,
|
|
98407
|
+
step: 1,
|
|
98408
|
+
unit: "%",
|
|
98409
|
+
call: {
|
|
98410
|
+
cap: "cover",
|
|
98411
|
+
method: "setTiltPosition",
|
|
98412
|
+
args: {}
|
|
98413
|
+
},
|
|
98414
|
+
valueArg: "tiltPosition"
|
|
98415
|
+
});
|
|
98416
|
+
return {
|
|
98417
|
+
reading: reading(s.source, words.state, false, words.title),
|
|
98418
|
+
...position === null ? {} : { facts: [fact("level", "arrow-up-down", pct(position))] },
|
|
98419
|
+
scene: {
|
|
98420
|
+
...words.mode === null ? {} : { mode: words.mode },
|
|
98421
|
+
...position === null ? {} : { level: position / 100 }
|
|
98422
|
+
},
|
|
98423
|
+
rows: [row$1(s.rowId, "arrow-up-down", joinText([words.title, position !== null && state !== "open" ? pct(position) : null]), controls)]
|
|
98424
|
+
};
|
|
98425
|
+
}
|
|
98426
|
+
var ACTUATORS_FAMILY_CONTRIBUTIONS = {
|
|
98427
|
+
brightness: brightnessContribution,
|
|
98428
|
+
color: colorContribution,
|
|
98429
|
+
cover: contribution("cover", CoverStatusSchema, (slice, ctx) => travelFragment({
|
|
98430
|
+
cap: "cover",
|
|
98431
|
+
rowId: "cover",
|
|
98432
|
+
source: "cover",
|
|
98433
|
+
stoppable: has$2(ctx, DeviceFeature.CoverStoppable),
|
|
98434
|
+
positionable: has$2(ctx, DeviceFeature.CoverPositionable)
|
|
98435
|
+
}, slice?.state, slice?.position ?? null, slice?.tiltPosition ?? null, ctx)),
|
|
98436
|
+
valve: contribution("valve", ValveStatusSchema, (slice, ctx) => travelFragment({
|
|
98437
|
+
cap: "valve",
|
|
98438
|
+
rowId: "valve",
|
|
98439
|
+
source: "valve",
|
|
98440
|
+
stoppable: false,
|
|
98441
|
+
positionable: has$2(ctx, DeviceFeature.ValvePositionable)
|
|
98442
|
+
}, slice?.state, slice?.position ?? null, null, ctx)),
|
|
98443
|
+
humidifier: contribution("humidifier", HumidifierStatusSchema, (slice) => {
|
|
98444
|
+
if (slice === void 0) return { reading: reading("humidifier", "unknown") };
|
|
98445
|
+
const action_ = slice.action;
|
|
98446
|
+
let state = "off";
|
|
98447
|
+
let title = t("Off", "Spento");
|
|
98448
|
+
if (slice.on) if (action_ === "humidifying") {
|
|
98449
|
+
state = "running";
|
|
98450
|
+
title = t("Humidifying", "Umidifica");
|
|
98451
|
+
} else if (action_ === "drying") {
|
|
98452
|
+
state = "running";
|
|
98453
|
+
title = t("Drying", "Deumidifica");
|
|
98454
|
+
} else if (action_ === "idle") {
|
|
98455
|
+
state = "idle";
|
|
98456
|
+
title = t("Idle", "In attesa");
|
|
98457
|
+
} else {
|
|
98458
|
+
state = "on";
|
|
98459
|
+
title = t("On", "Acceso");
|
|
98460
|
+
}
|
|
98461
|
+
const controls = [{
|
|
98462
|
+
kind: "toggle",
|
|
98463
|
+
id: "humidifier.power",
|
|
98464
|
+
label: t("Power", "Accensione"),
|
|
98465
|
+
on: slice.on,
|
|
98466
|
+
turnOn: action("humidifier.on", t("Turn on", "Accendi"), "power", "humidifier", "setOn", { on: true }),
|
|
98467
|
+
turnOff: action("humidifier.off", t("Turn off", "Spegni"), "power-off", "humidifier", "setOn", { on: false })
|
|
98468
|
+
}];
|
|
98469
|
+
if (slice.targetHumidity !== null) controls.push({
|
|
98470
|
+
kind: "slider",
|
|
98471
|
+
id: "humidifier.target",
|
|
98472
|
+
label: t("Target", "Obiettivo"),
|
|
98473
|
+
value: slice.targetHumidity,
|
|
98474
|
+
min: slice.minHumidity ?? 0,
|
|
98475
|
+
max: slice.maxHumidity ?? 100,
|
|
98476
|
+
step: 1,
|
|
98477
|
+
unit: "%",
|
|
98478
|
+
call: {
|
|
98479
|
+
cap: "humidifier",
|
|
98480
|
+
method: "setTargetHumidity",
|
|
98481
|
+
args: {}
|
|
98482
|
+
},
|
|
98483
|
+
valueArg: "humidity"
|
|
98484
|
+
});
|
|
98485
|
+
if (slice.availableModes.length > 0) controls.push({
|
|
98486
|
+
kind: "picker",
|
|
98487
|
+
id: "humidifier.mode",
|
|
98488
|
+
label: t("Mode", "Modalità"),
|
|
98489
|
+
current: slice.mode,
|
|
98490
|
+
options: [...slice.availableModes],
|
|
98491
|
+
call: {
|
|
98492
|
+
cap: "humidifier",
|
|
98493
|
+
method: "setMode",
|
|
98494
|
+
args: {}
|
|
98495
|
+
},
|
|
98496
|
+
valueArg: "mode"
|
|
98497
|
+
});
|
|
98498
|
+
const now = slice.currentHumidity;
|
|
98499
|
+
return {
|
|
98500
|
+
reading: reading("humidifier", state, false, title),
|
|
98501
|
+
...now === null ? {} : { facts: [fact("level", "droplets", pct(now), "info")] },
|
|
98502
|
+
...slice.targetHumidity === null ? {} : { tiles: { right: [{
|
|
98503
|
+
label: t("Target", "Obiettivo"),
|
|
98504
|
+
value: pct(slice.targetHumidity)
|
|
98505
|
+
}] } },
|
|
98506
|
+
...now === null ? {} : { scene: { level: now / 100 } },
|
|
98507
|
+
rows: [row$1("humidifier", "droplets", joinText([title, slice.mode === null ? null : t(slice.mode, slice.mode)]), controls)]
|
|
98508
|
+
};
|
|
98509
|
+
})
|
|
98510
|
+
};
|
|
98511
|
+
var GROUPS_FAMILY_CONTRIBUTIONS = {
|
|
98512
|
+
"group-active": contribution("group-active", GroupActiveSchema, (slice) => {
|
|
98513
|
+
if (slice === void 0) return { reading: reading("group-active", "unknown") };
|
|
98514
|
+
return { reading: reading("group-active", slice.active ? "on" : "off", false, slice.active ? t("Active", "Attivo") : t("Inactive", "Non attivo")) };
|
|
98515
|
+
}),
|
|
98516
|
+
"group-status": contribution("group-status", GroupStatusSchema, (slice) => {
|
|
98517
|
+
if (slice === void 0) return {};
|
|
98518
|
+
const text = slice.excluded === 0 ? t(`${slice.total} members`, `${slice.total} membri`) : t(`${slice.included} of ${slice.total} reporting`, `${slice.included} di ${slice.total} rispondono`);
|
|
98519
|
+
return {
|
|
98520
|
+
facts: [fact("members", "users", text, slice.excluded === 0 ? "muted" : "warning")],
|
|
98521
|
+
tiles: { left: [{
|
|
98522
|
+
label: t("Members", "Membri"),
|
|
98523
|
+
value: text
|
|
98524
|
+
}] }
|
|
98525
|
+
};
|
|
98526
|
+
}),
|
|
98527
|
+
"group-commands": contribution("group-commands", GroupCommandsSchema, (slice) => {
|
|
98528
|
+
if (slice === void 0) return {};
|
|
98529
|
+
const failed = slice.results.filter((r) => !r.ok).length;
|
|
98530
|
+
if (failed === 0) return {};
|
|
98531
|
+
const total = slice.results.length;
|
|
98532
|
+
return { facts: [fact("failures", "triangle-alert", t(`${failed} of ${total} failed`, `${failed} di ${total} falliti`), "danger")] };
|
|
98533
|
+
}),
|
|
98534
|
+
"event-emitter": contribution("event-emitter", EventEmitterStatusSchema, (slice, ctx) => {
|
|
98535
|
+
if (slice === void 0) return { reading: reading("event-emitter", "unknown") };
|
|
98536
|
+
const last = slice.lastEvent;
|
|
98537
|
+
const ago = last === null ? null : elapsedText(last.timestamp, ctx.now);
|
|
98538
|
+
return {
|
|
98539
|
+
reading: reading("event-emitter", "idle", false, t("Listening", "In ascolto")),
|
|
98540
|
+
...last === null ? {} : { facts: [fact("event", "radio-tower", ago === null ? t(last.eventType, last.eventType) : t(`${last.eventType} · ${ago.en}`, `${last.eventType} · ${ago.it}`), "primary")] },
|
|
98541
|
+
tiles: { right: [{
|
|
98542
|
+
label: t("Events", "Eventi"),
|
|
98543
|
+
value: t(`${slice.eventCountSinceStart}`, `${slice.eventCountSinceStart}`)
|
|
98544
|
+
}] }
|
|
98545
|
+
};
|
|
98546
|
+
})
|
|
98547
|
+
};
|
|
98548
|
+
/**
|
|
98549
|
+
* What the sensing caps add to a hero (D1023): the alarm sensors (smoke, flood,
|
|
98550
|
+
* gas, tamper, vibration), motion, presence, the doorbell, the generic binary
|
|
98551
|
+
* and meter, the weather station, a firmware update, an image and the two
|
|
98552
|
+
* caps a person acts on directly (a button, a control).
|
|
98553
|
+
*
|
|
98554
|
+
* A sensor's title is its READING ("Clear" / "Detected"), never a power word:
|
|
98555
|
+
* the generic On / Off belong to something that can be switched. A slice that
|
|
98556
|
+
* does not parse is "not answered" and reads `unknown`, never clear (D315/D393);
|
|
98557
|
+
* a measurement the device did not report is absent, never a zero (D393).
|
|
98558
|
+
*/
|
|
98559
|
+
/** The recency of a transition as the top line's "since" fact; absent when never observed. */
|
|
98560
|
+
function sinceFact(at, now, tone = "muted") {
|
|
98561
|
+
if (at === null) return [];
|
|
98562
|
+
const ago = elapsedText(at, now);
|
|
98563
|
+
return ago === null ? [] : [fact("since", "clock", ago, tone)];
|
|
98564
|
+
}
|
|
98565
|
+
function detection(spec) {
|
|
98566
|
+
return contribution(spec.cap, spec.schema, (slice, ctx) => {
|
|
98567
|
+
if (slice === void 0) return { reading: reading(spec.source, "unknown") };
|
|
98568
|
+
const tripped = spec.flag(slice);
|
|
98569
|
+
const changed = spec.changedAt(slice);
|
|
98570
|
+
return {
|
|
98571
|
+
reading: reading(spec.source, tripped ? spec.yesState : "idle", false, tripped ? spec.words.yes : spec.words.no),
|
|
98572
|
+
facts: sinceFact(changed === 0 ? null : changed, ctx.now, tripped ? "danger" : "muted")
|
|
98573
|
+
};
|
|
98574
|
+
});
|
|
98575
|
+
}
|
|
98576
|
+
var detected = {
|
|
98577
|
+
yes: t("Detected", "Rilevato"),
|
|
98578
|
+
no: t("Clear", "Libero")
|
|
98579
|
+
};
|
|
98580
|
+
var smokeContribution = detection({
|
|
98581
|
+
cap: "smoke",
|
|
98582
|
+
source: "smoke",
|
|
98583
|
+
schema: SmokeStatusSchema,
|
|
98584
|
+
words: {
|
|
98585
|
+
yes: t("Smoke detected", "Fumo rilevato"),
|
|
98586
|
+
no: t("Clear", "Nessun fumo")
|
|
98587
|
+
},
|
|
98588
|
+
yesState: "alert",
|
|
98589
|
+
flag: (s) => s.detected,
|
|
98590
|
+
changedAt: (s) => s.lastChangedAt
|
|
98591
|
+
});
|
|
98592
|
+
var floodContribution = detection({
|
|
98593
|
+
cap: "flood",
|
|
98594
|
+
source: "flood",
|
|
98595
|
+
schema: FloodStatusSchema,
|
|
98596
|
+
words: {
|
|
98597
|
+
yes: t("Leak detected", "Perdita rilevata"),
|
|
98598
|
+
no: t("Dry", "Asciutto")
|
|
98599
|
+
},
|
|
98600
|
+
yesState: "alert",
|
|
98601
|
+
flag: (s) => s.flooded,
|
|
98602
|
+
changedAt: (s) => s.lastChangedAt
|
|
98603
|
+
});
|
|
98604
|
+
var gasContribution = detection({
|
|
98605
|
+
cap: "gas",
|
|
98606
|
+
source: "gas",
|
|
98607
|
+
schema: GasStatusSchema,
|
|
98608
|
+
words: {
|
|
98609
|
+
yes: t("Gas detected", "Gas rilevato"),
|
|
98610
|
+
no: t("Clear", "Nessun gas")
|
|
98611
|
+
},
|
|
98612
|
+
yesState: "alert",
|
|
98613
|
+
flag: (s) => s.detected,
|
|
98614
|
+
changedAt: (s) => s.lastChangedAt
|
|
98615
|
+
});
|
|
98616
|
+
var tamperContribution = detection({
|
|
98617
|
+
cap: "tamper",
|
|
98618
|
+
source: "tamper",
|
|
98619
|
+
schema: TamperStatusSchema,
|
|
98620
|
+
words: {
|
|
98621
|
+
yes: t("Tampered", "Manomesso"),
|
|
98622
|
+
no: t("Secure", "Integro")
|
|
98623
|
+
},
|
|
98624
|
+
yesState: "alert",
|
|
98625
|
+
flag: (s) => s.tampered,
|
|
98626
|
+
changedAt: (s) => s.lastChangedAt
|
|
98627
|
+
});
|
|
98628
|
+
var vibrationContribution = detection({
|
|
98629
|
+
cap: "vibration",
|
|
98630
|
+
source: "vibration",
|
|
98631
|
+
schema: VibrationStatusSchema,
|
|
98632
|
+
words: {
|
|
98633
|
+
yes: t("Vibration", "Vibrazione"),
|
|
98634
|
+
no: t("Still", "Fermo")
|
|
98635
|
+
},
|
|
98636
|
+
yesState: "on",
|
|
98637
|
+
flag: (s) => s.detected,
|
|
98638
|
+
changedAt: (s) => s.lastChangedAt
|
|
98639
|
+
});
|
|
98640
|
+
var binaryContribution = detection({
|
|
98641
|
+
cap: "binary",
|
|
98642
|
+
source: "binary",
|
|
98643
|
+
schema: BinaryStatusSchema,
|
|
98644
|
+
words: {
|
|
98645
|
+
yes: t("Active", "Attivo"),
|
|
98646
|
+
no: t("Inactive", "Inattivo")
|
|
98647
|
+
},
|
|
98648
|
+
yesState: "on",
|
|
98649
|
+
flag: (s) => s.on,
|
|
98650
|
+
changedAt: (s) => s.lastChangedAt
|
|
98651
|
+
});
|
|
98652
|
+
var motionContribution = contribution("motion", MotionStatusSchema, (slice, ctx) => {
|
|
98653
|
+
if (slice === void 0) return { reading: reading("motion", "unknown") };
|
|
98654
|
+
const last = slice.lastDetectedAt;
|
|
98655
|
+
const ago = last === null ? null : elapsedText(last, ctx.now);
|
|
98656
|
+
return {
|
|
98657
|
+
reading: reading("motion", slice.detected ? "on" : "idle", false, slice.detected ? detected.yes : t("Clear", "Nessun movimento")),
|
|
98658
|
+
...ago === null ? {} : { facts: [fact("since", "clock", t(`Last motion ${ago.en}`, `Ultimo movimento ${ago.it}`), slice.detected ? "primary" : "muted")] }
|
|
98659
|
+
};
|
|
98660
|
+
});
|
|
98661
|
+
var presenceContribution = contribution("presence", PresenceStatusSchema, (slice, ctx) => {
|
|
98662
|
+
if (slice === void 0) return { reading: reading("presence", "unknown") };
|
|
98663
|
+
const zone = slice.state;
|
|
98664
|
+
const home = zone === "home";
|
|
98665
|
+
const away = zone === "not_home";
|
|
98666
|
+
const title = home ? t("Home", "A casa") : away ? t("Away", "Fuori casa") : t(zone, zone);
|
|
98667
|
+
const facts = [];
|
|
98668
|
+
if (slice.location !== null && slice.location !== "") facts.push(fact("reading", "map-pin", t(slice.location, slice.location)));
|
|
98669
|
+
facts.push(...sinceFact(slice.lastChangedAt === 0 ? null : slice.lastChangedAt, ctx.now));
|
|
98670
|
+
return {
|
|
98671
|
+
reading: reading("presence", away ? "off" : "on", false, title),
|
|
98672
|
+
facts
|
|
98673
|
+
};
|
|
98674
|
+
});
|
|
98675
|
+
/** A ring this recent still reads as "ringing". */
|
|
98676
|
+
var RINGING_MS = 3e4;
|
|
98677
|
+
var doorbellContribution = contribution("doorbell", DoorbellStatusSchema, (slice, ctx) => {
|
|
98678
|
+
if (slice === void 0) return { reading: reading("doorbell", "unknown") };
|
|
98679
|
+
const last = slice.lastPressedAt;
|
|
98680
|
+
const ago = last === null ? null : elapsedText(last, ctx.now);
|
|
98681
|
+
const ringing = last !== null && ctx.now >= last && ctx.now - last < RINGING_MS;
|
|
98682
|
+
const title = ringing ? t("Ringing", "Suona") : ago === null ? t("No ring yet", "Nessun squillo") : t(`Last ring ${ago.en}`, `Ultimo squillo ${ago.it}`);
|
|
98683
|
+
const count = slice.pressCountSinceStart;
|
|
98684
|
+
return {
|
|
98685
|
+
...ctx.caps.includes("motion") && !ringing ? {} : { reading: reading("doorbell", ringing ? "on" : "idle", false, title) },
|
|
98686
|
+
facts: [...ctx.caps.includes("motion") && !ringing ? [fact("event", "bell", title)] : [], ...count > 0 ? [fact("event", "bell-ring", t(`${count} ring${count === 1 ? "" : "s"}`, `${count} squilli`))] : []]
|
|
98687
|
+
};
|
|
98688
|
+
});
|
|
98689
|
+
var number = (n) => `${Number(n.toFixed(2))}`;
|
|
98690
|
+
var meterContribution = contribution("meter", MeterStatusSchema, (slice, ctx) => {
|
|
98691
|
+
if (slice === void 0 || slice.value === null) return { reading: reading("meter", "unknown") };
|
|
98692
|
+
const value = number(slice.value);
|
|
98693
|
+
return {
|
|
98694
|
+
reading: reading("meter", "idle", false, t(value, value)),
|
|
98695
|
+
facts: sinceFact(slice.lastFetchedAt === 0 ? null : slice.lastFetchedAt, ctx.now)
|
|
98696
|
+
};
|
|
98697
|
+
});
|
|
98698
|
+
var CONDITION_WORDS = {
|
|
98699
|
+
sunny: t("Sunny", "Soleggiato"),
|
|
98700
|
+
"clear-night": t("Clear night", "Notte serena"),
|
|
98701
|
+
cloudy: t("Cloudy", "Nuvoloso"),
|
|
98702
|
+
partlycloudy: t("Partly cloudy", "Parzialmente nuvoloso"),
|
|
98703
|
+
rainy: t("Rain", "Pioggia"),
|
|
98704
|
+
pouring: t("Heavy rain", "Pioggia forte"),
|
|
98705
|
+
snowy: t("Snow", "Neve"),
|
|
98706
|
+
"snowy-rainy": t("Sleet", "Nevischio"),
|
|
98707
|
+
fog: t("Fog", "Nebbia"),
|
|
98708
|
+
windy: t("Windy", "Ventoso"),
|
|
98709
|
+
"windy-variant": t("Windy", "Ventoso"),
|
|
98710
|
+
lightning: t("Thunderstorm", "Temporale"),
|
|
98711
|
+
"lightning-rainy": t("Thunderstorm", "Temporale"),
|
|
98712
|
+
hail: t("Hail", "Grandine"),
|
|
98713
|
+
exceptional: t("Exceptional", "Eccezionale")
|
|
98714
|
+
};
|
|
98715
|
+
var weatherContribution = contribution("weather", WeatherStatusSchema, (slice, ctx) => {
|
|
98716
|
+
if (slice === void 0) return { reading: reading("weather", "unknown") };
|
|
98717
|
+
const { condition, temperature, humidity, pressure, windSpeed } = slice;
|
|
98718
|
+
const celsius = temperature === null ? null : `${number(temperature)}°C`;
|
|
98719
|
+
const word = condition === null ? null : CONDITION_WORDS[condition] ?? t(condition, condition);
|
|
98720
|
+
const title = word ?? (celsius === null ? null : t(celsius, celsius));
|
|
98721
|
+
if (title === null) return { reading: reading("weather", "unknown") };
|
|
98722
|
+
const facts = [];
|
|
98723
|
+
if (celsius !== null && word !== null) facts.push(fact("reading", "thermometer", t(celsius, celsius), "primary"));
|
|
98724
|
+
if (humidity !== null) facts.push(fact("reading", "droplets", t(`${Math.round(humidity)}%`, `${Math.round(humidity)}%`)));
|
|
98725
|
+
if (windSpeed !== null) facts.push(fact("reading", "wind", t(`${number(windSpeed)} m/s`, `${number(windSpeed)} m/s`)));
|
|
98726
|
+
if (pressure !== null) facts.push(fact("reading", "gauge", t(`${Math.round(pressure)} hPa`, `${Math.round(pressure)} hPa`)));
|
|
98727
|
+
facts.push(...sinceFact(slice.lastFetchedAt === 0 ? null : slice.lastFetchedAt, ctx.now));
|
|
98728
|
+
const left = [];
|
|
98729
|
+
if (humidity !== null) left.push({
|
|
98730
|
+
label: t("Humidity", "Umidità"),
|
|
98731
|
+
value: t(`${Math.round(humidity)}%`, `${Math.round(humidity)}%`)
|
|
98732
|
+
});
|
|
98733
|
+
if (pressure !== null) left.push({
|
|
98734
|
+
label: t("Pressure", "Pressione"),
|
|
98735
|
+
value: t(`${Math.round(pressure)} hPa`, `${Math.round(pressure)} hPa`)
|
|
98736
|
+
});
|
|
98737
|
+
const right = windSpeed === null ? [] : [{
|
|
98738
|
+
label: t("Wind", "Vento"),
|
|
98739
|
+
value: t(`${number(windSpeed)} m/s`, `${number(windSpeed)} m/s`)
|
|
98740
|
+
}];
|
|
98741
|
+
return {
|
|
98742
|
+
reading: reading("weather", "on", false, title),
|
|
98743
|
+
facts,
|
|
98744
|
+
tiles: {
|
|
98745
|
+
left,
|
|
98746
|
+
right
|
|
98747
|
+
}
|
|
98748
|
+
};
|
|
98749
|
+
});
|
|
98750
|
+
var updateContribution = contribution("update", UpdateStatusSchema, (slice) => {
|
|
98751
|
+
if (slice === void 0) return { reading: reading("update", "unknown") };
|
|
98752
|
+
const { currentVersion, availableVersion, inProgress, updatable } = slice;
|
|
98753
|
+
const pending = availableVersion !== null && availableVersion !== "" && availableVersion !== currentVersion;
|
|
98754
|
+
if (!pending && currentVersion === null && !inProgress) return { reading: reading("update", "unknown") };
|
|
98755
|
+
const state = inProgress ? "running" : pending ? "standby" : "idle";
|
|
98756
|
+
const title = inProgress ? t("Updating", "Aggiornamento in corso") : pending ? t("Update available", "Aggiornamento disponibile") : t("Up to date", "Aggiornato");
|
|
98757
|
+
const versions = currentVersion === null ? pending ? t(`${availableVersion}`, `${availableVersion}`) : null : pending ? t(`${currentVersion} → ${availableVersion}`, `${currentVersion} → ${availableVersion}`) : t(`Version ${currentVersion}`, `Versione ${currentVersion}`);
|
|
98758
|
+
const install = pending && updatable && !inProgress ? [asAction(action("update.install", t("Install", "Installa"), "download", "update", "installUpdate", {}, "primary", "install"))] : [];
|
|
98759
|
+
return {
|
|
98760
|
+
reading: reading("update", state, false, title),
|
|
98761
|
+
facts: versions === null ? [] : [fact("reading", "download", versions, pending ? "warning" : "muted")],
|
|
98762
|
+
rows: [row$1("update", "download", versions, install)]
|
|
98763
|
+
};
|
|
98764
|
+
});
|
|
98765
|
+
var imageContribution = contribution("image", ImageStatusSchema, (slice, ctx) => {
|
|
98766
|
+
if (slice === void 0) return { reading: reading("image", "unknown") };
|
|
98767
|
+
if (slice.url === null) return { reading: reading("image", "idle", false, t("No image yet", "Nessuna immagine")) };
|
|
98768
|
+
const ago = slice.lastUpdated === null ? null : elapsedText(slice.lastUpdated, ctx.now);
|
|
98769
|
+
return {
|
|
98770
|
+
reading: reading("image", "on", false, ago === null ? t("Image", "Immagine") : t(`Updated ${ago.en}`, `Aggiornata ${ago.it}`)),
|
|
98771
|
+
artworkUrl: slice.url
|
|
98772
|
+
};
|
|
98773
|
+
});
|
|
98774
|
+
/** A button has no state to read: it is always ready, so it is never `unknown`. */
|
|
98775
|
+
var buttonContribution = {
|
|
98776
|
+
cap: "button",
|
|
98777
|
+
contribute: () => ({
|
|
98778
|
+
reading: reading("button", "idle", false, t("Ready", "Pronto")),
|
|
98779
|
+
rows: [row$1("button", "pointer", null, [asAction(action("button.press", t("Press", "Premi"), "pointer", "button", "press", {}, "primary", "press"))])]
|
|
98780
|
+
})
|
|
98781
|
+
};
|
|
98782
|
+
var controlContribution = contribution("control", ControlStatusSchema, (slice, ctx) => {
|
|
98783
|
+
if (slice === void 0) return { reading: reading("control", "unknown") };
|
|
98784
|
+
const text = typeof slice.value === "number" ? number(slice.value) : slice.value;
|
|
98785
|
+
return {
|
|
98786
|
+
reading: reading("control", "on", false, t(text, text)),
|
|
98787
|
+
facts: sinceFact(slice.lastChangedAt === 0 ? null : slice.lastChangedAt, ctx.now),
|
|
98788
|
+
rows: controlRows(slice)
|
|
98789
|
+
};
|
|
98790
|
+
});
|
|
98791
|
+
var CONTROL_LABEL = t("Value", "Valore");
|
|
98792
|
+
/** A number with known bounds is a slider, a choice a picker; text and dates stay read-only. */
|
|
98793
|
+
function controlRows(slice) {
|
|
98794
|
+
if (slice.kind === "numeric" && typeof slice.value === "number") {
|
|
98795
|
+
if (slice.min === void 0 || slice.max === void 0) return [];
|
|
98796
|
+
return [row$1("control", "sliders-horizontal", null, [{
|
|
98797
|
+
kind: "slider",
|
|
98798
|
+
id: "control.value",
|
|
98799
|
+
label: CONTROL_LABEL,
|
|
98800
|
+
value: slice.value,
|
|
98801
|
+
min: slice.min,
|
|
98802
|
+
max: slice.max,
|
|
98803
|
+
step: slice.step ?? 1,
|
|
98804
|
+
unit: "",
|
|
98805
|
+
call: {
|
|
98806
|
+
cap: "control",
|
|
98807
|
+
method: "setValue",
|
|
98808
|
+
args: { control: { kind: "numeric" } }
|
|
98809
|
+
},
|
|
98810
|
+
valueArg: "control.value"
|
|
98811
|
+
}])];
|
|
98812
|
+
}
|
|
98813
|
+
if (slice.kind === "select" && typeof slice.value === "string") return [row$1("control", "sliders-horizontal", null, [{
|
|
98814
|
+
kind: "picker",
|
|
98815
|
+
id: "control.value",
|
|
98816
|
+
label: CONTROL_LABEL,
|
|
98817
|
+
current: slice.value,
|
|
98818
|
+
options: slice.options,
|
|
98819
|
+
call: {
|
|
98820
|
+
cap: "control",
|
|
98821
|
+
method: "setValue",
|
|
98822
|
+
args: { control: { kind: "select" } }
|
|
98823
|
+
},
|
|
98824
|
+
valueArg: "control.value"
|
|
98825
|
+
}])];
|
|
98826
|
+
return [];
|
|
98827
|
+
}
|
|
98828
|
+
var SENSORS_FAMILY_CONTRIBUTIONS = {
|
|
98829
|
+
smoke: smokeContribution,
|
|
98830
|
+
flood: floodContribution,
|
|
98831
|
+
gas: gasContribution,
|
|
98832
|
+
tamper: tamperContribution,
|
|
98833
|
+
vibration: vibrationContribution,
|
|
98834
|
+
binary: binaryContribution,
|
|
98835
|
+
motion: motionContribution,
|
|
98836
|
+
presence: presenceContribution,
|
|
98837
|
+
doorbell: doorbellContribution,
|
|
98838
|
+
meter: meterContribution,
|
|
98839
|
+
weather: weatherContribution,
|
|
98840
|
+
update: updateContribution,
|
|
98841
|
+
image: imageContribution,
|
|
98842
|
+
button: buttonContribution,
|
|
98843
|
+
control: controlContribution
|
|
98844
|
+
};
|
|
98845
|
+
var MODE_LABEL = {
|
|
98846
|
+
off: t("Off", "Spento"),
|
|
98847
|
+
heat: t("Heating", "Riscalda"),
|
|
98848
|
+
cool: t("Cooling", "Freddo"),
|
|
98849
|
+
auto: t("Auto", "Auto"),
|
|
98850
|
+
heat_cool: t("Heat/Cool", "Caldo/Freddo"),
|
|
98851
|
+
fan_only: t("Fan only", "Solo ventola"),
|
|
98852
|
+
dry: t("Drying", "Deumidifica")
|
|
98853
|
+
};
|
|
98854
|
+
var SCENE_MODE = {
|
|
98855
|
+
off: null,
|
|
98856
|
+
heat: "heat",
|
|
98857
|
+
cool: "cool",
|
|
98858
|
+
auto: "auto",
|
|
98859
|
+
heat_cool: "auto",
|
|
98860
|
+
fan_only: "fan",
|
|
98861
|
+
dry: "dry"
|
|
98862
|
+
};
|
|
98863
|
+
/** Without a remembered mode, "turn on" picks the first of these the device accepts. */
|
|
98864
|
+
var ON_MODE_PREFERENCE = [
|
|
98865
|
+
"auto",
|
|
98866
|
+
"heat_cool",
|
|
98867
|
+
"heat",
|
|
98868
|
+
"cool"
|
|
98869
|
+
];
|
|
98870
|
+
/** 22 -> "22", 22.3 -> "22.3": a trailing zero is noise on a thermostat. */
|
|
98871
|
+
function formatDegrees(value) {
|
|
98872
|
+
return `${Number(value.toFixed(1))}°`;
|
|
98873
|
+
}
|
|
98874
|
+
/** "Turn on" returns to the mode the device last ran when it still accepts it, else the fixed order. */
|
|
98875
|
+
function onModeOf(available, last) {
|
|
98876
|
+
const candidates = available.filter((m) => m !== "off");
|
|
98877
|
+
if (last !== void 0 && candidates.includes(last)) return last;
|
|
98878
|
+
for (const preferred of ON_MODE_PREFERENCE) if (candidates.includes(preferred)) return preferred;
|
|
98879
|
+
return candidates[0] ?? null;
|
|
98880
|
+
}
|
|
98881
|
+
function deriveClimateView(slice) {
|
|
98882
|
+
const range = rangeFrom(slice.minTemp, slice.maxTemp, slice.tempStep);
|
|
98883
|
+
const level = levelWithin(slice.target, range);
|
|
98884
|
+
return {
|
|
98885
|
+
mode: slice.mode,
|
|
98886
|
+
isOff: slice.mode === "off",
|
|
98887
|
+
modeLabel: MODE_LABEL[slice.mode],
|
|
98888
|
+
target: slice.target,
|
|
98889
|
+
measured: slice.currentTemp,
|
|
98890
|
+
targetRange: slice.targetLow !== null && slice.targetHigh !== null ? {
|
|
98891
|
+
low: slice.targetLow,
|
|
98892
|
+
high: slice.targetHigh
|
|
98893
|
+
} : null,
|
|
98894
|
+
targetHumidity: slice.targetHumidity,
|
|
98895
|
+
humidity: slice.currentHumidity,
|
|
98896
|
+
range,
|
|
98897
|
+
availableModes: slice.availableModes,
|
|
98898
|
+
sceneMode: SCENE_MODE[slice.mode],
|
|
98899
|
+
level,
|
|
98900
|
+
onMode: onModeOf(slice.availableModes, slice.lastActiveMode)
|
|
98901
|
+
};
|
|
98902
|
+
}
|
|
98903
|
+
/** "22° (22.3°)": the setpoint and, in brackets, what is measured. The mode is the headline, not repeated here. */
|
|
98904
|
+
function thermalStatusText(target, measured) {
|
|
98905
|
+
const goal = target === null ? "" : typeof target === "string" ? target : formatDegrees(target);
|
|
98906
|
+
const now = measured === null ? "" : formatDegrees(measured);
|
|
98907
|
+
const temps = goal !== "" && now !== "" ? `${goal} (${now})` : goal !== "" ? goal : now;
|
|
98908
|
+
return temps === "" ? null : t(temps, temps);
|
|
98909
|
+
}
|
|
98910
|
+
function climateStatusText(view) {
|
|
98911
|
+
const range = view.targetRange;
|
|
98912
|
+
return thermalStatusText(view.target !== null ? view.target : range === null ? null : `${Number(range.low.toFixed(1))}–${formatDegrees(range.high)}`, view.measured);
|
|
98913
|
+
}
|
|
98914
|
+
/** The setpoint inside its range, 0..1. */
|
|
98915
|
+
function levelWithin(value, range) {
|
|
98916
|
+
if (value === null || range === null) return null;
|
|
98917
|
+
return Math.min(1, Math.max(0, (value - range.min) / (range.max - range.min)));
|
|
98918
|
+
}
|
|
98919
|
+
function rangeFrom(min, max, step) {
|
|
98920
|
+
if (min === null || min === void 0) return null;
|
|
98921
|
+
if (max === null || max === void 0 || max <= min) return null;
|
|
98922
|
+
return {
|
|
98923
|
+
min,
|
|
98924
|
+
max,
|
|
98925
|
+
step: step ?? 1
|
|
98926
|
+
};
|
|
98927
|
+
}
|
|
98928
|
+
/**
|
|
98929
|
+
* The climate family's contributions to a hero (D1023): `climate-control`,
|
|
98930
|
+
* `water-heater`, `heating-valve`, and the read-only sensors. Capabilities
|
|
98931
|
+
* contribute, types never do (D14). A slice that is absent or does not parse is
|
|
98932
|
+
* "not answered": the state reads unknown, no row is drawn (D315, D393).
|
|
98933
|
+
*/
|
|
98934
|
+
var same = (text) => t(text, text);
|
|
98935
|
+
function tile(en, it, value) {
|
|
98936
|
+
return {
|
|
98937
|
+
label: t(en, it),
|
|
98938
|
+
value: same(value)
|
|
98939
|
+
};
|
|
98940
|
+
}
|
|
98941
|
+
function setpointSlider(id, cap, method, valueArg, value, range) {
|
|
98942
|
+
return {
|
|
98943
|
+
kind: "slider",
|
|
98944
|
+
id,
|
|
98945
|
+
label: t("Target", "Obiettivo"),
|
|
98946
|
+
value,
|
|
98947
|
+
min: range.min,
|
|
98948
|
+
max: range.max,
|
|
98949
|
+
step: range.step,
|
|
98950
|
+
unit: "°",
|
|
98951
|
+
call: {
|
|
98952
|
+
cap,
|
|
98953
|
+
method,
|
|
98954
|
+
args: {}
|
|
98955
|
+
},
|
|
98956
|
+
valueArg
|
|
98957
|
+
};
|
|
98958
|
+
}
|
|
98959
|
+
function setpointRow(status, slider) {
|
|
98960
|
+
return slider === null ? [] : [{
|
|
98961
|
+
id: "setpoint",
|
|
98962
|
+
icon: "thermometer",
|
|
98963
|
+
status,
|
|
98964
|
+
controls: [slider]
|
|
98965
|
+
}];
|
|
98966
|
+
}
|
|
98967
|
+
var climateContribution = contribution("climate-control", ClimateControlStatusSchema, (slice, ctx) => {
|
|
98968
|
+
if (slice === void 0) return { reading: reading("climate-control", "unknown") };
|
|
98969
|
+
const view = deriveClimateView(slice);
|
|
98970
|
+
const status = climateStatusText(view);
|
|
98971
|
+
const facts = [];
|
|
98972
|
+
if (status !== null) facts.push(fact("climate", "thermometer", status));
|
|
98973
|
+
if (view.humidity !== null) facts.push(fact("humidity", "droplets", same(`${Math.round(view.humidity)}%`)));
|
|
98974
|
+
if (view.targetHumidity !== null) facts.push(fact("humidity", "droplets", same(`→ ${Math.round(view.targetHumidity)}%`)));
|
|
98975
|
+
const left = [];
|
|
98976
|
+
const right = [];
|
|
98977
|
+
if (view.measured !== null) left.push(tile("Indoor", "In casa", formatDegrees(view.measured)));
|
|
98978
|
+
if (view.humidity !== null) left.push(tile("Humidity", "Umidità", `${Math.round(view.humidity)}%`));
|
|
98979
|
+
const modeControls = [{
|
|
98980
|
+
kind: "picker",
|
|
98981
|
+
id: "climate.mode",
|
|
98982
|
+
label: t("Mode", "Modalità"),
|
|
98983
|
+
current: view.mode,
|
|
98984
|
+
options: [...view.availableModes],
|
|
98985
|
+
call: {
|
|
98986
|
+
cap: "climate-control",
|
|
98987
|
+
method: "setMode",
|
|
98988
|
+
args: {}
|
|
98989
|
+
},
|
|
98990
|
+
valueArg: "mode"
|
|
98991
|
+
}];
|
|
98992
|
+
if (slice.availablePresets.length > 0) modeControls.push({
|
|
98993
|
+
kind: "picker",
|
|
98994
|
+
id: "climate.preset",
|
|
98995
|
+
label: t("Preset", "Preset"),
|
|
98996
|
+
current: slice.preset === "" ? null : slice.preset,
|
|
98997
|
+
options: [...slice.availablePresets],
|
|
98998
|
+
call: {
|
|
98999
|
+
cap: "climate-control",
|
|
99000
|
+
method: "setPreset",
|
|
99001
|
+
args: {}
|
|
99002
|
+
},
|
|
99003
|
+
valueArg: "preset"
|
|
99004
|
+
});
|
|
99005
|
+
const fanControls = [];
|
|
99006
|
+
if (slice.availableFanModes.length > 0) fanControls.push({
|
|
99007
|
+
kind: "picker",
|
|
99008
|
+
id: "climate.fan",
|
|
99009
|
+
label: t("Fan", "Ventola"),
|
|
99010
|
+
current: slice.fanMode === "" ? null : slice.fanMode,
|
|
99011
|
+
options: [...slice.availableFanModes],
|
|
99012
|
+
call: {
|
|
99013
|
+
cap: "climate-control",
|
|
99014
|
+
method: "setFanMode",
|
|
99015
|
+
args: {}
|
|
99016
|
+
},
|
|
99017
|
+
valueArg: "fanMode"
|
|
99018
|
+
});
|
|
99019
|
+
const swing = (id, en, it, method, on, feature) => ctx.features.includes(feature) ? [{
|
|
99020
|
+
kind: "toggle",
|
|
99021
|
+
id,
|
|
99022
|
+
label: t(en, it),
|
|
99023
|
+
on,
|
|
99024
|
+
turnOn: action(`${id}.on`, t(en, it), "wind", "climate-control", method, { on: true }),
|
|
99025
|
+
turnOff: action(`${id}.off`, t(en, it), "wind", "climate-control", method, { on: false })
|
|
99026
|
+
}] : [];
|
|
99027
|
+
fanControls.push(...swing("climate.swing-vertical", "Swing vertical", "Oscillazione verticale", "setSwingVertical", slice.swingVertical, DeviceFeature.ClimateSwingVertical), ...swing("climate.swing-horizontal", "Swing horizontal", "Oscillazione orizzontale", "setSwingHorizontal", slice.swingHorizontal, DeviceFeature.ClimateSwingHorizontal));
|
|
99028
|
+
const rows = [{
|
|
99029
|
+
id: "climate-mode",
|
|
99030
|
+
icon: "thermometer",
|
|
99031
|
+
status: view.modeLabel,
|
|
99032
|
+
controls: modeControls
|
|
99033
|
+
}];
|
|
99034
|
+
if (fanControls.length > 0) rows.push({
|
|
99035
|
+
id: "climate-fan",
|
|
99036
|
+
icon: "fan",
|
|
99037
|
+
status: slice.fanMode === "" ? null : same(slice.fanMode),
|
|
99038
|
+
controls: fanControls
|
|
99039
|
+
});
|
|
99040
|
+
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)));
|
|
99041
|
+
const sceneMode = view.sceneMode;
|
|
99042
|
+
return {
|
|
99043
|
+
reading: reading("climate-control", view.isOff ? "off" : "on"),
|
|
99044
|
+
title: view.modeLabel,
|
|
99045
|
+
facts,
|
|
99046
|
+
...left.length === 0 && right.length === 0 ? {} : { tiles: {
|
|
99047
|
+
left,
|
|
99048
|
+
right
|
|
99049
|
+
} },
|
|
99050
|
+
scene: {
|
|
99051
|
+
...sceneMode === null ? {} : { mode: sceneMode },
|
|
99052
|
+
...view.level === null ? {} : { level: view.level }
|
|
99053
|
+
},
|
|
99054
|
+
...view.onMode === null ? {} : { ownPower: {
|
|
99055
|
+
source: "climate-control",
|
|
99056
|
+
on: !view.isOff,
|
|
99057
|
+
assumed: false,
|
|
99058
|
+
turnOn: action("own-power.on", t("Turn on", "Accendi"), "power", "climate-control", "setMode", { mode: view.onMode }),
|
|
99059
|
+
turnOff: action("own-power.off", t("Turn off", "Spegni"), "power-off", "climate-control", "setMode", { mode: "off" })
|
|
99060
|
+
} },
|
|
99061
|
+
rows
|
|
99062
|
+
};
|
|
99063
|
+
});
|
|
99064
|
+
var WATER_ON_PREFERENCE = [
|
|
99065
|
+
"eco",
|
|
99066
|
+
"electric",
|
|
99067
|
+
"heat_pump",
|
|
99068
|
+
"performance"
|
|
99069
|
+
];
|
|
99070
|
+
function capitalised(word) {
|
|
99071
|
+
return same(word.charAt(0).toUpperCase() + word.slice(1).replace(/_/g, " "));
|
|
99072
|
+
}
|
|
99073
|
+
var waterHeaterContribution = contribution("water-heater", WaterHeaterStatusSchema, (slice) => {
|
|
99074
|
+
if (slice === void 0 || slice.operationMode === null) return { reading: reading("climate-control", "unknown") };
|
|
99075
|
+
const isOff = slice.operationMode === "off";
|
|
99076
|
+
const label = capitalised(slice.operationMode);
|
|
99077
|
+
const status = thermalStatusText(slice.targetTemp, slice.currentTemp);
|
|
99078
|
+
const range = rangeFrom(slice.minTemp, slice.maxTemp, 1);
|
|
99079
|
+
const candidates = slice.availableModes.filter((m) => m !== "off");
|
|
99080
|
+
const last = slice.lastActiveMode;
|
|
99081
|
+
const onMode = last !== void 0 && candidates.includes(last) ? last : WATER_ON_PREFERENCE.find((m) => candidates.includes(m)) ?? candidates[0] ?? null;
|
|
99082
|
+
const modeControls = [{
|
|
99083
|
+
kind: "picker",
|
|
99084
|
+
id: "water-heater.mode",
|
|
99085
|
+
label: t("Mode", "Modalità"),
|
|
99086
|
+
current: slice.operationMode,
|
|
99087
|
+
options: [...slice.availableModes],
|
|
99088
|
+
call: {
|
|
99089
|
+
cap: "water-heater",
|
|
99090
|
+
method: "setOperationMode",
|
|
99091
|
+
args: {}
|
|
99092
|
+
},
|
|
99093
|
+
valueArg: "mode"
|
|
99094
|
+
}];
|
|
99095
|
+
if (slice.away !== null) modeControls.push({
|
|
99096
|
+
kind: "toggle",
|
|
99097
|
+
id: "water-heater.away",
|
|
99098
|
+
label: t("Away", "Assente"),
|
|
99099
|
+
on: slice.away,
|
|
99100
|
+
turnOn: action("water-heater.away.on", t("Away", "Assente"), "house", "water-heater", "setAway", { on: true }),
|
|
99101
|
+
turnOff: action("water-heater.away.off", t("Away", "Assente"), "house", "water-heater", "setAway", { on: false })
|
|
99102
|
+
});
|
|
99103
|
+
const rows = [{
|
|
99104
|
+
id: "climate-mode",
|
|
99105
|
+
icon: "flame",
|
|
99106
|
+
status: label,
|
|
99107
|
+
controls: modeControls
|
|
99108
|
+
}, ...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))];
|
|
99109
|
+
const level = levelWithin(slice.targetTemp, range);
|
|
99110
|
+
return {
|
|
99111
|
+
reading: reading("climate-control", isOff ? "off" : "on"),
|
|
99112
|
+
title: label,
|
|
99113
|
+
facts: status === null ? [] : [fact("climate", "flame", status)],
|
|
99114
|
+
...slice.currentTemp === null ? {} : { tiles: { left: [tile("Water", "Acqua", formatDegrees(slice.currentTemp))] } },
|
|
99115
|
+
scene: {
|
|
99116
|
+
...isOff ? {} : { mode: "heat" },
|
|
99117
|
+
...level === null ? {} : { level }
|
|
99118
|
+
},
|
|
99119
|
+
...onMode === null ? {} : { ownPower: {
|
|
99120
|
+
source: "climate-control",
|
|
99121
|
+
on: !isOff,
|
|
99122
|
+
assumed: false,
|
|
99123
|
+
turnOn: action("own-power.on", t("Turn on", "Accendi"), "power", "water-heater", "setOperationMode", { mode: onMode }),
|
|
99124
|
+
turnOff: action("own-power.off", t("Turn off", "Spegni"), "power-off", "water-heater", "setOperationMode", { mode: "off" })
|
|
99125
|
+
} },
|
|
99126
|
+
rows
|
|
99127
|
+
};
|
|
99128
|
+
});
|
|
99129
|
+
var heatingValveContribution = contribution("heating-valve", HeatingValveStatusSchema, (slice) => {
|
|
99130
|
+
const position = slice?.position ?? null;
|
|
99131
|
+
if (position === null) return { reading: reading("sensor", "unknown") };
|
|
99132
|
+
const text = same(`${Math.round(position)}%`);
|
|
99133
|
+
return {
|
|
99134
|
+
reading: reading("sensor", position > 0 ? "running" : "idle"),
|
|
99135
|
+
facts: [fact("valve", "gauge", t(`Valve ${text.en}`, `Valvola ${text.it}`))],
|
|
99136
|
+
tiles: { right: [tile("Valve", "Valvola", text.en)] },
|
|
99137
|
+
scene: { level: position / 100 }
|
|
99138
|
+
};
|
|
99139
|
+
});
|
|
99140
|
+
/** One reading fact plus its tile; a value that did not answer says nothing and the state stays unknown. */
|
|
99141
|
+
function sensorFragment(value, id, icon, en, it, text) {
|
|
99142
|
+
if (value === null) return { reading: reading("sensor", "unknown") };
|
|
99143
|
+
return {
|
|
99144
|
+
reading: reading("sensor", "on"),
|
|
99145
|
+
title: same(text),
|
|
99146
|
+
facts: [fact(id, icon, same(text))],
|
|
99147
|
+
tiles: { right: [tile(en, it, text)] }
|
|
99148
|
+
};
|
|
99149
|
+
}
|
|
99150
|
+
var temperatureContribution = contribution("temperature-sensor", TemperatureSensorStatusSchema, (slice) => sensorFragment(slice?.temperature ?? null, "temperature", "thermometer", "Temperature", "Temperatura", formatDegrees(slice?.temperature ?? 0)));
|
|
99151
|
+
var humidityContribution = contribution("humidity-sensor", HumiditySensorStatusSchema, (slice) => sensorFragment(slice?.humidity ?? null, "humidity", "droplets", "Humidity", "Umidità", `${Math.round(slice?.humidity ?? 0)}%`));
|
|
99152
|
+
var pressureContribution = contribution("pressure-sensor", PressureSensorStatusSchema, (slice) => sensorFragment(slice?.pressure ?? null, "pressure", "gauge", "Pressure", "Pressione", `${Math.round(slice?.pressure ?? 0)} hPa`));
|
|
99153
|
+
var illuminanceContribution = contribution("ambient-light-sensor", AmbientLightSensorStatusSchema, (slice) => sensorFragment(slice?.illuminance ?? null, "illuminance", "sun", "Light", "Luce", `${Math.round(slice?.illuminance ?? 0)} lx`));
|
|
99154
|
+
var numericContribution = contribution("numeric-sensor", NumericSensorStatusSchema, (slice) => sensorFragment(slice?.value ?? null, "reading", "gauge", "Value", "Valore", String(Number((slice?.value ?? 0).toFixed(2)))));
|
|
99155
|
+
var enumContribution = contribution("enum-sensor", EnumSensorStatusSchema, (slice) => {
|
|
99156
|
+
if (slice === void 0 || slice.value === "") return { reading: reading("sensor", "unknown") };
|
|
99157
|
+
if (slice.timestamp === true) return { reading: reading("sensor", "on") };
|
|
99158
|
+
return sensorFragment(slice.value, "reading", "gauge", "State", "Stato", slice.value);
|
|
99159
|
+
});
|
|
99160
|
+
/** Index bands: the headline of an air-quality sensor is a word, not a number. */
|
|
99161
|
+
function airQualityWord(aqi) {
|
|
99162
|
+
if (aqi <= 50) return t("Good", "Buona");
|
|
99163
|
+
if (aqi <= 100) return t("Moderate", "Discreta");
|
|
99164
|
+
if (aqi <= 150) return t("Poor", "Scadente");
|
|
99165
|
+
return t("Unhealthy", "Malsana");
|
|
99166
|
+
}
|
|
99167
|
+
/** The climate family, in the order their fragments are merged (a valve's level outranks a setpoint's). */
|
|
99168
|
+
var CLIMATE_FAMILY_CONTRIBUTIONS = {
|
|
99169
|
+
"heating-valve": heatingValveContribution,
|
|
99170
|
+
"climate-control": climateContribution,
|
|
99171
|
+
"water-heater": waterHeaterContribution,
|
|
99172
|
+
"temperature-sensor": temperatureContribution,
|
|
99173
|
+
"humidity-sensor": humidityContribution,
|
|
99174
|
+
"pressure-sensor": pressureContribution,
|
|
99175
|
+
"air-quality-sensor": contribution("air-quality-sensor", AirQualitySensorStatusSchema, (slice) => {
|
|
99176
|
+
if (slice === void 0) return { reading: reading("sensor", "unknown") };
|
|
99177
|
+
const parts = [];
|
|
99178
|
+
if (slice.aqi !== void 0) parts.push({
|
|
99179
|
+
label: "AQI",
|
|
99180
|
+
value: String(Math.round(slice.aqi))
|
|
99181
|
+
});
|
|
99182
|
+
if (slice.co2 !== void 0) parts.push({
|
|
99183
|
+
label: "CO₂",
|
|
99184
|
+
value: `${Math.round(slice.co2)} ppm`
|
|
99185
|
+
});
|
|
99186
|
+
if (slice.pm25 !== void 0) parts.push({
|
|
99187
|
+
label: "PM2.5",
|
|
99188
|
+
value: `${Math.round(slice.pm25)} µg/m³`
|
|
99189
|
+
});
|
|
99190
|
+
if (slice.voc !== void 0) parts.push({
|
|
99191
|
+
label: "VOC",
|
|
99192
|
+
value: `${Math.round(slice.voc)} ppb`
|
|
99193
|
+
});
|
|
99194
|
+
if (slice.pm10 !== void 0) parts.push({
|
|
99195
|
+
label: "PM10",
|
|
99196
|
+
value: `${Math.round(slice.pm10)} µg/m³`
|
|
99197
|
+
});
|
|
99198
|
+
if (parts.length === 0) return { reading: reading("sensor", "unknown") };
|
|
99199
|
+
return {
|
|
99200
|
+
reading: reading("sensor", "on"),
|
|
99201
|
+
...slice.aqi === void 0 ? {} : { title: airQualityWord(slice.aqi) },
|
|
99202
|
+
facts: parts.map((p) => fact("air-quality", "wind", same(`${p.label} ${p.value}`))),
|
|
99203
|
+
tiles: { right: parts.slice(0, 2).map((p) => tile(p.label, p.label, p.value)) }
|
|
99204
|
+
};
|
|
99205
|
+
}),
|
|
99206
|
+
"carbon-monoxide": contribution("carbon-monoxide", CarbonMonoxideStatusSchema, (slice) => {
|
|
99207
|
+
if (slice === void 0) return { reading: reading("sensor", "unknown") };
|
|
99208
|
+
return {
|
|
99209
|
+
reading: reading("sensor", slice.detected ? "alert" : "idle"),
|
|
99210
|
+
title: slice.detected ? t("CO detected", "CO rilevato") : t("Air clear", "Aria libera"),
|
|
99211
|
+
facts: [fact("reading", slice.detected ? "triangle-alert" : "shield-check", slice.detected ? t("CO detected", "CO rilevato") : t("Air clear", "Aria libera"), slice.detected ? "danger" : "muted")]
|
|
99212
|
+
};
|
|
99213
|
+
}),
|
|
99214
|
+
"ambient-light-sensor": illuminanceContribution,
|
|
99215
|
+
"numeric-sensor": numericContribution,
|
|
99216
|
+
"enum-sensor": enumContribution
|
|
99217
|
+
};
|
|
97493
99218
|
var NO_TRANSPORT = {
|
|
97494
99219
|
playPause: false,
|
|
97495
99220
|
previous: false,
|
|
@@ -97540,6 +99265,7 @@ var UNKNOWN_VIEW = {
|
|
|
97540
99265
|
artworkUrl: null,
|
|
97541
99266
|
mute: false,
|
|
97542
99267
|
source: null,
|
|
99268
|
+
channel: null,
|
|
97543
99269
|
shuffle: false,
|
|
97544
99270
|
repeat: false,
|
|
97545
99271
|
shuffleReadOnly: false,
|
|
@@ -97604,6 +99330,13 @@ function derivePowerGatedView(status, features, extras) {
|
|
|
97604
99330
|
runningReading
|
|
97605
99331
|
};
|
|
97606
99332
|
}
|
|
99333
|
+
/** The channel being watched: only a media item the device itself calls a channel. */
|
|
99334
|
+
function channelOf(status) {
|
|
99335
|
+
const media = status.currentMedia;
|
|
99336
|
+
if (media === null || media === void 0 || media.type !== "channel") return null;
|
|
99337
|
+
const title = media.title.trim();
|
|
99338
|
+
return title === "" ? null : title;
|
|
99339
|
+
}
|
|
97607
99340
|
function deriveFromStatus(status, features) {
|
|
97608
99341
|
const has = (f) => features?.includes(f) ?? false;
|
|
97609
99342
|
const canSwitchPower = has(DeviceFeature.MediaPlayerPower);
|
|
@@ -97645,53 +99378,22 @@ function deriveFromStatus(status, features) {
|
|
|
97645
99378
|
options,
|
|
97646
99379
|
selectable: has(DeviceFeature.MediaPlayerSelectSource) && options.length > 1
|
|
97647
99380
|
} : null,
|
|
99381
|
+
channel: has(DeviceFeature.MediaPlayerChannelStep) ? { current: channelOf(status) } : null,
|
|
97648
99382
|
shuffle: has(DeviceFeature.MediaPlayerShuffle) && status.shuffle !== null,
|
|
97649
99383
|
repeat: has(DeviceFeature.MediaPlayerRepeat) && status.repeat !== null
|
|
97650
99384
|
};
|
|
97651
99385
|
}
|
|
97652
|
-
/**
|
|
97653
|
-
|
|
97654
|
-
|
|
97655
|
-
|
|
97656
|
-
|
|
97657
|
-
|
|
97658
|
-
|
|
97659
|
-
|
|
97660
|
-
|
|
97661
|
-
|
|
97662
|
-
|
|
97663
|
-
return {
|
|
97664
|
-
id,
|
|
97665
|
-
label,
|
|
97666
|
-
icon,
|
|
97667
|
-
call: {
|
|
97668
|
-
cap,
|
|
97669
|
-
method,
|
|
97670
|
-
args
|
|
97671
|
-
},
|
|
97672
|
-
emphasis,
|
|
97673
|
-
confirm
|
|
97674
|
-
};
|
|
97675
|
-
}
|
|
97676
|
-
var asAction = (a) => ({
|
|
97677
|
-
kind: "action",
|
|
97678
|
-
action: a
|
|
97679
|
-
});
|
|
97680
|
-
function reading(source, state, assumed = false) {
|
|
97681
|
-
return {
|
|
97682
|
-
source,
|
|
97683
|
-
state,
|
|
97684
|
-
assumed
|
|
97685
|
-
};
|
|
97686
|
-
}
|
|
97687
|
-
function fact(id, icon, text, tone = "muted") {
|
|
97688
|
-
return {
|
|
97689
|
-
id,
|
|
97690
|
-
icon,
|
|
97691
|
-
text,
|
|
97692
|
-
tone
|
|
97693
|
-
};
|
|
97694
|
-
}
|
|
99386
|
+
/**
|
|
99387
|
+
* What each capability contributes to a hero (D1023). The map is typed against
|
|
99388
|
+
* the cap's own status schema: a slice is parsed at the boundary, and one that
|
|
99389
|
+
* does not parse reads as "not answered", never as a value.
|
|
99390
|
+
*
|
|
99391
|
+
* Capabilities contribute, device types never do (D14): nothing here looks at a
|
|
99392
|
+
* vendor. A type only chooses which ROWS its layout carries and how it looks.
|
|
99393
|
+
* `HERO_CAP_COVERAGE` (the second file of this directory) says, for every
|
|
99394
|
+
* device cap, whether it contributes and why it does not; the guard
|
|
99395
|
+
* `scripts/check-cap-hero-contributions.ts` keeps it complete.
|
|
99396
|
+
*/
|
|
97695
99397
|
function minutesLeft(seconds) {
|
|
97696
99398
|
const m = Math.ceil(seconds / 60);
|
|
97697
99399
|
return t(`${m} min left`, `${m} min rimanenti`);
|
|
@@ -98049,6 +99751,15 @@ var HERO_CAP_CONTRIBUTIONS = [
|
|
|
98049
99751
|
status: null,
|
|
98050
99752
|
controls: volume
|
|
98051
99753
|
});
|
|
99754
|
+
if (view.channel !== null) {
|
|
99755
|
+
const channel = view.channel.current;
|
|
99756
|
+
rows.push({
|
|
99757
|
+
id: "channel",
|
|
99758
|
+
icon: "tv",
|
|
99759
|
+
status: channel === null ? null : t(channel, channel),
|
|
99760
|
+
controls: [asAction(action("channel.down", t("Channel down", "Canale giù"), "chevron-down", "media-player", "channelDown")), asAction(action("channel.up", t("Channel up", "Canale su"), "chevron-up", "media-player", "channelUp"))]
|
|
99761
|
+
});
|
|
99762
|
+
}
|
|
98052
99763
|
if (view.source !== null) {
|
|
98053
99764
|
const current = view.source.current === "" ? null : view.source.current;
|
|
98054
99765
|
rows.push({
|
|
@@ -98109,7 +99820,13 @@ var HERO_CAP_CONTRIBUTIONS = [
|
|
|
98109
99820
|
powerSourceContribution,
|
|
98110
99821
|
remoteContribution,
|
|
98111
99822
|
consumablesContribution,
|
|
98112
|
-
dishwasherContribution
|
|
99823
|
+
dishwasherContribution,
|
|
99824
|
+
...Object.values(ACCESS_FAMILY_CONTRIBUTIONS),
|
|
99825
|
+
...Object.values(DEVICES_FAMILY_CONTRIBUTIONS),
|
|
99826
|
+
...Object.values(GROUPS_FAMILY_CONTRIBUTIONS),
|
|
99827
|
+
...Object.values(ACTUATORS_FAMILY_CONTRIBUTIONS),
|
|
99828
|
+
...Object.values(SENSORS_FAMILY_CONTRIBUTIONS),
|
|
99829
|
+
...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS)
|
|
98113
99830
|
];
|
|
98114
99831
|
/**
|
|
98115
99832
|
* The FIXED layout of each device type's hero (D1023). A layout lives in this
|
|
@@ -98128,7 +99845,9 @@ var MEDIA_PLAYER_LAYOUT = { rows: [
|
|
|
98128
99845
|
"now-playing",
|
|
98129
99846
|
"playback",
|
|
98130
99847
|
"volume",
|
|
98131
|
-
"
|
|
99848
|
+
"channel",
|
|
99849
|
+
"source",
|
|
99850
|
+
"do-not-disturb"
|
|
98132
99851
|
] };
|
|
98133
99852
|
var APPLIANCE_LAYOUT = { rows: ["cycle"] };
|
|
98134
99853
|
/** Its Home Connect PowerState is a secondary row action, never the own-power slot. */
|
|
@@ -98137,40 +99856,66 @@ var DISHWASHER_LAYOUT = { rows: [
|
|
|
98137
99856
|
"program",
|
|
98138
99857
|
"appliance-power"
|
|
98139
99858
|
] };
|
|
99859
|
+
var CLIMATE_LAYOUT = { rows: [
|
|
99860
|
+
"climate-mode",
|
|
99861
|
+
"climate-fan",
|
|
99862
|
+
"setpoint"
|
|
99863
|
+
] };
|
|
98140
99864
|
var SWITCH_LAYOUT = { rows: ["motion-trigger"] };
|
|
99865
|
+
var LOCK_LAYOUT = { rows: ["lock"] };
|
|
99866
|
+
var ALARM_LAYOUT = { rows: ["alarm"] };
|
|
99867
|
+
var FAN_LAYOUT = { rows: ["fan"] };
|
|
99868
|
+
var VACUUM_LAYOUT = { rows: ["vacuum"] };
|
|
99869
|
+
var MOWER_LAYOUT = { rows: ["mower"] };
|
|
99870
|
+
var FEEDER_LAYOUT = { rows: ["feeder"] };
|
|
99871
|
+
var FOUNTAIN_LAYOUT = { rows: ["fountain", "pump-cycle"] };
|
|
99872
|
+
var AUTOMATION_LAYOUT = { rows: ["automation"] };
|
|
99873
|
+
var SCRIPT_LAYOUT = { rows: ["script"] };
|
|
99874
|
+
var LIGHT_LAYOUT = { rows: [
|
|
99875
|
+
"brightness",
|
|
99876
|
+
"color",
|
|
99877
|
+
"contact",
|
|
99878
|
+
"motion-trigger"
|
|
99879
|
+
] };
|
|
99880
|
+
var COVER_LAYOUT = { rows: ["cover"] };
|
|
99881
|
+
var VALVE_LAYOUT = { rows: ["valve"] };
|
|
99882
|
+
var HUMIDIFIER_LAYOUT = { rows: ["humidifier"] };
|
|
99883
|
+
var UPDATE_LAYOUT = { rows: ["update"] };
|
|
99884
|
+
var CONTROL_LAYOUT = { rows: ["control"] };
|
|
99885
|
+
var BUTTON_LAYOUT = { rows: ["button"] };
|
|
98141
99886
|
var HERO_LAYOUT_BY_TYPE = {
|
|
98142
99887
|
[DeviceType.Camera]: HERO_LAYOUT_DEFAULT,
|
|
98143
99888
|
[DeviceType.Hub]: HERO_LAYOUT_DEFAULT,
|
|
98144
|
-
[DeviceType.Light]:
|
|
99889
|
+
[DeviceType.Light]: LIGHT_LAYOUT,
|
|
98145
99890
|
[DeviceType.Siren]: HERO_LAYOUT_DEFAULT,
|
|
98146
99891
|
[DeviceType.Switch]: SWITCH_LAYOUT,
|
|
98147
99892
|
[DeviceType.Sensor]: HERO_LAYOUT_DEFAULT,
|
|
98148
|
-
[DeviceType.Thermostat]:
|
|
98149
|
-
[DeviceType.Climate]:
|
|
98150
|
-
[DeviceType.Button]:
|
|
99893
|
+
[DeviceType.Thermostat]: CLIMATE_LAYOUT,
|
|
99894
|
+
[DeviceType.Climate]: CLIMATE_LAYOUT,
|
|
99895
|
+
[DeviceType.Button]: BUTTON_LAYOUT,
|
|
98151
99896
|
[DeviceType.EventEmitter]: HERO_LAYOUT_DEFAULT,
|
|
98152
|
-
[DeviceType.Update]:
|
|
99897
|
+
[DeviceType.Update]: UPDATE_LAYOUT,
|
|
98153
99898
|
[DeviceType.Generic]: HERO_LAYOUT_DEFAULT,
|
|
98154
99899
|
[DeviceType.Notifier]: HERO_LAYOUT_DEFAULT,
|
|
98155
|
-
[DeviceType.Script]:
|
|
98156
|
-
[DeviceType.Automation]:
|
|
98157
|
-
[DeviceType.Lock]:
|
|
98158
|
-
[DeviceType.Cover]:
|
|
98159
|
-
[DeviceType.Valve]:
|
|
98160
|
-
[DeviceType.Humidifier]:
|
|
98161
|
-
[DeviceType.WaterHeater]:
|
|
98162
|
-
[DeviceType.Fan]:
|
|
99900
|
+
[DeviceType.Script]: SCRIPT_LAYOUT,
|
|
99901
|
+
[DeviceType.Automation]: AUTOMATION_LAYOUT,
|
|
99902
|
+
[DeviceType.Lock]: LOCK_LAYOUT,
|
|
99903
|
+
[DeviceType.Cover]: COVER_LAYOUT,
|
|
99904
|
+
[DeviceType.Valve]: VALVE_LAYOUT,
|
|
99905
|
+
[DeviceType.Humidifier]: HUMIDIFIER_LAYOUT,
|
|
99906
|
+
[DeviceType.WaterHeater]: CLIMATE_LAYOUT,
|
|
99907
|
+
[DeviceType.Fan]: FAN_LAYOUT,
|
|
98163
99908
|
[DeviceType.MediaPlayer]: MEDIA_PLAYER_LAYOUT,
|
|
98164
|
-
[DeviceType.AlarmPanel]:
|
|
98165
|
-
[DeviceType.Control]:
|
|
99909
|
+
[DeviceType.AlarmPanel]: ALARM_LAYOUT,
|
|
99910
|
+
[DeviceType.Control]: CONTROL_LAYOUT,
|
|
98166
99911
|
[DeviceType.Presence]: HERO_LAYOUT_DEFAULT,
|
|
98167
99912
|
[DeviceType.Weather]: HERO_LAYOUT_DEFAULT,
|
|
98168
|
-
[DeviceType.Vacuum]:
|
|
98169
|
-
[DeviceType.LawnMower]:
|
|
99913
|
+
[DeviceType.Vacuum]: VACUUM_LAYOUT,
|
|
99914
|
+
[DeviceType.LawnMower]: MOWER_LAYOUT,
|
|
98170
99915
|
[DeviceType.Container]: HERO_LAYOUT_DEFAULT,
|
|
98171
99916
|
[DeviceType.Image]: HERO_LAYOUT_DEFAULT,
|
|
98172
|
-
[DeviceType.PetFeeder]:
|
|
98173
|
-
[DeviceType.PetFountain]:
|
|
99917
|
+
[DeviceType.PetFeeder]: FEEDER_LAYOUT,
|
|
99918
|
+
[DeviceType.PetFountain]: FOUNTAIN_LAYOUT,
|
|
98174
99919
|
[DeviceType.Dishwasher]: DISHWASHER_LAYOUT,
|
|
98175
99920
|
[DeviceType.Washer]: APPLIANCE_LAYOUT,
|
|
98176
99921
|
[DeviceType.Heater]: HEATER_LAYOUT,
|
|
@@ -98357,25 +100102,413 @@ var DISHWASHER_LOOK = lookOf({
|
|
|
98357
100102
|
idle: INFO,
|
|
98358
100103
|
standby: WARN
|
|
98359
100104
|
});
|
|
98360
|
-
|
|
98361
|
-
|
|
100105
|
+
/** A sensor that reads Clear or Detected: calm when clear, an alarm when it trips. */
|
|
100106
|
+
function sensorLook(icon, alertIcon = icon) {
|
|
100107
|
+
return lookOf({
|
|
100108
|
+
icon,
|
|
100109
|
+
on: [
|
|
100110
|
+
"primary",
|
|
100111
|
+
"glow",
|
|
100112
|
+
"halo"
|
|
100113
|
+
],
|
|
100114
|
+
off: MUTED,
|
|
100115
|
+
running: [
|
|
100116
|
+
"primary",
|
|
100117
|
+
"glow",
|
|
100118
|
+
"halo"
|
|
100119
|
+
],
|
|
100120
|
+
idle: [
|
|
100121
|
+
"success",
|
|
100122
|
+
"plain",
|
|
100123
|
+
"none"
|
|
100124
|
+
],
|
|
100125
|
+
standby: WARN,
|
|
100126
|
+
alert: look(alertIcon, "danger", "alert-wash", "pulse")
|
|
100127
|
+
});
|
|
100128
|
+
}
|
|
100129
|
+
var LEAK_LOOK = sensorLook("droplets");
|
|
100130
|
+
var SMOKE_LOOK = sensorLook("flame");
|
|
100131
|
+
var GAS_LOOK = sensorLook("wind");
|
|
100132
|
+
var TAMPER_LOOK = sensorLook("shield-alert");
|
|
100133
|
+
var VIBRATION_LOOK = sensorLook("vibrate");
|
|
100134
|
+
var MOTION_LOOK = sensorLook("radar", "triangle-alert");
|
|
100135
|
+
var DOORBELL_LOOK = sensorLook("bell-ring");
|
|
100136
|
+
/** A camera is a camera: never a power glyph, whatever its motion reads. */
|
|
100137
|
+
var CAMERA_LOOK = sensorLook("video", "triangle-alert");
|
|
100138
|
+
/** A bulb glows while lit. */
|
|
100139
|
+
var LIGHT_LOOK = lookOf({
|
|
100140
|
+
icon: "lightbulb",
|
|
98362
100141
|
on: [
|
|
98363
|
-
"
|
|
100142
|
+
"warning",
|
|
100143
|
+
"glow",
|
|
100144
|
+
"glow"
|
|
100145
|
+
],
|
|
100146
|
+
off: MUTED,
|
|
100147
|
+
running: [
|
|
100148
|
+
"warning",
|
|
100149
|
+
"glow",
|
|
100150
|
+
"glow"
|
|
100151
|
+
],
|
|
100152
|
+
idle: INFO,
|
|
100153
|
+
standby: WARN
|
|
100154
|
+
});
|
|
100155
|
+
/** Closed is a position, not an absence of power: the blind keeps its glyph and goes quiet. */
|
|
100156
|
+
var COVER_LOOK = lookOf({
|
|
100157
|
+
icon: "blinds",
|
|
100158
|
+
on: [
|
|
100159
|
+
"primary",
|
|
100160
|
+
"plain",
|
|
100161
|
+
"none"
|
|
100162
|
+
],
|
|
100163
|
+
off: MUTED,
|
|
100164
|
+
running: [
|
|
100165
|
+
"primary",
|
|
100166
|
+
"plain",
|
|
100167
|
+
"pulse"
|
|
100168
|
+
],
|
|
100169
|
+
idle: INFO,
|
|
100170
|
+
standby: WARN
|
|
100171
|
+
});
|
|
100172
|
+
var VALVE_LOOK = lookOf({
|
|
100173
|
+
icon: "droplet",
|
|
100174
|
+
on: [
|
|
100175
|
+
"primary",
|
|
98364
100176
|
"water",
|
|
98365
100177
|
"wave"
|
|
98366
100178
|
],
|
|
98367
100179
|
off: MUTED,
|
|
98368
100180
|
running: [
|
|
98369
|
-
"
|
|
100181
|
+
"primary",
|
|
98370
100182
|
"water",
|
|
100183
|
+
"pulse"
|
|
100184
|
+
],
|
|
100185
|
+
idle: INFO,
|
|
100186
|
+
standby: WARN
|
|
100187
|
+
});
|
|
100188
|
+
var HUMIDIFIER_LOOK = lookOf({
|
|
100189
|
+
icon: "droplets",
|
|
100190
|
+
on: [
|
|
100191
|
+
"info",
|
|
100192
|
+
"mist",
|
|
100193
|
+
"breathe"
|
|
100194
|
+
],
|
|
100195
|
+
off: MUTED,
|
|
100196
|
+
running: [
|
|
100197
|
+
"info",
|
|
100198
|
+
"mist",
|
|
98371
100199
|
"wave"
|
|
98372
100200
|
],
|
|
98373
100201
|
idle: INFO,
|
|
98374
|
-
standby: WARN
|
|
98375
|
-
alert: look("droplets", "danger", "alert-wash", "pulse")
|
|
100202
|
+
standby: WARN
|
|
98376
100203
|
});
|
|
98377
|
-
var
|
|
98378
|
-
icon: "
|
|
100204
|
+
var CONTROL_LOOK = lookOf({
|
|
100205
|
+
icon: "sliders-horizontal",
|
|
100206
|
+
on: [
|
|
100207
|
+
"primary",
|
|
100208
|
+
"plain",
|
|
100209
|
+
"none"
|
|
100210
|
+
],
|
|
100211
|
+
off: MUTED,
|
|
100212
|
+
running: [
|
|
100213
|
+
"primary",
|
|
100214
|
+
"plain",
|
|
100215
|
+
"pulse"
|
|
100216
|
+
],
|
|
100217
|
+
idle: INFO,
|
|
100218
|
+
standby: WARN
|
|
100219
|
+
});
|
|
100220
|
+
var PRESENCE_LOOK = lookOf({
|
|
100221
|
+
icon: "map-pin",
|
|
100222
|
+
on: [
|
|
100223
|
+
"success",
|
|
100224
|
+
"plain",
|
|
100225
|
+
"none"
|
|
100226
|
+
],
|
|
100227
|
+
off: MUTED,
|
|
100228
|
+
running: [
|
|
100229
|
+
"primary",
|
|
100230
|
+
"plain",
|
|
100231
|
+
"pulse"
|
|
100232
|
+
],
|
|
100233
|
+
idle: INFO,
|
|
100234
|
+
standby: WARN
|
|
100235
|
+
});
|
|
100236
|
+
var WEATHER_LOOK = lookOf({
|
|
100237
|
+
icon: "cloud-sun",
|
|
100238
|
+
on: [
|
|
100239
|
+
"info",
|
|
100240
|
+
"sky",
|
|
100241
|
+
"none"
|
|
100242
|
+
],
|
|
100243
|
+
off: MUTED,
|
|
100244
|
+
running: [
|
|
100245
|
+
"info",
|
|
100246
|
+
"sky",
|
|
100247
|
+
"none"
|
|
100248
|
+
],
|
|
100249
|
+
idle: INFO,
|
|
100250
|
+
standby: WARN
|
|
100251
|
+
});
|
|
100252
|
+
/** An update waits (warning), runs (pulse) or is done (calm). */
|
|
100253
|
+
var UPDATE_LOOK = lookOf({
|
|
100254
|
+
icon: "download",
|
|
100255
|
+
on: [
|
|
100256
|
+
"success",
|
|
100257
|
+
"plain",
|
|
100258
|
+
"none"
|
|
100259
|
+
],
|
|
100260
|
+
off: MUTED,
|
|
100261
|
+
running: [
|
|
100262
|
+
"primary",
|
|
100263
|
+
"plain",
|
|
100264
|
+
"pulse"
|
|
100265
|
+
],
|
|
100266
|
+
idle: [
|
|
100267
|
+
"success",
|
|
100268
|
+
"plain",
|
|
100269
|
+
"none"
|
|
100270
|
+
],
|
|
100271
|
+
standby: [
|
|
100272
|
+
"warning",
|
|
100273
|
+
"plain",
|
|
100274
|
+
"pulse"
|
|
100275
|
+
]
|
|
100276
|
+
});
|
|
100277
|
+
var BUTTON_LOOK = lookOf({
|
|
100278
|
+
icon: "pointer",
|
|
100279
|
+
on: [
|
|
100280
|
+
"primary",
|
|
100281
|
+
"plain",
|
|
100282
|
+
"none"
|
|
100283
|
+
],
|
|
100284
|
+
off: MUTED,
|
|
100285
|
+
running: [
|
|
100286
|
+
"primary",
|
|
100287
|
+
"plain",
|
|
100288
|
+
"pulse"
|
|
100289
|
+
],
|
|
100290
|
+
idle: INFO,
|
|
100291
|
+
standby: WARN
|
|
100292
|
+
});
|
|
100293
|
+
var IMAGE_LOOK = lookOf({
|
|
100294
|
+
icon: "image",
|
|
100295
|
+
on: [
|
|
100296
|
+
"primary",
|
|
100297
|
+
"plain",
|
|
100298
|
+
"none"
|
|
100299
|
+
],
|
|
100300
|
+
off: MUTED,
|
|
100301
|
+
running: [
|
|
100302
|
+
"primary",
|
|
100303
|
+
"plain",
|
|
100304
|
+
"pulse"
|
|
100305
|
+
],
|
|
100306
|
+
idle: INFO,
|
|
100307
|
+
standby: WARN
|
|
100308
|
+
});
|
|
100309
|
+
/** A lock is secure when locked, and says so when it is not. */
|
|
100310
|
+
var LOCK_LOOK = {
|
|
100311
|
+
...lookOf({
|
|
100312
|
+
icon: "lock",
|
|
100313
|
+
on: [
|
|
100314
|
+
"success",
|
|
100315
|
+
"plain",
|
|
100316
|
+
"none"
|
|
100317
|
+
],
|
|
100318
|
+
off: MUTED,
|
|
100319
|
+
running: [
|
|
100320
|
+
"primary",
|
|
100321
|
+
"plain",
|
|
100322
|
+
"pulse"
|
|
100323
|
+
],
|
|
100324
|
+
idle: INFO,
|
|
100325
|
+
standby: WARN
|
|
100326
|
+
}),
|
|
100327
|
+
standby: look("lock-open", "warning", "plain", "none"),
|
|
100328
|
+
off: look("lock-open", "muted", "plain", "none")
|
|
100329
|
+
};
|
|
100330
|
+
/** The shield glows while armed, blinks red in alarm and goes quiet when disarmed. */
|
|
100331
|
+
var ALARM_LOOK = {
|
|
100332
|
+
...lookOf({
|
|
100333
|
+
icon: "shield-check",
|
|
100334
|
+
on: [
|
|
100335
|
+
"success",
|
|
100336
|
+
"glow",
|
|
100337
|
+
"halo"
|
|
100338
|
+
],
|
|
100339
|
+
off: MUTED,
|
|
100340
|
+
running: [
|
|
100341
|
+
"primary",
|
|
100342
|
+
"plain",
|
|
100343
|
+
"pulse"
|
|
100344
|
+
],
|
|
100345
|
+
idle: INFO,
|
|
100346
|
+
standby: WARN
|
|
100347
|
+
}),
|
|
100348
|
+
off: look("shield-off", "muted", "plain", "none"),
|
|
100349
|
+
standby: look("shield", "warning", "plain", "pulse"),
|
|
100350
|
+
alert: look("shield-alert", "danger", "alert-wash", "blink")
|
|
100351
|
+
};
|
|
100352
|
+
/** Blades turn only while air moves. */
|
|
100353
|
+
var FAN_LOOK = lookOf({
|
|
100354
|
+
icon: "fan",
|
|
100355
|
+
on: [
|
|
100356
|
+
"success",
|
|
100357
|
+
"plain",
|
|
100358
|
+
"none"
|
|
100359
|
+
],
|
|
100360
|
+
off: MUTED,
|
|
100361
|
+
running: [
|
|
100362
|
+
"primary",
|
|
100363
|
+
"mist",
|
|
100364
|
+
"spin"
|
|
100365
|
+
],
|
|
100366
|
+
idle: INFO,
|
|
100367
|
+
standby: WARN
|
|
100368
|
+
});
|
|
100369
|
+
var VACUUM_LOOK = lookOf({
|
|
100370
|
+
icon: "bot",
|
|
100371
|
+
on: [
|
|
100372
|
+
"success",
|
|
100373
|
+
"plain",
|
|
100374
|
+
"none"
|
|
100375
|
+
],
|
|
100376
|
+
off: MUTED,
|
|
100377
|
+
running: [
|
|
100378
|
+
"primary",
|
|
100379
|
+
"plain",
|
|
100380
|
+
"pulse"
|
|
100381
|
+
],
|
|
100382
|
+
idle: INFO,
|
|
100383
|
+
standby: WARN
|
|
100384
|
+
});
|
|
100385
|
+
var MOWER_LOOK = lookOf({
|
|
100386
|
+
icon: "sprout",
|
|
100387
|
+
on: [
|
|
100388
|
+
"success",
|
|
100389
|
+
"plain",
|
|
100390
|
+
"none"
|
|
100391
|
+
],
|
|
100392
|
+
off: MUTED,
|
|
100393
|
+
running: [
|
|
100394
|
+
"primary",
|
|
100395
|
+
"plain",
|
|
100396
|
+
"pulse"
|
|
100397
|
+
],
|
|
100398
|
+
idle: INFO,
|
|
100399
|
+
standby: WARN
|
|
100400
|
+
});
|
|
100401
|
+
var FEEDER_LOOK = lookOf({
|
|
100402
|
+
icon: "bone",
|
|
100403
|
+
on: [
|
|
100404
|
+
"success",
|
|
100405
|
+
"plain",
|
|
100406
|
+
"none"
|
|
100407
|
+
],
|
|
100408
|
+
off: MUTED,
|
|
100409
|
+
running: [
|
|
100410
|
+
"primary",
|
|
100411
|
+
"plain",
|
|
100412
|
+
"pulse"
|
|
100413
|
+
],
|
|
100414
|
+
idle: INFO,
|
|
100415
|
+
standby: WARN
|
|
100416
|
+
});
|
|
100417
|
+
var FOUNTAIN_LOOK = lookOf({
|
|
100418
|
+
icon: "droplets",
|
|
100419
|
+
on: [
|
|
100420
|
+
"success",
|
|
100421
|
+
"plain",
|
|
100422
|
+
"none"
|
|
100423
|
+
],
|
|
100424
|
+
off: MUTED,
|
|
100425
|
+
running: [
|
|
100426
|
+
"primary",
|
|
100427
|
+
"water",
|
|
100428
|
+
"wave"
|
|
100429
|
+
],
|
|
100430
|
+
idle: INFO,
|
|
100431
|
+
standby: WARN
|
|
100432
|
+
});
|
|
100433
|
+
var AUTOMATION_LOOK = lookOf({
|
|
100434
|
+
icon: "workflow",
|
|
100435
|
+
on: [
|
|
100436
|
+
"success",
|
|
100437
|
+
"plain",
|
|
100438
|
+
"none"
|
|
100439
|
+
],
|
|
100440
|
+
off: MUTED,
|
|
100441
|
+
running: [
|
|
100442
|
+
"primary",
|
|
100443
|
+
"plain",
|
|
100444
|
+
"pulse"
|
|
100445
|
+
],
|
|
100446
|
+
idle: INFO,
|
|
100447
|
+
standby: WARN
|
|
100448
|
+
});
|
|
100449
|
+
var SCRIPT_LOOK = lookOf({
|
|
100450
|
+
icon: "scroll-text",
|
|
100451
|
+
on: [
|
|
100452
|
+
"success",
|
|
100453
|
+
"plain",
|
|
100454
|
+
"none"
|
|
100455
|
+
],
|
|
100456
|
+
off: MUTED,
|
|
100457
|
+
running: [
|
|
100458
|
+
"primary",
|
|
100459
|
+
"plain",
|
|
100460
|
+
"pulse"
|
|
100461
|
+
],
|
|
100462
|
+
idle: INFO,
|
|
100463
|
+
standby: WARN
|
|
100464
|
+
});
|
|
100465
|
+
var EVENT_EMITTER_LOOK = lookOf({
|
|
100466
|
+
icon: "radio-tower",
|
|
100467
|
+
on: [
|
|
100468
|
+
"success",
|
|
100469
|
+
"plain",
|
|
100470
|
+
"none"
|
|
100471
|
+
],
|
|
100472
|
+
off: MUTED,
|
|
100473
|
+
running: [
|
|
100474
|
+
"primary",
|
|
100475
|
+
"plain",
|
|
100476
|
+
"pulse"
|
|
100477
|
+
],
|
|
100478
|
+
idle: INFO,
|
|
100479
|
+
standby: WARN
|
|
100480
|
+
});
|
|
100481
|
+
/** A reading device: the value is the headline, the look only says what kind of reading it is. */
|
|
100482
|
+
function readingLook(icon, tone) {
|
|
100483
|
+
return lookOf({
|
|
100484
|
+
icon,
|
|
100485
|
+
on: [
|
|
100486
|
+
tone,
|
|
100487
|
+
"plain",
|
|
100488
|
+
"none"
|
|
100489
|
+
],
|
|
100490
|
+
off: MUTED,
|
|
100491
|
+
running: [
|
|
100492
|
+
tone,
|
|
100493
|
+
"plain",
|
|
100494
|
+
"none"
|
|
100495
|
+
],
|
|
100496
|
+
idle: [
|
|
100497
|
+
tone,
|
|
100498
|
+
"plain",
|
|
100499
|
+
"none"
|
|
100500
|
+
],
|
|
100501
|
+
standby: MUTED
|
|
100502
|
+
});
|
|
100503
|
+
}
|
|
100504
|
+
var READING_SENSOR_LOOK = readingLook("gauge", "info");
|
|
100505
|
+
var TEMPERATURE_LOOK = readingLook("thermometer", "info");
|
|
100506
|
+
var HUMIDITY_LOOK = readingLook("droplets", "info");
|
|
100507
|
+
var AIR_QUALITY_LOOK = readingLook("wind", "success");
|
|
100508
|
+
var LIGHT_SENSOR_LOOK = readingLook("sun", "warning");
|
|
100509
|
+
/** Carbon monoxide: calm is a shield, detected is the alarm. */
|
|
100510
|
+
var CO_LOOK = lookOf({
|
|
100511
|
+
icon: "shield-check",
|
|
98379
100512
|
on: [
|
|
98380
100513
|
"danger",
|
|
98381
100514
|
"alert-wash",
|
|
@@ -98387,43 +100520,109 @@ var SMOKE_LOOK = lookOf({
|
|
|
98387
100520
|
"alert-wash",
|
|
98388
100521
|
"pulse"
|
|
98389
100522
|
],
|
|
100523
|
+
idle: [
|
|
100524
|
+
"success",
|
|
100525
|
+
"plain",
|
|
100526
|
+
"none"
|
|
100527
|
+
],
|
|
100528
|
+
standby: MUTED,
|
|
100529
|
+
alert: look("triangle-alert", "danger", "alert-wash", "pulse")
|
|
100530
|
+
});
|
|
100531
|
+
/** Heating and cooling devices: the mode (see {@link HERO_MODE_LOOK}) picks the picture while on. */
|
|
100532
|
+
var THERMOSTAT_LOOK = lookOf({
|
|
100533
|
+
icon: "thermometer",
|
|
100534
|
+
on: [
|
|
100535
|
+
"primary",
|
|
100536
|
+
"plain",
|
|
100537
|
+
"none"
|
|
100538
|
+
],
|
|
100539
|
+
off: MUTED,
|
|
100540
|
+
running: [
|
|
100541
|
+
"warning",
|
|
100542
|
+
"heat-rise",
|
|
100543
|
+
"rise"
|
|
100544
|
+
],
|
|
100545
|
+
idle: INFO,
|
|
100546
|
+
standby: MUTED
|
|
100547
|
+
});
|
|
100548
|
+
var CLIMATE_LOOK = lookOf({
|
|
100549
|
+
icon: "snowflake",
|
|
100550
|
+
on: [
|
|
100551
|
+
"primary",
|
|
100552
|
+
"plain",
|
|
100553
|
+
"none"
|
|
100554
|
+
],
|
|
100555
|
+
off: MUTED,
|
|
100556
|
+
running: [
|
|
100557
|
+
"primary",
|
|
100558
|
+
"plain",
|
|
100559
|
+
"none"
|
|
100560
|
+
],
|
|
98390
100561
|
idle: INFO,
|
|
98391
|
-
standby:
|
|
98392
|
-
alert: look("flame", "danger", "alert-wash", "pulse")
|
|
100562
|
+
standby: MUTED
|
|
98393
100563
|
});
|
|
100564
|
+
var WATER_HEATER_LOOK = lookOf({
|
|
100565
|
+
icon: "thermometer-sun",
|
|
100566
|
+
on: [
|
|
100567
|
+
"warning",
|
|
100568
|
+
"heat-rise",
|
|
100569
|
+
"rise"
|
|
100570
|
+
],
|
|
100571
|
+
off: MUTED,
|
|
100572
|
+
running: [
|
|
100573
|
+
"warning",
|
|
100574
|
+
"heat-rise",
|
|
100575
|
+
"rise"
|
|
100576
|
+
],
|
|
100577
|
+
idle: INFO,
|
|
100578
|
+
standby: MUTED
|
|
100579
|
+
});
|
|
100580
|
+
/** What a climate device draws while it is on, by mode: warm air rises, cold falls, drops dry, the fan spins. */
|
|
100581
|
+
var HERO_MODE_LOOK = {
|
|
100582
|
+
heat: look("flame", "warning", "heat-rise", "rise"),
|
|
100583
|
+
cool: look("snowflake", "info", "cool-fall", "fall"),
|
|
100584
|
+
dry: look("droplets", "info", "water", "wave"),
|
|
100585
|
+
fan: look("fan", "primary", "plain", "spin"),
|
|
100586
|
+
auto: look("thermometer", "success", "glow", "glow"),
|
|
100587
|
+
playing: null,
|
|
100588
|
+
paused: null,
|
|
100589
|
+
open: null,
|
|
100590
|
+
closed: null
|
|
100591
|
+
};
|
|
100592
|
+
var MODE_LOOK_TYPES = [DeviceType.Climate, DeviceType.Thermostat];
|
|
98394
100593
|
var HERO_LOOK_BY_TYPE = {
|
|
98395
|
-
[DeviceType.Camera]:
|
|
100594
|
+
[DeviceType.Camera]: CAMERA_LOOK,
|
|
98396
100595
|
[DeviceType.Hub]: HERO_LOOK_DEFAULT,
|
|
98397
|
-
[DeviceType.Light]:
|
|
100596
|
+
[DeviceType.Light]: LIGHT_LOOK,
|
|
98398
100597
|
[DeviceType.Siren]: HERO_LOOK_DEFAULT,
|
|
98399
100598
|
[DeviceType.Switch]: SWITCH_LOOK,
|
|
98400
|
-
[DeviceType.Sensor]:
|
|
98401
|
-
[DeviceType.Thermostat]:
|
|
98402
|
-
[DeviceType.Climate]:
|
|
98403
|
-
[DeviceType.Button]:
|
|
98404
|
-
[DeviceType.EventEmitter]:
|
|
98405
|
-
[DeviceType.Update]:
|
|
100599
|
+
[DeviceType.Sensor]: READING_SENSOR_LOOK,
|
|
100600
|
+
[DeviceType.Thermostat]: THERMOSTAT_LOOK,
|
|
100601
|
+
[DeviceType.Climate]: CLIMATE_LOOK,
|
|
100602
|
+
[DeviceType.Button]: BUTTON_LOOK,
|
|
100603
|
+
[DeviceType.EventEmitter]: EVENT_EMITTER_LOOK,
|
|
100604
|
+
[DeviceType.Update]: UPDATE_LOOK,
|
|
98406
100605
|
[DeviceType.Generic]: HERO_LOOK_DEFAULT,
|
|
98407
100606
|
[DeviceType.Notifier]: HERO_LOOK_DEFAULT,
|
|
98408
|
-
[DeviceType.Script]:
|
|
98409
|
-
[DeviceType.Automation]:
|
|
98410
|
-
[DeviceType.Lock]:
|
|
98411
|
-
[DeviceType.Cover]:
|
|
98412
|
-
[DeviceType.Valve]:
|
|
98413
|
-
[DeviceType.Humidifier]:
|
|
98414
|
-
[DeviceType.WaterHeater]:
|
|
98415
|
-
[DeviceType.Fan]:
|
|
100607
|
+
[DeviceType.Script]: SCRIPT_LOOK,
|
|
100608
|
+
[DeviceType.Automation]: AUTOMATION_LOOK,
|
|
100609
|
+
[DeviceType.Lock]: LOCK_LOOK,
|
|
100610
|
+
[DeviceType.Cover]: COVER_LOOK,
|
|
100611
|
+
[DeviceType.Valve]: VALVE_LOOK,
|
|
100612
|
+
[DeviceType.Humidifier]: HUMIDIFIER_LOOK,
|
|
100613
|
+
[DeviceType.WaterHeater]: WATER_HEATER_LOOK,
|
|
100614
|
+
[DeviceType.Fan]: FAN_LOOK,
|
|
98416
100615
|
[DeviceType.MediaPlayer]: MEDIA_PLAYER_LOOK,
|
|
98417
|
-
[DeviceType.AlarmPanel]:
|
|
98418
|
-
[DeviceType.Control]:
|
|
98419
|
-
[DeviceType.Presence]:
|
|
98420
|
-
[DeviceType.Weather]:
|
|
98421
|
-
[DeviceType.Vacuum]:
|
|
98422
|
-
[DeviceType.LawnMower]:
|
|
100616
|
+
[DeviceType.AlarmPanel]: ALARM_LOOK,
|
|
100617
|
+
[DeviceType.Control]: CONTROL_LOOK,
|
|
100618
|
+
[DeviceType.Presence]: PRESENCE_LOOK,
|
|
100619
|
+
[DeviceType.Weather]: WEATHER_LOOK,
|
|
100620
|
+
[DeviceType.Vacuum]: VACUUM_LOOK,
|
|
100621
|
+
[DeviceType.LawnMower]: MOWER_LOOK,
|
|
98423
100622
|
[DeviceType.Container]: HERO_LOOK_DEFAULT,
|
|
98424
|
-
[DeviceType.Image]:
|
|
98425
|
-
[DeviceType.PetFeeder]:
|
|
98426
|
-
[DeviceType.PetFountain]:
|
|
100623
|
+
[DeviceType.Image]: IMAGE_LOOK,
|
|
100624
|
+
[DeviceType.PetFeeder]: FEEDER_LOOK,
|
|
100625
|
+
[DeviceType.PetFountain]: FOUNTAIN_LOOK,
|
|
98427
100626
|
[DeviceType.Dishwasher]: DISHWASHER_LOOK,
|
|
98428
100627
|
[DeviceType.Washer]: WASHER_LOOK,
|
|
98429
100628
|
[DeviceType.Heater]: HEATER_LOOK,
|
|
@@ -98435,12 +100634,12 @@ var HERO_LOOK_BY_ROLE = {
|
|
|
98435
100634
|
[DeviceRole.Siren]: "inherit",
|
|
98436
100635
|
[DeviceRole.Floodlight]: "inherit",
|
|
98437
100636
|
[DeviceRole.Spotlight]: "inherit",
|
|
98438
|
-
[DeviceRole.PirSensor]:
|
|
100637
|
+
[DeviceRole.PirSensor]: MOTION_LOOK,
|
|
98439
100638
|
[DeviceRole.Chime]: "inherit",
|
|
98440
100639
|
[DeviceRole.Autotrack]: "inherit",
|
|
98441
100640
|
[DeviceRole.Nightvision]: "inherit",
|
|
98442
100641
|
[DeviceRole.PrivacyMask]: "inherit",
|
|
98443
|
-
[DeviceRole.Doorbell]:
|
|
100642
|
+
[DeviceRole.Doorbell]: DOORBELL_LOOK,
|
|
98444
100643
|
[DeviceRole.CoverBlind]: "inherit",
|
|
98445
100644
|
[DeviceRole.CoverShutter]: "inherit",
|
|
98446
100645
|
[DeviceRole.CoverAwning]: "inherit",
|
|
@@ -98451,21 +100650,21 @@ var HERO_LOOK_BY_ROLE = {
|
|
|
98451
100650
|
[DeviceRole.CoverWindow]: "inherit",
|
|
98452
100651
|
[DeviceRole.BinaryHelper]: "inherit",
|
|
98453
100652
|
[DeviceRole.Outlet]: "inherit",
|
|
98454
|
-
[DeviceRole.MotionSensor]:
|
|
100653
|
+
[DeviceRole.MotionSensor]: MOTION_LOOK,
|
|
98455
100654
|
[DeviceRole.ContactSensor]: "inherit",
|
|
98456
100655
|
[DeviceRole.LeakSensor]: LEAK_LOOK,
|
|
98457
100656
|
[DeviceRole.SmokeSensor]: SMOKE_LOOK,
|
|
98458
|
-
[DeviceRole.COSensor]:
|
|
98459
|
-
[DeviceRole.GasSensor]:
|
|
98460
|
-
[DeviceRole.TamperSensor]:
|
|
98461
|
-
[DeviceRole.VibrationSensor]:
|
|
100657
|
+
[DeviceRole.COSensor]: CO_LOOK,
|
|
100658
|
+
[DeviceRole.GasSensor]: GAS_LOOK,
|
|
100659
|
+
[DeviceRole.TamperSensor]: TAMPER_LOOK,
|
|
100660
|
+
[DeviceRole.VibrationSensor]: VIBRATION_LOOK,
|
|
98462
100661
|
[DeviceRole.ConnectivitySensor]: "inherit",
|
|
98463
100662
|
[DeviceRole.SoundSensor]: "inherit",
|
|
98464
100663
|
[DeviceRole.BinarySensor]: "inherit",
|
|
98465
|
-
[DeviceRole.TemperatureSensor]:
|
|
98466
|
-
[DeviceRole.HumiditySensor]:
|
|
98467
|
-
[DeviceRole.AmbientLightSensor]:
|
|
98468
|
-
[DeviceRole.PressureSensor]:
|
|
100664
|
+
[DeviceRole.TemperatureSensor]: TEMPERATURE_LOOK,
|
|
100665
|
+
[DeviceRole.HumiditySensor]: HUMIDITY_LOOK,
|
|
100666
|
+
[DeviceRole.AmbientLightSensor]: LIGHT_SENSOR_LOOK,
|
|
100667
|
+
[DeviceRole.PressureSensor]: READING_SENSOR_LOOK,
|
|
98469
100668
|
[DeviceRole.WindSensor]: "inherit",
|
|
98470
100669
|
[DeviceRole.RainSensor]: "inherit",
|
|
98471
100670
|
[DeviceRole.UvSensor]: "inherit",
|
|
@@ -98475,7 +100674,7 @@ var HERO_LOOK_BY_ROLE = {
|
|
|
98475
100674
|
[DeviceRole.EnergySensor]: "inherit",
|
|
98476
100675
|
[DeviceRole.VoltageSensor]: "inherit",
|
|
98477
100676
|
[DeviceRole.CurrentSensor]: "inherit",
|
|
98478
|
-
[DeviceRole.AirQualitySensor]:
|
|
100677
|
+
[DeviceRole.AirQualitySensor]: AIR_QUALITY_LOOK,
|
|
98479
100678
|
[DeviceRole.BatterySensor]: "inherit",
|
|
98480
100679
|
[DeviceRole.NumericSensor]: "inherit",
|
|
98481
100680
|
[DeviceRole.EnumSensor]: "inherit",
|
|
@@ -98497,14 +100696,25 @@ function isDeviceType(type) {
|
|
|
98497
100696
|
function isDeviceRole(role) {
|
|
98498
100697
|
return Object.values(DeviceRole).includes(role);
|
|
98499
100698
|
}
|
|
98500
|
-
/**
|
|
98501
|
-
|
|
100699
|
+
/**
|
|
100700
|
+
* The look of a (role, type) pair, for a state. Role beats type beats the generic default.
|
|
100701
|
+
* A climate device that is on draws its MODE (`mode` is the scene's); a role never loses to it.
|
|
100702
|
+
*/
|
|
100703
|
+
function resolveHeroLook(role, type, state, mode = null) {
|
|
98502
100704
|
const byRole = role !== null && isDeviceRole(role) ? HERO_LOOK_BY_ROLE[role] : void 0;
|
|
98503
100705
|
if (byRole !== void 0 && byRole !== "inherit") return byRole[state];
|
|
100706
|
+
if (mode !== null && (state === "on" || state === "running") && MODE_LOOK_TYPES.includes(type)) {
|
|
100707
|
+
const byMode = HERO_MODE_LOOK[mode];
|
|
100708
|
+
if (byMode !== null) return byMode;
|
|
100709
|
+
}
|
|
98504
100710
|
return ((isDeviceType(type) ? HERO_LOOK_BY_TYPE[type] : void 0) ?? HERO_LOOK_DEFAULT)[state];
|
|
98505
100711
|
}
|
|
98506
100712
|
/** The media player's offer outranks a bound switch: the player's own state is the device's. */
|
|
98507
|
-
var OWN_POWER_SOURCE_ORDER = [
|
|
100713
|
+
var OWN_POWER_SOURCE_ORDER = [
|
|
100714
|
+
"media-player",
|
|
100715
|
+
"climate-control",
|
|
100716
|
+
"switch"
|
|
100717
|
+
];
|
|
98508
100718
|
function resolveOwnPower(offers) {
|
|
98509
100719
|
for (const source of OWN_POWER_SOURCE_ORDER) {
|
|
98510
100720
|
const offer = offers.find((o) => o.source === source);
|
|
@@ -98526,9 +100736,41 @@ function resolveOwnPower(offers) {
|
|
|
98526
100736
|
var STATE_SOURCE_ORDER = [
|
|
98527
100737
|
"media-player",
|
|
98528
100738
|
"dishwasher",
|
|
100739
|
+
"lock-control",
|
|
100740
|
+
"alarm-panel",
|
|
100741
|
+
"vacuum-control",
|
|
100742
|
+
"lawn-mower-control",
|
|
100743
|
+
"fan-control",
|
|
100744
|
+
"pet-feeder",
|
|
100745
|
+
"pet-fountain",
|
|
100746
|
+
"automation-control",
|
|
100747
|
+
"script-runner",
|
|
100748
|
+
"event-emitter",
|
|
98529
100749
|
"running-state",
|
|
98530
100750
|
"switch",
|
|
98531
|
-
"contact"
|
|
100751
|
+
"contact",
|
|
100752
|
+
"group-active",
|
|
100753
|
+
"cover",
|
|
100754
|
+
"valve",
|
|
100755
|
+
"humidifier",
|
|
100756
|
+
"brightness",
|
|
100757
|
+
"smoke",
|
|
100758
|
+
"flood",
|
|
100759
|
+
"gas",
|
|
100760
|
+
"tamper",
|
|
100761
|
+
"vibration",
|
|
100762
|
+
"doorbell",
|
|
100763
|
+
"motion",
|
|
100764
|
+
"presence",
|
|
100765
|
+
"update",
|
|
100766
|
+
"weather",
|
|
100767
|
+
"image",
|
|
100768
|
+
"control",
|
|
100769
|
+
"meter",
|
|
100770
|
+
"binary",
|
|
100771
|
+
"button",
|
|
100772
|
+
"climate-control",
|
|
100773
|
+
"sensor"
|
|
98532
100774
|
];
|
|
98533
100775
|
var STATE_TEXT = {
|
|
98534
100776
|
on: t("On", "Acceso"),
|
|
@@ -98541,6 +100783,10 @@ var STATE_TEXT = {
|
|
|
98541
100783
|
unknown: t("Unknown", "Sconosciuto")
|
|
98542
100784
|
};
|
|
98543
100785
|
function pickReading(readings) {
|
|
100786
|
+
for (const source of STATE_SOURCE_ORDER) {
|
|
100787
|
+
const alarm = readings.find((r) => r.source === source && r.state === "alert");
|
|
100788
|
+
if (alarm !== void 0) return alarm;
|
|
100789
|
+
}
|
|
98544
100790
|
for (const source of STATE_SOURCE_ORDER) {
|
|
98545
100791
|
const found = readings.find((r) => r.source === source && r.state !== "unknown");
|
|
98546
100792
|
if (found !== void 0) return found;
|
|
@@ -98555,21 +100801,25 @@ function runningOf(input) {
|
|
|
98555
100801
|
function stateOf(input, readings) {
|
|
98556
100802
|
if (!input.device.online) return {
|
|
98557
100803
|
state: "offline",
|
|
98558
|
-
assumed: false
|
|
100804
|
+
assumed: false,
|
|
100805
|
+
title: STATE_TEXT.offline
|
|
98559
100806
|
};
|
|
98560
100807
|
const picked = pickReading(readings);
|
|
98561
100808
|
if (picked === null) return {
|
|
98562
100809
|
state: "unknown",
|
|
98563
|
-
assumed: false
|
|
100810
|
+
assumed: false,
|
|
100811
|
+
title: STATE_TEXT.unknown
|
|
98564
100812
|
};
|
|
98565
100813
|
const switchOff = readings.some((r) => r.source === "switch" && r.state === "off");
|
|
98566
100814
|
if (picked.source === "running-state" && picked.state === "idle" && switchOff) return {
|
|
98567
100815
|
state: "off",
|
|
98568
|
-
assumed: false
|
|
100816
|
+
assumed: false,
|
|
100817
|
+
title: STATE_TEXT.off
|
|
98569
100818
|
};
|
|
98570
100819
|
return {
|
|
98571
100820
|
state: picked.state,
|
|
98572
|
-
assumed: picked.assumed
|
|
100821
|
+
assumed: picked.assumed,
|
|
100822
|
+
title: picked.title ?? STATE_TEXT[picked.state]
|
|
98573
100823
|
};
|
|
98574
100824
|
}
|
|
98575
100825
|
function provenanceOf(cap, fragment) {
|
|
@@ -98618,15 +100868,17 @@ function buildHeroModel(input) {
|
|
|
98618
100868
|
features: input.features,
|
|
98619
100869
|
now: input.now,
|
|
98620
100870
|
running: runningOf(input),
|
|
98621
|
-
remoteCommands: input.remoteCommands
|
|
100871
|
+
remoteCommands: input.remoteCommands,
|
|
100872
|
+
caps: input.caps
|
|
98622
100873
|
};
|
|
98623
100874
|
const contributed = HERO_CAP_CONTRIBUTIONS.filter((c) => input.caps.includes(c.cap)).map((c) => ({
|
|
98624
100875
|
cap: c.cap,
|
|
98625
100876
|
fragment: c.contribute(input.slices[c.cap], ctx)
|
|
98626
100877
|
}));
|
|
98627
100878
|
const fragments = contributed.map((c) => c.fragment);
|
|
98628
|
-
const { state, assumed } = stateOf(input, fragments.flatMap((f) => f.reading === void 0 ? [] : [f.reading]));
|
|
98629
|
-
const
|
|
100879
|
+
const { state, assumed, title } = stateOf(input, fragments.flatMap((f) => f.reading === void 0 ? [] : [f.reading]));
|
|
100880
|
+
const scene = sceneOf(device.role, device.type, fragments);
|
|
100881
|
+
const look = resolveHeroLook(device.role, device.type, state, scene.mode);
|
|
98630
100882
|
const artworkUrl = fragments.find((f) => f.artworkUrl !== void 0)?.artworkUrl;
|
|
98631
100883
|
const background = artworkUrl === void 0 || state === "offline" ? {
|
|
98632
100884
|
kind: "state",
|
|
@@ -98650,7 +100902,8 @@ function buildHeroModel(input) {
|
|
|
98650
100902
|
const powerSupply = fragments.find((f) => f.powerSupply !== void 0)?.powerSupply ?? null;
|
|
98651
100903
|
const remote = fragments.find((f) => f.remote !== void 0)?.remote ?? null;
|
|
98652
100904
|
const badges = fragments.flatMap((f) => f.badges ?? []);
|
|
98653
|
-
const
|
|
100905
|
+
const headline = state === "offline" || state === "unknown" ? void 0 : fragments.find((f) => f.title !== void 0)?.title;
|
|
100906
|
+
const facts = fragments.flatMap((f) => f.facts ?? []).filter((f) => headline === void 0 || f.text.en !== headline.en);
|
|
98654
100907
|
const sideTiles = {
|
|
98655
100908
|
left: tilesOf(fragments, "left"),
|
|
98656
100909
|
right: tilesOf(fragments, "right")
|
|
@@ -98672,10 +100925,10 @@ function buildHeroModel(input) {
|
|
|
98672
100925
|
stateAssumed: assumed,
|
|
98673
100926
|
look,
|
|
98674
100927
|
background,
|
|
98675
|
-
scene
|
|
100928
|
+
scene,
|
|
98676
100929
|
facts,
|
|
98677
100930
|
sideTiles,
|
|
98678
|
-
title:
|
|
100931
|
+
title: headline ?? title,
|
|
98679
100932
|
badges,
|
|
98680
100933
|
remote,
|
|
98681
100934
|
consumables: fragments.find((f) => f.consumables !== void 0)?.consumables ?? null,
|
|
@@ -102336,13 +104589,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
102336
104589
|
access: "create",
|
|
102337
104590
|
role: "admin"
|
|
102338
104591
|
},
|
|
102339
|
-
"integrations.create": {
|
|
102340
|
-
capName: "integrations",
|
|
102341
|
-
capScope: "system",
|
|
102342
|
-
addonId: null,
|
|
102343
|
-
access: "create",
|
|
102344
|
-
role: "admin"
|
|
102345
|
-
},
|
|
102346
104592
|
"integrations.delete": {
|
|
102347
104593
|
capName: "integrations",
|
|
102348
104594
|
capScope: "system",
|
|
@@ -112225,7 +114471,7 @@ Object.freeze({
|
|
|
112225
114471
|
});
|
|
112226
114472
|
/**
|
|
112227
114473
|
* Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
|
|
112228
|
-
* `runtimeState`. 81 caps:
|
|
114474
|
+
* `runtimeState`. 81 caps: 41 `restored`, 40 `session`.
|
|
112229
114475
|
*
|
|
112230
114476
|
* A cap absent from this map has no runtime-state slice at all. A cap PRESENT
|
|
112231
114477
|
* with `durability: 'session'` has one and has decided not to keep it.
|
|
@@ -112272,8 +114518,9 @@ var RUNTIME_STATE_POLICY = {
|
|
|
112272
114518
|
volatileFields: ["lastChangedAt"]
|
|
112273
114519
|
},
|
|
112274
114520
|
"climate-control": {
|
|
112275
|
-
durability: "
|
|
112276
|
-
volatileFields: []
|
|
114521
|
+
durability: "restored",
|
|
114522
|
+
volatileFields: [],
|
|
114523
|
+
restoredFields: ["lastActiveMode"]
|
|
112277
114524
|
},
|
|
112278
114525
|
"color": {
|
|
112279
114526
|
durability: "session",
|
|
@@ -112325,7 +114572,7 @@ var RUNTIME_STATE_POLICY = {
|
|
|
112325
114572
|
},
|
|
112326
114573
|
"enum-sensor": {
|
|
112327
114574
|
durability: "restored",
|
|
112328
|
-
volatileFields: ["lastFetchedAt"]
|
|
114575
|
+
volatileFields: ["lastFetchedAt", "timestamp"]
|
|
112329
114576
|
},
|
|
112330
114577
|
"event-emitter": {
|
|
112331
114578
|
durability: "session",
|
|
@@ -112536,8 +114783,9 @@ var RUNTIME_STATE_POLICY = {
|
|
|
112536
114783
|
volatileFields: ["lastChangedAt"]
|
|
112537
114784
|
},
|
|
112538
114785
|
"water-heater": {
|
|
112539
|
-
durability: "
|
|
112540
|
-
volatileFields: []
|
|
114786
|
+
durability: "restored",
|
|
114787
|
+
volatileFields: [],
|
|
114788
|
+
restoredFields: ["lastActiveMode"]
|
|
112541
114789
|
},
|
|
112542
114790
|
"weather": {
|
|
112543
114791
|
durability: "session",
|
|
@@ -114962,12 +117210,6 @@ Object.defineProperty(exports, "LOG_LEVEL_RANK", {
|
|
|
114962
117210
|
return LOG_LEVEL_RANK;
|
|
114963
117211
|
}
|
|
114964
117212
|
});
|
|
114965
|
-
Object.defineProperty(exports, "LegacyStorageLocationDefaultSchema", {
|
|
114966
|
-
enumerable: true,
|
|
114967
|
-
get: function() {
|
|
114968
|
-
return LegacyStorageLocationDefaultSchema;
|
|
114969
|
-
}
|
|
114970
|
-
});
|
|
114971
117213
|
Object.defineProperty(exports, "METHOD_ACCESS_MAP", {
|
|
114972
117214
|
enumerable: true,
|
|
114973
117215
|
get: function() {
|