@camstack/types 1.2.557 → 1.2.559
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/addon.js +2 -2
- package/dist/addon.mjs +2 -2
- package/dist/automation/action-target.d.ts +8 -0
- package/dist/client.d.ts +2 -1
- package/dist/client.js +289 -0
- package/dist/client.mjs +288 -1
- package/dist/{composed-stable-id-CDNLq7Y8.js → composed-stable-id-BmJ_5GiE.js} +5 -0
- package/dist/{composed-stable-id-CPp3votu.mjs → composed-stable-id-iddnCQ51.mjs} +5 -0
- package/dist/composition/composition.d.ts +8 -0
- package/dist/composition/helpers/index.d.ts +1 -1
- package/dist/composition/helpers/save.d.ts +2 -0
- package/dist/composition/helpers/source-pick.d.ts +11 -5
- package/dist/composition/validate-composition.d.ts +2 -0
- package/dist/device/device-icon.d.ts +136 -0
- package/dist/device/device-kind.d.ts +36 -0
- package/dist/device/device-type.d.ts +5 -0
- package/dist/device/hero/hero-look.d.ts +6 -0
- package/dist/device/hero/hero-measurement.d.ts +7 -0
- package/dist/device/hero/hero-scene.d.ts +1 -0
- package/dist/device/hero/hero-text.d.ts +8 -0
- package/dist/device/hero/index.d.ts +2 -2
- package/dist/device/index.d.ts +3 -1
- package/dist/{implemented-methods-5YMDeE3f.mjs → implemented-methods-CSTk6zYK.mjs} +147 -2
- package/dist/{implemented-methods-Cj65uy2F.js → implemented-methods-CfaRR_ki.js} +212 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +529 -284
- package/dist/index.mjs +507 -278
- package/dist/node.js +2 -2
- package/dist/node.mjs +2 -2
- package/dist/{sleep-DyIxjZZt.mjs → sleep-BvVGLl30.mjs} +8 -1
- package/dist/{sleep-1RkA30Y1.js → sleep-CyWfD1LJ.js} +8 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_sleep = require("./sleep-
|
|
2
|
+
const require_sleep = require("./sleep-CyWfD1LJ.js");
|
|
3
3
|
const require_event_category = require("./event-category-Ps2LC8dN.js");
|
|
4
|
-
const require_composed_stable_id = require("./composed-stable-id-
|
|
5
|
-
const require_implemented_methods = require("./implemented-methods-
|
|
4
|
+
const require_composed_stable_id = require("./composed-stable-id-BmJ_5GiE.js");
|
|
5
|
+
const require_implemented_methods = require("./implemented-methods-CfaRR_ki.js");
|
|
6
6
|
const require_node_color = require("./node-color.js");
|
|
7
7
|
const require_convert = require("./convert-BmtM6K-5.js");
|
|
8
8
|
const require_enums = require("./enums.js");
|
|
@@ -10122,7 +10122,7 @@ var DeviceTokenScopeSchema = zod.z.object({
|
|
|
10122
10122
|
function migrateLegacyTokenScope(raw) {
|
|
10123
10123
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
10124
10124
|
if (Reflect.get(raw, "type") !== "device") return raw;
|
|
10125
|
-
if (Reflect.get(raw, "selector") !== void 0) return raw;
|
|
10125
|
+
if (Reflect.get(raw, "selector") !== void 0) return canonicalSelectorTypes(raw);
|
|
10126
10126
|
const targets = Reflect.get(raw, "targets");
|
|
10127
10127
|
if (!Array.isArray(targets)) return raw;
|
|
10128
10128
|
return {
|
|
@@ -10134,6 +10134,27 @@ function migrateLegacyTokenScope(raw) {
|
|
|
10134
10134
|
access: Reflect.get(raw, "access")
|
|
10135
10135
|
};
|
|
10136
10136
|
}
|
|
10137
|
+
/**
|
|
10138
|
+
* A stored `types` selector may name a type D1033 retired (`thermostat`). The
|
|
10139
|
+
* grant is read back through this same preprocess, so the retired name is
|
|
10140
|
+
* rewritten to its canonical type here and {@link DeviceSelectorSchema} itself
|
|
10141
|
+
* stays a strict enum on the wire.
|
|
10142
|
+
*/
|
|
10143
|
+
function canonicalSelectorTypes(raw) {
|
|
10144
|
+
const selector = Reflect.get(raw, "selector");
|
|
10145
|
+
if (selector === null || typeof selector !== "object") return raw;
|
|
10146
|
+
if (Reflect.get(selector, "kind") !== "types") return raw;
|
|
10147
|
+
const types = Reflect.get(selector, "types");
|
|
10148
|
+
if (!Array.isArray(types)) return raw;
|
|
10149
|
+
const canonical = types.map((t) => typeof t === "string" ? require_implemented_methods.canonicalStoredDeviceType(t) : t);
|
|
10150
|
+
return {
|
|
10151
|
+
...raw,
|
|
10152
|
+
selector: {
|
|
10153
|
+
...selector,
|
|
10154
|
+
types: canonical
|
|
10155
|
+
}
|
|
10156
|
+
};
|
|
10157
|
+
}
|
|
10137
10158
|
var TokenScopeSchema = zod.z.preprocess(migrateLegacyTokenScope, zod.z.discriminatedUnion("type", [
|
|
10138
10159
|
zod.z.object({
|
|
10139
10160
|
type: zod.z.literal("category"),
|
|
@@ -31047,6 +31068,36 @@ var ActionTargetSchema = zod.z.discriminatedUnion("kind", [
|
|
|
31047
31068
|
name: zod.z.string().min(1)
|
|
31048
31069
|
})
|
|
31049
31070
|
]);
|
|
31071
|
+
/**
|
|
31072
|
+
* A STORED list of steps, read back: a `domain` target may name a device type
|
|
31073
|
+
* D1033 retired (`thermostat`). The step schema stays a strict enum on the
|
|
31074
|
+
* wire, so the store rewrites the retired name to its canonical type before
|
|
31075
|
+
* it parses the row — on the step and on each step of its `else` list. Any
|
|
31076
|
+
* other value is returned untouched, for the schema to judge.
|
|
31077
|
+
*/
|
|
31078
|
+
function canonicalStoredStepTargets(steps) {
|
|
31079
|
+
if (!Array.isArray(steps)) return steps;
|
|
31080
|
+
return steps.map(canonicalStoredStep);
|
|
31081
|
+
}
|
|
31082
|
+
function canonicalStoredStep(step) {
|
|
31083
|
+
if (step === null || typeof step !== "object" || Array.isArray(step)) return step;
|
|
31084
|
+
const target = Reflect.get(step, "target");
|
|
31085
|
+
const elseSteps = Reflect.get(step, "else");
|
|
31086
|
+
return {
|
|
31087
|
+
...step,
|
|
31088
|
+
...target === void 0 ? {} : { target: canonicalStoredTarget(target) },
|
|
31089
|
+
...elseSteps === void 0 ? {} : { else: canonicalStoredStepTargets(elseSteps) }
|
|
31090
|
+
};
|
|
31091
|
+
}
|
|
31092
|
+
function canonicalStoredTarget(target) {
|
|
31093
|
+
if (target === null || typeof target !== "object" || Array.isArray(target)) return target;
|
|
31094
|
+
const deviceType = Reflect.get(target, "deviceType");
|
|
31095
|
+
if (typeof deviceType !== "string") return target;
|
|
31096
|
+
return {
|
|
31097
|
+
...target,
|
|
31098
|
+
deviceType: require_implemented_methods.canonicalStoredDeviceType(deviceType)
|
|
31099
|
+
};
|
|
31100
|
+
}
|
|
31050
31101
|
/** The events after which a cached domain is stale. */
|
|
31051
31102
|
var ACTION_TARGET_INVALIDATION_EVENTS = [
|
|
31052
31103
|
require_event_category.EventCategory.DeviceRegistered,
|
|
@@ -48986,95 +49037,6 @@ function groupTemplate(id) {
|
|
|
48986
49037
|
return BY_ID.get(id) ?? null;
|
|
48987
49038
|
}
|
|
48988
49039
|
//#endregion
|
|
48989
|
-
//#region src/composition/helpers/actuator.ts
|
|
48990
|
-
/**
|
|
48991
|
-
* Actuator groups (D944 phase 1b). The active boolean is the binary reducer
|
|
48992
|
-
* with unknown members left out. A command is one call per member that binds
|
|
48993
|
-
* the cap, including members that are offline. One failure does not cancel
|
|
48994
|
-
* the others.
|
|
48995
|
-
*/
|
|
48996
|
-
/** Caps a light group may expose, in display order. Switch is the active state. */
|
|
48997
|
-
var LIGHT_SHARED_CAPS = [
|
|
48998
|
-
"switch",
|
|
48999
|
-
"brightness",
|
|
49000
|
-
"color"
|
|
49001
|
-
];
|
|
49002
|
-
var COLOR_MODE_FEATURES = [
|
|
49003
|
-
require_composed_stable_id.DeviceFeature.LightColorRgb,
|
|
49004
|
-
require_composed_stable_id.DeviceFeature.LightColorHsv,
|
|
49005
|
-
require_composed_stable_id.DeviceFeature.LightColorMired
|
|
49006
|
-
];
|
|
49007
|
-
/** How many member calls run at once. The rest wait; none are dropped. */
|
|
49008
|
-
var FAN_OUT_CONCURRENCY = 4;
|
|
49009
|
-
/** `at-least-one` is any included member on; `all` is every included member on. */
|
|
49010
|
-
function reducerForActive(active) {
|
|
49011
|
-
return active === "all" ? "all" : "any";
|
|
49012
|
-
}
|
|
49013
|
-
function activeForReducer(reducer) {
|
|
49014
|
-
return reducer === "all" ? "all" : "at-least-one";
|
|
49015
|
-
}
|
|
49016
|
-
/**
|
|
49017
|
-
* Caps every member binds, from {@link LIGHT_SHARED_CAPS}. An empty member
|
|
49018
|
-
* list shares nothing. A member that lacks colour drops colour from the group.
|
|
49019
|
-
*/
|
|
49020
|
-
function sharedLightCaps(memberCaps) {
|
|
49021
|
-
if (memberCaps.length === 0) return [];
|
|
49022
|
-
return LIGHT_SHARED_CAPS.filter((cap) => memberCaps.every((bound) => bound.includes(cap)));
|
|
49023
|
-
}
|
|
49024
|
-
/**
|
|
49025
|
-
* Colour modes every member advertises. Offline does not remove a mode:
|
|
49026
|
-
* the caller passes device features, not liveness. No members → no mode.
|
|
49027
|
-
*/
|
|
49028
|
-
function sharedColorModes(memberFeatures) {
|
|
49029
|
-
if (memberFeatures.length === 0) return [];
|
|
49030
|
-
return COLOR_MODE_FEATURES.filter((mode) => memberFeatures.every((features) => features.includes(mode)));
|
|
49031
|
-
}
|
|
49032
|
-
/**
|
|
49033
|
-
* One call per member that binds `cap`. Offline members stay in the list.
|
|
49034
|
-
* A member without the cap is not called — the command cannot reach it.
|
|
49035
|
-
*/
|
|
49036
|
-
function fanOutTargets(members, cap, method, args) {
|
|
49037
|
-
return members.flatMap((member) => member.caps.includes(cap) ? [{
|
|
49038
|
-
deviceId: member.deviceId,
|
|
49039
|
-
cap,
|
|
49040
|
-
method,
|
|
49041
|
-
args: { ...args }
|
|
49042
|
-
}] : []);
|
|
49043
|
-
}
|
|
49044
|
-
/**
|
|
49045
|
-
* Run every call. A throw is that member's result; the other calls still run.
|
|
49046
|
-
* At most {@link FAN_OUT_CONCURRENCY} are in flight.
|
|
49047
|
-
*/
|
|
49048
|
-
async function runFanOut(calls, invoke) {
|
|
49049
|
-
const results = [];
|
|
49050
|
-
let next = 0;
|
|
49051
|
-
const worker = async () => {
|
|
49052
|
-
for (;;) {
|
|
49053
|
-
const index = next;
|
|
49054
|
-
next += 1;
|
|
49055
|
-
const call = calls[index];
|
|
49056
|
-
if (call === void 0) return;
|
|
49057
|
-
try {
|
|
49058
|
-
await invoke(call);
|
|
49059
|
-
results[index] = {
|
|
49060
|
-
deviceId: call.deviceId,
|
|
49061
|
-
ok: true
|
|
49062
|
-
};
|
|
49063
|
-
} catch (err) {
|
|
49064
|
-
const error = err instanceof Error ? err.message : String(err);
|
|
49065
|
-
results[index] = {
|
|
49066
|
-
deviceId: call.deviceId,
|
|
49067
|
-
ok: false,
|
|
49068
|
-
error
|
|
49069
|
-
};
|
|
49070
|
-
}
|
|
49071
|
-
}
|
|
49072
|
-
};
|
|
49073
|
-
const width = Math.min(4, calls.length);
|
|
49074
|
-
await Promise.all(Array.from({ length: width }, () => worker()));
|
|
49075
|
-
return results;
|
|
49076
|
-
}
|
|
49077
|
-
//#endregion
|
|
49078
49040
|
//#region src/generated/history-catalog.ts
|
|
49079
49041
|
/**
|
|
49080
49042
|
* Cap history catalog, projected from every `*.cap.ts` `history` block.
|
|
@@ -49600,6 +49562,200 @@ function historyFieldsFor(capName) {
|
|
|
49600
49562
|
return HISTORY_CATALOG[capName] ?? {};
|
|
49601
49563
|
}
|
|
49602
49564
|
//#endregion
|
|
49565
|
+
//#region src/composition/helpers/source-pick.ts
|
|
49566
|
+
/**
|
|
49567
|
+
* The request the common source selector (#236) accepts for a helper (D944 §5).
|
|
49568
|
+
* The selector's layout is not specified here. Groups ask for one device type
|
|
49569
|
+
* and the catalog field; they do not opt into incompatible fields.
|
|
49570
|
+
*/
|
|
49571
|
+
/**
|
|
49572
|
+
* Does a device of this type and role answer the request's device types?
|
|
49573
|
+
*
|
|
49574
|
+
* The one gate both the member picker and the save use. No types = any device.
|
|
49575
|
+
* A relay driving a lamp (`switch-light`) is a switch AND a light member: it
|
|
49576
|
+
* joins a light group with its on/off only, and a command it cannot do
|
|
49577
|
+
* (brightness, colour) skips it like any member that lacks the cap.
|
|
49578
|
+
*/
|
|
49579
|
+
function sourcePickAcceptsDevice(request, deviceType, role) {
|
|
49580
|
+
return memberKindAccepted(request.deviceTypes, deviceType, role);
|
|
49581
|
+
}
|
|
49582
|
+
/** `sourcePickAcceptsDevice` over a bare list of member types. */
|
|
49583
|
+
function memberKindAccepted(allowed, deviceType, role) {
|
|
49584
|
+
if (allowed.length === 0) return true;
|
|
49585
|
+
if (allowed.some((type) => type === deviceType)) return true;
|
|
49586
|
+
return require_implemented_methods.isSwitchLight(deviceType, role) && allowed.includes(require_composed_stable_id.DeviceType.Light);
|
|
49587
|
+
}
|
|
49588
|
+
/** What the member step asks the selector for this template. */
|
|
49589
|
+
function sourcePickForTemplate(template) {
|
|
49590
|
+
const valueKind = template.family === "numeric" ? "number" : template.activeWhen === void 0 ? "boolean" : "state";
|
|
49591
|
+
return {
|
|
49592
|
+
fieldChoice: template.family === "numeric" ? "first-match" : "operator",
|
|
49593
|
+
purpose: "member",
|
|
49594
|
+
multiple: true,
|
|
49595
|
+
max: 64,
|
|
49596
|
+
deviceTypes: [...template.memberDeviceTypes],
|
|
49597
|
+
accept: template.accept.map((field) => ({
|
|
49598
|
+
...field,
|
|
49599
|
+
valueKind
|
|
49600
|
+
})),
|
|
49601
|
+
history: {
|
|
49602
|
+
required: false,
|
|
49603
|
+
minRetentionMs: null
|
|
49604
|
+
},
|
|
49605
|
+
mustBindCaps: template.family === "actuator" ? template.accept.map((field) => field.cap) : [],
|
|
49606
|
+
exclude: []
|
|
49607
|
+
};
|
|
49608
|
+
}
|
|
49609
|
+
/** A statistic or integral reads one field that declares history. */
|
|
49610
|
+
function sourcePickForHistory(kind) {
|
|
49611
|
+
return {
|
|
49612
|
+
fieldChoice: "operator",
|
|
49613
|
+
purpose: "historised",
|
|
49614
|
+
multiple: false,
|
|
49615
|
+
max: 1,
|
|
49616
|
+
deviceTypes: [],
|
|
49617
|
+
accept: historyAccept(kind),
|
|
49618
|
+
history: {
|
|
49619
|
+
required: true,
|
|
49620
|
+
minRetentionMs: null
|
|
49621
|
+
},
|
|
49622
|
+
mustBindCaps: [],
|
|
49623
|
+
exclude: []
|
|
49624
|
+
};
|
|
49625
|
+
}
|
|
49626
|
+
function historyAccept(kind) {
|
|
49627
|
+
const fields = [];
|
|
49628
|
+
for (const cap of Object.keys(HISTORY_CATALOG)) for (const [fieldPath, field] of Object.entries(historyFieldsFor(cap))) {
|
|
49629
|
+
if (field.kind === "enum") continue;
|
|
49630
|
+
if (kind === "integral" && field.kind !== "gauge") continue;
|
|
49631
|
+
fields.push({
|
|
49632
|
+
cap,
|
|
49633
|
+
fieldPath,
|
|
49634
|
+
valueKind: field.kind === "boolean" ? "boolean" : "number"
|
|
49635
|
+
});
|
|
49636
|
+
}
|
|
49637
|
+
return fields;
|
|
49638
|
+
}
|
|
49639
|
+
/**
|
|
49640
|
+
* What the input step asks the selector for a math helper. A threshold reads
|
|
49641
|
+
* one number, a difference or a ratio two, a sum and an expression several.
|
|
49642
|
+
* A derivative reads one historised number.
|
|
49643
|
+
*/
|
|
49644
|
+
function sourcePickForMath(kind) {
|
|
49645
|
+
if (kind === "derivative") return {
|
|
49646
|
+
...sourcePickForHistory("statistic"),
|
|
49647
|
+
accept: numericAccept()
|
|
49648
|
+
};
|
|
49649
|
+
const multiple = kind === "sum" || kind === "expression";
|
|
49650
|
+
const max = kind === "difference" || kind === "ratio" ? 2 : multiple ? 64 : 1;
|
|
49651
|
+
return {
|
|
49652
|
+
fieldChoice: "operator",
|
|
49653
|
+
purpose: "reading",
|
|
49654
|
+
multiple: multiple || max > 1,
|
|
49655
|
+
max,
|
|
49656
|
+
deviceTypes: [],
|
|
49657
|
+
accept: numericAccept(),
|
|
49658
|
+
history: {
|
|
49659
|
+
required: false,
|
|
49660
|
+
minRetentionMs: null
|
|
49661
|
+
},
|
|
49662
|
+
mustBindCaps: [],
|
|
49663
|
+
exclude: []
|
|
49664
|
+
};
|
|
49665
|
+
}
|
|
49666
|
+
function numericAccept() {
|
|
49667
|
+
return historyAccept("statistic").filter((field) => field.valueKind === "number");
|
|
49668
|
+
}
|
|
49669
|
+
//#endregion
|
|
49670
|
+
//#region src/composition/helpers/actuator.ts
|
|
49671
|
+
/**
|
|
49672
|
+
* Actuator groups (D944 phase 1b). The active boolean is the binary reducer
|
|
49673
|
+
* with unknown members left out. A command is one call per member that binds
|
|
49674
|
+
* the cap, including members that are offline. One failure does not cancel
|
|
49675
|
+
* the others.
|
|
49676
|
+
*/
|
|
49677
|
+
/** Caps a light group may expose, in display order. Switch is the active state. */
|
|
49678
|
+
var LIGHT_SHARED_CAPS = [
|
|
49679
|
+
"switch",
|
|
49680
|
+
"brightness",
|
|
49681
|
+
"color"
|
|
49682
|
+
];
|
|
49683
|
+
var COLOR_MODE_FEATURES = [
|
|
49684
|
+
require_composed_stable_id.DeviceFeature.LightColorRgb,
|
|
49685
|
+
require_composed_stable_id.DeviceFeature.LightColorHsv,
|
|
49686
|
+
require_composed_stable_id.DeviceFeature.LightColorMired
|
|
49687
|
+
];
|
|
49688
|
+
/** How many member calls run at once. The rest wait; none are dropped. */
|
|
49689
|
+
var FAN_OUT_CONCURRENCY = 4;
|
|
49690
|
+
/** `at-least-one` is any included member on; `all` is every included member on. */
|
|
49691
|
+
function reducerForActive(active) {
|
|
49692
|
+
return active === "all" ? "all" : "any";
|
|
49693
|
+
}
|
|
49694
|
+
function activeForReducer(reducer) {
|
|
49695
|
+
return reducer === "all" ? "all" : "at-least-one";
|
|
49696
|
+
}
|
|
49697
|
+
/**
|
|
49698
|
+
* Caps every member binds, from {@link LIGHT_SHARED_CAPS}. An empty member
|
|
49699
|
+
* list shares nothing. A member that lacks colour drops colour from the group.
|
|
49700
|
+
*/
|
|
49701
|
+
function sharedLightCaps(memberCaps) {
|
|
49702
|
+
if (memberCaps.length === 0) return [];
|
|
49703
|
+
return LIGHT_SHARED_CAPS.filter((cap) => memberCaps.every((bound) => bound.includes(cap)));
|
|
49704
|
+
}
|
|
49705
|
+
/**
|
|
49706
|
+
* Colour modes every member advertises. Offline does not remove a mode:
|
|
49707
|
+
* the caller passes device features, not liveness. No members → no mode.
|
|
49708
|
+
*/
|
|
49709
|
+
function sharedColorModes(memberFeatures) {
|
|
49710
|
+
if (memberFeatures.length === 0) return [];
|
|
49711
|
+
return COLOR_MODE_FEATURES.filter((mode) => memberFeatures.every((features) => features.includes(mode)));
|
|
49712
|
+
}
|
|
49713
|
+
/**
|
|
49714
|
+
* One call per member that binds `cap`. Offline members stay in the list.
|
|
49715
|
+
* A member without the cap is not called — the command cannot reach it.
|
|
49716
|
+
*/
|
|
49717
|
+
function fanOutTargets(members, cap, method, args) {
|
|
49718
|
+
return members.flatMap((member) => member.caps.includes(cap) ? [{
|
|
49719
|
+
deviceId: member.deviceId,
|
|
49720
|
+
cap,
|
|
49721
|
+
method,
|
|
49722
|
+
args: { ...args }
|
|
49723
|
+
}] : []);
|
|
49724
|
+
}
|
|
49725
|
+
/**
|
|
49726
|
+
* Run every call. A throw is that member's result; the other calls still run.
|
|
49727
|
+
* At most {@link FAN_OUT_CONCURRENCY} are in flight.
|
|
49728
|
+
*/
|
|
49729
|
+
async function runFanOut(calls, invoke) {
|
|
49730
|
+
const results = [];
|
|
49731
|
+
let next = 0;
|
|
49732
|
+
const worker = async () => {
|
|
49733
|
+
for (;;) {
|
|
49734
|
+
const index = next;
|
|
49735
|
+
next += 1;
|
|
49736
|
+
const call = calls[index];
|
|
49737
|
+
if (call === void 0) return;
|
|
49738
|
+
try {
|
|
49739
|
+
await invoke(call);
|
|
49740
|
+
results[index] = {
|
|
49741
|
+
deviceId: call.deviceId,
|
|
49742
|
+
ok: true
|
|
49743
|
+
};
|
|
49744
|
+
} catch (err) {
|
|
49745
|
+
const error = err instanceof Error ? err.message : String(err);
|
|
49746
|
+
results[index] = {
|
|
49747
|
+
deviceId: call.deviceId,
|
|
49748
|
+
ok: false,
|
|
49749
|
+
error
|
|
49750
|
+
};
|
|
49751
|
+
}
|
|
49752
|
+
}
|
|
49753
|
+
};
|
|
49754
|
+
const width = Math.min(4, calls.length);
|
|
49755
|
+
await Promise.all(Array.from({ length: width }, () => worker()));
|
|
49756
|
+
return results;
|
|
49757
|
+
}
|
|
49758
|
+
//#endregion
|
|
49603
49759
|
//#region src/composition/helpers/compile-history.ts
|
|
49604
49760
|
/**
|
|
49605
49761
|
* Project a statistics or integral helper onto a new device (D944 §3).
|
|
@@ -50195,8 +50351,10 @@ function deviceTypeProblems(spec, facts) {
|
|
|
50195
50351
|
const template = groupTemplate(spec.templateId);
|
|
50196
50352
|
if (template === null) return [];
|
|
50197
50353
|
return spec.members.flatMap((member, index) => {
|
|
50198
|
-
const
|
|
50199
|
-
|
|
50354
|
+
const fact = facts.get(require_implemented_methods.compositionSourceKey(member.source));
|
|
50355
|
+
const deviceType = fact?.deviceType;
|
|
50356
|
+
if (deviceType === void 0) return [];
|
|
50357
|
+
if (memberKindAccepted(template.memberDeviceTypes, deviceType, fact?.role)) return [];
|
|
50200
50358
|
return [problem("member-constraint", `helper.members[${index}]`, `a ${template.id} group takes ${template.memberDeviceTypes.join(" or ")} devices; this member is a ${deviceType}`)];
|
|
50201
50359
|
});
|
|
50202
50360
|
}
|
|
@@ -51060,6 +51218,7 @@ function validateComposition(composition, ctx) {
|
|
|
51060
51218
|
});
|
|
51061
51219
|
const facts = new Map([...ctx.sources].flatMap(([key, source]) => source.kind === "found" ? [[key, {
|
|
51062
51220
|
deviceType: source.deviceType,
|
|
51221
|
+
role: source.role,
|
|
51063
51222
|
quantity: source.quantity
|
|
51064
51223
|
}]] : []));
|
|
51065
51224
|
const problems = [
|
|
@@ -59938,6 +60097,19 @@ var HeroTextSchema = zod.z.object({
|
|
|
59938
60097
|
en: zod.z.string(),
|
|
59939
60098
|
it: zod.z.string()
|
|
59940
60099
|
});
|
|
60100
|
+
/**
|
|
60101
|
+
* What a device that has not reported says in place of its value: an empty "—",
|
|
60102
|
+
* never a word like "Unknown" and never a 0 (D393). The card stays its normal
|
|
60103
|
+
* self; only the value is empty.
|
|
60104
|
+
*/
|
|
60105
|
+
var NOT_REPORTED = {
|
|
60106
|
+
en: "—",
|
|
60107
|
+
it: "—"
|
|
60108
|
+
};
|
|
60109
|
+
/** Whether `text` is {@link NOT_REPORTED}: a client may leave such a slot out instead of painting a dash twice. */
|
|
60110
|
+
function isNotReported(text) {
|
|
60111
|
+
return text.en === NOT_REPORTED.en && text.it === NOT_REPORTED.it;
|
|
60112
|
+
}
|
|
59941
60113
|
//#endregion
|
|
59942
60114
|
//#region src/device/hero/hero-measurement.ts
|
|
59943
60115
|
/**
|
|
@@ -60095,6 +60267,62 @@ function textMeasurement(text, since) {
|
|
|
60095
60267
|
historyKey: null
|
|
60096
60268
|
};
|
|
60097
60269
|
}
|
|
60270
|
+
/** What each quantity draws beside its value, reported or not. */
|
|
60271
|
+
var QUANTITY_FACE = {
|
|
60272
|
+
temperature: {
|
|
60273
|
+
icon: "thermometer",
|
|
60274
|
+
unit: "°C",
|
|
60275
|
+
sinceKind: "updated",
|
|
60276
|
+
historyKey: "cap:temperature-sensor.temperature"
|
|
60277
|
+
},
|
|
60278
|
+
humidity: {
|
|
60279
|
+
icon: "droplets",
|
|
60280
|
+
unit: "%",
|
|
60281
|
+
sinceKind: "updated",
|
|
60282
|
+
historyKey: "cap:humidity-sensor.humidity"
|
|
60283
|
+
},
|
|
60284
|
+
power: {
|
|
60285
|
+
icon: "zap",
|
|
60286
|
+
unit: "W",
|
|
60287
|
+
sinceKind: "updated",
|
|
60288
|
+
historyKey: "cap:power-meter.power"
|
|
60289
|
+
},
|
|
60290
|
+
contact: {
|
|
60291
|
+
icon: null,
|
|
60292
|
+
unit: null,
|
|
60293
|
+
sinceKind: "changed",
|
|
60294
|
+
historyKey: null
|
|
60295
|
+
},
|
|
60296
|
+
text: {
|
|
60297
|
+
icon: null,
|
|
60298
|
+
unit: null,
|
|
60299
|
+
sinceKind: "updated",
|
|
60300
|
+
historyKey: null
|
|
60301
|
+
}
|
|
60302
|
+
};
|
|
60303
|
+
/**
|
|
60304
|
+
* The measurement of a sensor that has not reported yet: its normal card with
|
|
60305
|
+
* an empty "—" value and its unit — never a placeholder, never a 0 (D393). The
|
|
60306
|
+
* reading is `null` (nothing to format), the scene does not move, and nothing
|
|
60307
|
+
* claims a moment.
|
|
60308
|
+
*/
|
|
60309
|
+
function emptyMeasurement(quantity) {
|
|
60310
|
+
const face = QUANTITY_FACE[quantity];
|
|
60311
|
+
return {
|
|
60312
|
+
quantity,
|
|
60313
|
+
reading: null,
|
|
60314
|
+
icon: face.icon,
|
|
60315
|
+
value: NOT_REPORTED,
|
|
60316
|
+
unit: face.unit,
|
|
60317
|
+
band: null,
|
|
60318
|
+
level: null,
|
|
60319
|
+
word: NOT_REPORTED,
|
|
60320
|
+
tone: "muted",
|
|
60321
|
+
since: null,
|
|
60322
|
+
sinceKind: face.sinceKind,
|
|
60323
|
+
historyKey: face.historyKey
|
|
60324
|
+
};
|
|
60325
|
+
}
|
|
60098
60326
|
/**
|
|
60099
60327
|
* Roles whose reading is ANOTHER field of the slice a measurement comes from: an
|
|
60100
60328
|
* energy, voltage or current sensor rides the `power-meter` slice, which also carries
|
|
@@ -60241,6 +60469,7 @@ var HERO_SCENE_BY_ROLE = {
|
|
|
60241
60469
|
[require_composed_stable_id.DeviceRole.Outlet]: "plug",
|
|
60242
60470
|
[require_composed_stable_id.DeviceRole.SwitchHeater]: "heater",
|
|
60243
60471
|
[require_composed_stable_id.DeviceRole.SwitchFan]: "fan",
|
|
60472
|
+
[require_composed_stable_id.DeviceRole.SwitchLight]: "light",
|
|
60244
60473
|
[require_composed_stable_id.DeviceRole.ClimateAc]: "ac",
|
|
60245
60474
|
[require_composed_stable_id.DeviceRole.ClimateThermostat]: "inherit",
|
|
60246
60475
|
[require_composed_stable_id.DeviceRole.ClimateFloor]: "inherit",
|
|
@@ -60287,17 +60516,17 @@ var HERO_SCENE_BY_ROLE = {
|
|
|
60287
60516
|
[require_composed_stable_id.DeviceRole.GenericNotifier]: "inherit",
|
|
60288
60517
|
[require_composed_stable_id.DeviceRole.IrTransmitter]: "inherit"
|
|
60289
60518
|
};
|
|
60290
|
-
function isDeviceType$
|
|
60519
|
+
function isDeviceType$3(type) {
|
|
60291
60520
|
return Object.values(require_composed_stable_id.DeviceType).includes(type);
|
|
60292
60521
|
}
|
|
60293
|
-
function isDeviceRole$
|
|
60522
|
+
function isDeviceRole$2(role) {
|
|
60294
60523
|
return Object.values(require_composed_stable_id.DeviceRole).includes(role);
|
|
60295
60524
|
}
|
|
60296
60525
|
/** The scene id of a (role, type) pair. Role beats type; a type this build does not know gets the terminal. */
|
|
60297
60526
|
function resolveHeroSceneId(role, type) {
|
|
60298
|
-
const byRole = role !== null && isDeviceRole$
|
|
60527
|
+
const byRole = role !== null && isDeviceRole$2(role) ? HERO_SCENE_BY_ROLE[role] : void 0;
|
|
60299
60528
|
if (byRole !== void 0 && byRole !== "inherit") return byRole;
|
|
60300
|
-
return isDeviceType$
|
|
60529
|
+
return isDeviceType$3(type) ? HERO_SCENE_BY_TYPE[type] : "generic";
|
|
60301
60530
|
}
|
|
60302
60531
|
//#endregion
|
|
60303
60532
|
//#region src/device/hero/hero-model.ts
|
|
@@ -100001,89 +100230,6 @@ function evaluateAggregate(input) {
|
|
|
100001
100230
|
};
|
|
100002
100231
|
}
|
|
100003
100232
|
//#endregion
|
|
100004
|
-
//#region src/composition/helpers/source-pick.ts
|
|
100005
|
-
/** What the member step asks the selector for this template. */
|
|
100006
|
-
function sourcePickForTemplate(template) {
|
|
100007
|
-
const valueKind = template.family === "numeric" ? "number" : template.activeWhen === void 0 ? "boolean" : "state";
|
|
100008
|
-
return {
|
|
100009
|
-
fieldChoice: template.family === "numeric" ? "first-match" : "operator",
|
|
100010
|
-
purpose: "member",
|
|
100011
|
-
multiple: true,
|
|
100012
|
-
max: 64,
|
|
100013
|
-
deviceTypes: [...template.memberDeviceTypes],
|
|
100014
|
-
accept: template.accept.map((field) => ({
|
|
100015
|
-
...field,
|
|
100016
|
-
valueKind
|
|
100017
|
-
})),
|
|
100018
|
-
history: {
|
|
100019
|
-
required: false,
|
|
100020
|
-
minRetentionMs: null
|
|
100021
|
-
},
|
|
100022
|
-
mustBindCaps: template.family === "actuator" ? template.accept.map((field) => field.cap) : [],
|
|
100023
|
-
exclude: []
|
|
100024
|
-
};
|
|
100025
|
-
}
|
|
100026
|
-
/** A statistic or integral reads one field that declares history. */
|
|
100027
|
-
function sourcePickForHistory(kind) {
|
|
100028
|
-
return {
|
|
100029
|
-
fieldChoice: "operator",
|
|
100030
|
-
purpose: "historised",
|
|
100031
|
-
multiple: false,
|
|
100032
|
-
max: 1,
|
|
100033
|
-
deviceTypes: [],
|
|
100034
|
-
accept: historyAccept(kind),
|
|
100035
|
-
history: {
|
|
100036
|
-
required: true,
|
|
100037
|
-
minRetentionMs: null
|
|
100038
|
-
},
|
|
100039
|
-
mustBindCaps: [],
|
|
100040
|
-
exclude: []
|
|
100041
|
-
};
|
|
100042
|
-
}
|
|
100043
|
-
function historyAccept(kind) {
|
|
100044
|
-
const fields = [];
|
|
100045
|
-
for (const cap of Object.keys(HISTORY_CATALOG)) for (const [fieldPath, field] of Object.entries(historyFieldsFor(cap))) {
|
|
100046
|
-
if (field.kind === "enum") continue;
|
|
100047
|
-
if (kind === "integral" && field.kind !== "gauge") continue;
|
|
100048
|
-
fields.push({
|
|
100049
|
-
cap,
|
|
100050
|
-
fieldPath,
|
|
100051
|
-
valueKind: field.kind === "boolean" ? "boolean" : "number"
|
|
100052
|
-
});
|
|
100053
|
-
}
|
|
100054
|
-
return fields;
|
|
100055
|
-
}
|
|
100056
|
-
/**
|
|
100057
|
-
* What the input step asks the selector for a math helper. A threshold reads
|
|
100058
|
-
* one number, a difference or a ratio two, a sum and an expression several.
|
|
100059
|
-
* A derivative reads one historised number.
|
|
100060
|
-
*/
|
|
100061
|
-
function sourcePickForMath(kind) {
|
|
100062
|
-
if (kind === "derivative") return {
|
|
100063
|
-
...sourcePickForHistory("statistic"),
|
|
100064
|
-
accept: numericAccept()
|
|
100065
|
-
};
|
|
100066
|
-
const multiple = kind === "sum" || kind === "expression";
|
|
100067
|
-
const max = kind === "difference" || kind === "ratio" ? 2 : multiple ? 64 : 1;
|
|
100068
|
-
return {
|
|
100069
|
-
fieldChoice: "operator",
|
|
100070
|
-
purpose: "reading",
|
|
100071
|
-
multiple: multiple || max > 1,
|
|
100072
|
-
max,
|
|
100073
|
-
deviceTypes: [],
|
|
100074
|
-
accept: numericAccept(),
|
|
100075
|
-
history: {
|
|
100076
|
-
required: false,
|
|
100077
|
-
minRetentionMs: null
|
|
100078
|
-
},
|
|
100079
|
-
mustBindCaps: [],
|
|
100080
|
-
exclude: []
|
|
100081
|
-
};
|
|
100082
|
-
}
|
|
100083
|
-
function numericAccept() {
|
|
100084
|
-
return historyAccept("statistic").filter((field) => field.valueKind === "number");
|
|
100085
|
-
}
|
|
100086
|
-
//#endregion
|
|
100087
100233
|
//#region src/composition/customize/field-source.ts
|
|
100088
100234
|
function fromRead(source, cap, fieldPath) {
|
|
100089
100235
|
return {
|
|
@@ -100964,7 +101110,7 @@ function convertPresetFeature(input) {
|
|
|
100964
101110
|
* 0 (D393). The caller supplies the sources — it knows which entity is which;
|
|
100965
101111
|
* the preset guesses no entity id.
|
|
100966
101112
|
*/
|
|
100967
|
-
var UNKNOWN
|
|
101113
|
+
var UNKNOWN = {
|
|
100968
101114
|
kind: "expression",
|
|
100969
101115
|
expr: "null",
|
|
100970
101116
|
bindings: {}
|
|
@@ -101052,8 +101198,8 @@ function pumpCycleFeature(cycle) {
|
|
|
101052
101198
|
cap: "pump-cycle",
|
|
101053
101199
|
fields: {
|
|
101054
101200
|
enabled: from(cycle.interval, "switch", "on"),
|
|
101055
|
-
onTime: UNKNOWN
|
|
101056
|
-
offTime: UNKNOWN
|
|
101201
|
+
onTime: UNKNOWN,
|
|
101202
|
+
offTime: UNKNOWN,
|
|
101057
101203
|
lastFetchedAt: NOW
|
|
101058
101204
|
},
|
|
101059
101205
|
commands: {
|
|
@@ -101095,7 +101241,7 @@ function petFountainFromEntitiesComposition(sources) {
|
|
|
101095
101241
|
waterVolume: millilitresAsLitres(sources.waterVolume),
|
|
101096
101242
|
empty: over("l", from(sources.waterLevel, "enum-sensor", "value"), "number(l) == null ? null : number(l) <= 0"),
|
|
101097
101243
|
pumpRunning: from(sources.pump, "switch", "on"),
|
|
101098
|
-
error: UNKNOWN
|
|
101244
|
+
error: UNKNOWN,
|
|
101099
101245
|
lastFetchedAt: NOW
|
|
101100
101246
|
},
|
|
101101
101247
|
commands: { setPump: {
|
|
@@ -105270,73 +105416,6 @@ function widenDeviceConstructor(ctor) {
|
|
|
105270
105416
|
return ctor;
|
|
105271
105417
|
}
|
|
105272
105418
|
//#endregion
|
|
105273
|
-
//#region src/device/device-kind.ts
|
|
105274
|
-
/**
|
|
105275
|
-
* A device's KIND is its type plus its role (D1033): the type is the set of
|
|
105276
|
-
* controls it has, the role says which thing it is among the devices that
|
|
105277
|
-
* share those controls. A plug-in heater is a `switch` with role
|
|
105278
|
-
* `switch-heater`; an air conditioner and a radiator valve are both `climate`,
|
|
105279
|
-
* told apart by their `climate-*` role.
|
|
105280
|
-
*/
|
|
105281
|
-
/**
|
|
105282
|
-
* Type values a persisted row may still carry after the type was retired, and
|
|
105283
|
-
* the type each one is read as. The row is rewritten by the next registration
|
|
105284
|
-
* of the device (its provider stamps the live type), so this is a read alias,
|
|
105285
|
-
* not a migration.
|
|
105286
|
-
*
|
|
105287
|
-
* `heater` is deliberately absent: the only heaters were composed devices the
|
|
105288
|
-
* operator deletes. Such a row stays an unknown type, which every reader
|
|
105289
|
-
* treats as a generic device.
|
|
105290
|
-
*/
|
|
105291
|
-
var RETIRED_DEVICE_TYPES = { thermostat: require_composed_stable_id.DeviceType.Climate };
|
|
105292
|
-
/** The live type a stored `type` value stands for (itself unless retired). */
|
|
105293
|
-
function canonicalStoredDeviceType(stored) {
|
|
105294
|
-
return RETIRED_DEVICE_TYPES[stored] ?? stored;
|
|
105295
|
-
}
|
|
105296
|
-
/** The `climate-*` roles, in the order the role picker lists them. */
|
|
105297
|
-
var CLIMATE_ROLES = [
|
|
105298
|
-
require_composed_stable_id.DeviceRole.ClimateThermostat,
|
|
105299
|
-
require_composed_stable_id.DeviceRole.ClimateAc,
|
|
105300
|
-
require_composed_stable_id.DeviceRole.ClimateRadiator,
|
|
105301
|
-
require_composed_stable_id.DeviceRole.ClimateFloor,
|
|
105302
|
-
require_composed_stable_id.DeviceRole.ClimateHeater,
|
|
105303
|
-
require_composed_stable_id.DeviceRole.ClimateHeatPumpCircuit
|
|
105304
|
-
];
|
|
105305
|
-
function isClimateRole(role) {
|
|
105306
|
-
return CLIMATE_ROLES.some((candidate) => candidate === role);
|
|
105307
|
-
}
|
|
105308
|
-
/**
|
|
105309
|
-
* Which climate device this is. A climate device with no role, or a role that
|
|
105310
|
-
* is not a climate one, is a room thermostat: that is what most of them are,
|
|
105311
|
-
* and it is the presentation a thermostat had before the types were folded.
|
|
105312
|
-
*/
|
|
105313
|
-
function climateRoleOf(role) {
|
|
105314
|
-
return role !== null && role !== void 0 && isClimateRole(role) ? role : require_composed_stable_id.DeviceRole.ClimateThermostat;
|
|
105315
|
-
}
|
|
105316
|
-
/** An air conditioner: exports present it as an AC unit, not a thermostat. */
|
|
105317
|
-
function isAirConditioner(type, role) {
|
|
105318
|
-
return type === require_composed_stable_id.DeviceType.Climate && climateRoleOf(role) === require_composed_stable_id.DeviceRole.ClimateAc;
|
|
105319
|
-
}
|
|
105320
|
-
/**
|
|
105321
|
-
* Is a capability offered on a device of this type and role?
|
|
105322
|
-
*
|
|
105323
|
-
* Fails open where the old type-only gate did: no `deviceTypes` (or an empty
|
|
105324
|
-
* list) applies to every device, and an unknown type never filters (a failed
|
|
105325
|
-
* meta read must not destroy work, D49). A type the cap's `deviceRoles` names
|
|
105326
|
-
* is offered only to the roles listed there; an unknown role is NOT one of
|
|
105327
|
-
* them, so a `switch` whose role could not be read is not a heater.
|
|
105328
|
-
*/
|
|
105329
|
-
function capAppliesToDeviceKind(gate, deviceType, role) {
|
|
105330
|
-
if (deviceType === void 0) return true;
|
|
105331
|
-
const types = gate?.deviceTypes;
|
|
105332
|
-
if (!types || types.length === 0) return true;
|
|
105333
|
-
const type = types.find((candidate) => candidate === deviceType);
|
|
105334
|
-
if (type === void 0) return false;
|
|
105335
|
-
const roles = gate?.deviceRoles?.[type];
|
|
105336
|
-
if (roles === void 0) return true;
|
|
105337
|
-
return role !== null && role !== void 0 && roles.some((candidate) => candidate === role);
|
|
105338
|
-
}
|
|
105339
|
-
//#endregion
|
|
105340
105419
|
//#region src/device/device-control-resolution.ts
|
|
105341
105420
|
/**
|
|
105342
105421
|
* Device-control RESOLUTION LOGIC — the single, presentation-free source of
|
|
@@ -105424,7 +105503,7 @@ var DEVICE_TYPE_VALUES = new Set(Object.values(require_composed_stable_id.Device
|
|
|
105424
105503
|
*/
|
|
105425
105504
|
function resolveDeviceControlKind(type, role) {
|
|
105426
105505
|
if (!DEVICE_TYPE_VALUES.has(type)) return null;
|
|
105427
|
-
if (isAirConditioner(type, role)) return "climate";
|
|
105506
|
+
if (require_implemented_methods.isAirConditioner(type, role)) return "climate";
|
|
105428
105507
|
if (type === require_composed_stable_id.DeviceType.Switch && role === require_composed_stable_id.DeviceRole.SwitchHeater) return "heater";
|
|
105429
105508
|
return DEVICE_TYPE_CONTROL_KIND[type];
|
|
105430
105509
|
}
|
|
@@ -105660,7 +105739,7 @@ var lockContribution = contribution("lock-control", LockControlStatusSchema, (sl
|
|
|
105660
105739
|
const state = slice?.state ?? null;
|
|
105661
105740
|
const words = state === null ? null : LOCK_WORDS[state];
|
|
105662
105741
|
const since = slice === void 0 ? null : elapsedText(slice.lastChangedAt, ctx.now);
|
|
105663
|
-
const title = words?.title ??
|
|
105742
|
+
const title = words?.title ?? NOT_REPORTED;
|
|
105664
105743
|
return {
|
|
105665
105744
|
reading: reading("lock-control", words?.state ?? "unknown", false, words?.title),
|
|
105666
105745
|
rows: [row$1("lock", state === "locked" || state === "locking" ? "lock" : "lock-open", joinText([title, since]), lockControls(state, ctx.features.includes(require_composed_stable_id.DeviceFeature.LockOpen)))],
|
|
@@ -105752,7 +105831,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
|
|
|
105752
105831
|
const modes = slice === void 0 ? ALARM_MODES : slice.availableModes;
|
|
105753
105832
|
return {
|
|
105754
105833
|
reading: reading("alarm-panel", words?.state ?? "unknown", false, words?.title),
|
|
105755
|
-
rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ??
|
|
105834
|
+
rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? NOT_REPORTED, since]), alarmControls(state, modes, slice?.requiresCode ?? false))],
|
|
105756
105835
|
...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] },
|
|
105757
105836
|
...words === null ? {} : { tiles: {
|
|
105758
105837
|
left: [{
|
|
@@ -105783,7 +105862,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
|
|
|
105783
105862
|
return {
|
|
105784
105863
|
reading: reading("automation-control", state, false, title),
|
|
105785
105864
|
rows: [row$1("automation", "workflow", joinText([
|
|
105786
|
-
title ??
|
|
105865
|
+
title ?? NOT_REPORTED,
|
|
105787
105866
|
last === null ? null : require_sleep.t(`Ran ${last.en}`, `Eseguita ${last.it}`),
|
|
105788
105867
|
slice?.lastError == null ? null : require_sleep.t(slice.lastError, slice.lastError)
|
|
105789
105868
|
]), [asAction(run), toggle])],
|
|
@@ -105799,7 +105878,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
|
|
|
105799
105878
|
return {
|
|
105800
105879
|
reading: reading("script-runner", state, false, title),
|
|
105801
105880
|
rows: [row$1("script", "scroll-text", joinText([
|
|
105802
|
-
title ??
|
|
105881
|
+
title ?? NOT_REPORTED,
|
|
105803
105882
|
last === null ? null : require_sleep.t(`Ran ${last.en}`, `Eseguito ${last.it}`),
|
|
105804
105883
|
slice?.lastError == null ? null : require_sleep.t(slice.lastError, slice.lastError)
|
|
105805
105884
|
]), [asAction(control)])],
|
|
@@ -105808,7 +105887,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
|
|
|
105808
105887
|
}),
|
|
105809
105888
|
"do-not-disturb": contribution("do-not-disturb", DoNotDisturbStatusSchema, (slice) => {
|
|
105810
105889
|
const on = slice?.enabled ?? null;
|
|
105811
|
-
return { rows: [row$1("do-not-disturb", "bell-off", on === null ?
|
|
105890
|
+
return { rows: [row$1("do-not-disturb", "bell-off", on === null ? NOT_REPORTED : on ? require_sleep.t("Do not disturb on", "Non disturbare attivo") : require_sleep.t("Do not disturb off", "Non disturbare spento"), [{
|
|
105812
105891
|
kind: "toggle",
|
|
105813
105892
|
id: "do-not-disturb.toggle",
|
|
105814
105893
|
label: require_sleep.t("Do not disturb", "Non disturbare"),
|
|
@@ -105828,7 +105907,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
|
|
|
105828
105907
|
* is absent from the facts, never a zero (D393).
|
|
105829
105908
|
*/
|
|
105830
105909
|
var has$3 = (ctx, f) => ctx.features.includes(f);
|
|
105831
|
-
var unknownText =
|
|
105910
|
+
var unknownText = NOT_REPORTED;
|
|
105832
105911
|
var pct$2 = (n) => require_sleep.t(`${Math.round(n)}%`, `${Math.round(n)}%`);
|
|
105833
105912
|
var unit = (n) => Math.min(1, Math.max(0, n / 100));
|
|
105834
105913
|
/** Battery as a fact, unless the device is also bound to the `battery` cap (it already says so). */
|
|
@@ -107242,13 +107321,13 @@ function sensorFragment(value, id, icon, en, it, text) {
|
|
|
107242
107321
|
tiles: { right: [tile$1(en, it, text)] }
|
|
107243
107322
|
};
|
|
107244
107323
|
}
|
|
107245
|
-
var temperatureContribution = contribution("temperature-sensor", TemperatureSensorStatusSchema, (slice) => measured(sensorFragment(slice?.temperature ?? null, "temperature", "thermometer", "Temperature", "Temperatura", formatDegrees(slice?.temperature ?? 0)), slice?.temperature == null ?
|
|
107246
|
-
var humidityContribution = contribution("humidity-sensor", HumiditySensorStatusSchema, (slice) => measured(sensorFragment(slice?.humidity ?? null, "humidity", "droplets", "Humidity", "Umidità", `${Math.round(slice?.humidity ?? 0)}%`), slice?.humidity == null ?
|
|
107324
|
+
var temperatureContribution = contribution("temperature-sensor", TemperatureSensorStatusSchema, (slice) => measured(sensorFragment(slice?.temperature ?? null, "temperature", "thermometer", "Temperature", "Temperatura", formatDegrees(slice?.temperature ?? 0)), slice?.temperature == null ? emptyMeasurement("temperature") : temperatureMeasurement(slice.temperature, slice.lastFetchedAt)));
|
|
107325
|
+
var humidityContribution = contribution("humidity-sensor", HumiditySensorStatusSchema, (slice) => measured(sensorFragment(slice?.humidity ?? null, "humidity", "droplets", "Humidity", "Umidità", `${Math.round(slice?.humidity ?? 0)}%`), slice?.humidity == null ? emptyMeasurement("humidity") : humidityMeasurement(slice.humidity, slice.lastFetchedAt)));
|
|
107247
107326
|
var pressureContribution = contribution("pressure-sensor", PressureSensorStatusSchema, (slice) => sensorFragment(slice?.pressure ?? null, "pressure", "gauge", "Pressure", "Pressione", `${Math.round(slice?.pressure ?? 0)} hPa`));
|
|
107248
107327
|
var illuminanceContribution = contribution("ambient-light-sensor", AmbientLightSensorStatusSchema, (slice) => sensorFragment(slice?.illuminance ?? null, "illuminance", "sun", "Light", "Luce", `${Math.round(slice?.illuminance ?? 0)} lx`));
|
|
107249
107328
|
var numericContribution = contribution("numeric-sensor", NumericSensorStatusSchema, (slice) => sensorFragment(slice?.value ?? null, "reading", "gauge", "Value", "Valore", String(Number((slice?.value ?? 0).toFixed(2)))));
|
|
107250
107329
|
var enumContribution = contribution("enum-sensor", EnumSensorStatusSchema, (slice) => {
|
|
107251
|
-
if (slice === void 0 || slice.value === "") return { reading: reading("sensor", "unknown") };
|
|
107330
|
+
if (slice === void 0 || slice.value === "") return measured({ reading: reading("sensor", "unknown") }, emptyMeasurement("text"));
|
|
107252
107331
|
if (slice.timestamp === true) return { reading: reading("sensor", "on") };
|
|
107253
107332
|
return measured(sensorFragment(slice.value, "reading", "gauge", "State", "Stato", slice.value), textMeasurement(slice.value, slice.lastFetchedAt));
|
|
107254
107333
|
});
|
|
@@ -107374,7 +107453,7 @@ function circuitControl(circuit) {
|
|
|
107374
107453
|
return picker(`heat-pump.${circuit.id}.mode`, require_sleep.t("Mode", "Modalità"), circuit.operationMode, method, args);
|
|
107375
107454
|
}
|
|
107376
107455
|
/** A circuit with no reading is still a row: it shows that nothing is known, not nothing. */
|
|
107377
|
-
var UNKNOWN_STATUS =
|
|
107456
|
+
var UNKNOWN_STATUS = NOT_REPORTED;
|
|
107378
107457
|
function circuitRow(circuit) {
|
|
107379
107458
|
const control = circuitControl(circuit);
|
|
107380
107459
|
const status = thermalStatusText(circuit.targetTemp, circuit.currentTemp) ?? UNKNOWN_STATUS;
|
|
@@ -107836,7 +107915,7 @@ var runningStateContribution = contribution("running-state", RunningStateStatusS
|
|
|
107836
107915
|
};
|
|
107837
107916
|
});
|
|
107838
107917
|
var powerMeterContribution = contribution("power-meter", PowerMeterStatusSchema, (slice) => {
|
|
107839
|
-
if (slice?.power === void 0) return {};
|
|
107918
|
+
if (slice?.power === void 0) return { measurement: emptyMeasurement("power") };
|
|
107840
107919
|
const detail = [];
|
|
107841
107920
|
if (slice.energy !== void 0) detail.push({
|
|
107842
107921
|
label: require_sleep.t("Energy", "Energia"),
|
|
@@ -107924,14 +108003,14 @@ var contactContribution = contribution("contact", ContactStatusSchema, (slice) =
|
|
|
107924
108003
|
const row = {
|
|
107925
108004
|
id: "contact",
|
|
107926
108005
|
icon: slice?.entryOpen === true ? "door-open" : "door-closed",
|
|
107927
|
-
status: slice === void 0 ?
|
|
108006
|
+
status: slice === void 0 ? NOT_REPORTED : slice.entryOpen ? require_sleep.t("Open", "Aperto") : require_sleep.t("Closed", "Chiuso"),
|
|
107928
108007
|
controls: []
|
|
107929
108008
|
};
|
|
107930
108009
|
return measured({
|
|
107931
108010
|
reading: reading("contact", slice === void 0 ? "unknown" : slice.entryOpen ? "on" : "off"),
|
|
107932
108011
|
rows: [row],
|
|
107933
108012
|
...slice === void 0 ? {} : { scene: { mode: slice.entryOpen ? "open" : "closed" } }
|
|
107934
|
-
}, slice === void 0 ?
|
|
108013
|
+
}, slice === void 0 ? emptyMeasurement("contact") : contactMeasurement(slice.entryOpen, slice.lastChangedAt > 0 ? slice.lastChangedAt : null));
|
|
107935
108014
|
});
|
|
107936
108015
|
var motionTriggerContribution = contribution("motion-trigger", MotionTriggerStatusSchema, (slice) => {
|
|
107937
108016
|
const on = slice?.enabled ?? null;
|
|
@@ -107946,7 +108025,7 @@ var motionTriggerContribution = contribution("motion-trigger", MotionTriggerStat
|
|
|
107946
108025
|
return { rows: [{
|
|
107947
108026
|
id: "motion-trigger",
|
|
107948
108027
|
icon: "activity",
|
|
107949
|
-
status: on === null ?
|
|
108028
|
+
status: on === null ? NOT_REPORTED : on ? require_sleep.t("Follows motion", "Segue il movimento") : require_sleep.t("Ignores motion", "Ignora il movimento"),
|
|
107950
108029
|
controls: [toggle]
|
|
107951
108030
|
}] };
|
|
107952
108031
|
});
|
|
@@ -108435,13 +108514,14 @@ var HERO_LAYOUT_BY_TYPE = {
|
|
|
108435
108514
|
[require_composed_stable_id.DeviceType.Dryer]: APPLIANCE_LAYOUT,
|
|
108436
108515
|
[require_composed_stable_id.DeviceType.Gateway]: HERO_LAYOUT_DEFAULT
|
|
108437
108516
|
};
|
|
108438
|
-
function isDeviceType$
|
|
108517
|
+
function isDeviceType$2(type) {
|
|
108439
108518
|
return Object.values(require_composed_stable_id.DeviceType).includes(type);
|
|
108440
108519
|
}
|
|
108441
108520
|
/** The layout of a type; a type this build does not know gets the default. */
|
|
108442
108521
|
function resolveHeroLayout(type, role = null) {
|
|
108443
108522
|
if (type === require_composed_stable_id.DeviceType.Switch && role === require_composed_stable_id.DeviceRole.SwitchHeater) return HEATER_LAYOUT;
|
|
108444
|
-
|
|
108523
|
+
const live = require_implemented_methods.canonicalStoredDeviceType(type);
|
|
108524
|
+
return isDeviceType$2(live) ? HERO_LAYOUT_BY_TYPE[live] : HERO_LAYOUT_DEFAULT;
|
|
108445
108525
|
}
|
|
108446
108526
|
//#endregion
|
|
108447
108527
|
//#region src/device/hero/hero-look.ts
|
|
@@ -108467,9 +108547,8 @@ function look(icon, tone, background, animation) {
|
|
|
108467
108547
|
animation
|
|
108468
108548
|
};
|
|
108469
108549
|
}
|
|
108470
|
-
/**
|
|
108550
|
+
/** Unreachable: identical for every look. */
|
|
108471
108551
|
var OFFLINE = look("wifi-off", "muted", "plain", "none");
|
|
108472
|
-
var UNKNOWN = look("circle-question-mark", "muted", "plain", "none");
|
|
108473
108552
|
var ALERT = look("triangle-alert", "danger", "alert-wash", "pulse");
|
|
108474
108553
|
function lookOf(spec) {
|
|
108475
108554
|
const at = (s) => look(spec.icon, s[0], s[1], s[2]);
|
|
@@ -108481,7 +108560,7 @@ function lookOf(spec) {
|
|
|
108481
108560
|
standby: at(spec.standby),
|
|
108482
108561
|
alert: spec.alert ?? ALERT,
|
|
108483
108562
|
offline: OFFLINE,
|
|
108484
|
-
unknown:
|
|
108563
|
+
unknown: look(spec.icon, "muted", "plain", "none")
|
|
108485
108564
|
};
|
|
108486
108565
|
}
|
|
108487
108566
|
var MUTED = [
|
|
@@ -109183,6 +109262,7 @@ var HERO_LOOK_BY_ROLE = {
|
|
|
109183
109262
|
[require_composed_stable_id.DeviceRole.Outlet]: "inherit",
|
|
109184
109263
|
[require_composed_stable_id.DeviceRole.SwitchHeater]: HEATER_LOOK,
|
|
109185
109264
|
[require_composed_stable_id.DeviceRole.SwitchFan]: FAN_LOOK,
|
|
109265
|
+
[require_composed_stable_id.DeviceRole.SwitchLight]: LIGHT_LOOK,
|
|
109186
109266
|
[require_composed_stable_id.DeviceRole.ClimateAc]: "inherit",
|
|
109187
109267
|
[require_composed_stable_id.DeviceRole.ClimateThermostat]: "inherit",
|
|
109188
109268
|
[require_composed_stable_id.DeviceRole.ClimateFloor]: "inherit",
|
|
@@ -109229,10 +109309,10 @@ var HERO_LOOK_BY_ROLE = {
|
|
|
109229
109309
|
[require_composed_stable_id.DeviceRole.GenericNotifier]: "inherit",
|
|
109230
109310
|
[require_composed_stable_id.DeviceRole.IrTransmitter]: "inherit"
|
|
109231
109311
|
};
|
|
109232
|
-
function isDeviceType(type) {
|
|
109312
|
+
function isDeviceType$1(type) {
|
|
109233
109313
|
return Object.values(require_composed_stable_id.DeviceType).includes(type);
|
|
109234
109314
|
}
|
|
109235
|
-
function isDeviceRole(role) {
|
|
109315
|
+
function isDeviceRole$1(role) {
|
|
109236
109316
|
return Object.values(require_composed_stable_id.DeviceRole).includes(role);
|
|
109237
109317
|
}
|
|
109238
109318
|
/**
|
|
@@ -109240,14 +109320,14 @@ function isDeviceRole(role) {
|
|
|
109240
109320
|
* A climate device that is on draws its MODE (`mode` is the scene's); a role never loses to it.
|
|
109241
109321
|
*/
|
|
109242
109322
|
function resolveHeroLook(role, type, state, mode = null) {
|
|
109243
|
-
const byRole = role !== null && isDeviceRole(role) ? HERO_LOOK_BY_ROLE[role] : void 0;
|
|
109323
|
+
const byRole = role !== null && isDeviceRole$1(role) ? HERO_LOOK_BY_ROLE[role] : void 0;
|
|
109244
109324
|
if (byRole !== void 0 && byRole !== "inherit") return byRole[state];
|
|
109245
109325
|
if (mode !== null && (state === "on" || state === "running") && MODE_LOOK_TYPES.includes(type)) {
|
|
109246
109326
|
const byMode = HERO_MODE_LOOK[mode];
|
|
109247
109327
|
if (byMode !== null) return byMode;
|
|
109248
109328
|
}
|
|
109249
|
-
if (isAirConditioner(type, role)) return CLIMATE_LOOK[state];
|
|
109250
|
-
return ((isDeviceType(type) ? HERO_LOOK_BY_TYPE[type] : void 0) ?? HERO_LOOK_DEFAULT)[state];
|
|
109329
|
+
if (require_implemented_methods.isAirConditioner(type, role)) return CLIMATE_LOOK[state];
|
|
109330
|
+
return ((isDeviceType$1(type) ? HERO_LOOK_BY_TYPE[type] : void 0) ?? HERO_LOOK_DEFAULT)[state];
|
|
109251
109331
|
}
|
|
109252
109332
|
/** Every look the model declares, for the exhaustiveness guard and its spec. */
|
|
109253
109333
|
function allHeroLooks() {
|
|
@@ -109332,7 +109412,7 @@ var STATE_TEXT = {
|
|
|
109332
109412
|
standby: require_sleep.t("Standby", "In standby"),
|
|
109333
109413
|
alert: require_sleep.t("Alert", "Allarme"),
|
|
109334
109414
|
offline: require_sleep.t("Offline", "Non raggiungibile"),
|
|
109335
|
-
unknown:
|
|
109415
|
+
unknown: NOT_REPORTED
|
|
109336
109416
|
};
|
|
109337
109417
|
function pickReading(readings) {
|
|
109338
109418
|
for (const source of STATE_SOURCE_ORDER) {
|
|
@@ -121014,6 +121094,155 @@ function applianceExport(ecosystem, deviceType) {
|
|
|
121014
121094
|
return APPLIANCE_EXPORT[ecosystem][deviceType];
|
|
121015
121095
|
}
|
|
121016
121096
|
//#endregion
|
|
121097
|
+
//#region src/device/device-icon.ts
|
|
121098
|
+
/**
|
|
121099
|
+
* device-icon — THE icon of a device, from what it IS: its {@link DeviceType},
|
|
121100
|
+
* refined by its {@link DeviceRole}. One table for every surface: the admin's
|
|
121101
|
+
* rows, cards, page header, lists and pickers draw it through ui-library's
|
|
121102
|
+
* glyph table, the viewer through its catalog nodes. The value is a key of the
|
|
121103
|
+
* icon catalog (D854), never a glyph.
|
|
121104
|
+
*
|
|
121105
|
+
* Exhaustive over both enums (`satisfies Record<…>`): a new type or role fails
|
|
121106
|
+
* the build until it has an icon. Nothing here reads a name, a provider or a
|
|
121107
|
+
* capability — an icon picked from those would be invented.
|
|
121108
|
+
*
|
|
121109
|
+
* Precedence: a known role → its icon; otherwise the type's icon; a type this
|
|
121110
|
+
* build does not know → the generic type's icon. An operator's per-device or
|
|
121111
|
+
* per-role display override is the caller's level above this one.
|
|
121112
|
+
*/
|
|
121113
|
+
/** The icon of each device type. */
|
|
121114
|
+
var DEVICE_TYPE_ICON = {
|
|
121115
|
+
[require_composed_stable_id.DeviceType.Camera]: "camera",
|
|
121116
|
+
[require_composed_stable_id.DeviceType.Hub]: "network",
|
|
121117
|
+
[require_composed_stable_id.DeviceType.Light]: "lightbulb",
|
|
121118
|
+
[require_composed_stable_id.DeviceType.Siren]: "siren",
|
|
121119
|
+
[require_composed_stable_id.DeviceType.Switch]: "toggle-left",
|
|
121120
|
+
[require_composed_stable_id.DeviceType.Sensor]: "activity",
|
|
121121
|
+
[require_composed_stable_id.DeviceType.Climate]: "thermometer",
|
|
121122
|
+
[require_composed_stable_id.DeviceType.HeatPump]: "flame",
|
|
121123
|
+
[require_composed_stable_id.DeviceType.Button]: "circle-dot",
|
|
121124
|
+
[require_composed_stable_id.DeviceType.EventEmitter]: "zap",
|
|
121125
|
+
[require_composed_stable_id.DeviceType.Update]: "refresh-cw",
|
|
121126
|
+
[require_composed_stable_id.DeviceType.Generic]: "box",
|
|
121127
|
+
[require_composed_stable_id.DeviceType.Notifier]: "bell",
|
|
121128
|
+
[require_composed_stable_id.DeviceType.Script]: "scroll-text",
|
|
121129
|
+
[require_composed_stable_id.DeviceType.Automation]: "workflow",
|
|
121130
|
+
[require_composed_stable_id.DeviceType.Lock]: "lock",
|
|
121131
|
+
[require_composed_stable_id.DeviceType.Cover]: "blinds",
|
|
121132
|
+
[require_composed_stable_id.DeviceType.Valve]: "pipette",
|
|
121133
|
+
[require_composed_stable_id.DeviceType.Humidifier]: "waves",
|
|
121134
|
+
[require_composed_stable_id.DeviceType.WaterHeater]: "bath",
|
|
121135
|
+
[require_composed_stable_id.DeviceType.Fan]: "fan",
|
|
121136
|
+
[require_composed_stable_id.DeviceType.MediaPlayer]: "monitor-play",
|
|
121137
|
+
[require_composed_stable_id.DeviceType.AlarmPanel]: "shield-alert",
|
|
121138
|
+
[require_composed_stable_id.DeviceType.Control]: "sliders-horizontal",
|
|
121139
|
+
[require_composed_stable_id.DeviceType.Presence]: "map-pin",
|
|
121140
|
+
[require_composed_stable_id.DeviceType.Weather]: "cloud-sun",
|
|
121141
|
+
[require_composed_stable_id.DeviceType.Vacuum]: "bot",
|
|
121142
|
+
[require_composed_stable_id.DeviceType.LawnMower]: "tractor",
|
|
121143
|
+
[require_composed_stable_id.DeviceType.Container]: "box",
|
|
121144
|
+
[require_composed_stable_id.DeviceType.Image]: "image",
|
|
121145
|
+
[require_composed_stable_id.DeviceType.PetFeeder]: "bone",
|
|
121146
|
+
[require_composed_stable_id.DeviceType.PetFountain]: "droplets",
|
|
121147
|
+
[require_composed_stable_id.DeviceType.Dishwasher]: "waves",
|
|
121148
|
+
[require_composed_stable_id.DeviceType.Washer]: "washing-machine",
|
|
121149
|
+
[require_composed_stable_id.DeviceType.Dryer]: "wind",
|
|
121150
|
+
[require_composed_stable_id.DeviceType.Gateway]: "router"
|
|
121151
|
+
};
|
|
121152
|
+
/** The icon of each role: what the device is FOR, which reads better than its type. */
|
|
121153
|
+
var DEVICE_ROLE_ICON = {
|
|
121154
|
+
[require_composed_stable_id.DeviceRole.Siren]: "siren",
|
|
121155
|
+
[require_composed_stable_id.DeviceRole.Floodlight]: "lightbulb",
|
|
121156
|
+
[require_composed_stable_id.DeviceRole.Spotlight]: "flashlight",
|
|
121157
|
+
[require_composed_stable_id.DeviceRole.PirSensor]: "radar",
|
|
121158
|
+
[require_composed_stable_id.DeviceRole.Chime]: "bell",
|
|
121159
|
+
[require_composed_stable_id.DeviceRole.Autotrack]: "crosshair",
|
|
121160
|
+
[require_composed_stable_id.DeviceRole.Nightvision]: "moon",
|
|
121161
|
+
[require_composed_stable_id.DeviceRole.PrivacyMask]: "eye-off",
|
|
121162
|
+
[require_composed_stable_id.DeviceRole.Doorbell]: "door-closed",
|
|
121163
|
+
[require_composed_stable_id.DeviceRole.CoverBlind]: "blinds",
|
|
121164
|
+
[require_composed_stable_id.DeviceRole.CoverShutter]: "blinds",
|
|
121165
|
+
[require_composed_stable_id.DeviceRole.CoverAwning]: "blinds",
|
|
121166
|
+
[require_composed_stable_id.DeviceRole.CoverCurtain]: "blinds",
|
|
121167
|
+
[require_composed_stable_id.DeviceRole.CoverGarage]: "door-closed",
|
|
121168
|
+
[require_composed_stable_id.DeviceRole.CoverGate]: "door-closed",
|
|
121169
|
+
[require_composed_stable_id.DeviceRole.CoverDoor]: "door-open",
|
|
121170
|
+
[require_composed_stable_id.DeviceRole.CoverWindow]: "blinds",
|
|
121171
|
+
[require_composed_stable_id.DeviceRole.BinaryHelper]: "toggle-left",
|
|
121172
|
+
[require_composed_stable_id.DeviceRole.Outlet]: "plug",
|
|
121173
|
+
[require_composed_stable_id.DeviceRole.SwitchHeater]: "flame",
|
|
121174
|
+
[require_composed_stable_id.DeviceRole.SwitchFan]: "fan",
|
|
121175
|
+
[require_composed_stable_id.DeviceRole.SwitchLight]: "lightbulb",
|
|
121176
|
+
[require_composed_stable_id.DeviceRole.ClimateAc]: "air-vent",
|
|
121177
|
+
[require_composed_stable_id.DeviceRole.ClimateThermostat]: "thermometer",
|
|
121178
|
+
[require_composed_stable_id.DeviceRole.ClimateFloor]: "waves",
|
|
121179
|
+
[require_composed_stable_id.DeviceRole.ClimateRadiator]: "heater",
|
|
121180
|
+
[require_composed_stable_id.DeviceRole.ClimateHeater]: "flame",
|
|
121181
|
+
[require_composed_stable_id.DeviceRole.ClimateHeatPumpCircuit]: "refresh-cw",
|
|
121182
|
+
[require_composed_stable_id.DeviceRole.MotionSensor]: "footprints",
|
|
121183
|
+
[require_composed_stable_id.DeviceRole.ContactSensor]: "door-open",
|
|
121184
|
+
[require_composed_stable_id.DeviceRole.LeakSensor]: "droplet",
|
|
121185
|
+
[require_composed_stable_id.DeviceRole.SmokeSensor]: "alarm-smoke",
|
|
121186
|
+
[require_composed_stable_id.DeviceRole.COSensor]: "wind",
|
|
121187
|
+
[require_composed_stable_id.DeviceRole.GasSensor]: "flame",
|
|
121188
|
+
[require_composed_stable_id.DeviceRole.TamperSensor]: "shield-alert",
|
|
121189
|
+
[require_composed_stable_id.DeviceRole.VibrationSensor]: "vibrate",
|
|
121190
|
+
[require_composed_stable_id.DeviceRole.ConnectivitySensor]: "wifi",
|
|
121191
|
+
[require_composed_stable_id.DeviceRole.SoundSensor]: "volume-2",
|
|
121192
|
+
[require_composed_stable_id.DeviceRole.BinarySensor]: "toggle-left",
|
|
121193
|
+
[require_composed_stable_id.DeviceRole.TemperatureSensor]: "thermometer",
|
|
121194
|
+
[require_composed_stable_id.DeviceRole.HumiditySensor]: "droplets",
|
|
121195
|
+
[require_composed_stable_id.DeviceRole.AmbientLightSensor]: "sun",
|
|
121196
|
+
[require_composed_stable_id.DeviceRole.PressureSensor]: "gauge",
|
|
121197
|
+
[require_composed_stable_id.DeviceRole.WindSensor]: "wind",
|
|
121198
|
+
[require_composed_stable_id.DeviceRole.RainSensor]: "cloud-rain",
|
|
121199
|
+
[require_composed_stable_id.DeviceRole.UvSensor]: "sun-medium",
|
|
121200
|
+
[require_composed_stable_id.DeviceRole.SolarRadiationSensor]: "sunrise",
|
|
121201
|
+
[require_composed_stable_id.DeviceRole.SoilMoistureSensor]: "sprout",
|
|
121202
|
+
[require_composed_stable_id.DeviceRole.PowerSensor]: "zap",
|
|
121203
|
+
[require_composed_stable_id.DeviceRole.EnergySensor]: "zap",
|
|
121204
|
+
[require_composed_stable_id.DeviceRole.VoltageSensor]: "zap",
|
|
121205
|
+
[require_composed_stable_id.DeviceRole.CurrentSensor]: "zap",
|
|
121206
|
+
[require_composed_stable_id.DeviceRole.AirQualitySensor]: "wind",
|
|
121207
|
+
[require_composed_stable_id.DeviceRole.BatterySensor]: "gauge",
|
|
121208
|
+
[require_composed_stable_id.DeviceRole.NumericSensor]: "hash",
|
|
121209
|
+
[require_composed_stable_id.DeviceRole.EnumSensor]: "list",
|
|
121210
|
+
[require_composed_stable_id.DeviceRole.DateTimeSensor]: "clock",
|
|
121211
|
+
[require_composed_stable_id.DeviceRole.GenericSensor]: "gauge",
|
|
121212
|
+
[require_composed_stable_id.DeviceRole.NumericControl]: "sliders-horizontal",
|
|
121213
|
+
[require_composed_stable_id.DeviceRole.SelectControl]: "list-checks",
|
|
121214
|
+
[require_composed_stable_id.DeviceRole.TextControl]: "type",
|
|
121215
|
+
[require_composed_stable_id.DeviceRole.DateTimeControl]: "clock",
|
|
121216
|
+
[require_composed_stable_id.DeviceRole.MobilePushNotifier]: "smartphone",
|
|
121217
|
+
[require_composed_stable_id.DeviceRole.MessagingNotifier]: "message-square",
|
|
121218
|
+
[require_composed_stable_id.DeviceRole.EmailNotifier]: "mail",
|
|
121219
|
+
[require_composed_stable_id.DeviceRole.GenericNotifier]: "bell",
|
|
121220
|
+
[require_composed_stable_id.DeviceRole.IrTransmitter]: "radio-tower"
|
|
121221
|
+
};
|
|
121222
|
+
var TYPE_VALUES = new Set(Object.values(require_composed_stable_id.DeviceType));
|
|
121223
|
+
var ROLE_VALUES = new Set(Object.values(require_composed_stable_id.DeviceRole));
|
|
121224
|
+
function isDeviceType(value) {
|
|
121225
|
+
return TYPE_VALUES.has(value);
|
|
121226
|
+
}
|
|
121227
|
+
function isDeviceRole(value) {
|
|
121228
|
+
return ROLE_VALUES.has(value);
|
|
121229
|
+
}
|
|
121230
|
+
/** The icon of a device type alone; a type this build does not know draws the generic one. */
|
|
121231
|
+
function deviceTypeIconKey(type) {
|
|
121232
|
+
return isDeviceType(type) ? DEVICE_TYPE_ICON[type] : DEVICE_TYPE_ICON[require_composed_stable_id.DeviceType.Generic];
|
|
121233
|
+
}
|
|
121234
|
+
/** The icon of a role alone, or `null` for a role this build does not know. */
|
|
121235
|
+
function deviceRoleIconKey(role) {
|
|
121236
|
+
return isDeviceRole(role) ? DEVICE_ROLE_ICON[role] : null;
|
|
121237
|
+
}
|
|
121238
|
+
/**
|
|
121239
|
+
* The icon of a device: its role's when the role is known, else its type's.
|
|
121240
|
+
* An unknown role never borrows another role's icon — it is drawn as its type.
|
|
121241
|
+
*/
|
|
121242
|
+
function deviceIconKey(type, role) {
|
|
121243
|
+
return (role === null || role === void 0 ? null : deviceRoleIconKey(role)) ?? deviceTypeIconKey(type);
|
|
121244
|
+
}
|
|
121245
|
+
//#endregion
|
|
121017
121246
|
//#region src/device/path-util.ts
|
|
121018
121247
|
/** Returns true when `x` is a non-null, non-array plain object. */
|
|
121019
121248
|
function isRecord$1(x) {
|
|
@@ -139645,7 +139874,7 @@ exports.CATALOG_LANGS = CATALOG_LANGS;
|
|
|
139645
139874
|
exports.CHOOSE_BRANCHES_MAX = CHOOSE_BRANCHES_MAX;
|
|
139646
139875
|
exports.CIVIL_TWILIGHT_ALTITUDE_DEG = CIVIL_TWILIGHT_ALTITUDE_DEG;
|
|
139647
139876
|
exports.CLASS_MAP_MACRO_TARGETS = CLASS_MAP_MACRO_TARGETS;
|
|
139648
|
-
exports.CLIMATE_ROLES = CLIMATE_ROLES;
|
|
139877
|
+
exports.CLIMATE_ROLES = require_implemented_methods.CLIMATE_ROLES;
|
|
139649
139878
|
exports.CLIP_BROKER_PACED_RATES = CLIP_BROKER_PACED_RATES;
|
|
139650
139879
|
exports.CLIP_LABEL_EVENT_FETCH_LIMIT = CLIP_LABEL_EVENT_FETCH_LIMIT;
|
|
139651
139880
|
exports.CLIP_PLAYBACK_OPTIONS = CLIP_PLAYBACK_OPTIONS;
|
|
@@ -139971,6 +140200,7 @@ exports.DEVICE_RAMP = DEVICE_RAMP;
|
|
|
139971
140200
|
exports.DEVICE_REFRESH_REFUSAL_PREFIX = DEVICE_REFRESH_REFUSAL_PREFIX;
|
|
139972
140201
|
exports.DEVICE_RESTORE_RETRY_CONCURRENCY = DEVICE_RESTORE_RETRY_CONCURRENCY;
|
|
139973
140202
|
exports.DEVICE_RESTORE_RETRY_DELAYS_MS = DEVICE_RESTORE_RETRY_DELAYS_MS;
|
|
140203
|
+
exports.DEVICE_ROLE_ICON = DEVICE_ROLE_ICON;
|
|
139974
140204
|
exports.DEVICE_RUNS_MAX_PAGE = DEVICE_RUNS_MAX_PAGE;
|
|
139975
140205
|
exports.DEVICE_SAN_CREDENTIAL_PREFIX = DEVICE_SAN_CREDENTIAL_PREFIX;
|
|
139976
140206
|
exports.DEVICE_SAN_USER_PREFIX = DEVICE_SAN_USER_PREFIX;
|
|
@@ -139995,6 +140225,7 @@ exports.DEVICE_TOMBSTONE_RETENTION_MS = DEVICE_TOMBSTONE_RETENTION_MS;
|
|
|
139995
140225
|
exports.DEVICE_TRANSITIONS_MAX_PAGE = DEVICE_TRANSITIONS_MAX_PAGE;
|
|
139996
140226
|
exports.DEVICE_TRANSITIONS_RECORD_BATCH_MAX = DEVICE_TRANSITIONS_RECORD_BATCH_MAX;
|
|
139997
140227
|
exports.DEVICE_TYPE_CONTROL_KIND = DEVICE_TYPE_CONTROL_KIND;
|
|
140228
|
+
exports.DEVICE_TYPE_ICON = DEVICE_TYPE_ICON;
|
|
139998
140229
|
exports.DEVICE_TYPE_INFO = DEVICE_TYPE_INFO;
|
|
139999
140230
|
exports.DISPLAY_PREFERENCES = require_sleep.DISPLAY_PREFERENCES;
|
|
140000
140231
|
exports.DISPLAY_PRESETS = DISPLAY_PRESETS;
|
|
@@ -140862,6 +141093,7 @@ exports.NODE_COLOR_IDS = require_node_color.NODE_COLOR_IDS;
|
|
|
140862
141093
|
exports.NOTIFICATION_FIELDS = NOTIFICATION_FIELDS;
|
|
140863
141094
|
exports.NOTIFICATION_OUTPUT_CAP = NOTIFICATION_OUTPUT_CAP;
|
|
140864
141095
|
exports.NOT_A_HERO_FACT = NOT_A_HERO_FACT;
|
|
141096
|
+
exports.NOT_REPORTED = NOT_REPORTED;
|
|
140865
141097
|
exports.NO_MEASURED_CAPACITY = NO_MEASURED_CAPACITY;
|
|
140866
141098
|
exports.NUMERIC_AGGREGATES = require_implemented_methods.NUMERIC_AGGREGATES;
|
|
140867
141099
|
exports.NativeCropBboxSchema = NativeCropBboxSchema;
|
|
@@ -141705,6 +141937,7 @@ exports.StorageReadChunkInputSchema = ReadChunkInputSchema;
|
|
|
141705
141937
|
exports.StorageTableSchema = StorageTableSchema;
|
|
141706
141938
|
exports.StorageTestLocationResultSchema = TestLocationResultSchema;
|
|
141707
141939
|
exports.StorageWriteChunkInputSchema = WriteChunkInputSchema;
|
|
141940
|
+
exports.StoredDeviceTypeSchema = require_implemented_methods.StoredDeviceTypeSchema;
|
|
141708
141941
|
exports.StoredRecordKindDeclarationSchema = require_sleep.StoredRecordKindDeclarationSchema;
|
|
141709
141942
|
exports.StreamCodecSchema = StreamCodecSchema;
|
|
141710
141943
|
exports.StreamFormatSchema = StreamFormatSchema;
|
|
@@ -142111,9 +142344,11 @@ exports.canConvertUnit = require_convert.canConvertUnit;
|
|
|
142111
142344
|
exports.canonicalEgressPlan = canonicalEgressPlan;
|
|
142112
142345
|
exports.canonicalIconKey = canonicalIconKey;
|
|
142113
142346
|
exports.canonicalJson = canonicalJson;
|
|
142114
|
-
exports.
|
|
142347
|
+
exports.canonicalStoredBlockTarget = require_implemented_methods.canonicalStoredBlockTarget;
|
|
142348
|
+
exports.canonicalStoredDeviceType = require_implemented_methods.canonicalStoredDeviceType;
|
|
142349
|
+
exports.canonicalStoredStepTargets = canonicalStoredStepTargets;
|
|
142115
142350
|
exports.canonicalizeAppCallback = canonicalizeAppCallback;
|
|
142116
|
-
exports.capAppliesToDeviceKind = capAppliesToDeviceKind;
|
|
142351
|
+
exports.capAppliesToDeviceKind = require_implemented_methods.capAppliesToDeviceKind;
|
|
142117
142352
|
exports.capUnitResolver = capUnitResolver;
|
|
142118
142353
|
exports.capabilityScopesOf = capabilityScopesOf;
|
|
142119
142354
|
exports.capacityForModel = capacityForModel;
|
|
@@ -142143,7 +142378,7 @@ exports.clearKnownSecrets = require_sleep.clearKnownSecrets;
|
|
|
142143
142378
|
exports.clearModelBoundOverrides = clearModelBoundOverrides;
|
|
142144
142379
|
exports.clearModelBoundSetting = clearModelBoundSetting;
|
|
142145
142380
|
exports.climateControlCapability = climateControlCapability;
|
|
142146
|
-
exports.climateRoleOf = climateRoleOf;
|
|
142381
|
+
exports.climateRoleOf = require_implemented_methods.climateRoleOf;
|
|
142147
142382
|
exports.clipEventLabelDepsFromApi = clipEventLabelDepsFromApi;
|
|
142148
142383
|
exports.clipExportFailure = clipExportFailure;
|
|
142149
142384
|
exports.clipExportFailureOf = clipExportFailureOf;
|
|
@@ -142333,17 +142568,20 @@ exports.deviceExportCapability = deviceExportCapability;
|
|
|
142333
142568
|
exports.deviceExportStatusInstanceOf = statusInstanceOf;
|
|
142334
142569
|
exports.deviceExtensionCapability = deviceExtensionCapability;
|
|
142335
142570
|
exports.deviceHistoryCapability = deviceHistoryCapability;
|
|
142571
|
+
exports.deviceIconKey = deviceIconKey;
|
|
142336
142572
|
exports.deviceManagerCapability = deviceManagerCapability;
|
|
142337
142573
|
exports.deviceMatchesProfile = deviceMatchesProfile;
|
|
142338
142574
|
exports.deviceOpsCapability = require_sleep.deviceOpsCapability;
|
|
142339
142575
|
exports.deviceProviderCapability = deviceProviderCapability;
|
|
142340
142576
|
exports.deviceRefusalFromMessage = deviceRefusalFromMessage;
|
|
142341
142577
|
exports.deviceRemovalHookCapability = deviceRemovalHookCapability;
|
|
142578
|
+
exports.deviceRoleIconKey = deviceRoleIconKey;
|
|
142342
142579
|
exports.deviceRunsCapability = deviceRunsCapability;
|
|
142343
142580
|
exports.deviceSelectorMatches = deviceSelectorMatches;
|
|
142344
142581
|
exports.deviceStateCapability = deviceStateCapability;
|
|
142345
142582
|
exports.deviceStatusCapability = deviceStatusCapability;
|
|
142346
142583
|
exports.deviceTransitionsCapability = deviceTransitionsCapability;
|
|
142584
|
+
exports.deviceTypeIconKey = deviceTypeIconKey;
|
|
142347
142585
|
exports.diffStepSettings = diffStepSettings;
|
|
142348
142586
|
exports.disarmRoseMemory = require_implemented_methods.disarmRoseMemory;
|
|
142349
142587
|
exports.dishwasherCapability = dishwasherCapability;
|
|
@@ -142369,6 +142607,7 @@ exports.embeddingRequirementsUnavailableError = embeddingRequirementsUnavailable
|
|
|
142369
142607
|
exports.emitDownForOwnedCaps = require_sleep.emitDownForOwnedCaps;
|
|
142370
142608
|
exports.emitReadiness = require_sleep.emitReadiness;
|
|
142371
142609
|
exports.emitsCollectionSelector = emitsCollectionSelector;
|
|
142610
|
+
exports.emptyMeasurement = emptyMeasurement;
|
|
142372
142611
|
exports.encodeCardsToComposition = encodeCardsToComposition;
|
|
142373
142612
|
exports.encodeFlipperParsed = encodeFlipperParsed;
|
|
142374
142613
|
exports.encodeProfileFromStreamShape = encodeProfileFromStreamShape;
|
|
@@ -142574,7 +142813,7 @@ exports.irSourceProblem = irSourceProblem;
|
|
|
142574
142813
|
exports.irTransmitterCapability = irTransmitterCapability;
|
|
142575
142814
|
exports.isAddonInstanceId = isAddonInstanceId;
|
|
142576
142815
|
exports.isAgentOnlyPlacement = isAgentOnlyPlacement;
|
|
142577
|
-
exports.isAirConditioner = isAirConditioner;
|
|
142816
|
+
exports.isAirConditioner = require_implemented_methods.isAirConditioner;
|
|
142578
142817
|
exports.isAlarmControllableCap = isAlarmControllableCap;
|
|
142579
142818
|
exports.isAlertEpisodeOpen = isAlertEpisodeOpen;
|
|
142580
142819
|
exports.isAlertEpisodeSeverity = isAlertEpisodeSeverity;
|
|
@@ -142626,9 +142865,11 @@ exports.isLocationEnabled = isLocationEnabled;
|
|
|
142626
142865
|
exports.isMediaOwnerType = isMediaOwnerType;
|
|
142627
142866
|
exports.isModelScopedStepSettingKey = isModelScopedStepSettingKey;
|
|
142628
142867
|
exports.isNode = isNode;
|
|
142868
|
+
exports.isNotReported = isNotReported;
|
|
142629
142869
|
exports.isOauthLandingReason = isOauthLandingReason;
|
|
142630
142870
|
exports.isObjectInput = isObjectInput;
|
|
142631
142871
|
exports.isOccupancyRule = isOccupancyRule;
|
|
142872
|
+
exports.isOutlet = require_implemented_methods.isOutlet;
|
|
142632
142873
|
exports.isOwnerOnlyEventCategory = require_event_category.isOwnerOnlyEventCategory;
|
|
142633
142874
|
exports.isPlugApplianceType = isPlugApplianceType;
|
|
142634
142875
|
exports.isPositionTicking = isPositionTicking;
|
|
@@ -142662,6 +142903,9 @@ exports.isSourceCap = require_implemented_methods.isSourceCap;
|
|
|
142662
142903
|
exports.isStateLabelKey = isStateLabelKey;
|
|
142663
142904
|
exports.isStatefulBuiltin = require_implemented_methods.isStatefulBuiltin;
|
|
142664
142905
|
exports.isStorageLocationMode = isStorageLocationMode;
|
|
142906
|
+
exports.isSwitchFan = require_implemented_methods.isSwitchFan;
|
|
142907
|
+
exports.isSwitchHeater = require_implemented_methods.isSwitchHeater;
|
|
142908
|
+
exports.isSwitchLight = require_implemented_methods.isSwitchLight;
|
|
142665
142909
|
exports.isSystemDelivery = isSystemDelivery;
|
|
142666
142910
|
exports.isSystemEventFamily = isSystemEventFamily;
|
|
142667
142911
|
exports.isSystemEventRecoveryKind = isSystemEventRecoveryKind;
|
|
@@ -143213,6 +143457,7 @@ exports.smokeCapability = smokeCapability;
|
|
|
143213
143457
|
exports.smtpProviderCapability = smtpProviderCapability;
|
|
143214
143458
|
exports.smtpSinceKey = smtpSinceKey;
|
|
143215
143459
|
exports.snapshotCapability = snapshotCapability;
|
|
143460
|
+
exports.sourcePickAcceptsDevice = sourcePickAcceptsDevice;
|
|
143216
143461
|
exports.sourcePickForHistory = sourcePickForHistory;
|
|
143217
143462
|
exports.sourcePickForMath = sourcePickForMath;
|
|
143218
143463
|
exports.sourcePickForTemplate = sourcePickForTemplate;
|