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