@camstack/types 1.2.299 → 1.2.300
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/dist/capabilities/alarm-panel.cap.d.ts +21 -0
- package/dist/device/device-do-actions.d.ts +12 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +234 -5
- package/dist/index.mjs +234 -5
- package/package.json +1 -1
|
@@ -51,6 +51,13 @@ export declare const AlarmPanelStatusSchema: z.ZodObject<{
|
|
|
51
51
|
disarming: "disarming";
|
|
52
52
|
triggered: "triggered";
|
|
53
53
|
}>;
|
|
54
|
+
targetMode: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
55
|
+
home: "home";
|
|
56
|
+
away: "away";
|
|
57
|
+
night: "night";
|
|
58
|
+
vacation: "vacation";
|
|
59
|
+
custom_bypass: "custom_bypass";
|
|
60
|
+
}>>>;
|
|
54
61
|
availableModes: z.ZodArray<z.ZodEnum<{
|
|
55
62
|
home: "home";
|
|
56
63
|
away: "away";
|
|
@@ -109,6 +116,13 @@ export declare const alarmPanelCapability: {
|
|
|
109
116
|
disarming: "disarming";
|
|
110
117
|
triggered: "triggered";
|
|
111
118
|
}>;
|
|
119
|
+
targetMode: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
120
|
+
home: "home";
|
|
121
|
+
away: "away";
|
|
122
|
+
night: "night";
|
|
123
|
+
vacation: "vacation";
|
|
124
|
+
custom_bypass: "custom_bypass";
|
|
125
|
+
}>>>;
|
|
112
126
|
availableModes: z.ZodArray<z.ZodEnum<{
|
|
113
127
|
home: "home";
|
|
114
128
|
away: "away";
|
|
@@ -139,6 +153,13 @@ export declare const alarmPanelCapability: {
|
|
|
139
153
|
disarming: "disarming";
|
|
140
154
|
triggered: "triggered";
|
|
141
155
|
}>;
|
|
156
|
+
targetMode: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
157
|
+
home: "home";
|
|
158
|
+
away: "away";
|
|
159
|
+
night: "night";
|
|
160
|
+
vacation: "vacation";
|
|
161
|
+
custom_bypass: "custom_bypass";
|
|
162
|
+
}>>>;
|
|
142
163
|
availableModes: z.ZodArray<z.ZodEnum<{
|
|
143
164
|
home: "home";
|
|
144
165
|
away: "away";
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/** An arg the authoring UI collects (not baked into the catalogue entry). */
|
|
2
|
+
export interface DeviceDoOpenArg {
|
|
3
|
+
readonly key: string;
|
|
4
|
+
readonly label: string;
|
|
5
|
+
readonly kind: 'string' | 'number';
|
|
6
|
+
}
|
|
1
7
|
/** One operator-facing action that becomes a cap method call. */
|
|
2
8
|
export interface DeviceDoAction {
|
|
3
9
|
/** Stable id for the select value, e.g. `switch.on`. */
|
|
@@ -7,6 +13,12 @@ export interface DeviceDoAction {
|
|
|
7
13
|
readonly cap: string;
|
|
8
14
|
readonly method: string;
|
|
9
15
|
readonly args?: Readonly<Record<string, unknown>>;
|
|
16
|
+
/**
|
|
17
|
+
* Keys the operator fills after picking the action (e.g. `presetId` for
|
|
18
|
+
* `ptz.goToPreset`). Matching ignores these — only baked {@link args} must
|
|
19
|
+
* agree — so a saved step with a filled preset still selects this entry.
|
|
20
|
+
*/
|
|
21
|
+
readonly openArgs?: readonly DeviceDoOpenArg[];
|
|
10
22
|
}
|
|
11
23
|
/**
|
|
12
24
|
* The curated catalogue. Order is the order the select draws.
|
package/dist/index.d.ts
CHANGED
|
@@ -178,7 +178,7 @@ export { DeviceConfig } from './device/device-config.js';
|
|
|
178
178
|
export type { DeviceConstructor, DeviceContext, DeviceManagerApi, IDeviceRegistry, IDeviceRegistryReader, } from './device/device-context.js';
|
|
179
179
|
export type { AccessoryControlInput, AccessoryControlKind, AccessoryControlPick, DeviceControlKind, SensorMapping, } from './device/device-control-resolution.js';
|
|
180
180
|
export { DEVICE_TYPE_CONTROL_KIND, hasMotionTrigger, isNode, MOTION_TRIGGER_FEATURE, pickAccessoryControl, resolveDeviceControlKind, resolveMutate, SENSOR_FEATURES, SENSOR_MAP, } from './device/device-control-resolution.js';
|
|
181
|
-
export type { DeviceDoAction } from './device/device-do-actions.js';
|
|
181
|
+
export type { DeviceDoAction, DeviceDoOpenArg } from './device/device-do-actions.js';
|
|
182
182
|
export { actionsForBoundCaps, allDoActions, DEVICE_DO_ACTIONS, doActionSelectValue, isDoActionActuatable, matchDoAction, } from './device/device-do-actions.js';
|
|
183
183
|
export type { ChildLayout, ChildLayoutEntry, CreateDeviceSpec, DeviceCapDisplayOverride, DeviceDiscovery, DeviceDisplayOverride, DeviceManualCreation, DeviceMeta, DiscoveredDevice, InitialDeviceMeta, RoleDisplayDefault, SavedDevice, } from './device/device-management.js';
|
|
184
184
|
export type { DeviceProfile, DeviceProfileDefaults, DeviceProfileMatch, PipelinePhaseMode, } from './device/device-profile.js';
|
package/dist/index.js
CHANGED
|
@@ -18950,6 +18950,15 @@ var AlarmArmModeSchema = zod.z.enum([
|
|
|
18950
18950
|
var AlarmPanelStatusSchema = zod.z.object({
|
|
18951
18951
|
/** Current lifecycle state. */
|
|
18952
18952
|
state: AlarmStateSchema,
|
|
18953
|
+
/**
|
|
18954
|
+
* The arm mode the machine belongs to under transitional words
|
|
18955
|
+
* (`arming` / `pending` / `triggered` / `disarming`). `null` when
|
|
18956
|
+
* disarmed or when a provider cannot name one. Exporters MUST prefer
|
|
18957
|
+
* this over an in-process memo — a HomeKit accessory that missed the
|
|
18958
|
+
* settled `armed_*` slice used to map `pending` to DISARMED and hide
|
|
18959
|
+
* an entry delay.
|
|
18960
|
+
*/
|
|
18961
|
+
targetMode: AlarmArmModeSchema.nullable().optional(),
|
|
18953
18962
|
/** Subset of arm modes the panel accepts. UI renders one button per
|
|
18954
18963
|
* mode in this list. */
|
|
18955
18964
|
availableModes: zod.z.array(AlarmArmModeSchema),
|
|
@@ -57636,6 +57645,199 @@ var DEVICE_DO_ACTIONS = [
|
|
|
57636
57645
|
method: "stop",
|
|
57637
57646
|
args: {}
|
|
57638
57647
|
},
|
|
57648
|
+
{
|
|
57649
|
+
id: "climate.off",
|
|
57650
|
+
label: "Climate off",
|
|
57651
|
+
cap: "climate-control",
|
|
57652
|
+
method: "setMode",
|
|
57653
|
+
args: { mode: "off" }
|
|
57654
|
+
},
|
|
57655
|
+
{
|
|
57656
|
+
id: "climate.heat",
|
|
57657
|
+
label: "Heat",
|
|
57658
|
+
cap: "climate-control",
|
|
57659
|
+
method: "setMode",
|
|
57660
|
+
args: { mode: "heat" }
|
|
57661
|
+
},
|
|
57662
|
+
{
|
|
57663
|
+
id: "climate.cool",
|
|
57664
|
+
label: "Cool",
|
|
57665
|
+
cap: "climate-control",
|
|
57666
|
+
method: "setMode",
|
|
57667
|
+
args: { mode: "cool" }
|
|
57668
|
+
},
|
|
57669
|
+
{
|
|
57670
|
+
id: "climate.auto",
|
|
57671
|
+
label: "Climate auto",
|
|
57672
|
+
cap: "climate-control",
|
|
57673
|
+
method: "setMode",
|
|
57674
|
+
args: { mode: "auto" }
|
|
57675
|
+
},
|
|
57676
|
+
{
|
|
57677
|
+
id: "fan.off",
|
|
57678
|
+
label: "Fan off",
|
|
57679
|
+
cap: "fan-control",
|
|
57680
|
+
method: "setPercentage",
|
|
57681
|
+
args: { percentage: 0 }
|
|
57682
|
+
},
|
|
57683
|
+
{
|
|
57684
|
+
id: "fan.full",
|
|
57685
|
+
label: "Fan full",
|
|
57686
|
+
cap: "fan-control",
|
|
57687
|
+
method: "setPercentage",
|
|
57688
|
+
args: { percentage: 100 }
|
|
57689
|
+
},
|
|
57690
|
+
{
|
|
57691
|
+
id: "vacuum.start",
|
|
57692
|
+
label: "Start cleaning",
|
|
57693
|
+
cap: "vacuum-control",
|
|
57694
|
+
method: "start",
|
|
57695
|
+
args: {}
|
|
57696
|
+
},
|
|
57697
|
+
{
|
|
57698
|
+
id: "vacuum.pause",
|
|
57699
|
+
label: "Pause",
|
|
57700
|
+
cap: "vacuum-control",
|
|
57701
|
+
method: "pause",
|
|
57702
|
+
args: {}
|
|
57703
|
+
},
|
|
57704
|
+
{
|
|
57705
|
+
id: "vacuum.stop",
|
|
57706
|
+
label: "Stop",
|
|
57707
|
+
cap: "vacuum-control",
|
|
57708
|
+
method: "stop",
|
|
57709
|
+
args: {}
|
|
57710
|
+
},
|
|
57711
|
+
{
|
|
57712
|
+
id: "vacuum.dock",
|
|
57713
|
+
label: "Return to base",
|
|
57714
|
+
cap: "vacuum-control",
|
|
57715
|
+
method: "returnToBase",
|
|
57716
|
+
args: {}
|
|
57717
|
+
},
|
|
57718
|
+
{
|
|
57719
|
+
id: "ptz.goHome",
|
|
57720
|
+
label: "PTZ go home",
|
|
57721
|
+
cap: "ptz",
|
|
57722
|
+
method: "goHome",
|
|
57723
|
+
args: {}
|
|
57724
|
+
},
|
|
57725
|
+
{
|
|
57726
|
+
id: "ptz.goToPreset",
|
|
57727
|
+
label: "PTZ go to preset",
|
|
57728
|
+
cap: "ptz",
|
|
57729
|
+
method: "goToPreset",
|
|
57730
|
+
openArgs: [{
|
|
57731
|
+
key: "presetId",
|
|
57732
|
+
label: "Preset id",
|
|
57733
|
+
kind: "string"
|
|
57734
|
+
}]
|
|
57735
|
+
},
|
|
57736
|
+
{
|
|
57737
|
+
id: "ptz.autotrackOn",
|
|
57738
|
+
label: "Autotrack on",
|
|
57739
|
+
cap: "ptz-autotrack",
|
|
57740
|
+
method: "setEnabled",
|
|
57741
|
+
args: { enabled: true }
|
|
57742
|
+
},
|
|
57743
|
+
{
|
|
57744
|
+
id: "ptz.autotrackOff",
|
|
57745
|
+
label: "Autotrack off",
|
|
57746
|
+
cap: "ptz-autotrack",
|
|
57747
|
+
method: "setEnabled",
|
|
57748
|
+
args: { enabled: false }
|
|
57749
|
+
},
|
|
57750
|
+
{
|
|
57751
|
+
id: "privacy.maskOn",
|
|
57752
|
+
label: "Privacy mask on",
|
|
57753
|
+
cap: "privacy-mask",
|
|
57754
|
+
method: "setMask",
|
|
57755
|
+
args: { patch: { enabled: true } }
|
|
57756
|
+
},
|
|
57757
|
+
{
|
|
57758
|
+
id: "privacy.maskOff",
|
|
57759
|
+
label: "Privacy mask off",
|
|
57760
|
+
cap: "privacy-mask",
|
|
57761
|
+
method: "setMask",
|
|
57762
|
+
args: { patch: { enabled: false } }
|
|
57763
|
+
},
|
|
57764
|
+
{
|
|
57765
|
+
id: "privacy.micOn",
|
|
57766
|
+
label: "Microphone on",
|
|
57767
|
+
cap: "privacy-mask",
|
|
57768
|
+
method: "setAudioEnabled",
|
|
57769
|
+
args: { enabled: true }
|
|
57770
|
+
},
|
|
57771
|
+
{
|
|
57772
|
+
id: "privacy.micOff",
|
|
57773
|
+
label: "Microphone off",
|
|
57774
|
+
cap: "privacy-mask",
|
|
57775
|
+
method: "setAudioEnabled",
|
|
57776
|
+
args: { enabled: false }
|
|
57777
|
+
},
|
|
57778
|
+
{
|
|
57779
|
+
id: "dayNight.auto",
|
|
57780
|
+
label: "Day/night auto",
|
|
57781
|
+
cap: "day-night",
|
|
57782
|
+
method: "setSettings",
|
|
57783
|
+
args: { settings: { mode: "auto" } }
|
|
57784
|
+
},
|
|
57785
|
+
{
|
|
57786
|
+
id: "dayNight.day",
|
|
57787
|
+
label: "Day mode",
|
|
57788
|
+
cap: "day-night",
|
|
57789
|
+
method: "setSettings",
|
|
57790
|
+
args: { settings: { mode: "day" } }
|
|
57791
|
+
},
|
|
57792
|
+
{
|
|
57793
|
+
id: "dayNight.night",
|
|
57794
|
+
label: "Night mode",
|
|
57795
|
+
cap: "day-night",
|
|
57796
|
+
method: "setSettings",
|
|
57797
|
+
args: { settings: { mode: "night" } }
|
|
57798
|
+
},
|
|
57799
|
+
{
|
|
57800
|
+
id: "reboot.reboot",
|
|
57801
|
+
label: "Reboot device",
|
|
57802
|
+
cap: "reboot",
|
|
57803
|
+
method: "reboot",
|
|
57804
|
+
args: {}
|
|
57805
|
+
},
|
|
57806
|
+
{
|
|
57807
|
+
id: "brightness.full",
|
|
57808
|
+
label: "Brightness full",
|
|
57809
|
+
cap: "brightness",
|
|
57810
|
+
method: "setBrightness",
|
|
57811
|
+
args: { percentage: 100 }
|
|
57812
|
+
},
|
|
57813
|
+
{
|
|
57814
|
+
id: "brightness.half",
|
|
57815
|
+
label: "Brightness half",
|
|
57816
|
+
cap: "brightness",
|
|
57817
|
+
method: "setBrightness",
|
|
57818
|
+
args: { percentage: 50 }
|
|
57819
|
+
},
|
|
57820
|
+
{
|
|
57821
|
+
id: "brightness.off",
|
|
57822
|
+
label: "Brightness off",
|
|
57823
|
+
cap: "brightness",
|
|
57824
|
+
method: "setBrightness",
|
|
57825
|
+
args: { percentage: 0 }
|
|
57826
|
+
},
|
|
57827
|
+
{
|
|
57828
|
+
id: "motionTrigger.on",
|
|
57829
|
+
label: "Motion trigger on",
|
|
57830
|
+
cap: "motion-trigger",
|
|
57831
|
+
method: "setMotionTrigger",
|
|
57832
|
+
args: { enabled: true }
|
|
57833
|
+
},
|
|
57834
|
+
{
|
|
57835
|
+
id: "motionTrigger.off",
|
|
57836
|
+
label: "Motion trigger off",
|
|
57837
|
+
cap: "motion-trigger",
|
|
57838
|
+
method: "setMotionTrigger",
|
|
57839
|
+
args: { enabled: false }
|
|
57840
|
+
},
|
|
57639
57841
|
{
|
|
57640
57842
|
id: "alarm.trigger",
|
|
57641
57843
|
label: "Trigger alarm",
|
|
@@ -57703,15 +57905,42 @@ function isDoActionActuatable(action) {
|
|
|
57703
57905
|
}
|
|
57704
57906
|
return false;
|
|
57705
57907
|
}
|
|
57706
|
-
function
|
|
57707
|
-
|
|
57708
|
-
|
|
57908
|
+
function valueEqual(left, right) {
|
|
57909
|
+
if (left === right) return true;
|
|
57910
|
+
if (left === null || right === null) return left === right;
|
|
57911
|
+
if (typeof left !== "object" || typeof right !== "object") return false;
|
|
57912
|
+
if (Array.isArray(left) || Array.isArray(right)) {
|
|
57913
|
+
if (!Array.isArray(left) || !Array.isArray(right)) return false;
|
|
57914
|
+
if (left.length !== right.length) return false;
|
|
57915
|
+
for (let i = 0; i < left.length; i++) if (!valueEqual(left[i], right[i])) return false;
|
|
57916
|
+
return true;
|
|
57917
|
+
}
|
|
57918
|
+
const a = left;
|
|
57919
|
+
const b = right;
|
|
57709
57920
|
const aKeys = Object.keys(a);
|
|
57710
57921
|
const bKeys = Object.keys(b);
|
|
57711
57922
|
if (aKeys.length !== bKeys.length) return false;
|
|
57712
|
-
for (const key of aKeys) if (a[key]
|
|
57923
|
+
for (const key of aKeys) if (!valueEqual(a[key], b[key])) return false;
|
|
57713
57924
|
return true;
|
|
57714
57925
|
}
|
|
57926
|
+
function argsEqual(left, right) {
|
|
57927
|
+
return valueEqual(left ?? {}, right ?? {});
|
|
57928
|
+
}
|
|
57929
|
+
/** Baked args only — open-arg keys the operator fills are ignored for matching. */
|
|
57930
|
+
function bakedArgsEqual(action, args) {
|
|
57931
|
+
if (action.openArgs !== void 0) {
|
|
57932
|
+
const open = new Set(action.openArgs.map((a) => a.key));
|
|
57933
|
+
const baked = action.args ?? {};
|
|
57934
|
+
const actual = args ?? {};
|
|
57935
|
+
for (const key of Object.keys(baked)) if (!valueEqual(baked[key], actual[key])) return false;
|
|
57936
|
+
for (const key of Object.keys(actual)) {
|
|
57937
|
+
if (open.has(key)) continue;
|
|
57938
|
+
if (!(key in baked)) return false;
|
|
57939
|
+
}
|
|
57940
|
+
return true;
|
|
57941
|
+
}
|
|
57942
|
+
return argsEqual(action.args, args);
|
|
57943
|
+
}
|
|
57715
57944
|
/**
|
|
57716
57945
|
* Actions offered for a device that binds the given caps.
|
|
57717
57946
|
*
|
|
@@ -57734,7 +57963,7 @@ function allDoActions() {
|
|
|
57734
57963
|
function matchDoAction(cap, method, args) {
|
|
57735
57964
|
for (const action of DEVICE_DO_ACTIONS) {
|
|
57736
57965
|
if (action.cap !== cap || action.method !== method) continue;
|
|
57737
|
-
if (!
|
|
57966
|
+
if (!bakedArgsEqual(action, args)) continue;
|
|
57738
57967
|
return action;
|
|
57739
57968
|
}
|
|
57740
57969
|
return null;
|
package/dist/index.mjs
CHANGED
|
@@ -18949,6 +18949,15 @@ var AlarmArmModeSchema = z.enum([
|
|
|
18949
18949
|
var AlarmPanelStatusSchema = z.object({
|
|
18950
18950
|
/** Current lifecycle state. */
|
|
18951
18951
|
state: AlarmStateSchema,
|
|
18952
|
+
/**
|
|
18953
|
+
* The arm mode the machine belongs to under transitional words
|
|
18954
|
+
* (`arming` / `pending` / `triggered` / `disarming`). `null` when
|
|
18955
|
+
* disarmed or when a provider cannot name one. Exporters MUST prefer
|
|
18956
|
+
* this over an in-process memo — a HomeKit accessory that missed the
|
|
18957
|
+
* settled `armed_*` slice used to map `pending` to DISARMED and hide
|
|
18958
|
+
* an entry delay.
|
|
18959
|
+
*/
|
|
18960
|
+
targetMode: AlarmArmModeSchema.nullable().optional(),
|
|
18952
18961
|
/** Subset of arm modes the panel accepts. UI renders one button per
|
|
18953
18962
|
* mode in this list. */
|
|
18954
18963
|
availableModes: z.array(AlarmArmModeSchema),
|
|
@@ -57635,6 +57644,199 @@ var DEVICE_DO_ACTIONS = [
|
|
|
57635
57644
|
method: "stop",
|
|
57636
57645
|
args: {}
|
|
57637
57646
|
},
|
|
57647
|
+
{
|
|
57648
|
+
id: "climate.off",
|
|
57649
|
+
label: "Climate off",
|
|
57650
|
+
cap: "climate-control",
|
|
57651
|
+
method: "setMode",
|
|
57652
|
+
args: { mode: "off" }
|
|
57653
|
+
},
|
|
57654
|
+
{
|
|
57655
|
+
id: "climate.heat",
|
|
57656
|
+
label: "Heat",
|
|
57657
|
+
cap: "climate-control",
|
|
57658
|
+
method: "setMode",
|
|
57659
|
+
args: { mode: "heat" }
|
|
57660
|
+
},
|
|
57661
|
+
{
|
|
57662
|
+
id: "climate.cool",
|
|
57663
|
+
label: "Cool",
|
|
57664
|
+
cap: "climate-control",
|
|
57665
|
+
method: "setMode",
|
|
57666
|
+
args: { mode: "cool" }
|
|
57667
|
+
},
|
|
57668
|
+
{
|
|
57669
|
+
id: "climate.auto",
|
|
57670
|
+
label: "Climate auto",
|
|
57671
|
+
cap: "climate-control",
|
|
57672
|
+
method: "setMode",
|
|
57673
|
+
args: { mode: "auto" }
|
|
57674
|
+
},
|
|
57675
|
+
{
|
|
57676
|
+
id: "fan.off",
|
|
57677
|
+
label: "Fan off",
|
|
57678
|
+
cap: "fan-control",
|
|
57679
|
+
method: "setPercentage",
|
|
57680
|
+
args: { percentage: 0 }
|
|
57681
|
+
},
|
|
57682
|
+
{
|
|
57683
|
+
id: "fan.full",
|
|
57684
|
+
label: "Fan full",
|
|
57685
|
+
cap: "fan-control",
|
|
57686
|
+
method: "setPercentage",
|
|
57687
|
+
args: { percentage: 100 }
|
|
57688
|
+
},
|
|
57689
|
+
{
|
|
57690
|
+
id: "vacuum.start",
|
|
57691
|
+
label: "Start cleaning",
|
|
57692
|
+
cap: "vacuum-control",
|
|
57693
|
+
method: "start",
|
|
57694
|
+
args: {}
|
|
57695
|
+
},
|
|
57696
|
+
{
|
|
57697
|
+
id: "vacuum.pause",
|
|
57698
|
+
label: "Pause",
|
|
57699
|
+
cap: "vacuum-control",
|
|
57700
|
+
method: "pause",
|
|
57701
|
+
args: {}
|
|
57702
|
+
},
|
|
57703
|
+
{
|
|
57704
|
+
id: "vacuum.stop",
|
|
57705
|
+
label: "Stop",
|
|
57706
|
+
cap: "vacuum-control",
|
|
57707
|
+
method: "stop",
|
|
57708
|
+
args: {}
|
|
57709
|
+
},
|
|
57710
|
+
{
|
|
57711
|
+
id: "vacuum.dock",
|
|
57712
|
+
label: "Return to base",
|
|
57713
|
+
cap: "vacuum-control",
|
|
57714
|
+
method: "returnToBase",
|
|
57715
|
+
args: {}
|
|
57716
|
+
},
|
|
57717
|
+
{
|
|
57718
|
+
id: "ptz.goHome",
|
|
57719
|
+
label: "PTZ go home",
|
|
57720
|
+
cap: "ptz",
|
|
57721
|
+
method: "goHome",
|
|
57722
|
+
args: {}
|
|
57723
|
+
},
|
|
57724
|
+
{
|
|
57725
|
+
id: "ptz.goToPreset",
|
|
57726
|
+
label: "PTZ go to preset",
|
|
57727
|
+
cap: "ptz",
|
|
57728
|
+
method: "goToPreset",
|
|
57729
|
+
openArgs: [{
|
|
57730
|
+
key: "presetId",
|
|
57731
|
+
label: "Preset id",
|
|
57732
|
+
kind: "string"
|
|
57733
|
+
}]
|
|
57734
|
+
},
|
|
57735
|
+
{
|
|
57736
|
+
id: "ptz.autotrackOn",
|
|
57737
|
+
label: "Autotrack on",
|
|
57738
|
+
cap: "ptz-autotrack",
|
|
57739
|
+
method: "setEnabled",
|
|
57740
|
+
args: { enabled: true }
|
|
57741
|
+
},
|
|
57742
|
+
{
|
|
57743
|
+
id: "ptz.autotrackOff",
|
|
57744
|
+
label: "Autotrack off",
|
|
57745
|
+
cap: "ptz-autotrack",
|
|
57746
|
+
method: "setEnabled",
|
|
57747
|
+
args: { enabled: false }
|
|
57748
|
+
},
|
|
57749
|
+
{
|
|
57750
|
+
id: "privacy.maskOn",
|
|
57751
|
+
label: "Privacy mask on",
|
|
57752
|
+
cap: "privacy-mask",
|
|
57753
|
+
method: "setMask",
|
|
57754
|
+
args: { patch: { enabled: true } }
|
|
57755
|
+
},
|
|
57756
|
+
{
|
|
57757
|
+
id: "privacy.maskOff",
|
|
57758
|
+
label: "Privacy mask off",
|
|
57759
|
+
cap: "privacy-mask",
|
|
57760
|
+
method: "setMask",
|
|
57761
|
+
args: { patch: { enabled: false } }
|
|
57762
|
+
},
|
|
57763
|
+
{
|
|
57764
|
+
id: "privacy.micOn",
|
|
57765
|
+
label: "Microphone on",
|
|
57766
|
+
cap: "privacy-mask",
|
|
57767
|
+
method: "setAudioEnabled",
|
|
57768
|
+
args: { enabled: true }
|
|
57769
|
+
},
|
|
57770
|
+
{
|
|
57771
|
+
id: "privacy.micOff",
|
|
57772
|
+
label: "Microphone off",
|
|
57773
|
+
cap: "privacy-mask",
|
|
57774
|
+
method: "setAudioEnabled",
|
|
57775
|
+
args: { enabled: false }
|
|
57776
|
+
},
|
|
57777
|
+
{
|
|
57778
|
+
id: "dayNight.auto",
|
|
57779
|
+
label: "Day/night auto",
|
|
57780
|
+
cap: "day-night",
|
|
57781
|
+
method: "setSettings",
|
|
57782
|
+
args: { settings: { mode: "auto" } }
|
|
57783
|
+
},
|
|
57784
|
+
{
|
|
57785
|
+
id: "dayNight.day",
|
|
57786
|
+
label: "Day mode",
|
|
57787
|
+
cap: "day-night",
|
|
57788
|
+
method: "setSettings",
|
|
57789
|
+
args: { settings: { mode: "day" } }
|
|
57790
|
+
},
|
|
57791
|
+
{
|
|
57792
|
+
id: "dayNight.night",
|
|
57793
|
+
label: "Night mode",
|
|
57794
|
+
cap: "day-night",
|
|
57795
|
+
method: "setSettings",
|
|
57796
|
+
args: { settings: { mode: "night" } }
|
|
57797
|
+
},
|
|
57798
|
+
{
|
|
57799
|
+
id: "reboot.reboot",
|
|
57800
|
+
label: "Reboot device",
|
|
57801
|
+
cap: "reboot",
|
|
57802
|
+
method: "reboot",
|
|
57803
|
+
args: {}
|
|
57804
|
+
},
|
|
57805
|
+
{
|
|
57806
|
+
id: "brightness.full",
|
|
57807
|
+
label: "Brightness full",
|
|
57808
|
+
cap: "brightness",
|
|
57809
|
+
method: "setBrightness",
|
|
57810
|
+
args: { percentage: 100 }
|
|
57811
|
+
},
|
|
57812
|
+
{
|
|
57813
|
+
id: "brightness.half",
|
|
57814
|
+
label: "Brightness half",
|
|
57815
|
+
cap: "brightness",
|
|
57816
|
+
method: "setBrightness",
|
|
57817
|
+
args: { percentage: 50 }
|
|
57818
|
+
},
|
|
57819
|
+
{
|
|
57820
|
+
id: "brightness.off",
|
|
57821
|
+
label: "Brightness off",
|
|
57822
|
+
cap: "brightness",
|
|
57823
|
+
method: "setBrightness",
|
|
57824
|
+
args: { percentage: 0 }
|
|
57825
|
+
},
|
|
57826
|
+
{
|
|
57827
|
+
id: "motionTrigger.on",
|
|
57828
|
+
label: "Motion trigger on",
|
|
57829
|
+
cap: "motion-trigger",
|
|
57830
|
+
method: "setMotionTrigger",
|
|
57831
|
+
args: { enabled: true }
|
|
57832
|
+
},
|
|
57833
|
+
{
|
|
57834
|
+
id: "motionTrigger.off",
|
|
57835
|
+
label: "Motion trigger off",
|
|
57836
|
+
cap: "motion-trigger",
|
|
57837
|
+
method: "setMotionTrigger",
|
|
57838
|
+
args: { enabled: false }
|
|
57839
|
+
},
|
|
57638
57840
|
{
|
|
57639
57841
|
id: "alarm.trigger",
|
|
57640
57842
|
label: "Trigger alarm",
|
|
@@ -57702,15 +57904,42 @@ function isDoActionActuatable(action) {
|
|
|
57702
57904
|
}
|
|
57703
57905
|
return false;
|
|
57704
57906
|
}
|
|
57705
|
-
function
|
|
57706
|
-
|
|
57707
|
-
|
|
57907
|
+
function valueEqual(left, right) {
|
|
57908
|
+
if (left === right) return true;
|
|
57909
|
+
if (left === null || right === null) return left === right;
|
|
57910
|
+
if (typeof left !== "object" || typeof right !== "object") return false;
|
|
57911
|
+
if (Array.isArray(left) || Array.isArray(right)) {
|
|
57912
|
+
if (!Array.isArray(left) || !Array.isArray(right)) return false;
|
|
57913
|
+
if (left.length !== right.length) return false;
|
|
57914
|
+
for (let i = 0; i < left.length; i++) if (!valueEqual(left[i], right[i])) return false;
|
|
57915
|
+
return true;
|
|
57916
|
+
}
|
|
57917
|
+
const a = left;
|
|
57918
|
+
const b = right;
|
|
57708
57919
|
const aKeys = Object.keys(a);
|
|
57709
57920
|
const bKeys = Object.keys(b);
|
|
57710
57921
|
if (aKeys.length !== bKeys.length) return false;
|
|
57711
|
-
for (const key of aKeys) if (a[key]
|
|
57922
|
+
for (const key of aKeys) if (!valueEqual(a[key], b[key])) return false;
|
|
57712
57923
|
return true;
|
|
57713
57924
|
}
|
|
57925
|
+
function argsEqual(left, right) {
|
|
57926
|
+
return valueEqual(left ?? {}, right ?? {});
|
|
57927
|
+
}
|
|
57928
|
+
/** Baked args only — open-arg keys the operator fills are ignored for matching. */
|
|
57929
|
+
function bakedArgsEqual(action, args) {
|
|
57930
|
+
if (action.openArgs !== void 0) {
|
|
57931
|
+
const open = new Set(action.openArgs.map((a) => a.key));
|
|
57932
|
+
const baked = action.args ?? {};
|
|
57933
|
+
const actual = args ?? {};
|
|
57934
|
+
for (const key of Object.keys(baked)) if (!valueEqual(baked[key], actual[key])) return false;
|
|
57935
|
+
for (const key of Object.keys(actual)) {
|
|
57936
|
+
if (open.has(key)) continue;
|
|
57937
|
+
if (!(key in baked)) return false;
|
|
57938
|
+
}
|
|
57939
|
+
return true;
|
|
57940
|
+
}
|
|
57941
|
+
return argsEqual(action.args, args);
|
|
57942
|
+
}
|
|
57714
57943
|
/**
|
|
57715
57944
|
* Actions offered for a device that binds the given caps.
|
|
57716
57945
|
*
|
|
@@ -57733,7 +57962,7 @@ function allDoActions() {
|
|
|
57733
57962
|
function matchDoAction(cap, method, args) {
|
|
57734
57963
|
for (const action of DEVICE_DO_ACTIONS) {
|
|
57735
57964
|
if (action.cap !== cap || action.method !== method) continue;
|
|
57736
|
-
if (!
|
|
57965
|
+
if (!bakedArgsEqual(action, args)) continue;
|
|
57737
57966
|
return action;
|
|
57738
57967
|
}
|
|
57739
57968
|
return null;
|