@camstack/types 1.2.591 → 1.2.593
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 +1 -1
- package/dist/addon.mjs +1 -1
- package/dist/capabilities/device-state-refresh.cap.d.ts +58 -0
- package/dist/capabilities/device-state.cap.d.ts +4 -1
- package/dist/capabilities/index.d.ts +3 -1
- package/dist/client.js +53 -0
- package/dist/client.mjs +53 -0
- package/dist/device/cap-vocabulary/command-catalog.d.ts +34 -1
- package/dist/device/cap-vocabulary/declaration.d.ts +21 -1
- package/dist/device/cap-vocabulary/hold-limits.d.ts +8 -0
- package/dist/device/cap-vocabulary/index.d.ts +3 -2
- package/dist/device/cap-vocabulary/types.d.ts +68 -0
- package/dist/device/command-hold.d.ts +60 -0
- package/dist/device/device-context.d.ts +5 -2
- package/dist/device/state-refresh.d.ts +51 -0
- package/dist/generated/addon-api.d.ts +22 -0
- package/dist/generated/cap-vocabulary.d.ts +1 -1
- package/dist/generated/capability-router-map.d.ts +5 -2
- package/dist/generated/device-proxy.d.ts +2 -0
- package/dist/generated/device-scoped-caps.d.ts +1 -1
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/method-device-selectors.d.ts +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +457 -10
- package/dist/index.mjs +439 -11
- package/dist/{sleep-BA_SIc0O.js → sleep-BOK28JE0.js} +429 -45
- package/dist/{sleep-BT1bLgPq.mjs → sleep-DO-ayTnk.mjs} +406 -46
- 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-BOK28JE0.js");
|
|
3
3
|
const require_event_category = require("./event-category-BKxXXxnV.js");
|
|
4
4
|
const require_composed_stable_id = require("./composed-stable-id-BdeYe5dD.js");
|
|
5
5
|
const require_implemented_methods = require("./implemented-methods-BarLh7tc.js");
|
|
@@ -37418,7 +37418,7 @@ ${hasTime ? ` /** Read the site into memory. A failed read keeps the previous v
|
|
|
37418
37418
|
` : ""} // ── the condition mirror (D49): memory only at fire time ──
|
|
37419
37419
|
async function refreshMirror(): Promise<void> {
|
|
37420
37420
|
const report = await mirror.refresh({
|
|
37421
|
-
fetchSlice: (deviceId, cap) => ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap }),
|
|
37421
|
+
fetchSlice: (deviceId, cap) => ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap, confirmed: true }),
|
|
37422
37422
|
fetchStableIds: async () => {
|
|
37423
37423
|
const all = await ctx.api.deviceManager.listAll.query({})
|
|
37424
37424
|
return stableIdMapOf(all)
|
|
@@ -37432,7 +37432,7 @@ ${hasTime ? ` /** Read the site into memory. A failed read keeps the previous v
|
|
|
37432
37432
|
|
|
37433
37433
|
function mirrorFetchers() {
|
|
37434
37434
|
return {
|
|
37435
|
-
fetchSlice: (deviceId: number, cap: string) => ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap }),
|
|
37435
|
+
fetchSlice: (deviceId: number, cap: string) => ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap, confirmed: true }),
|
|
37436
37436
|
fetchStableIds: async () => {
|
|
37437
37437
|
const all = await ctx.api.deviceManager.listAll.query({})
|
|
37438
37438
|
return stableIdMapOf(all)
|
|
@@ -37501,7 +37501,7 @@ ${hasTime ? ` // a time-is leaf changes sides at a boundary with no device ev
|
|
|
37501
37501
|
cap: string,
|
|
37502
37502
|
): Promise<{ readonly ok: true; readonly slice: unknown } | { readonly ok: false }> {
|
|
37503
37503
|
try {
|
|
37504
|
-
const slice = await ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap })
|
|
37504
|
+
const slice = await ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap, confirmed: true })
|
|
37505
37505
|
return { ok: true, slice }
|
|
37506
37506
|
} catch (err: unknown) {
|
|
37507
37507
|
ctx.logger.debug('device state read failed — the leaf keeps what it knew', {
|
|
@@ -37888,8 +37888,10 @@ ${hasTime ? " await refreshSite()\n" : ""} await refreshMirror()
|
|
|
37888
37888
|
const deviceId = data['deviceId']
|
|
37889
37889
|
const capName = data['capName']
|
|
37890
37890
|
if (typeof deviceId === 'number' && typeof capName === 'string') {
|
|
37891
|
-
|
|
37892
|
-
|
|
37891
|
+
// what the device reported: a held command is never a condition (D1061)
|
|
37892
|
+
const slice = data['confirmed'] ?? data['slice']
|
|
37893
|
+
mirror.apply(deviceId, capName, slice)
|
|
37894
|
+
guardMirror.apply(deviceId, capName, slice)
|
|
37893
37895
|
feedHolds()
|
|
37894
37896
|
evaluateStateTree()
|
|
37895
37897
|
}
|
|
@@ -41689,6 +41691,14 @@ var alarmPanelCapability = {
|
|
|
41689
41691
|
field: "state",
|
|
41690
41692
|
value: "disarmed"
|
|
41691
41693
|
},
|
|
41694
|
+
hold: { effects: [{
|
|
41695
|
+
field: "state",
|
|
41696
|
+
value: "disarming",
|
|
41697
|
+
when: {
|
|
41698
|
+
field: "state",
|
|
41699
|
+
notIn: ["disarmed"]
|
|
41700
|
+
}
|
|
41701
|
+
}] },
|
|
41692
41702
|
openArgs: [{
|
|
41693
41703
|
key: "code",
|
|
41694
41704
|
label: require_sleep.t("PIN code", "Codice PIN"),
|
|
@@ -41719,6 +41729,14 @@ var alarmPanelCapability = {
|
|
|
41719
41729
|
field: "state",
|
|
41720
41730
|
value: "armed_home"
|
|
41721
41731
|
},
|
|
41732
|
+
hold: { effects: [{
|
|
41733
|
+
field: "state",
|
|
41734
|
+
value: "arming",
|
|
41735
|
+
when: {
|
|
41736
|
+
field: "state",
|
|
41737
|
+
notIn: ["armed_home"]
|
|
41738
|
+
}
|
|
41739
|
+
}] },
|
|
41722
41740
|
args: { mode: "home" },
|
|
41723
41741
|
openArgs: [{
|
|
41724
41742
|
key: "code",
|
|
@@ -41739,6 +41757,14 @@ var alarmPanelCapability = {
|
|
|
41739
41757
|
field: "state",
|
|
41740
41758
|
value: "armed_away"
|
|
41741
41759
|
},
|
|
41760
|
+
hold: { effects: [{
|
|
41761
|
+
field: "state",
|
|
41762
|
+
value: "arming",
|
|
41763
|
+
when: {
|
|
41764
|
+
field: "state",
|
|
41765
|
+
notIn: ["armed_away"]
|
|
41766
|
+
}
|
|
41767
|
+
}] },
|
|
41742
41768
|
args: { mode: "away" },
|
|
41743
41769
|
openArgs: [{
|
|
41744
41770
|
key: "code",
|
|
@@ -41759,6 +41785,14 @@ var alarmPanelCapability = {
|
|
|
41759
41785
|
field: "state",
|
|
41760
41786
|
value: "armed_night"
|
|
41761
41787
|
},
|
|
41788
|
+
hold: { effects: [{
|
|
41789
|
+
field: "state",
|
|
41790
|
+
value: "arming",
|
|
41791
|
+
when: {
|
|
41792
|
+
field: "state",
|
|
41793
|
+
notIn: ["armed_night"]
|
|
41794
|
+
}
|
|
41795
|
+
}] },
|
|
41762
41796
|
args: { mode: "night" },
|
|
41763
41797
|
openArgs: [{
|
|
41764
41798
|
key: "code",
|
|
@@ -41779,6 +41813,14 @@ var alarmPanelCapability = {
|
|
|
41779
41813
|
field: "state",
|
|
41780
41814
|
value: "armed_vacation"
|
|
41781
41815
|
},
|
|
41816
|
+
hold: { effects: [{
|
|
41817
|
+
field: "state",
|
|
41818
|
+
value: "arming",
|
|
41819
|
+
when: {
|
|
41820
|
+
field: "state",
|
|
41821
|
+
notIn: ["armed_vacation"]
|
|
41822
|
+
}
|
|
41823
|
+
}] },
|
|
41782
41824
|
args: { mode: "vacation" },
|
|
41783
41825
|
openArgs: [{
|
|
41784
41826
|
key: "code",
|
|
@@ -41799,6 +41841,14 @@ var alarmPanelCapability = {
|
|
|
41799
41841
|
field: "state",
|
|
41800
41842
|
value: "armed_custom_bypass"
|
|
41801
41843
|
},
|
|
41844
|
+
hold: { effects: [{
|
|
41845
|
+
field: "state",
|
|
41846
|
+
value: "arming",
|
|
41847
|
+
when: {
|
|
41848
|
+
field: "state",
|
|
41849
|
+
notIn: ["armed_custom_bypass"]
|
|
41850
|
+
}
|
|
41851
|
+
}] },
|
|
41802
41852
|
args: { mode: "custom_bypass" },
|
|
41803
41853
|
openArgs: [{
|
|
41804
41854
|
key: "code",
|
|
@@ -42689,6 +42739,10 @@ var automationControlCapability = {
|
|
|
42689
42739
|
auth: "admin",
|
|
42690
42740
|
actions: [{
|
|
42691
42741
|
id: "haAutomation.enable",
|
|
42742
|
+
effect: {
|
|
42743
|
+
field: "enabled",
|
|
42744
|
+
value: true
|
|
42745
|
+
},
|
|
42692
42746
|
label: require_sleep.t("Enable automation", "Abilita l’automazione"),
|
|
42693
42747
|
phrase: require_sleep.t("Enable {device}", "Abilita {device}"),
|
|
42694
42748
|
icon: "toggle-right"
|
|
@@ -42699,6 +42753,10 @@ var automationControlCapability = {
|
|
|
42699
42753
|
auth: "admin",
|
|
42700
42754
|
actions: [{
|
|
42701
42755
|
id: "haAutomation.disable",
|
|
42756
|
+
effect: {
|
|
42757
|
+
field: "enabled",
|
|
42758
|
+
value: false
|
|
42759
|
+
},
|
|
42702
42760
|
label: require_sleep.t("Disable automation", "Disabilita l’automazione"),
|
|
42703
42761
|
phrase: require_sleep.t("Disable {device}", "Disabilita {device}"),
|
|
42704
42762
|
icon: "toggle-left"
|
|
@@ -46231,6 +46289,14 @@ var climateControlCapability = {
|
|
|
46231
46289
|
label: require_sleep.t("Set temperature range", "Imposta l’intervallo di temperatura"),
|
|
46232
46290
|
phrase: require_sleep.t("Keep {device} between {targetLow} and {targetHigh}", "Mantieni {device} tra {targetLow} e {targetHigh}"),
|
|
46233
46291
|
icon: "thermometer",
|
|
46292
|
+
effect: {
|
|
46293
|
+
field: "targetLow",
|
|
46294
|
+
fromArg: "targetLow"
|
|
46295
|
+
},
|
|
46296
|
+
sideEffects: [{
|
|
46297
|
+
field: "targetHigh",
|
|
46298
|
+
fromArg: "targetHigh"
|
|
46299
|
+
}],
|
|
46234
46300
|
openArgs: [{
|
|
46235
46301
|
key: "targetLow",
|
|
46236
46302
|
label: require_sleep.t("Lowest", "Minima"),
|
|
@@ -46289,6 +46355,10 @@ var climateControlCapability = {
|
|
|
46289
46355
|
label: require_sleep.t("Set fan mode", "Imposta la ventilazione"),
|
|
46290
46356
|
phrase: require_sleep.t("Set the fan of {device} to {fanMode}", "Imposta la ventilazione di {device} su {fanMode}"),
|
|
46291
46357
|
icon: "fan",
|
|
46358
|
+
effect: {
|
|
46359
|
+
field: "fanMode",
|
|
46360
|
+
fromArg: "fanMode"
|
|
46361
|
+
},
|
|
46292
46362
|
openArgs: [{
|
|
46293
46363
|
key: "fanMode",
|
|
46294
46364
|
label: require_sleep.t("Fan mode", "Ventilazione"),
|
|
@@ -46311,6 +46381,10 @@ var climateControlCapability = {
|
|
|
46311
46381
|
label: require_sleep.t("Set preset", "Imposta il preset"),
|
|
46312
46382
|
phrase: require_sleep.t("Set {device} to preset {preset}", "Imposta {device} sul preset {preset}"),
|
|
46313
46383
|
icon: "list",
|
|
46384
|
+
effect: {
|
|
46385
|
+
field: "preset",
|
|
46386
|
+
fromArg: "preset"
|
|
46387
|
+
},
|
|
46314
46388
|
openArgs: [{
|
|
46315
46389
|
key: "preset",
|
|
46316
46390
|
label: require_sleep.t("Preset", "Preset"),
|
|
@@ -48627,6 +48701,10 @@ var mediaPlayerCapability = {
|
|
|
48627
48701
|
auth: "protected",
|
|
48628
48702
|
actions: [{
|
|
48629
48703
|
id: "media.play",
|
|
48704
|
+
effect: {
|
|
48705
|
+
field: "state",
|
|
48706
|
+
value: "playing"
|
|
48707
|
+
},
|
|
48630
48708
|
label: require_sleep.t("Play", "Riproduci"),
|
|
48631
48709
|
phrase: require_sleep.t("Play on {device}", "Avvia la riproduzione su {device}"),
|
|
48632
48710
|
icon: "play"
|
|
@@ -48637,6 +48715,10 @@ var mediaPlayerCapability = {
|
|
|
48637
48715
|
auth: "protected",
|
|
48638
48716
|
actions: [{
|
|
48639
48717
|
id: "media.pause",
|
|
48718
|
+
effect: {
|
|
48719
|
+
field: "state",
|
|
48720
|
+
value: "paused"
|
|
48721
|
+
},
|
|
48640
48722
|
label: require_sleep.t("Pause media", "Metti in pausa"),
|
|
48641
48723
|
phrase: require_sleep.t("Pause {device}", "Metti in pausa {device}"),
|
|
48642
48724
|
icon: "pause"
|
|
@@ -48680,6 +48762,10 @@ var mediaPlayerCapability = {
|
|
|
48680
48762
|
auth: "protected",
|
|
48681
48763
|
actions: [{
|
|
48682
48764
|
id: "media.volume",
|
|
48765
|
+
effect: {
|
|
48766
|
+
field: "volumeLevel",
|
|
48767
|
+
fromArg: "volumeLevel"
|
|
48768
|
+
},
|
|
48683
48769
|
label: require_sleep.t("Set volume", "Imposta il volume"),
|
|
48684
48770
|
phrase: require_sleep.t("Set the volume of {device} to {volumeLevel}", "Imposta il volume di {device} al {volumeLevel}"),
|
|
48685
48771
|
icon: "volume-2",
|
|
@@ -48704,12 +48790,20 @@ var mediaPlayerCapability = {
|
|
|
48704
48790
|
auth: "protected",
|
|
48705
48791
|
actions: [{
|
|
48706
48792
|
id: "media.mute",
|
|
48793
|
+
effect: {
|
|
48794
|
+
field: "isMuted",
|
|
48795
|
+
value: true
|
|
48796
|
+
},
|
|
48707
48797
|
label: require_sleep.t("Mute", "Silenzia"),
|
|
48708
48798
|
phrase: require_sleep.t("Mute {device}", "Silenzia {device}"),
|
|
48709
48799
|
icon: "volume-x",
|
|
48710
48800
|
args: { muted: true }
|
|
48711
48801
|
}, {
|
|
48712
48802
|
id: "media.unmute",
|
|
48803
|
+
effect: {
|
|
48804
|
+
field: "isMuted",
|
|
48805
|
+
value: false
|
|
48806
|
+
},
|
|
48713
48807
|
label: require_sleep.t("Unmute", "Riattiva l’audio"),
|
|
48714
48808
|
phrase: require_sleep.t("Unmute {device}", "Riattiva l’audio di {device}"),
|
|
48715
48809
|
icon: "volume-2",
|
|
@@ -48724,12 +48818,20 @@ var mediaPlayerCapability = {
|
|
|
48724
48818
|
auth: "protected",
|
|
48725
48819
|
actions: [{
|
|
48726
48820
|
id: "media.shuffleOn",
|
|
48821
|
+
effect: {
|
|
48822
|
+
field: "shuffle",
|
|
48823
|
+
value: true
|
|
48824
|
+
},
|
|
48727
48825
|
label: require_sleep.t("Shuffle on", "Riproduzione casuale attiva"),
|
|
48728
48826
|
phrase: require_sleep.t("Turn on shuffle on {device}", "Attiva la riproduzione casuale su {device}"),
|
|
48729
48827
|
icon: "shuffle",
|
|
48730
48828
|
args: { shuffle: true }
|
|
48731
48829
|
}, {
|
|
48732
48830
|
id: "media.shuffleOff",
|
|
48831
|
+
effect: {
|
|
48832
|
+
field: "shuffle",
|
|
48833
|
+
value: false
|
|
48834
|
+
},
|
|
48733
48835
|
label: require_sleep.t("Shuffle off", "Riproduzione casuale spenta"),
|
|
48734
48836
|
phrase: require_sleep.t("Turn off shuffle on {device}", "Disattiva la riproduzione casuale su {device}"),
|
|
48735
48837
|
icon: "shuffle",
|
|
@@ -48744,6 +48846,10 @@ var mediaPlayerCapability = {
|
|
|
48744
48846
|
auth: "protected",
|
|
48745
48847
|
actions: [{
|
|
48746
48848
|
id: "media.repeat",
|
|
48849
|
+
effect: {
|
|
48850
|
+
field: "repeat",
|
|
48851
|
+
fromArg: "repeat"
|
|
48852
|
+
},
|
|
48747
48853
|
label: require_sleep.t("Set repeat", "Imposta la ripetizione"),
|
|
48748
48854
|
phrase: require_sleep.t("Set repeat on {device} to {repeat}", "Imposta la ripetizione di {device} su {repeat}"),
|
|
48749
48855
|
icon: "repeat",
|
|
@@ -48778,6 +48884,10 @@ var mediaPlayerCapability = {
|
|
|
48778
48884
|
auth: "protected",
|
|
48779
48885
|
actions: [{
|
|
48780
48886
|
id: "media.source",
|
|
48887
|
+
effect: {
|
|
48888
|
+
field: "source",
|
|
48889
|
+
fromArg: "source"
|
|
48890
|
+
},
|
|
48781
48891
|
label: require_sleep.t("Select source", "Scegli la sorgente"),
|
|
48782
48892
|
phrase: require_sleep.t("Switch {device} to {source}", "Passa {device} alla sorgente {source}"),
|
|
48783
48893
|
icon: "cast",
|
|
@@ -59950,7 +60060,9 @@ var deviceStateCapability = {
|
|
|
59950
60060
|
*/
|
|
59951
60061
|
getCapSlice: require_sleep.method(zod.z.object({
|
|
59952
60062
|
deviceId: zod.z.number(),
|
|
59953
|
-
capName: zod.z.string()
|
|
60063
|
+
capName: zod.z.string(),
|
|
60064
|
+
/** The slice the device CONFIRMED, without a held command (D1061) — history and automations. */
|
|
60065
|
+
confirmed: zod.z.boolean().optional()
|
|
59954
60066
|
}), zod.z.record(zod.z.string(), zod.z.unknown()).nullable()),
|
|
59955
60067
|
/**
|
|
59956
60068
|
* Whole-system snapshot — every device's full state in one
|
|
@@ -59959,7 +60071,9 @@ var deviceStateCapability = {
|
|
|
59959
60071
|
* `sm.getDeviceById(id).state.<cap>.value` is sync. Empty inner
|
|
59960
60072
|
* record for devices that haven't emitted any slice yet.
|
|
59961
60073
|
*/
|
|
59962
|
-
getAllSnapshots: require_sleep.method(zod.z.object({
|
|
60074
|
+
getAllSnapshots: require_sleep.method(zod.z.object({
|
|
60075
|
+
/** The slices the devices CONFIRMED, without held commands (D1061). */
|
|
60076
|
+
confirmed: zod.z.boolean().optional() }), zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.unknown())))),
|
|
59963
60077
|
/**
|
|
59964
60078
|
* Canonical cross-layer WRITE for one cap-keyed slice. Used by
|
|
59965
60079
|
* everyone who needs to publish runtime state for a device:
|
|
@@ -60068,6 +60182,116 @@ onChanged: require_sleep.event(zod.z.object({
|
|
|
60068
60182
|
vocabulary: { notOperatorFacing: "the runtime-state mirror every trigger already reads through" }
|
|
60069
60183
|
};
|
|
60070
60184
|
//#endregion
|
|
60185
|
+
//#region src/device/state-refresh.ts
|
|
60186
|
+
/**
|
|
60187
|
+
* Server-driven device state refresh (D1062): the core decides WHEN a device is
|
|
60188
|
+
* re-read, the integration only knows HOW.
|
|
60189
|
+
*
|
|
60190
|
+
* A provider states its policy where it registers the device's
|
|
60191
|
+
* `device-state-refresh` cap (`ctx.registerNativeCap(cap, provider, {
|
|
60192
|
+
* stateRefresh })`). It reaches the hub by the road the command-hold options
|
|
60193
|
+
* take (D1061): written directly in-process, carried on a forked child's cap
|
|
60194
|
+
* descriptors otherwise. Plain data, wire-safe.
|
|
60195
|
+
*/
|
|
60196
|
+
/** Why the core asks for a refresh. */
|
|
60197
|
+
var StateRefreshReasonSchema = zod.z.enum([
|
|
60198
|
+
"schedule",
|
|
60199
|
+
"command",
|
|
60200
|
+
"burst"
|
|
60201
|
+
]);
|
|
60202
|
+
/**
|
|
60203
|
+
* What arrives without asking: `none` (everything is read), `partial` (some
|
|
60204
|
+
* fields arrive by push, the rest is read on the schedule), `full` (everything
|
|
60205
|
+
* arrives by push — never read on a schedule).
|
|
60206
|
+
*/
|
|
60207
|
+
var StateRefreshPushSchema = zod.z.enum([
|
|
60208
|
+
"none",
|
|
60209
|
+
"partial",
|
|
60210
|
+
"full"
|
|
60211
|
+
]);
|
|
60212
|
+
/** The fastest base cadence the core accepts from any provider. */
|
|
60213
|
+
var MIN_STATE_REFRESH_INTERVAL_MS = 1e3;
|
|
60214
|
+
var StateRefreshPolicySchema = zod.z.object({
|
|
60215
|
+
/**
|
|
60216
|
+
* The integration instance the device belongs to. Devices of one instance
|
|
60217
|
+
* share one schedule group: a batching provider is asked once for all of
|
|
60218
|
+
* them, and the heartbeat is judged across them.
|
|
60219
|
+
*/
|
|
60220
|
+
integrationId: zod.z.string().min(1),
|
|
60221
|
+
/** The fastest interval the integration can afford for its devices. The core polls at it by default. */
|
|
60222
|
+
minIntervalMs: zod.z.number().int().min(MIN_STATE_REFRESH_INTERVAL_MS),
|
|
60223
|
+
/**
|
|
60224
|
+
* The operator's per-integration setting, when there is one. It can only SLOW
|
|
60225
|
+
* the cadence: the core polls at `max(minIntervalMs, intervalMs)`.
|
|
60226
|
+
*/
|
|
60227
|
+
intervalMs: zod.z.number().int().positive().optional(),
|
|
60228
|
+
/** One `refresh` call can read every device of the integration at once. */
|
|
60229
|
+
batch: zod.z.boolean(),
|
|
60230
|
+
push: StateRefreshPushSchema,
|
|
60231
|
+
/** Longest silence a push integration may keep before the core re-reads it and asks it to resubscribe. */
|
|
60232
|
+
heartbeatMs: zod.z.number().int().positive().optional(),
|
|
60233
|
+
/**
|
|
60234
|
+
* Bumped by the provider each time its push subscription reconnected on its
|
|
60235
|
+
* own. A change makes the core re-read every device of the integration
|
|
60236
|
+
* (pushes lost while it was down; events may be dropped, D8).
|
|
60237
|
+
*/
|
|
60238
|
+
connectionEpoch: zod.z.number().int().nonnegative().optional()
|
|
60239
|
+
});
|
|
60240
|
+
/** The cadence the core runs a policy at: the declared minimum, slowed (never sped up) by the setting. */
|
|
60241
|
+
function effectiveRefreshIntervalMs(policy) {
|
|
60242
|
+
const setting = policy.intervalMs ?? 0;
|
|
60243
|
+
return Math.max(policy.minIntervalMs, setting);
|
|
60244
|
+
}
|
|
60245
|
+
/** The burst after a command on a read (non-push) device: offsets from the command, in ms. */
|
|
60246
|
+
var COMMAND_BURST_OFFSETS_MS = [3e3, 1e4];
|
|
60247
|
+
/** How long the core waits for a push device to confirm a command before reading it once. */
|
|
60248
|
+
var PUSH_CONFIRM_WINDOW_MS = 2500;
|
|
60249
|
+
//#endregion
|
|
60250
|
+
//#region src/capabilities/device-state-refresh.cap.ts
|
|
60251
|
+
/**
|
|
60252
|
+
* device-state-refresh — the HOW of a device's state refresh, called by the
|
|
60253
|
+
* core, which owns the WHEN (D1062).
|
|
60254
|
+
*
|
|
60255
|
+
* The provider registers it per device with its policy
|
|
60256
|
+
* (`registerNativeCap(cap, provider, { stateRefresh })`). The hub's scheduler
|
|
60257
|
+
* calls `refresh` on the schedule, after a command and in the burst that
|
|
60258
|
+
* follows it, and `resubscribe` when a push integration fell silent. The
|
|
60259
|
+
* provider re-reads and writes the slices it already writes; nothing is
|
|
60260
|
+
* returned but completion.
|
|
60261
|
+
*/
|
|
60262
|
+
var DeviceStateRefreshInputSchema = zod.z.object({
|
|
60263
|
+
/** The device the call is routed by (one of `deviceIds`). */
|
|
60264
|
+
deviceId: zod.z.number().int().nonnegative(),
|
|
60265
|
+
/** Every device to re-read: one, or the integration's whole set when the provider batches. */
|
|
60266
|
+
deviceIds: zod.z.array(zod.z.number().int().nonnegative()).min(1),
|
|
60267
|
+
reason: StateRefreshReasonSchema
|
|
60268
|
+
});
|
|
60269
|
+
var DeviceStateResubscribeInputSchema = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
|
|
60270
|
+
var DeviceStateRefreshResultSchema = zod.z.object({ ok: zod.z.literal(true) });
|
|
60271
|
+
var NOT_OPERATOR_FACING = "the core schedules state refreshes itself; an operator never asks for one";
|
|
60272
|
+
var deviceStateRefreshCapability = {
|
|
60273
|
+
name: "device-state-refresh",
|
|
60274
|
+
scope: "device",
|
|
60275
|
+
deviceNative: true,
|
|
60276
|
+
mode: "singleton",
|
|
60277
|
+
methods: {
|
|
60278
|
+
refresh: require_sleep.method(DeviceStateRefreshInputSchema, DeviceStateRefreshResultSchema, {
|
|
60279
|
+
kind: "mutation",
|
|
60280
|
+
auth: "admin",
|
|
60281
|
+
notOperatorFacing: NOT_OPERATOR_FACING
|
|
60282
|
+
}),
|
|
60283
|
+
resubscribe: require_sleep.method(DeviceStateResubscribeInputSchema, DeviceStateRefreshResultSchema, {
|
|
60284
|
+
kind: "mutation",
|
|
60285
|
+
auth: "admin",
|
|
60286
|
+
notOperatorFacing: NOT_OPERATOR_FACING
|
|
60287
|
+
})
|
|
60288
|
+
},
|
|
60289
|
+
vocabulary: {
|
|
60290
|
+
noun: require_sleep.t("State refresh", "Aggiornamento dello stato"),
|
|
60291
|
+
order: 3247
|
|
60292
|
+
}
|
|
60293
|
+
};
|
|
60294
|
+
//#endregion
|
|
60071
60295
|
//#region src/capabilities/device-status.cap.ts
|
|
60072
60296
|
/**
|
|
60073
60297
|
* Generic device-level status snapshot. Auto-registered by `BaseDevice`
|
|
@@ -63041,7 +63265,15 @@ var fanControlCapability = {
|
|
|
63041
63265
|
field: "speed",
|
|
63042
63266
|
value: 100
|
|
63043
63267
|
},
|
|
63044
|
-
args: { speed: 100 }
|
|
63268
|
+
args: { speed: 100 },
|
|
63269
|
+
sideEffects: [{
|
|
63270
|
+
field: "preset",
|
|
63271
|
+
value: "",
|
|
63272
|
+
when: {
|
|
63273
|
+
field: "preset",
|
|
63274
|
+
notIn: [""]
|
|
63275
|
+
}
|
|
63276
|
+
}]
|
|
63045
63277
|
},
|
|
63046
63278
|
{
|
|
63047
63279
|
id: "fan.speed",
|
|
@@ -63052,6 +63284,14 @@ var fanControlCapability = {
|
|
|
63052
63284
|
field: "speed",
|
|
63053
63285
|
fromArg: "speed"
|
|
63054
63286
|
},
|
|
63287
|
+
sideEffects: [{
|
|
63288
|
+
field: "preset",
|
|
63289
|
+
value: "",
|
|
63290
|
+
when: {
|
|
63291
|
+
field: "preset",
|
|
63292
|
+
notIn: [""]
|
|
63293
|
+
}
|
|
63294
|
+
}],
|
|
63055
63295
|
openArgs: [{
|
|
63056
63296
|
key: "speed",
|
|
63057
63297
|
label: require_sleep.t("Speed", "Velocità"),
|
|
@@ -63077,6 +63317,10 @@ var fanControlCapability = {
|
|
|
63077
63317
|
label: require_sleep.t("Set preset", "Imposta il preset"),
|
|
63078
63318
|
phrase: require_sleep.t("Set {device} to preset {preset}", "Imposta {device} sul preset {preset}"),
|
|
63079
63319
|
icon: "list",
|
|
63320
|
+
effect: {
|
|
63321
|
+
field: "preset",
|
|
63322
|
+
fromArg: "preset"
|
|
63323
|
+
},
|
|
63080
63324
|
openArgs: [{
|
|
63081
63325
|
key: "preset",
|
|
63082
63326
|
label: require_sleep.t("Preset", "Preset"),
|
|
@@ -70031,6 +70275,14 @@ var lockControlCapability = {
|
|
|
70031
70275
|
field: "state",
|
|
70032
70276
|
value: "locked"
|
|
70033
70277
|
},
|
|
70278
|
+
hold: { effects: [{
|
|
70279
|
+
field: "state",
|
|
70280
|
+
value: "locking",
|
|
70281
|
+
when: {
|
|
70282
|
+
field: "state",
|
|
70283
|
+
notIn: ["locked"]
|
|
70284
|
+
}
|
|
70285
|
+
}] },
|
|
70034
70286
|
openArgs: [{
|
|
70035
70287
|
key: "code",
|
|
70036
70288
|
label: require_sleep.t("PIN code", "Codice PIN"),
|
|
@@ -70064,6 +70316,14 @@ var lockControlCapability = {
|
|
|
70064
70316
|
field: "state",
|
|
70065
70317
|
value: "unlocked"
|
|
70066
70318
|
},
|
|
70319
|
+
hold: { effects: [{
|
|
70320
|
+
field: "state",
|
|
70321
|
+
value: "unlocking",
|
|
70322
|
+
when: {
|
|
70323
|
+
field: "state",
|
|
70324
|
+
notIn: ["unlocked"]
|
|
70325
|
+
}
|
|
70326
|
+
}] },
|
|
70067
70327
|
openArgs: [{
|
|
70068
70328
|
key: "code",
|
|
70069
70329
|
label: require_sleep.t("PIN code", "Codice PIN"),
|
|
@@ -85508,6 +85768,16 @@ var osdManagerCapability = {
|
|
|
85508
85768
|
vocabulary: { notOperatorFacing: require_sleep.NOT_A_DEVICE.PIPELINE }
|
|
85509
85769
|
};
|
|
85510
85770
|
//#endregion
|
|
85771
|
+
//#region src/device/cap-vocabulary/hold-limits.ts
|
|
85772
|
+
/**
|
|
85773
|
+
* Hold limits a cap's vocabulary may declare on an action (D1061).
|
|
85774
|
+
*
|
|
85775
|
+
* A one-shot command (feed, run a script) has no lasting state to confirm; it
|
|
85776
|
+
* holds its in-progress flag just long enough that a second tap, before the
|
|
85777
|
+
* device reports, is seen as "already running" and refused.
|
|
85778
|
+
*/
|
|
85779
|
+
var ONE_SHOT_HOLD_MS = 1e4;
|
|
85780
|
+
//#endregion
|
|
85511
85781
|
//#region src/capabilities/pet-feeder.cap.ts
|
|
85512
85782
|
/**
|
|
85513
85783
|
* PetKit pet-feeder cap. Models the control + telemetry surface of a
|
|
@@ -85659,6 +85929,13 @@ var petFeederCapability = {
|
|
|
85659
85929
|
label: require_sleep.t("Feed", "Dai da mangiare"),
|
|
85660
85930
|
phrase: require_sleep.t("Dispense {grams} from {device}", "Eroga {grams} da {device}"),
|
|
85661
85931
|
icon: "paw-print",
|
|
85932
|
+
hold: {
|
|
85933
|
+
effects: [{
|
|
85934
|
+
field: "feeding",
|
|
85935
|
+
value: true
|
|
85936
|
+
}],
|
|
85937
|
+
holdMs: ONE_SHOT_HOLD_MS
|
|
85938
|
+
},
|
|
85662
85939
|
openArgs: [{
|
|
85663
85940
|
key: "grams",
|
|
85664
85941
|
label: require_sleep.t("Grams", "Grammi"),
|
|
@@ -85677,6 +85954,13 @@ var petFeederCapability = {
|
|
|
85677
85954
|
label: require_sleep.t("Feed from both hoppers", "Eroga da entrambi i serbatoi"),
|
|
85678
85955
|
phrase: require_sleep.t("Dispense {hopper1} and {hopper2} from {device}", "Eroga {hopper1} e {hopper2} da {device}"),
|
|
85679
85956
|
icon: "paw-print",
|
|
85957
|
+
hold: {
|
|
85958
|
+
effects: [{
|
|
85959
|
+
field: "feeding",
|
|
85960
|
+
value: true
|
|
85961
|
+
}],
|
|
85962
|
+
holdMs: ONE_SHOT_HOLD_MS
|
|
85963
|
+
},
|
|
85680
85964
|
openArgs: [{
|
|
85681
85965
|
key: "hopper1",
|
|
85682
85966
|
label: require_sleep.t("Hopper 1", "Serbatoio 1"),
|
|
@@ -85782,12 +86066,20 @@ var petFeederCapability = {
|
|
|
85782
86066
|
auth: "protected",
|
|
85783
86067
|
actions: [{
|
|
85784
86068
|
id: "petFeeder.childLockOn",
|
|
86069
|
+
effect: {
|
|
86070
|
+
field: "childLock",
|
|
86071
|
+
value: true
|
|
86072
|
+
},
|
|
85785
86073
|
label: require_sleep.t("Child lock on", "Blocco bambini attivo"),
|
|
85786
86074
|
phrase: require_sleep.t("Turn on the child lock of {device}", "Attiva il blocco bambini di {device}"),
|
|
85787
86075
|
icon: "lock",
|
|
85788
86076
|
args: { on: true }
|
|
85789
86077
|
}, {
|
|
85790
86078
|
id: "petFeeder.childLockOff",
|
|
86079
|
+
effect: {
|
|
86080
|
+
field: "childLock",
|
|
86081
|
+
value: false
|
|
86082
|
+
},
|
|
85791
86083
|
label: require_sleep.t("Child lock off", "Blocco bambini spento"),
|
|
85792
86084
|
phrase: require_sleep.t("Turn off the child lock of {device}", "Disattiva il blocco bambini di {device}"),
|
|
85793
86085
|
icon: "lock-open",
|
|
@@ -85803,12 +86095,20 @@ var petFeederCapability = {
|
|
|
85803
86095
|
auth: "protected",
|
|
85804
86096
|
actions: [{
|
|
85805
86097
|
id: "petFeeder.lightOn",
|
|
86098
|
+
effect: {
|
|
86099
|
+
field: "indicatorLight",
|
|
86100
|
+
value: true
|
|
86101
|
+
},
|
|
85806
86102
|
label: require_sleep.t("Indicator light on", "Spia accesa"),
|
|
85807
86103
|
phrase: require_sleep.t("Turn on the indicator light of {device}", "Accendi la spia di {device}"),
|
|
85808
86104
|
icon: "lightbulb",
|
|
85809
86105
|
args: { on: true }
|
|
85810
86106
|
}, {
|
|
85811
86107
|
id: "petFeeder.lightOff",
|
|
86108
|
+
effect: {
|
|
86109
|
+
field: "indicatorLight",
|
|
86110
|
+
value: false
|
|
86111
|
+
},
|
|
85812
86112
|
label: require_sleep.t("Indicator light off", "Spia spenta"),
|
|
85813
86113
|
phrase: require_sleep.t("Turn off the indicator light of {device}", "Spegni la spia di {device}"),
|
|
85814
86114
|
icon: "lightbulb-off",
|
|
@@ -85824,12 +86124,20 @@ var petFeederCapability = {
|
|
|
85824
86124
|
auth: "protected",
|
|
85825
86125
|
actions: [{
|
|
85826
86126
|
id: "petFeeder.feedSoundOn",
|
|
86127
|
+
effect: {
|
|
86128
|
+
field: "feedSound",
|
|
86129
|
+
value: true
|
|
86130
|
+
},
|
|
85827
86131
|
label: require_sleep.t("Feeding sound on", "Suono di erogazione attivo"),
|
|
85828
86132
|
phrase: require_sleep.t("Turn on the feeding sound of {device}", "Attiva il suono di erogazione di {device}"),
|
|
85829
86133
|
icon: "volume-2",
|
|
85830
86134
|
args: { on: true }
|
|
85831
86135
|
}, {
|
|
85832
86136
|
id: "petFeeder.feedSoundOff",
|
|
86137
|
+
effect: {
|
|
86138
|
+
field: "feedSound",
|
|
86139
|
+
value: false
|
|
86140
|
+
},
|
|
85833
86141
|
label: require_sleep.t("Feeding sound off", "Suono di erogazione spento"),
|
|
85834
86142
|
phrase: require_sleep.t("Turn off the feeding sound of {device}", "Disattiva il suono di erogazione di {device}"),
|
|
85835
86143
|
icon: "volume-x",
|
|
@@ -85845,6 +86153,10 @@ var petFeederCapability = {
|
|
|
85845
86153
|
auth: "protected",
|
|
85846
86154
|
actions: [{
|
|
85847
86155
|
id: "petFeeder.volume",
|
|
86156
|
+
effect: {
|
|
86157
|
+
field: "volume",
|
|
86158
|
+
fromArg: "level"
|
|
86159
|
+
},
|
|
85848
86160
|
label: require_sleep.t("Set volume", "Imposta il volume"),
|
|
85849
86161
|
phrase: require_sleep.t("Set the volume of {device} to {level}", "Imposta il volume di {device} a {level}"),
|
|
85850
86162
|
icon: "volume-2",
|
|
@@ -86013,12 +86325,20 @@ setPump: require_sleep.method(zod.z.object({
|
|
|
86013
86325
|
auth: "protected",
|
|
86014
86326
|
actions: [{
|
|
86015
86327
|
id: "petFountain.pumpOn",
|
|
86328
|
+
effect: {
|
|
86329
|
+
field: "pumpRunning",
|
|
86330
|
+
value: true
|
|
86331
|
+
},
|
|
86016
86332
|
label: require_sleep.t("Pump on", "Pompa accesa"),
|
|
86017
86333
|
phrase: require_sleep.t("Start the pump of {device}", "Avvia la pompa di {device}"),
|
|
86018
86334
|
icon: "play",
|
|
86019
86335
|
args: { on: true }
|
|
86020
86336
|
}, {
|
|
86021
86337
|
id: "petFountain.pumpOff",
|
|
86338
|
+
effect: {
|
|
86339
|
+
field: "pumpRunning",
|
|
86340
|
+
value: false
|
|
86341
|
+
},
|
|
86022
86342
|
label: require_sleep.t("Pump off", "Pompa spenta"),
|
|
86023
86343
|
phrase: require_sleep.t("Stop the pump of {device}", "Ferma la pompa di {device}"),
|
|
86024
86344
|
icon: "square",
|
|
@@ -90319,12 +90639,20 @@ var pumpCycleCapability = {
|
|
|
90319
90639
|
auth: "protected",
|
|
90320
90640
|
actions: [{
|
|
90321
90641
|
id: "pumpCycle.on",
|
|
90642
|
+
effect: {
|
|
90643
|
+
field: "enabled",
|
|
90644
|
+
value: true
|
|
90645
|
+
},
|
|
90322
90646
|
label: require_sleep.t("Pump cycle on", "Ciclo pompa attivo"),
|
|
90323
90647
|
phrase: require_sleep.t("Run the pump of {device} on its on/off cycle", "Fai lavorare la pompa di {device} a ciclo acceso/spento"),
|
|
90324
90648
|
icon: "timer",
|
|
90325
90649
|
args: { on: true }
|
|
90326
90650
|
}, {
|
|
90327
90651
|
id: "pumpCycle.off",
|
|
90652
|
+
effect: {
|
|
90653
|
+
field: "enabled",
|
|
90654
|
+
value: false
|
|
90655
|
+
},
|
|
90328
90656
|
label: require_sleep.t("Pump cycle off", "Ciclo pompa spento"),
|
|
90329
90657
|
phrase: require_sleep.t("Run the pump of {device} continuously", "Fai lavorare la pompa di {device} in continuo"),
|
|
90330
90658
|
icon: "timer-off",
|
|
@@ -90343,6 +90671,11 @@ var pumpCycleCapability = {
|
|
|
90343
90671
|
label: require_sleep.t("Set pump run time", "Imposta il tempo di lavoro della pompa"),
|
|
90344
90672
|
phrase: require_sleep.t("Set the pump of {device} to run {minutes} minutes per cycle", "Imposta la pompa di {device} a lavorare {minutes} minuti per ciclo"),
|
|
90345
90673
|
icon: "timer",
|
|
90674
|
+
effect: {
|
|
90675
|
+
field: "onTime",
|
|
90676
|
+
fromArg: "minutes",
|
|
90677
|
+
scale: 60
|
|
90678
|
+
},
|
|
90346
90679
|
openArgs: [{
|
|
90347
90680
|
key: "minutes",
|
|
90348
90681
|
label: require_sleep.t("Minutes", "Minuti"),
|
|
@@ -90367,6 +90700,11 @@ var pumpCycleCapability = {
|
|
|
90367
90700
|
label: require_sleep.t("Set pump rest time", "Imposta il tempo di riposo della pompa"),
|
|
90368
90701
|
phrase: require_sleep.t("Set the pump of {device} to rest {minutes} minutes per cycle", "Imposta la pompa di {device} a riposare {minutes} minuti per ciclo"),
|
|
90369
90702
|
icon: "timer-off",
|
|
90703
|
+
effect: {
|
|
90704
|
+
field: "offTime",
|
|
90705
|
+
fromArg: "minutes",
|
|
90706
|
+
scale: 60
|
|
90707
|
+
},
|
|
90370
90708
|
openArgs: [{
|
|
90371
90709
|
key: "minutes",
|
|
90372
90710
|
label: require_sleep.t("Minutes", "Minuti"),
|
|
@@ -95330,7 +95668,14 @@ var scriptRunnerCapability = {
|
|
|
95330
95668
|
id: "script.run",
|
|
95331
95669
|
label: require_sleep.t("Run script", "Esegui lo script"),
|
|
95332
95670
|
phrase: require_sleep.t("Run {device}", "Esegui {device}"),
|
|
95333
|
-
icon: "scroll-text"
|
|
95671
|
+
icon: "scroll-text",
|
|
95672
|
+
hold: {
|
|
95673
|
+
effects: [{
|
|
95674
|
+
field: "isRunning",
|
|
95675
|
+
value: true
|
|
95676
|
+
}],
|
|
95677
|
+
holdMs: ONE_SHOT_HOLD_MS
|
|
95678
|
+
}
|
|
95334
95679
|
}]
|
|
95335
95680
|
}),
|
|
95336
95681
|
/** Cancel a running script. Provider rejects when the script
|
|
@@ -95340,6 +95685,10 @@ var scriptRunnerCapability = {
|
|
|
95340
95685
|
auth: "admin",
|
|
95341
95686
|
actions: [{
|
|
95342
95687
|
id: "script.stop",
|
|
95688
|
+
effect: {
|
|
95689
|
+
field: "isRunning",
|
|
95690
|
+
value: false
|
|
95691
|
+
},
|
|
95343
95692
|
label: require_sleep.t("Stop script", "Ferma lo script"),
|
|
95344
95693
|
phrase: require_sleep.t("Stop {device}", "Ferma {device}"),
|
|
95345
95694
|
icon: "square"
|
|
@@ -97892,6 +98241,10 @@ var switchCapability = {
|
|
|
97892
98241
|
auth: "protected",
|
|
97893
98242
|
actions: [{
|
|
97894
98243
|
id: "switch.toggle",
|
|
98244
|
+
sideEffects: [{
|
|
98245
|
+
field: "on",
|
|
98246
|
+
negate: true
|
|
98247
|
+
}],
|
|
97895
98248
|
label: require_sleep.t("Toggle", "Commuta"),
|
|
97896
98249
|
phrase: require_sleep.t("Toggle {device}", "Commuta {device}"),
|
|
97897
98250
|
icon: "toggle-right",
|
|
@@ -104354,6 +104707,7 @@ var CAPABILITY_NAMES = {
|
|
|
104354
104707
|
deviceRemovalHook: "device-removal-hook",
|
|
104355
104708
|
deviceRuns: "device-runs",
|
|
104356
104709
|
deviceState: "device-state",
|
|
104710
|
+
deviceStateRefresh: "device-state-refresh",
|
|
104357
104711
|
deviceStatus: "device-status",
|
|
104358
104712
|
deviceTransitions: "device-transitions",
|
|
104359
104713
|
dishwasher: "dishwasher",
|
|
@@ -104759,6 +105113,10 @@ var CAPABILITY_ROUTER_KEYS = [
|
|
|
104759
105113
|
key: "deviceState",
|
|
104760
105114
|
name: "device-state"
|
|
104761
105115
|
},
|
|
105116
|
+
{
|
|
105117
|
+
key: "deviceStateRefresh",
|
|
105118
|
+
name: "device-state-refresh"
|
|
105119
|
+
},
|
|
104762
105120
|
{
|
|
104763
105121
|
key: "deviceStatus",
|
|
104764
105122
|
name: "device-status"
|
|
@@ -105433,6 +105791,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
105433
105791
|
deviceRemovalHookCapability,
|
|
105434
105792
|
deviceRunsCapability,
|
|
105435
105793
|
deviceStateCapability,
|
|
105794
|
+
deviceStateRefreshCapability,
|
|
105436
105795
|
deviceStatusCapability,
|
|
105437
105796
|
deviceTransitionsCapability,
|
|
105438
105797
|
dishwasherCapability,
|
|
@@ -123145,6 +123504,20 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
123145
123504
|
access: "create",
|
|
123146
123505
|
role: "admin"
|
|
123147
123506
|
},
|
|
123507
|
+
"deviceStateRefresh.refresh": {
|
|
123508
|
+
capName: "device-state-refresh",
|
|
123509
|
+
capScope: "device",
|
|
123510
|
+
addonId: null,
|
|
123511
|
+
access: "create",
|
|
123512
|
+
role: "admin"
|
|
123513
|
+
},
|
|
123514
|
+
"deviceStateRefresh.resubscribe": {
|
|
123515
|
+
capName: "device-state-refresh",
|
|
123516
|
+
capScope: "device",
|
|
123517
|
+
addonId: null,
|
|
123518
|
+
access: "create",
|
|
123519
|
+
role: "admin"
|
|
123520
|
+
},
|
|
123148
123521
|
"deviceStatus.getStatus": {
|
|
123149
123522
|
capName: "device-status",
|
|
123150
123523
|
capScope: "device",
|
|
@@ -130785,6 +131158,7 @@ var KNOWN_CAP_NAMES = [
|
|
|
130785
131158
|
"device-removal-hook",
|
|
130786
131159
|
"device-runs",
|
|
130787
131160
|
"device-state",
|
|
131161
|
+
"device-state-refresh",
|
|
130788
131162
|
"device-status",
|
|
130789
131163
|
"device-transitions",
|
|
130790
131164
|
"dishwasher",
|
|
@@ -130967,6 +131341,7 @@ var DEVICE_CAP_NAMES = [
|
|
|
130967
131341
|
"device-extension",
|
|
130968
131342
|
"device-ops",
|
|
130969
131343
|
"device-runs",
|
|
131344
|
+
"device-state-refresh",
|
|
130970
131345
|
"device-status",
|
|
130971
131346
|
"device-transitions",
|
|
130972
131347
|
"dishwasher",
|
|
@@ -134086,6 +134461,20 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
|
|
|
134086
134461
|
form: "single",
|
|
134087
134462
|
optional: false
|
|
134088
134463
|
}],
|
|
134464
|
+
"deviceStateRefresh.refresh": [{
|
|
134465
|
+
name: "deviceId",
|
|
134466
|
+
form: "single",
|
|
134467
|
+
optional: false
|
|
134468
|
+
}, {
|
|
134469
|
+
name: "deviceIds",
|
|
134470
|
+
form: "array",
|
|
134471
|
+
optional: false
|
|
134472
|
+
}],
|
|
134473
|
+
"deviceStateRefresh.resubscribe": [{
|
|
134474
|
+
name: "deviceId",
|
|
134475
|
+
form: "single",
|
|
134476
|
+
optional: false
|
|
134477
|
+
}],
|
|
134089
134478
|
"deviceStatus.getStatus": [{
|
|
134090
134479
|
name: "deviceId",
|
|
134091
134480
|
form: "single",
|
|
@@ -150793,6 +151182,45 @@ function searchRank(rawQuery, fields) {
|
|
|
150793
151182
|
return matchRank(label, keywords, (fields.identifiers ?? []).map(normalizeSearchText).filter((identifier) => identifier.length > 0), query) ?? fuzzyMatchRank(label, query) ?? bestFuzzy(keywords, query);
|
|
150794
151183
|
}
|
|
150795
151184
|
//#endregion
|
|
151185
|
+
//#region src/device/command-hold.ts
|
|
151186
|
+
/**
|
|
151187
|
+
* How long a command is held when nothing says otherwise. Equal to the
|
|
151188
|
+
* transition correlator's match window (D1022), so a hold that reverts and a
|
|
151189
|
+
* command recorded `unconfirmed` are the same event.
|
|
151190
|
+
*/
|
|
151191
|
+
var DEFAULT_COMMAND_HOLD_MS = 3e4;
|
|
151192
|
+
/** The longest hold a provider may ask for: a value the device never confirms is not shown for long. */
|
|
151193
|
+
var MAX_COMMAND_HOLD_MS = 12e4;
|
|
151194
|
+
function clampHoldMs(ms) {
|
|
151195
|
+
if (ms === void 0 || !Number.isFinite(ms)) return DEFAULT_COMMAND_HOLD_MS;
|
|
151196
|
+
return Math.min(MAX_COMMAND_HOLD_MS, Math.max(1, Math.round(ms)));
|
|
151197
|
+
}
|
|
151198
|
+
function resolveList(list, args, current, shown, into) {
|
|
151199
|
+
for (const entry of list) {
|
|
151200
|
+
if (!require_sleep.effectConditionHolds(entry.when, current)) continue;
|
|
151201
|
+
const resolved = require_sleep.resolveSideEffect(entry, args, shown);
|
|
151202
|
+
if (resolved !== null && !into.some((e) => e.field === resolved.field)) into.push(resolved);
|
|
151203
|
+
}
|
|
151204
|
+
}
|
|
151205
|
+
/**
|
|
151206
|
+
* What to hold for `cap.method(args)` given the cap's slice when it arrived
|
|
151207
|
+
* (`current`, as the device reported it; `shown`, with the held values over
|
|
151208
|
+
* it — what a `negate` flips) and the provider's option for the method.
|
|
151209
|
+
* `null` = hold nothing (`never`, or a command that leads to no state).
|
|
151210
|
+
*/
|
|
151211
|
+
function resolveCommandHold(cap, method, args, current, option, shown = current) {
|
|
151212
|
+
if (option?.hold === "never") return null;
|
|
151213
|
+
const effects = [];
|
|
151214
|
+
if (option?.effects !== void 0) resolveList(option.effects, args, current, shown, effects);
|
|
151215
|
+
else effects.push(...require_sleep.commandEffects(cap, method, args, current, shown));
|
|
151216
|
+
if (option?.extraEffects !== void 0) resolveList(option.extraEffects, args, current, shown, effects);
|
|
151217
|
+
if (effects.length === 0) return null;
|
|
151218
|
+
return {
|
|
151219
|
+
effects,
|
|
151220
|
+
holdMs: clampHoldMs(option?.holdMs ?? require_sleep.commandHoldMs(cap, method, args))
|
|
151221
|
+
};
|
|
151222
|
+
}
|
|
151223
|
+
//#endregion
|
|
150796
151224
|
exports.ACCESSORY_LABEL = ACCESSORY_LABEL;
|
|
150797
151225
|
exports.ACCESS_ROLES = ACCESS_ROLES;
|
|
150798
151226
|
exports.ACTION_RUN_MAX_MS = ACTION_RUN_MAX_MS;
|
|
@@ -151083,6 +151511,7 @@ exports.CLUSTER_MODEL_SECTION_ID = CLUSTER_MODEL_SECTION_ID;
|
|
|
151083
151511
|
exports.CLUSTER_STEP_SETTING_FIELDS = CLUSTER_STEP_SETTING_FIELDS;
|
|
151084
151512
|
exports.COCO_80_LABELS = COCO_80_LABELS;
|
|
151085
151513
|
exports.COCO_TO_MACRO = COCO_TO_MACRO;
|
|
151514
|
+
exports.COMMAND_BURST_OFFSETS_MS = COMMAND_BURST_OFFSETS_MS;
|
|
151086
151515
|
exports.COMPOSED_DEVICE_STABLE_ID_PREFIX = require_composed_stable_id.COMPOSED_DEVICE_STABLE_ID_PREFIX;
|
|
151087
151516
|
exports.COMPOSED_ITEM_FIXED_FIELDS = COMPOSED_ITEM_FIXED_FIELDS;
|
|
151088
151517
|
exports.COMPOSER_ADDON_ID = require_implemented_methods.COMPOSER_ADDON_ID;
|
|
@@ -151328,6 +151757,7 @@ exports.DEFAULT_CAMERA_SENSOR_MODE = DEFAULT_CAMERA_SENSOR_MODE;
|
|
|
151328
151757
|
exports.DEFAULT_CATALOG_LANG = DEFAULT_CATALOG_LANG;
|
|
151329
151758
|
exports.DEFAULT_CLUSTER_STEP_MODELS = DEFAULT_CLUSTER_STEP_MODELS;
|
|
151330
151759
|
exports.DEFAULT_CLUSTER_STEP_SETTINGS = DEFAULT_CLUSTER_STEP_SETTINGS;
|
|
151760
|
+
exports.DEFAULT_COMMAND_HOLD_MS = DEFAULT_COMMAND_HOLD_MS;
|
|
151331
151761
|
exports.DEFAULT_CORE_BLOCK_ENTRY = DEFAULT_CORE_BLOCK_ENTRY;
|
|
151332
151762
|
exports.DEFAULT_DECODER_HWACCEL_CONFIG = DEFAULT_DECODER_HWACCEL_CONFIG;
|
|
151333
151763
|
exports.DEFAULT_DETAIL_CROP_CONVENTION = DEFAULT_DETAIL_CROP_CONVENTION;
|
|
@@ -151527,6 +151957,9 @@ exports.DeviceSearchRequiresSchema = DeviceSearchRequiresSchema;
|
|
|
151527
151957
|
exports.DeviceSearchResultSchema = DeviceSearchResultSchema;
|
|
151528
151958
|
exports.DeviceSelectorSchema = DeviceSelectorSchema;
|
|
151529
151959
|
exports.DeviceSignaturePurposeSchema = DeviceSignaturePurposeSchema;
|
|
151960
|
+
exports.DeviceStateRefreshInputSchema = DeviceStateRefreshInputSchema;
|
|
151961
|
+
exports.DeviceStateRefreshResultSchema = DeviceStateRefreshResultSchema;
|
|
151962
|
+
exports.DeviceStateResubscribeInputSchema = DeviceStateResubscribeInputSchema;
|
|
151530
151963
|
exports.DeviceStatusSchema = DeviceStatusSchema;
|
|
151531
151964
|
exports.DeviceTemplateRefusalSchema = DeviceTemplateRefusalSchema;
|
|
151532
151965
|
exports.DeviceTemplateRenderSchema = DeviceTemplateRenderSchema;
|
|
@@ -152076,6 +152509,7 @@ exports.MAX_BIRTH_LATENCY_PROXY_MS = MAX_BIRTH_LATENCY_PROXY_MS;
|
|
|
152076
152509
|
exports.MAX_CAMERA_SENSORS = MAX_CAMERA_SENSORS;
|
|
152077
152510
|
exports.MAX_CLIP_EVENT_IDS = MAX_CLIP_EVENT_IDS;
|
|
152078
152511
|
exports.MAX_CLIP_LABELS = MAX_CLIP_LABELS;
|
|
152512
|
+
exports.MAX_COMMAND_HOLD_MS = MAX_COMMAND_HOLD_MS;
|
|
152079
152513
|
exports.MAX_COMPONENT_BUTTONS = MAX_COMPONENT_BUTTONS;
|
|
152080
152514
|
exports.MAX_COMPOSITION_CODE_LENGTH = require_implemented_methods.MAX_COMPOSITION_CODE_LENGTH;
|
|
152081
152515
|
exports.MAX_COMPOSITION_FEATURES = require_implemented_methods.MAX_COMPOSITION_FEATURES;
|
|
@@ -152125,6 +152559,7 @@ exports.MIN_CUSTOM_MINUTES = require_implemented_methods.MIN_CUSTOM_MINUTES;
|
|
|
152125
152559
|
exports.MIN_RUN_MS = MIN_RUN_MS;
|
|
152126
152560
|
exports.MIN_SCRUBBED_LENGTH = require_sleep.MIN_SCRUBBED_LENGTH;
|
|
152127
152561
|
exports.MIN_SESSIONS_PER_DEVICE_RANGE = MIN_SESSIONS_PER_DEVICE_RANGE;
|
|
152562
|
+
exports.MIN_STATE_REFRESH_INTERVAL_MS = MIN_STATE_REFRESH_INTERVAL_MS;
|
|
152128
152563
|
exports.MODEL_FORMATS = require_sleep.MODEL_FORMATS;
|
|
152129
152564
|
exports.MODEL_HOSTING = MODEL_HOSTING;
|
|
152130
152565
|
exports.MODEL_PROVIDER_IDS = MODEL_PROVIDER_IDS;
|
|
@@ -152516,6 +152951,7 @@ exports.NumericSensorStatusSchema = NumericSensorStatusSchema;
|
|
|
152516
152951
|
exports.OAUTH_LANDING_PATH = OAUTH_LANDING_PATH;
|
|
152517
152952
|
exports.OAUTH_LANDING_REASONS = OAUTH_LANDING_REASONS;
|
|
152518
152953
|
exports.OBJECT_DETECTION_STEP_ID = OBJECT_DETECTION_STEP_ID;
|
|
152954
|
+
exports.ONE_SHOT_HOLD_MS = ONE_SHOT_HOLD_MS;
|
|
152519
152955
|
exports.OPERATOR_WRITTEN_STALE_MS = OPERATOR_WRITTEN_STALE_MS;
|
|
152520
152956
|
exports.OPS_LOG_DEFAULT_LIMIT = OPS_LOG_DEFAULT_LIMIT;
|
|
152521
152957
|
exports.OPS_LOG_RING_DEFAULT_MAX = OPS_LOG_RING_DEFAULT_MAX;
|
|
@@ -152600,6 +153036,7 @@ exports.PROVIDER_KIND_CAP_NAMES = PROVIDER_KIND_CAP_NAMES;
|
|
|
152600
153036
|
exports.PROVIDER_PIN_FIELD = require_sleep.PROVIDER_PIN_FIELD;
|
|
152601
153037
|
exports.PUBLIC_ENDPOINT_HTTP_REASON = PUBLIC_ENDPOINT_HTTP_REASON;
|
|
152602
153038
|
exports.PULSE_MAX_MS = PULSE_MAX_MS;
|
|
153039
|
+
exports.PUSH_CONFIRM_WINDOW_MS = PUSH_CONFIRM_WINDOW_MS;
|
|
152603
153040
|
exports.PYTHON_SCRIPT = PYTHON_SCRIPT;
|
|
152604
153041
|
exports.PackageInstallationSchema = PackageInstallationSchema;
|
|
152605
153042
|
exports.PackageInstallationsSchema = PackageInstallationsSchema;
|
|
@@ -153148,6 +153585,9 @@ exports.StaleSettingsKeyFindingSchema = StaleSettingsKeyFindingSchema;
|
|
|
153148
153585
|
exports.StartClusterUpdateResultSchema = StartClusterUpdateResultSchema;
|
|
153149
153586
|
exports.StartEmbeddedInputSchema = StartEmbeddedInputSchema;
|
|
153150
153587
|
exports.StartEnrollmentOutputSchema = StartEnrollmentOutputSchema;
|
|
153588
|
+
exports.StateRefreshPolicySchema = StateRefreshPolicySchema;
|
|
153589
|
+
exports.StateRefreshPushSchema = StateRefreshPushSchema;
|
|
153590
|
+
exports.StateRefreshReasonSchema = StateRefreshReasonSchema;
|
|
153151
153591
|
exports.StationaryObjectSchema = StationaryObjectSchema;
|
|
153152
153592
|
exports.StationarySubjectSchema = StationarySubjectSchema;
|
|
153153
153593
|
exports.StatisticHelperSpecSchema = require_implemented_methods.StatisticHelperSpecSchema;
|
|
@@ -153729,6 +154169,8 @@ exports.collectZodSecretPaths = require_sleep.collectZodSecretPaths;
|
|
|
153729
154169
|
exports.colorCapability = colorCapability;
|
|
153730
154170
|
exports.colorForKind = colorForKind;
|
|
153731
154171
|
exports.commandEffect = require_sleep.commandEffect;
|
|
154172
|
+
exports.commandEffects = require_sleep.commandEffects;
|
|
154173
|
+
exports.commandHoldMs = require_sleep.commandHoldMs;
|
|
153732
154174
|
exports.commandMethodProblems = commandMethodProblems;
|
|
153733
154175
|
exports.commandOrigin = require_sleep.commandOrigin;
|
|
153734
154176
|
exports.commandStepMeta = commandStepMeta;
|
|
@@ -153910,6 +154352,7 @@ exports.deviceRunsCapability = deviceRunsCapability;
|
|
|
153910
154352
|
exports.deviceSelectorMatches = deviceSelectorMatches;
|
|
153911
154353
|
exports.deviceSleeps = deviceSleeps;
|
|
153912
154354
|
exports.deviceStateCapability = deviceStateCapability;
|
|
154355
|
+
exports.deviceStateRefreshCapability = deviceStateRefreshCapability;
|
|
153913
154356
|
exports.deviceStatusCapability = deviceStatusCapability;
|
|
153914
154357
|
exports.deviceTemplateCallableBounds = require_device_template_catalogue.deviceTemplateCallableBounds;
|
|
153915
154358
|
exports.deviceTemplateCameraValues = require_device_template_catalogue.deviceTemplateCameraValues;
|
|
@@ -153935,6 +154378,8 @@ exports.dominantClipLabels = dominantClipLabels;
|
|
|
153935
154378
|
exports.doorbellCapability = doorbellCapability;
|
|
153936
154379
|
exports.droppedConditionsForKind = droppedConditionsForKind;
|
|
153937
154380
|
exports.edgetpuDelegateDevice = edgetpuDelegateDevice;
|
|
154381
|
+
exports.effectConditionHolds = require_sleep.effectConditionHolds;
|
|
154382
|
+
exports.effectiveRefreshIntervalMs = effectiveRefreshIntervalMs;
|
|
153938
154383
|
exports.effectiveStepSettings = effectiveStepSettings;
|
|
153939
154384
|
exports.egressTranscodeSharingKey = egressTranscodeSharingKey;
|
|
153940
154385
|
exports.egressTransportFromRequest = egressTransportFromRequest;
|
|
@@ -154670,6 +155115,7 @@ exports.resolveBucketMs = resolveBucketMs;
|
|
|
154670
155115
|
exports.resolveCapMount = require_sleep.resolveCapMount;
|
|
154671
155116
|
exports.resolveClipSearchMinScore = resolveClipSearchMinScore;
|
|
154672
155117
|
exports.resolveClusterStepModelId = resolveClusterStepModelId;
|
|
155118
|
+
exports.resolveCommandHold = resolveCommandHold;
|
|
154673
155119
|
exports.resolveContainerPrimaryChild = resolveContainerPrimaryChild;
|
|
154674
155120
|
exports.resolveCoreBlockEntry = resolveCoreBlockEntry;
|
|
154675
155121
|
exports.resolveCoreBlockFiles = resolveCoreBlockFiles;
|
|
@@ -154711,6 +155157,7 @@ exports.resolveSecretMarkers = require_sleep.resolveSecretMarkers;
|
|
|
154711
155157
|
exports.resolveSecretViewsIn = require_sleep.resolveSecretViewsIn;
|
|
154712
155158
|
exports.resolveSelectStep = resolveSelectStep;
|
|
154713
155159
|
exports.resolveServerName = resolveServerName;
|
|
155160
|
+
exports.resolveSideEffect = require_sleep.resolveSideEffect;
|
|
154714
155161
|
exports.resolveSirenPlays = resolveSirenPlays;
|
|
154715
155162
|
exports.resolveSirenSeconds = resolveSirenSeconds;
|
|
154716
155163
|
exports.resolveStepArgs = resolveStepArgs;
|