@camstack/addon-export-hap 1.2.190 → 1.2.191

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.
@@ -5888,7 +5888,7 @@ var ZodIssueCode = {
5888
5888
  var ZodFirstPartyTypeKind;
5889
5889
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5890
5890
  //#endregion
5891
- //#region ../types/dist/sleep-BKClVk0K.mjs
5891
+ //#region ../types/dist/sleep-BkzQdpzF.mjs
5892
5892
  /**
5893
5893
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5894
5894
  * window to float samples (D455).
@@ -7976,6 +7976,10 @@ var BaseAddon = class {
7976
7976
  const stored = keychain ? await this.readAddonStoreWithRetry() : {};
7977
7977
  const patch = {};
7978
7978
  for (const key of keys) {
7979
+ if (tree.get(key)?.kind === "array") {
7980
+ patch[key] = [];
7981
+ continue;
7982
+ }
7979
7983
  const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7980
7984
  patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7981
7985
  }
@@ -11432,7 +11436,7 @@ object({
11432
11436
  params: record(string(), union([string(), number()])).optional()
11433
11437
  });
11434
11438
  //#endregion
11435
- //#region ../types/dist/composition-BodkvOV0.mjs
11439
+ //#region ../types/dist/composition-CRNwcFYY.mjs
11436
11440
  var AUDIO_ENCODER_BY_CODEC = {
11437
11441
  opus: "libopus",
11438
11442
  aac: "aac",
@@ -11609,6 +11613,7 @@ function buildVideoArgs(video, outputArgs, filterGraph, hwEncode) {
11609
11613
  if (video.level !== void 0) args.push("-level", video.level);
11610
11614
  if (video.pixelFormat !== void 0) args.push("-pix_fmt", video.pixelFormat);
11611
11615
  if (video.fps !== void 0) args.push("-r", String(video.fps));
11616
+ if (video.fpsMode !== void 0) args.push("-fps_mode", video.fpsMode);
11612
11617
  if (video.gopFrames !== void 0) args.push("-g", String(video.gopFrames));
11613
11618
  if (video.forceKeyFramesSeconds !== void 0) args.push("-force_key_frames", `expr:gte(t,n_forced*${video.forceKeyFramesSeconds})`);
11614
11619
  if (video.bf !== void 0) args.push("-bf", String(video.bf));
@@ -12790,38 +12795,6 @@ function validateExpressionSource(src) {
12790
12795
  return null;
12791
12796
  }
12792
12797
  /**
12793
- * One power reading becomes a washer, dryer or dishwasher (D944 helper).
12794
- *
12795
- * Standby of the control board is under 5 W; a motor or a heater is far
12796
- * above that, so 5 W is the line. A door lock or a short pump spike is not
12797
- * a cycle, so running starts only after 30 s above the line.
12798
- *
12799
- * A wash, dry or dishwasher pause (soak, heat-wait, heater off between
12800
- * bursts) lasts several minutes. Ending the cycle on the first dip would
12801
- * report "finished" in the middle of the program, so the stop dwell is
12802
- * 10 minutes on every type. The number is stored per type so one machine
12803
- * can move later without moving the others.
12804
- */
12805
- var APPLIANCE_TEMPLATE_ID = "appliance";
12806
- var APPLIANCE_KINDS = [
12807
- "washer",
12808
- "dryer",
12809
- "dishwasher"
12810
- ];
12811
- DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
12812
- /**
12813
- * A dumb plug-in stove or heater, built from a smart plug (a `Heater`).
12814
- *
12815
- * The plug is the actuator: `switch.setState` is a FORWARD to the plug's own
12816
- * (D967), so the heater switches exactly as the plug does. Running is the
12817
- * plug being on; when a power reading is also named, running is the draw
12818
- * staying above the line instead (a plug left on with the stove's own
12819
- * thermostat open is not heating). 50 W is far above any standby and below
12820
- * the smallest radiator.
12821
- */
12822
- var HEATER_TEMPLATE_ID = "heater";
12823
- DeviceType.Heater;
12824
- /**
12825
12798
  * Statistics and integrals over a history read (D944).
12826
12799
  *
12827
12800
  * Pure: the same points always give the same answer, so a restart recomputes
@@ -12965,34 +12938,6 @@ var HelperSpecSchema = discriminatedUnion("kind", [
12965
12938
  /** Actuator groups only. Readings leave this unset. */
12966
12939
  active: ActiveCriterionSchema.optional()
12967
12940
  }),
12968
- object({
12969
- kind: literal("appliance"),
12970
- templateId: literal(APPLIANCE_TEMPLATE_ID),
12971
- appliance: _enum(APPLIANCE_KINDS),
12972
- thresholdWatts: number().positive(),
12973
- startDwellMs: number().int().nonnegative(),
12974
- stopDwellMs: number().int().nonnegative(),
12975
- member: HelperMemberSchema,
12976
- /**
12977
- * The plug that powers the appliance (`switch.on`). Optional: when set, the
12978
- * composition carries a `power-source` feature, so the hub can cut and restore
12979
- * that plug (power-source link of a NEW-target composition).
12980
- */
12981
- powerSwitch: HelperMemberSchema.optional(),
12982
- /** How long a forced restart keeps the plug off; the cap's default when unset. */
12983
- offSeconds: number().optional()
12984
- }),
12985
- object({
12986
- kind: literal("heater"),
12987
- templateId: literal(HEATER_TEMPLATE_ID),
12988
- /** The plug, read and commanded at `switch.on`. */
12989
- plug: HelperMemberSchema,
12990
- /** The plug's power reading, when it has one: running is then the draw, not the switch. */
12991
- meter: HelperMemberSchema.optional(),
12992
- thresholdWatts: number().positive(),
12993
- startDwellMs: number().int().nonnegative(),
12994
- stopDwellMs: number().int().nonnegative()
12995
- }),
12996
12941
  object({
12997
12942
  kind: literal("statistic"),
12998
12943
  stat: _enum(STATISTIC_STATS),
@@ -13216,7 +13161,7 @@ var CompositionSchema = object({
13216
13161
  kind: literal("existing"),
13217
13162
  device: CompositionSourceRefSchema
13218
13163
  })]),
13219
- features: array(CompositionFeatureSchema).min(1).max(16),
13164
+ features: array(CompositionFeatureSchema).min(0).max(16),
13220
13165
  /**
13221
13166
  * Present when the block is a helper template. Absent on a free
13222
13167
  * composition (the room example, device 4603). The editor reads this,
@@ -49136,49 +49081,6 @@ function actuator(input) {
49136
49081
  };
49137
49082
  }
49138
49083
  new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
49139
- var PowerSourceRefusalReasonSchema = _enum([
49140
- "no-power-source",
49141
- "switch-missing",
49142
- "switch-offline",
49143
- "switch-unknown",
49144
- "restart-in-progress",
49145
- "switch-call-failed"
49146
- ]);
49147
- var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
49148
- accepted: literal(false),
49149
- reason: PowerSourceRefusalReasonSchema,
49150
- /** One line for the operator, naming the switch. */
49151
- message: string()
49152
- })]);
49153
- var PowerSourceInfoSchema = object({
49154
- /** False when the device has no power source linked; the rest is then empty. */
49155
- linked: boolean(),
49156
- switchDeviceId: number().nullable(),
49157
- switchName: string().nullable(),
49158
- /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
49159
- switchOn: boolean().nullable(),
49160
- switchOnline: boolean().nullable(),
49161
- restartInProgress: boolean(),
49162
- offSeconds: number().int()
49163
- });
49164
- object({
49165
- /** Null while the switch has not reported: unknown is never `false` (D393). */
49166
- switchOn: boolean().nullable(),
49167
- offSeconds: number().int(),
49168
- lastFetchedAt: number()
49169
- });
49170
- DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater;
49171
- var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
49172
- systemMethod(deviceInput$2, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
49173
- kind: "mutation",
49174
- auth: "admin"
49175
- }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
49176
- kind: "mutation",
49177
- auth: "admin"
49178
- }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
49179
- kind: "mutation",
49180
- auth: "admin"
49181
- });
49182
49084
  DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
49183
49085
  DeviceType.Camera;
49184
49086
  `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
@@ -49206,6 +49108,165 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
49206
49108
  }).optional()
49207
49109
  })) });
49208
49110
  /**
49111
+ * A saved Customize assignment (D936). The schema is the type: callers use
49112
+ * `z.infer`, they do not restate the shape.
49113
+ */
49114
+ var OverrideSourceSchema = object({
49115
+ addonId: string().min(1),
49116
+ stableId: string().min(1),
49117
+ cap: string().min(1),
49118
+ fieldPath: string().min(1)
49119
+ });
49120
+ var IdentityTransformDraftSchema = object({ kind: literal("identity") });
49121
+ var InvertTransformDraftSchema = object({ kind: literal("invert") });
49122
+ var ThresholdTransformDraftSchema = object({
49123
+ kind: literal("threshold"),
49124
+ comparison: _enum(["gte", "lte"]),
49125
+ threshold: number(),
49126
+ startDwellMs: number().nonnegative(),
49127
+ stopDwellMs: number().nonnegative()
49128
+ });
49129
+ var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
49130
+ IdentityTransformDraftSchema,
49131
+ InvertTransformDraftSchema,
49132
+ ThresholdTransformDraftSchema,
49133
+ object({
49134
+ kind: literal("linear"),
49135
+ scale: number(),
49136
+ offset: number(),
49137
+ clampMin: number().optional(),
49138
+ clampMax: number().optional()
49139
+ }),
49140
+ object({
49141
+ kind: literal("enum-map"),
49142
+ mapping: record(string(), string().nullable())
49143
+ }),
49144
+ object({ kind: literal("number") })
49145
+ ]);
49146
+ var ScalarOverrideDraftSchema = object({
49147
+ kind: literal("scalar"),
49148
+ cap: string().min(1),
49149
+ targetId: string().min(1),
49150
+ source: OverrideSourceSchema,
49151
+ transform: CustomizeTransformDraftSchema
49152
+ });
49153
+ var KeyedArrayOverrideDraftSchema = object({
49154
+ kind: literal("keyedArray"),
49155
+ cap: string().min(1),
49156
+ targetId: string().min(1),
49157
+ key: string().min(1),
49158
+ label: string().min(1),
49159
+ fieldPath: string().min(1),
49160
+ source: OverrideSourceSchema,
49161
+ transform: CustomizeTransformDraftSchema
49162
+ });
49163
+ var PulseOverrideDraftSchema = object({
49164
+ kind: literal("pulse"),
49165
+ cap: string().min(1),
49166
+ targetId: string().min(1),
49167
+ enabled: boolean(),
49168
+ debounceMs: number().nonnegative(),
49169
+ edges: array(_enum([
49170
+ "rising",
49171
+ "button",
49172
+ "native-event"
49173
+ ])).min(1).optional(),
49174
+ sources: array(OverrideSourceSchema).min(1)
49175
+ });
49176
+ var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
49177
+ "in-addition",
49178
+ "confirm",
49179
+ "replace"
49180
+ ]).optional() });
49181
+ discriminatedUnion("kind", [
49182
+ ScalarOverrideDraftSchema,
49183
+ KeyedArrayOverrideDraftSchema,
49184
+ PulseOverrideDraftSchema,
49185
+ object({
49186
+ kind: literal("span"),
49187
+ cap: string().min(1),
49188
+ targetId: string().min(1),
49189
+ timeoutMs: number().nonnegative(),
49190
+ cooldownMs: number().nonnegative().optional(),
49191
+ sources: array(SpanSourceDraftSchema)
49192
+ })
49193
+ ]);
49194
+ object({
49195
+ targetId: string().min(1),
49196
+ configured: boolean(),
49197
+ source: _enum(["native", "assigned"]),
49198
+ state: _enum([
49199
+ "active",
49200
+ "stale",
49201
+ "released",
49202
+ "unavailable"
49203
+ ]),
49204
+ reason: string().nullable()
49205
+ });
49206
+ /**
49207
+ * What a running-threshold proposal says (planning#405). The schema is the
49208
+ * type: the algorithm, the capability method and the UI all read `z.infer`.
49209
+ *
49210
+ * A proposal is read-only advice: it carries the numbers it was derived from
49211
+ * (`evidence`) so the operator can judge it, and an `insufficient` answer names
49212
+ * WHY with a typed reason and the catalog defaults, never an invented number.
49213
+ */
49214
+ var RunningProposalTierSchema = _enum(["raw", "5m"]);
49215
+ var RunningProposalConfidenceSchema = _enum([
49216
+ "high",
49217
+ "medium",
49218
+ "low"
49219
+ ]);
49220
+ var RunningProposalInsufficientReasonSchema = _enum([
49221
+ "no-history",
49222
+ "span-too-short",
49223
+ "truncated",
49224
+ "no-idle-floor",
49225
+ "no-runs",
49226
+ "no-separation"
49227
+ ]);
49228
+ var RunningProposalReplaySchema = object({
49229
+ /** Intervals the real dwell expression held true over the window. */
49230
+ intervals: number().int().nonnegative(),
49231
+ /** Intervals outside every run, or a second interval inside one. */
49232
+ extra: number().int().nonnegative(),
49233
+ /** Runs without an interval of their own (none, or merged into a neighbour). */
49234
+ missed: number().int().nonnegative()
49235
+ });
49236
+ var RunningProposalEvidenceSchema = object({
49237
+ tier: RunningProposalTierSchema,
49238
+ spanMs: number().nonnegative(),
49239
+ from: number(),
49240
+ to: number(),
49241
+ points: number().int().nonnegative(),
49242
+ runsFound: number().int().nonnegative(),
49243
+ pausesFound: number().int().nonnegative(),
49244
+ longestPauseMs: number().nonnegative(),
49245
+ idleFloorW: number(),
49246
+ noiseCeilingW: number(),
49247
+ plateauW: number(),
49248
+ replay: RunningProposalReplaySchema
49249
+ });
49250
+ var RunningProposalInsufficientEvidenceSchema = object({
49251
+ spanMs: number().nonnegative(),
49252
+ points: number().int().nonnegative(),
49253
+ runsFound: number().int().nonnegative()
49254
+ });
49255
+ var RunningThresholdProposalSchema = discriminatedUnion("state", [object({
49256
+ state: literal("proposal"),
49257
+ transform: ThresholdTransformDraftSchema,
49258
+ evidence: RunningProposalEvidenceSchema,
49259
+ confidence: RunningProposalConfidenceSchema,
49260
+ /** Why the confidence is not higher; empty when nothing held it back. */
49261
+ notes: array(string())
49262
+ }), object({
49263
+ state: literal("insufficient"),
49264
+ reason: RunningProposalInsufficientReasonSchema,
49265
+ evidence: RunningProposalInsufficientEvidenceSchema,
49266
+ /** The catalog defaults, offered as what stands when nothing better is known. */
49267
+ fallback: ThresholdTransformDraftSchema
49268
+ })]);
49269
+ /**
49209
49270
  * The report of a one-shot "move this owner's plaintext secrets into the
49210
49271
  * keychain" run (D878). COUNTS only - never a value, never a ref.
49211
49272
  *
@@ -49495,6 +49556,14 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
49495
49556
  kind: "mutation",
49496
49557
  auth: "admin",
49497
49558
  access: "view"
49559
+ }), method(object({
49560
+ deviceId: number().int(),
49561
+ cap: string().min(1),
49562
+ fieldPath: string().min(1),
49563
+ deviceType: _enum(DeviceType).optional()
49564
+ }), RunningThresholdProposalSchema, {
49565
+ auth: "admin",
49566
+ access: "view"
49498
49567
  }), method(object({
49499
49568
  blockId: string().min(1),
49500
49569
  trace: AutomationRunTraceSchema.optional(),
@@ -50359,7 +50428,53 @@ method(object({
50359
50428
  * exposes only the COMMON surface: link state, supported device
50360
50429
  * kinds (so the UI can filter the device picker), and per-device
50361
50430
  * expose/unexpose.
50431
+ *
50432
+ * INSTANCES. One export addon can serve several independent targets (a
50433
+ * HomeKit bridge, a Home Assistant broker). `listInstances` names them.
50434
+ * `instanceId` on a READ is optional: absent = the whole addon (linked if any
50435
+ * enabled instance is, `exposedDeviceCount` = distinct devices, `setup` = the
50436
+ * default instance's); present = that instance; an id the provider does not
50437
+ * serve is refused with `ExportInstanceUnknownError` (`export-instance-unknown`),
50438
+ * never answered empty. `instanceId` on a WRITE is REQUIRED: a membership
50439
+ * change always names the target it changes. A single-instance provider
50440
+ * accepts an absent id on a read or its own id, and refuses any other.
50441
+ */
50442
+ /** Which instance of an export addon a call addresses. Absent on a read = the whole addon. */
50443
+ var InstanceIdSchema$1 = string().min(1);
50444
+ var InstancePinSchema = object({ instanceId: InstanceIdSchema$1.optional() });
50445
+ /** One independent export target of an addon. */
50446
+ var ExportInstanceSchema = object({
50447
+ instanceId: InstanceIdSchema$1,
50448
+ name: string(),
50449
+ enabled: boolean(),
50450
+ kind: string().optional()
50451
+ });
50452
+ var EXPORT_INSTANCE_UNKNOWN = "export-instance-unknown";
50453
+ /** The named failure of an `instanceId` the provider does not serve. The message starts with the code. */
50454
+ var ExportInstanceUnknownError = class extends Error {
50455
+ code = EXPORT_INSTANCE_UNKNOWN;
50456
+ instanceId;
50457
+ constructor(addon, instanceId) {
50458
+ super(`${EXPORT_INSTANCE_UNKNOWN}: ${addon} serves no instance "${instanceId}"`);
50459
+ this.name = "ExportInstanceUnknownError";
50460
+ this.instanceId = instanceId;
50461
+ }
50462
+ };
50463
+ /**
50464
+ * The instance a `getStatus` call names. The cap's `status` block injects a per-device
50465
+ * `getStatus({ deviceId })` beside the method's own `{ instanceId? }`, so the provider sees
50466
+ * both shapes; only the second names an instance (a per-device status read is addon-wide).
50362
50467
  */
50468
+ function statusInstanceOf(input) {
50469
+ return "instanceId" in input ? input.instanceId : void 0;
50470
+ }
50471
+ /**
50472
+ * A single-instance provider's check: an absent id or its own passes, any other throws
50473
+ * `ExportInstanceUnknownError`.
50474
+ */
50475
+ function assertOwnExportInstance(addon, own, instanceId) {
50476
+ if (instanceId !== void 0 && instanceId !== own) throw new ExportInstanceUnknownError(addon, instanceId);
50477
+ }
50363
50478
  var LinkStateSchema = _enum([
50364
50479
  "unlinked",
50365
50480
  "linked",
@@ -50410,10 +50525,14 @@ var ExposedDeviceSchema = object({
50410
50525
  capabilities: array(string()).optional()
50411
50526
  });
50412
50527
  var ExposeInputSchema = object({
50528
+ instanceId: InstanceIdSchema$1,
50413
50529
  deviceId: string(),
50414
50530
  capabilities: array(string()).optional()
50415
50531
  });
50416
- var UnexposeInputSchema = object({ deviceId: string() });
50532
+ var UnexposeInputSchema = object({
50533
+ instanceId: InstanceIdSchema$1,
50534
+ deviceId: string()
50535
+ });
50417
50536
  /**
50418
50537
  * What an exporter may expose besides devices (D968). An action and a
50419
50538
  * notification target are LIST ENTRIES, never devices (D954): they enter an
@@ -50442,8 +50561,14 @@ var ExposedEntitySchema = object({
50442
50561
  entity: ExportEntityRefSchema,
50443
50562
  exposedAs: string().optional()
50444
50563
  });
50445
- var ExposeEntityInputSchema = object({ entity: ExportEntityRefSchema });
50446
- var UnexposeEntityInputSchema = object({ entity: ExportEntityRefSchema });
50564
+ var ExposeEntityInputSchema = object({
50565
+ instanceId: InstanceIdSchema$1,
50566
+ entity: ExportEntityRefSchema
50567
+ });
50568
+ var UnexposeEntityInputSchema = object({
50569
+ instanceId: InstanceIdSchema$1,
50570
+ entity: ExportEntityRefSchema
50571
+ });
50447
50572
  var deviceExportCapability = {
50448
50573
  name: "device-export",
50449
50574
  scope: "system",
@@ -50463,9 +50588,10 @@ var deviceExportCapability = {
50463
50588
  */
50464
50589
  exposesDeviceSettings: true,
50465
50590
  methods: {
50466
- getStatus: method(_void(), DeviceExportStatusSchema),
50467
- listSupportedDeviceKinds: method(_void(), array(DeviceKindSchema)),
50468
- listExposedDevices: method(_void(), array(ExposedDeviceSchema)),
50591
+ getStatus: method(InstancePinSchema, DeviceExportStatusSchema),
50592
+ listInstances: method(_void(), array(ExportInstanceSchema)),
50593
+ listSupportedDeviceKinds: method(InstancePinSchema, array(DeviceKindSchema)),
50594
+ listExposedDevices: method(InstancePinSchema, array(ExposedDeviceSchema)),
50469
50595
  exposeDevice: method(ExposeInputSchema, _void(), {
50470
50596
  kind: "mutation",
50471
50597
  auth: "admin"
@@ -50475,7 +50601,7 @@ var deviceExportCapability = {
50475
50601
  auth: "admin"
50476
50602
  }),
50477
50603
  listSupportedEntityKinds: optionalMethod(_void(), array(ExportEntityKindSchema)),
50478
- listExposedEntities: optionalMethod(_void(), array(ExposedEntitySchema)),
50604
+ listExposedEntities: optionalMethod(InstancePinSchema, array(ExposedEntitySchema)),
50479
50605
  exposeEntity: optionalMethod(ExposeEntityInputSchema, _void(), {
50480
50606
  kind: "mutation",
50481
50607
  auth: "admin"
@@ -53680,15 +53806,15 @@ var FanPresetCaptureResultSchema = object({
53680
53806
  items: array(FanCaptureItemSchema),
53681
53807
  omitted: array(FanCaptureOmissionSchema)
53682
53808
  });
53683
- var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
53809
+ var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
53684
53810
  DeviceType.Fan;
53685
- method(deviceInput$1, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$1.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
53811
+ method(deviceInput$2, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$2.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
53686
53812
  kind: "mutation",
53687
53813
  auth: "admin"
53688
- }), method(deviceInput$1.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
53814
+ }), method(deviceInput$2.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
53689
53815
  kind: "mutation",
53690
53816
  auth: "protected"
53691
- }), method(deviceInput$1.extend({
53817
+ }), method(deviceInput$2.extend({
53692
53818
  fields: array(FanCaptureFieldSchema).optional(),
53693
53819
  steps: array(ActionStepSchema).max(20).default([])
53694
53820
  }), FanPresetCaptureResultSchema, { auth: "protected" });
@@ -54228,13 +54354,50 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54228
54354
  */
54229
54355
  var ConfigSchemaPassthrough$3 = custom();
54230
54356
  var IntegrationInstanceIdSchema = string().min(1);
54357
+ var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
54358
+ /**
54359
+ * One kind of instance a provider can create (an adapter, an account type). The sign-in and
54360
+ * connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
54361
+ * hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
54362
+ * interactive account link (popup) and may carry `{{brokerId}}`, which the UI replaces with the
54363
+ * instance id.
54364
+ */
54365
+ var IntegrationInstanceKindSchema = object({
54366
+ /** Stable id of the kind, sent back as `createInstance.kind`. */
54367
+ id: string().min(1),
54368
+ label: string().min(1),
54369
+ /** The kind signs in through a server-held interactive session. */
54370
+ signIn: object({
54371
+ basePath: string().min(1),
54372
+ methods: array(_enum(["device-code", "proxy"])).optional()
54373
+ }).optional(),
54374
+ /** Relative hub path to start an interactive account link of an instance of this kind. */
54375
+ connectPath: string().min(1).optional(),
54376
+ /** Relative hub path to disconnect that account. */
54377
+ disconnectPath: string().min(1).optional()
54378
+ });
54231
54379
  var IntegrationInstanceDescriptionSchema = object({
54232
54380
  /** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
54233
- instanceMode: _enum(["single", "multiple"]),
54381
+ instanceMode: IntegrationInstanceModeSchema,
54234
54382
  /** What the instance is, for the UI (`destination`, `relay`, `account`). */
54235
54383
  kind: string(),
54236
54384
  /** True when `testInstance` really probes the remote. */
54237
- canTest: boolean()
54385
+ canTest: boolean(),
54386
+ /**
54387
+ * The kinds an instance can be of. Absent or one entry: nothing to choose; more than one: the
54388
+ * Add flow asks which first and sends it as `createInstance.kind`.
54389
+ */
54390
+ kinds: array(IntegrationInstanceKindSchema).optional(),
54391
+ /**
54392
+ * The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
54393
+ * devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
54394
+ */
54395
+ allowRestoreId: boolean().optional(),
54396
+ /**
54397
+ * `createInstance` without an `id` works: the provider mints it. Absent means the caller must
54398
+ * send an id (the UI then mints an opaque one).
54399
+ */
54400
+ mintsId: boolean().optional()
54238
54401
  });
54239
54402
  var IntegrationInstanceStatusSchema = object({
54240
54403
  state: _enum([
@@ -54243,7 +54406,9 @@ var IntegrationInstanceStatusSchema = object({
54243
54406
  "error",
54244
54407
  "unknown"
54245
54408
  ]),
54246
- detail: string().optional()
54409
+ detail: string().optional(),
54410
+ /** A short human word for the state ("Signed in", "Token expired"); shown instead of `state`. */
54411
+ label: string().optional()
54247
54412
  });
54248
54413
  var IntegrationInstanceSchema = object({
54249
54414
  id: IntegrationInstanceIdSchema,
@@ -54255,9 +54420,13 @@ var IntegrationInstanceSchema = object({
54255
54420
  * (`enabled !== false`, so a row written before the field existed is on).
54256
54421
  */
54257
54422
  enabled: boolean(),
54423
+ /** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
54424
+ kind: string().optional(),
54258
54425
  /** Values for the instance form; a secret is a `SecretFieldView`, never text. */
54259
54426
  formValues: record(string(), unknown()),
54260
- status: IntegrationInstanceStatusSchema.optional()
54427
+ status: IntegrationInstanceStatusSchema.optional(),
54428
+ /** Epoch ms of the last probe of the remote that produced `status`; absent when never checked. */
54429
+ lastCheckedAt: number().optional()
54261
54430
  });
54262
54431
  var IntegrationInstancePatchSchema = object({
54263
54432
  id: IntegrationInstanceIdSchema,
@@ -54266,8 +54435,9 @@ var IntegrationInstancePatchSchema = object({
54266
54435
  values: record(string(), unknown())
54267
54436
  });
54268
54437
  method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema.nullable() }), ConfigSchemaPassthrough$3, { auth: "admin" }), method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }), method(object({
54269
- id: IntegrationInstanceIdSchema,
54270
- name: string().min(1)
54438
+ id: IntegrationInstanceIdSchema.optional(),
54439
+ name: string().min(1),
54440
+ kind: string().min(1).optional()
54271
54441
  }), object({ id: string() }), {
54272
54442
  kind: "mutation",
54273
54443
  auth: "admin"
@@ -56088,6 +56258,11 @@ var LogEntrySchema = object({
56088
56258
  * flight, and not asking for the next slice ends the scan.
56089
56259
  */
56090
56260
  var LogReadQuerySchema = object({
56261
+ /**
56262
+ * Which destination INSTANCE answers (a destination addon may hold several records). Absent ⇒
56263
+ * the provider's first readable one, so a caller written before instances existed is unchanged.
56264
+ */
56265
+ instanceId: string().min(1).max(200).optional(),
56091
56266
  /** Correlates `cancelRead`. Caller-chosen, unique per in-flight read. */
56092
56267
  requestId: string().min(1).max(64).optional(),
56093
56268
  /** The device the line is about (`tags.deviceId`, numeric). */
@@ -56150,6 +56325,8 @@ var LogReadResultSchema = object({
56150
56325
  /** True when `cancelRead` ended this slice early. */
56151
56326
  cancelled: boolean().optional()
56152
56327
  });
56328
+ /** Names one destination instance; absent ⇒ the provider's first readable one. */
56329
+ var LogInstanceSelectorSchema = object({ instanceId: string().min(1).max(200).optional() });
56153
56330
  var LogReadCapabilitiesSchema = object({
56154
56331
  /** False ⇒ this destination only ships lines (console, forwarder, an unconfigured Loki). */
56155
56332
  readable: boolean(),
@@ -56168,7 +56345,7 @@ var LogReadCapabilitiesSchema = object({
56168
56345
  /** How far back the store reaches, when the provider knows (days). */
56169
56346
  retentionDays: number().nullable()
56170
56347
  });
56171
- method(LogEntrySchema, _void(), { kind: "mutation" }), optionalMethod(_void(), LogReadCapabilitiesSchema, { auth: "admin" }), optionalMethod(LogReadQuerySchema, LogReadResultSchema, { auth: "admin" }), optionalMethod(object({ requestId: string().min(1).max(64) }), object({ cancelled: boolean() }), {
56348
+ method(LogEntrySchema, _void(), { kind: "mutation" }), optionalMethod(LogInstanceSelectorSchema, LogReadCapabilitiesSchema, { auth: "admin" }), optionalMethod(LogReadQuerySchema, LogReadResultSchema, { auth: "admin" }), optionalMethod(object({ requestId: string().min(1).max(64) }), object({ cancelled: boolean() }), {
56172
56349
  kind: "mutation",
56173
56350
  auth: "admin"
56174
56351
  });
@@ -67740,6 +67917,49 @@ object({
67740
67917
  DeviceType.PetFeeder,
67741
67918
  DeviceType.Heater
67742
67919
  ].filter((type) => type !== DeviceType.Sensor);
67920
+ var PowerSourceRefusalReasonSchema = _enum([
67921
+ "no-power-source",
67922
+ "switch-missing",
67923
+ "switch-offline",
67924
+ "switch-unknown",
67925
+ "restart-in-progress",
67926
+ "switch-call-failed"
67927
+ ]);
67928
+ var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
67929
+ accepted: literal(false),
67930
+ reason: PowerSourceRefusalReasonSchema,
67931
+ /** One line for the operator, naming the switch. */
67932
+ message: string()
67933
+ })]);
67934
+ var PowerSourceInfoSchema = object({
67935
+ /** False when the device has no power source linked; the rest is then empty. */
67936
+ linked: boolean(),
67937
+ switchDeviceId: number().nullable(),
67938
+ switchName: string().nullable(),
67939
+ /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
67940
+ switchOn: boolean().nullable(),
67941
+ switchOnline: boolean().nullable(),
67942
+ restartInProgress: boolean(),
67943
+ offSeconds: number().int()
67944
+ });
67945
+ object({
67946
+ /** Null while the switch has not reported: unknown is never `false` (D393). */
67947
+ switchOn: boolean().nullable(),
67948
+ offSeconds: number().int(),
67949
+ lastFetchedAt: number()
67950
+ });
67951
+ DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater;
67952
+ var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
67953
+ systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
67954
+ kind: "mutation",
67955
+ auth: "admin"
67956
+ }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
67957
+ kind: "mutation",
67958
+ auth: "admin"
67959
+ }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
67960
+ kind: "mutation",
67961
+ auth: "admin"
67962
+ });
67743
67963
  /**
67744
67964
  * Presence cap. Models HA `person.*` and `device_tracker.*` entities
67745
67965
  * on `DeviceType.Presence`. Read-only — no setters: presence is
@@ -76007,6 +76227,25 @@ function buildDescriptor(capName, kind) {
76007
76227
  * contributes one entry per bound cap present in this map.
76008
76228
  */
76009
76229
  var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
76230
+ /**
76231
+ * What a remote key is CALLED and what it LOOKS like, for every role (D963),
76232
+ * shared by the admin UI and the viewer. A role is data on the wire; each
76233
+ * client resolves its name from `label` (English and Italian side by side) and
76234
+ * its glyph from `icon`, a lucide id from the shared icon catalogue — the
76235
+ * server sends an id, a client maps it to its own icon set.
76236
+ *
76237
+ * `legend` is text printed on the key INSTEAD of a glyph (a digit has no
76238
+ * pictogram): a client that can draw text shows it, one that cannot falls back
76239
+ * to `icon`.
76240
+ */
76241
+ function digit(n) {
76242
+ return {
76243
+ label: t(n, n),
76244
+ icon: "hash",
76245
+ legend: n
76246
+ };
76247
+ }
76248
+ digit("0"), digit("1"), digit("2"), digit("3"), digit("4"), digit("5"), digit("6"), digit("7"), digit("8"), digit("9");
76010
76249
  DeviceFeature.MediaPlayerPower, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious;
76011
76250
  var btn = (idSuffix, row, col, init) => ({
76012
76251
  idSuffix,
@@ -76134,6 +76373,34 @@ discriminatedUnion("kind", [object({
76134
76373
  kind: literal("pronto"),
76135
76374
  code: string()
76136
76375
  })]);
76376
+ /**
76377
+ * Propose a running threshold from a device's own power history (planning#405).
76378
+ *
76379
+ * Pure and deterministic: the same series gives the same answer. The series is
76380
+ * a HELD-VALUE step series — a point's value stands until the next point — which
76381
+ * is how device-history stores a gauge, so "time at a level" is exact, not a
76382
+ * count of samples.
76383
+ *
76384
+ * 1. idle floor F = time-weighted median; noise ceiling N = highest value seen
76385
+ * near F. A device that is not near one level most of the time has no floor.
76386
+ * 2. coarse activity = above max(2N, N + 5 W); consecutive stretches are episodes.
76387
+ * 3. gaps between episodes split in two by the largest log-scale jump (>= 3x):
76388
+ * the short ones are pauses INSIDE a run (a soak), the long ones separate runs.
76389
+ * 4. T = geometric mean of N and the plateau's 10th percentile, snapped to a
76390
+ * grid a person would type; stop dwell covers the longest pause; start dwell
76391
+ * covers the longest standby blip above T.
76392
+ * 5. the numbers are proved by REPLAY through the real `dwell` evaluation: each
76393
+ * run must hold exactly one true interval and nothing may flap outside.
76394
+ */
76395
+ var SECOND_MS = 1e3;
76396
+ var MINUTE_MS$1 = 60 * SECOND_MS;
76397
+ 24 * (60 * MINUTE_MS$1);
76398
+ 10 * MINUTE_MS$1;
76399
+ 30 * SECOND_MS;
76400
+ 60 * SECOND_MS;
76401
+ 20 * MINUTE_MS$1;
76402
+ 10 * SECOND_MS;
76403
+ 10 * SECOND_MS;
76137
76404
  DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverStoppable, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
76138
76405
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
76139
76406
  String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
@@ -77675,6 +77942,13 @@ Object.freeze({
77675
77942
  access: "create",
77676
77943
  role: "admin"
77677
77944
  },
77945
+ "coreBlocks.proposeRunningThreshold": {
77946
+ capName: "core-blocks",
77947
+ capScope: "system",
77948
+ addonId: null,
77949
+ access: "view",
77950
+ role: "admin"
77951
+ },
77678
77952
  "coreBlocks.reportAutomationRun": {
77679
77953
  capName: "core-blocks",
77680
77954
  capScope: "system",
@@ -78186,6 +78460,13 @@ Object.freeze({
78186
78460
  access: "view",
78187
78461
  role: "admin"
78188
78462
  },
78463
+ "deviceExport.listInstances": {
78464
+ capName: "device-export",
78465
+ capScope: "system",
78466
+ addonId: null,
78467
+ access: "view",
78468
+ role: "admin"
78469
+ },
78189
78470
  "deviceExport.listSupportedDeviceKinds": {
78190
78471
  capName: "device-export",
78191
78472
  capScope: "system",
@@ -87158,6 +87439,11 @@ Object.freeze({
87158
87439
  form: "single",
87159
87440
  optional: false
87160
87441
  }],
87442
+ "coreBlocks.proposeRunningThreshold": [{
87443
+ name: "deviceId",
87444
+ form: "single",
87445
+ optional: false
87446
+ }],
87161
87447
  "cover.close": [{
87162
87448
  name: "deviceId",
87163
87449
  form: "single",
@@ -89821,99 +90107,6 @@ Object.freeze({
89821
90107
  "network-access": "ingress",
89822
90108
  "smtp-provider": "email"
89823
90109
  });
89824
- /**
89825
- * A saved Customize assignment (D936). The schema is the type: callers use
89826
- * `z.infer`, they do not restate the shape.
89827
- */
89828
- var OverrideSourceSchema = object({
89829
- addonId: string().min(1),
89830
- stableId: string().min(1),
89831
- cap: string().min(1),
89832
- fieldPath: string().min(1)
89833
- });
89834
- var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
89835
- object({ kind: literal("identity") }),
89836
- object({ kind: literal("invert") }),
89837
- object({
89838
- kind: literal("threshold"),
89839
- comparison: _enum(["gte", "lte"]),
89840
- threshold: number(),
89841
- startDwellMs: number().nonnegative(),
89842
- stopDwellMs: number().nonnegative()
89843
- }),
89844
- object({
89845
- kind: literal("linear"),
89846
- scale: number(),
89847
- offset: number(),
89848
- clampMin: number().optional(),
89849
- clampMax: number().optional()
89850
- }),
89851
- object({
89852
- kind: literal("enum-map"),
89853
- mapping: record(string(), string().nullable())
89854
- }),
89855
- object({ kind: literal("number") })
89856
- ]);
89857
- var ScalarOverrideDraftSchema = object({
89858
- kind: literal("scalar"),
89859
- cap: string().min(1),
89860
- targetId: string().min(1),
89861
- source: OverrideSourceSchema,
89862
- transform: CustomizeTransformDraftSchema
89863
- });
89864
- var KeyedArrayOverrideDraftSchema = object({
89865
- kind: literal("keyedArray"),
89866
- cap: string().min(1),
89867
- targetId: string().min(1),
89868
- key: string().min(1),
89869
- label: string().min(1),
89870
- fieldPath: string().min(1),
89871
- source: OverrideSourceSchema,
89872
- transform: CustomizeTransformDraftSchema
89873
- });
89874
- var PulseOverrideDraftSchema = object({
89875
- kind: literal("pulse"),
89876
- cap: string().min(1),
89877
- targetId: string().min(1),
89878
- enabled: boolean(),
89879
- debounceMs: number().nonnegative(),
89880
- edges: array(_enum([
89881
- "rising",
89882
- "button",
89883
- "native-event"
89884
- ])).min(1).optional(),
89885
- sources: array(OverrideSourceSchema).min(1)
89886
- });
89887
- var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
89888
- "in-addition",
89889
- "confirm",
89890
- "replace"
89891
- ]).optional() });
89892
- discriminatedUnion("kind", [
89893
- ScalarOverrideDraftSchema,
89894
- KeyedArrayOverrideDraftSchema,
89895
- PulseOverrideDraftSchema,
89896
- object({
89897
- kind: literal("span"),
89898
- cap: string().min(1),
89899
- targetId: string().min(1),
89900
- timeoutMs: number().nonnegative(),
89901
- cooldownMs: number().nonnegative().optional(),
89902
- sources: array(SpanSourceDraftSchema)
89903
- })
89904
- ]);
89905
- object({
89906
- targetId: string().min(1),
89907
- configured: boolean(),
89908
- source: _enum(["native", "assigned"]),
89909
- state: _enum([
89910
- "active",
89911
- "stale",
89912
- "released",
89913
- "unavailable"
89914
- ]),
89915
- reason: string().nullable()
89916
- });
89917
90110
  var G711_SCALE_CORRECTION_DB = {
89918
90111
  PCMU: 20 * Math.log10(4),
89919
90112
  PCMA: 20 * Math.log10(8)
@@ -158109,8 +158302,10 @@ var ExportHapAddon = class extends BaseAddon {
158109
158302
  this.subscribeDeviceReadyForReconcile();
158110
158303
  this.subscribeStorageLocationsForClips();
158111
158304
  this.disposeSharedRebuildTimers();
158305
+ const ownInstance = (instanceId) => assertOwnExportInstance("export-hap", EXPORT_HAP_ADDON_ID, instanceId);
158112
158306
  const provider = {
158113
- getStatus: async () => {
158307
+ getStatus: async (input) => {
158308
+ ownInstance(statusInstanceOf(input));
158114
158309
  const anyPaired = Array.from(this.exposed.values()).some((m) => accessoryPaired(m.accessory));
158115
158310
  const linkState = this.lastError ? "error" : anyPaired ? "linked" : "unlinked";
158116
158311
  const setup = this.buildSetupBlock();
@@ -158121,19 +158316,38 @@ var ExportHapAddon = class extends BaseAddon {
158121
158316
  ...setup ? { setup } : {}
158122
158317
  };
158123
158318
  },
158124
- listSupportedDeviceKinds: async () => [...HAP_EXPORTABLE_DEVICE_TYPES],
158125
- listExposedDevices: async () => Array.from(this.exposed.entries()).map(([deviceId, m]) => {
158126
- const entry = this.config.exposed.find((e) => e.deviceId === deviceId);
158127
- return {
158128
- deviceId,
158129
- exposedAs: m.accessory.displayName,
158130
- ...entry?.capabilities ? { capabilities: [...entry.capabilities] } : {}
158131
- };
158132
- }),
158133
- exposeDevice: async ({ deviceId, capabilities }) => this.exposeDevice(deviceId, capabilities),
158134
- unexposeDevice: async ({ deviceId }) => this.unexposeDevice(deviceId),
158319
+ listInstances: async () => [{
158320
+ instanceId: EXPORT_HAP_ADDON_ID,
158321
+ name: "HomeKit",
158322
+ enabled: true,
158323
+ kind: "hap-bridge"
158324
+ }],
158325
+ listSupportedDeviceKinds: async ({ instanceId }) => {
158326
+ ownInstance(instanceId);
158327
+ return [...HAP_EXPORTABLE_DEVICE_TYPES];
158328
+ },
158329
+ listExposedDevices: async ({ instanceId }) => {
158330
+ ownInstance(instanceId);
158331
+ return Array.from(this.exposed.entries()).map(([deviceId, m]) => {
158332
+ const entry = this.config.exposed.find((e) => e.deviceId === deviceId);
158333
+ return {
158334
+ deviceId,
158335
+ exposedAs: m.accessory.displayName,
158336
+ ...entry?.capabilities ? { capabilities: [...entry.capabilities] } : {}
158337
+ };
158338
+ });
158339
+ },
158340
+ exposeDevice: async ({ instanceId, deviceId, capabilities }) => {
158341
+ ownInstance(instanceId);
158342
+ return this.exposeDevice(deviceId, capabilities);
158343
+ },
158344
+ unexposeDevice: async ({ instanceId, deviceId }) => {
158345
+ ownInstance(instanceId);
158346
+ return this.unexposeDevice(deviceId);
158347
+ },
158135
158348
  listSupportedEntityKinds: async () => ["device", "action"],
158136
- listExposedEntities: async () => {
158349
+ listExposedEntities: async ({ instanceId }) => {
158350
+ ownInstance(instanceId);
158137
158351
  await this.actionExports?.reconcile();
158138
158352
  return [...Array.from(this.exposed.entries()).map(([deviceId, m]) => ({
158139
158353
  entity: {
@@ -158143,12 +158357,14 @@ var ExportHapAddon = class extends BaseAddon {
158143
158357
  exposedAs: m.accessory.displayName
158144
158358
  })), ...this.actionExports?.list() ?? []];
158145
158359
  },
158146
- exposeEntity: async ({ entity }) => {
158360
+ exposeEntity: async ({ instanceId, entity }) => {
158361
+ ownInstance(instanceId);
158147
158362
  if (entity.kind === "device") return this.exposeDevice(entity.deviceId);
158148
158363
  if (entity.kind === "action") return this.requireActionExports().expose(entity.actionId);
158149
158364
  throw new Error("export-hap: a notification target cannot be exported to HomeKit");
158150
158365
  },
158151
- unexposeEntity: async ({ entity }) => {
158366
+ unexposeEntity: async ({ instanceId, entity }) => {
158367
+ ownInstance(instanceId);
158152
158368
  if (entity.kind === "device") return this.unexposeDevice(entity.deviceId);
158153
158369
  if (entity.kind === "action") return this.requireActionExports().unexpose(entity.actionId);
158154
158370
  throw new Error("export-hap: a notification target cannot be exported to HomeKit");