@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.
@@ -5898,7 +5898,7 @@ var ZodIssueCode = {
5898
5898
  var ZodFirstPartyTypeKind;
5899
5899
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5900
5900
  //#endregion
5901
- //#region ../types/dist/sleep-BKClVk0K.mjs
5901
+ //#region ../types/dist/sleep-BkzQdpzF.mjs
5902
5902
  /**
5903
5903
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5904
5904
  * window to float samples (D455).
@@ -7986,6 +7986,10 @@ var BaseAddon = class {
7986
7986
  const stored = keychain ? await this.readAddonStoreWithRetry() : {};
7987
7987
  const patch = {};
7988
7988
  for (const key of keys) {
7989
+ if (tree.get(key)?.kind === "array") {
7990
+ patch[key] = [];
7991
+ continue;
7992
+ }
7989
7993
  const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7990
7994
  patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7991
7995
  }
@@ -11442,7 +11446,7 @@ object({
11442
11446
  params: record(string(), union([string(), number()])).optional()
11443
11447
  });
11444
11448
  //#endregion
11445
- //#region ../types/dist/composition-BodkvOV0.mjs
11449
+ //#region ../types/dist/composition-CRNwcFYY.mjs
11446
11450
  var AUDIO_ENCODER_BY_CODEC = {
11447
11451
  opus: "libopus",
11448
11452
  aac: "aac",
@@ -11619,6 +11623,7 @@ function buildVideoArgs(video, outputArgs, filterGraph, hwEncode) {
11619
11623
  if (video.level !== void 0) args.push("-level", video.level);
11620
11624
  if (video.pixelFormat !== void 0) args.push("-pix_fmt", video.pixelFormat);
11621
11625
  if (video.fps !== void 0) args.push("-r", String(video.fps));
11626
+ if (video.fpsMode !== void 0) args.push("-fps_mode", video.fpsMode);
11622
11627
  if (video.gopFrames !== void 0) args.push("-g", String(video.gopFrames));
11623
11628
  if (video.forceKeyFramesSeconds !== void 0) args.push("-force_key_frames", `expr:gte(t,n_forced*${video.forceKeyFramesSeconds})`);
11624
11629
  if (video.bf !== void 0) args.push("-bf", String(video.bf));
@@ -12800,38 +12805,6 @@ function validateExpressionSource(src) {
12800
12805
  return null;
12801
12806
  }
12802
12807
  /**
12803
- * One power reading becomes a washer, dryer or dishwasher (D944 helper).
12804
- *
12805
- * Standby of the control board is under 5 W; a motor or a heater is far
12806
- * above that, so 5 W is the line. A door lock or a short pump spike is not
12807
- * a cycle, so running starts only after 30 s above the line.
12808
- *
12809
- * A wash, dry or dishwasher pause (soak, heat-wait, heater off between
12810
- * bursts) lasts several minutes. Ending the cycle on the first dip would
12811
- * report "finished" in the middle of the program, so the stop dwell is
12812
- * 10 minutes on every type. The number is stored per type so one machine
12813
- * can move later without moving the others.
12814
- */
12815
- var APPLIANCE_TEMPLATE_ID = "appliance";
12816
- var APPLIANCE_KINDS = [
12817
- "washer",
12818
- "dryer",
12819
- "dishwasher"
12820
- ];
12821
- DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
12822
- /**
12823
- * A dumb plug-in stove or heater, built from a smart plug (a `Heater`).
12824
- *
12825
- * The plug is the actuator: `switch.setState` is a FORWARD to the plug's own
12826
- * (D967), so the heater switches exactly as the plug does. Running is the
12827
- * plug being on; when a power reading is also named, running is the draw
12828
- * staying above the line instead (a plug left on with the stove's own
12829
- * thermostat open is not heating). 50 W is far above any standby and below
12830
- * the smallest radiator.
12831
- */
12832
- var HEATER_TEMPLATE_ID = "heater";
12833
- DeviceType.Heater;
12834
- /**
12835
12808
  * Statistics and integrals over a history read (D944).
12836
12809
  *
12837
12810
  * Pure: the same points always give the same answer, so a restart recomputes
@@ -12975,34 +12948,6 @@ var HelperSpecSchema = discriminatedUnion("kind", [
12975
12948
  /** Actuator groups only. Readings leave this unset. */
12976
12949
  active: ActiveCriterionSchema.optional()
12977
12950
  }),
12978
- object({
12979
- kind: literal("appliance"),
12980
- templateId: literal(APPLIANCE_TEMPLATE_ID),
12981
- appliance: _enum(APPLIANCE_KINDS),
12982
- thresholdWatts: number().positive(),
12983
- startDwellMs: number().int().nonnegative(),
12984
- stopDwellMs: number().int().nonnegative(),
12985
- member: HelperMemberSchema,
12986
- /**
12987
- * The plug that powers the appliance (`switch.on`). Optional: when set, the
12988
- * composition carries a `power-source` feature, so the hub can cut and restore
12989
- * that plug (power-source link of a NEW-target composition).
12990
- */
12991
- powerSwitch: HelperMemberSchema.optional(),
12992
- /** How long a forced restart keeps the plug off; the cap's default when unset. */
12993
- offSeconds: number().optional()
12994
- }),
12995
- object({
12996
- kind: literal("heater"),
12997
- templateId: literal(HEATER_TEMPLATE_ID),
12998
- /** The plug, read and commanded at `switch.on`. */
12999
- plug: HelperMemberSchema,
13000
- /** The plug's power reading, when it has one: running is then the draw, not the switch. */
13001
- meter: HelperMemberSchema.optional(),
13002
- thresholdWatts: number().positive(),
13003
- startDwellMs: number().int().nonnegative(),
13004
- stopDwellMs: number().int().nonnegative()
13005
- }),
13006
12951
  object({
13007
12952
  kind: literal("statistic"),
13008
12953
  stat: _enum(STATISTIC_STATS),
@@ -13226,7 +13171,7 @@ var CompositionSchema = object({
13226
13171
  kind: literal("existing"),
13227
13172
  device: CompositionSourceRefSchema
13228
13173
  })]),
13229
- features: array(CompositionFeatureSchema).min(1).max(16),
13174
+ features: array(CompositionFeatureSchema).min(0).max(16),
13230
13175
  /**
13231
13176
  * Present when the block is a helper template. Absent on a free
13232
13177
  * composition (the room example, device 4603). The editor reads this,
@@ -49146,49 +49091,6 @@ function actuator(input) {
49146
49091
  };
49147
49092
  }
49148
49093
  new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
49149
- var PowerSourceRefusalReasonSchema = _enum([
49150
- "no-power-source",
49151
- "switch-missing",
49152
- "switch-offline",
49153
- "switch-unknown",
49154
- "restart-in-progress",
49155
- "switch-call-failed"
49156
- ]);
49157
- var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
49158
- accepted: literal(false),
49159
- reason: PowerSourceRefusalReasonSchema,
49160
- /** One line for the operator, naming the switch. */
49161
- message: string()
49162
- })]);
49163
- var PowerSourceInfoSchema = object({
49164
- /** False when the device has no power source linked; the rest is then empty. */
49165
- linked: boolean(),
49166
- switchDeviceId: number().nullable(),
49167
- switchName: string().nullable(),
49168
- /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
49169
- switchOn: boolean().nullable(),
49170
- switchOnline: boolean().nullable(),
49171
- restartInProgress: boolean(),
49172
- offSeconds: number().int()
49173
- });
49174
- object({
49175
- /** Null while the switch has not reported: unknown is never `false` (D393). */
49176
- switchOn: boolean().nullable(),
49177
- offSeconds: number().int(),
49178
- lastFetchedAt: number()
49179
- });
49180
- 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;
49181
- var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
49182
- systemMethod(deviceInput$2, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
49183
- kind: "mutation",
49184
- auth: "admin"
49185
- }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
49186
- kind: "mutation",
49187
- auth: "admin"
49188
- }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
49189
- kind: "mutation",
49190
- auth: "admin"
49191
- });
49192
49094
  DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
49193
49095
  DeviceType.Camera;
49194
49096
  `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
@@ -49216,6 +49118,165 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
49216
49118
  }).optional()
49217
49119
  })) });
49218
49120
  /**
49121
+ * A saved Customize assignment (D936). The schema is the type: callers use
49122
+ * `z.infer`, they do not restate the shape.
49123
+ */
49124
+ var OverrideSourceSchema = object({
49125
+ addonId: string().min(1),
49126
+ stableId: string().min(1),
49127
+ cap: string().min(1),
49128
+ fieldPath: string().min(1)
49129
+ });
49130
+ var IdentityTransformDraftSchema = object({ kind: literal("identity") });
49131
+ var InvertTransformDraftSchema = object({ kind: literal("invert") });
49132
+ var ThresholdTransformDraftSchema = object({
49133
+ kind: literal("threshold"),
49134
+ comparison: _enum(["gte", "lte"]),
49135
+ threshold: number(),
49136
+ startDwellMs: number().nonnegative(),
49137
+ stopDwellMs: number().nonnegative()
49138
+ });
49139
+ var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
49140
+ IdentityTransformDraftSchema,
49141
+ InvertTransformDraftSchema,
49142
+ ThresholdTransformDraftSchema,
49143
+ object({
49144
+ kind: literal("linear"),
49145
+ scale: number(),
49146
+ offset: number(),
49147
+ clampMin: number().optional(),
49148
+ clampMax: number().optional()
49149
+ }),
49150
+ object({
49151
+ kind: literal("enum-map"),
49152
+ mapping: record(string(), string().nullable())
49153
+ }),
49154
+ object({ kind: literal("number") })
49155
+ ]);
49156
+ var ScalarOverrideDraftSchema = object({
49157
+ kind: literal("scalar"),
49158
+ cap: string().min(1),
49159
+ targetId: string().min(1),
49160
+ source: OverrideSourceSchema,
49161
+ transform: CustomizeTransformDraftSchema
49162
+ });
49163
+ var KeyedArrayOverrideDraftSchema = object({
49164
+ kind: literal("keyedArray"),
49165
+ cap: string().min(1),
49166
+ targetId: string().min(1),
49167
+ key: string().min(1),
49168
+ label: string().min(1),
49169
+ fieldPath: string().min(1),
49170
+ source: OverrideSourceSchema,
49171
+ transform: CustomizeTransformDraftSchema
49172
+ });
49173
+ var PulseOverrideDraftSchema = object({
49174
+ kind: literal("pulse"),
49175
+ cap: string().min(1),
49176
+ targetId: string().min(1),
49177
+ enabled: boolean(),
49178
+ debounceMs: number().nonnegative(),
49179
+ edges: array(_enum([
49180
+ "rising",
49181
+ "button",
49182
+ "native-event"
49183
+ ])).min(1).optional(),
49184
+ sources: array(OverrideSourceSchema).min(1)
49185
+ });
49186
+ var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
49187
+ "in-addition",
49188
+ "confirm",
49189
+ "replace"
49190
+ ]).optional() });
49191
+ discriminatedUnion("kind", [
49192
+ ScalarOverrideDraftSchema,
49193
+ KeyedArrayOverrideDraftSchema,
49194
+ PulseOverrideDraftSchema,
49195
+ object({
49196
+ kind: literal("span"),
49197
+ cap: string().min(1),
49198
+ targetId: string().min(1),
49199
+ timeoutMs: number().nonnegative(),
49200
+ cooldownMs: number().nonnegative().optional(),
49201
+ sources: array(SpanSourceDraftSchema)
49202
+ })
49203
+ ]);
49204
+ object({
49205
+ targetId: string().min(1),
49206
+ configured: boolean(),
49207
+ source: _enum(["native", "assigned"]),
49208
+ state: _enum([
49209
+ "active",
49210
+ "stale",
49211
+ "released",
49212
+ "unavailable"
49213
+ ]),
49214
+ reason: string().nullable()
49215
+ });
49216
+ /**
49217
+ * What a running-threshold proposal says (planning#405). The schema is the
49218
+ * type: the algorithm, the capability method and the UI all read `z.infer`.
49219
+ *
49220
+ * A proposal is read-only advice: it carries the numbers it was derived from
49221
+ * (`evidence`) so the operator can judge it, and an `insufficient` answer names
49222
+ * WHY with a typed reason and the catalog defaults, never an invented number.
49223
+ */
49224
+ var RunningProposalTierSchema = _enum(["raw", "5m"]);
49225
+ var RunningProposalConfidenceSchema = _enum([
49226
+ "high",
49227
+ "medium",
49228
+ "low"
49229
+ ]);
49230
+ var RunningProposalInsufficientReasonSchema = _enum([
49231
+ "no-history",
49232
+ "span-too-short",
49233
+ "truncated",
49234
+ "no-idle-floor",
49235
+ "no-runs",
49236
+ "no-separation"
49237
+ ]);
49238
+ var RunningProposalReplaySchema = object({
49239
+ /** Intervals the real dwell expression held true over the window. */
49240
+ intervals: number().int().nonnegative(),
49241
+ /** Intervals outside every run, or a second interval inside one. */
49242
+ extra: number().int().nonnegative(),
49243
+ /** Runs without an interval of their own (none, or merged into a neighbour). */
49244
+ missed: number().int().nonnegative()
49245
+ });
49246
+ var RunningProposalEvidenceSchema = object({
49247
+ tier: RunningProposalTierSchema,
49248
+ spanMs: number().nonnegative(),
49249
+ from: number(),
49250
+ to: number(),
49251
+ points: number().int().nonnegative(),
49252
+ runsFound: number().int().nonnegative(),
49253
+ pausesFound: number().int().nonnegative(),
49254
+ longestPauseMs: number().nonnegative(),
49255
+ idleFloorW: number(),
49256
+ noiseCeilingW: number(),
49257
+ plateauW: number(),
49258
+ replay: RunningProposalReplaySchema
49259
+ });
49260
+ var RunningProposalInsufficientEvidenceSchema = object({
49261
+ spanMs: number().nonnegative(),
49262
+ points: number().int().nonnegative(),
49263
+ runsFound: number().int().nonnegative()
49264
+ });
49265
+ var RunningThresholdProposalSchema = discriminatedUnion("state", [object({
49266
+ state: literal("proposal"),
49267
+ transform: ThresholdTransformDraftSchema,
49268
+ evidence: RunningProposalEvidenceSchema,
49269
+ confidence: RunningProposalConfidenceSchema,
49270
+ /** Why the confidence is not higher; empty when nothing held it back. */
49271
+ notes: array(string())
49272
+ }), object({
49273
+ state: literal("insufficient"),
49274
+ reason: RunningProposalInsufficientReasonSchema,
49275
+ evidence: RunningProposalInsufficientEvidenceSchema,
49276
+ /** The catalog defaults, offered as what stands when nothing better is known. */
49277
+ fallback: ThresholdTransformDraftSchema
49278
+ })]);
49279
+ /**
49219
49280
  * The report of a one-shot "move this owner's plaintext secrets into the
49220
49281
  * keychain" run (D878). COUNTS only - never a value, never a ref.
49221
49282
  *
@@ -49505,6 +49566,14 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
49505
49566
  kind: "mutation",
49506
49567
  auth: "admin",
49507
49568
  access: "view"
49569
+ }), method(object({
49570
+ deviceId: number().int(),
49571
+ cap: string().min(1),
49572
+ fieldPath: string().min(1),
49573
+ deviceType: _enum(DeviceType).optional()
49574
+ }), RunningThresholdProposalSchema, {
49575
+ auth: "admin",
49576
+ access: "view"
49508
49577
  }), method(object({
49509
49578
  blockId: string().min(1),
49510
49579
  trace: AutomationRunTraceSchema.optional(),
@@ -50369,7 +50438,53 @@ method(object({
50369
50438
  * exposes only the COMMON surface: link state, supported device
50370
50439
  * kinds (so the UI can filter the device picker), and per-device
50371
50440
  * expose/unexpose.
50441
+ *
50442
+ * INSTANCES. One export addon can serve several independent targets (a
50443
+ * HomeKit bridge, a Home Assistant broker). `listInstances` names them.
50444
+ * `instanceId` on a READ is optional: absent = the whole addon (linked if any
50445
+ * enabled instance is, `exposedDeviceCount` = distinct devices, `setup` = the
50446
+ * default instance's); present = that instance; an id the provider does not
50447
+ * serve is refused with `ExportInstanceUnknownError` (`export-instance-unknown`),
50448
+ * never answered empty. `instanceId` on a WRITE is REQUIRED: a membership
50449
+ * change always names the target it changes. A single-instance provider
50450
+ * accepts an absent id on a read or its own id, and refuses any other.
50451
+ */
50452
+ /** Which instance of an export addon a call addresses. Absent on a read = the whole addon. */
50453
+ var InstanceIdSchema$1 = string().min(1);
50454
+ var InstancePinSchema = object({ instanceId: InstanceIdSchema$1.optional() });
50455
+ /** One independent export target of an addon. */
50456
+ var ExportInstanceSchema = object({
50457
+ instanceId: InstanceIdSchema$1,
50458
+ name: string(),
50459
+ enabled: boolean(),
50460
+ kind: string().optional()
50461
+ });
50462
+ var EXPORT_INSTANCE_UNKNOWN = "export-instance-unknown";
50463
+ /** The named failure of an `instanceId` the provider does not serve. The message starts with the code. */
50464
+ var ExportInstanceUnknownError = class extends Error {
50465
+ code = EXPORT_INSTANCE_UNKNOWN;
50466
+ instanceId;
50467
+ constructor(addon, instanceId) {
50468
+ super(`${EXPORT_INSTANCE_UNKNOWN}: ${addon} serves no instance "${instanceId}"`);
50469
+ this.name = "ExportInstanceUnknownError";
50470
+ this.instanceId = instanceId;
50471
+ }
50472
+ };
50473
+ /**
50474
+ * The instance a `getStatus` call names. The cap's `status` block injects a per-device
50475
+ * `getStatus({ deviceId })` beside the method's own `{ instanceId? }`, so the provider sees
50476
+ * both shapes; only the second names an instance (a per-device status read is addon-wide).
50372
50477
  */
50478
+ function statusInstanceOf(input) {
50479
+ return "instanceId" in input ? input.instanceId : void 0;
50480
+ }
50481
+ /**
50482
+ * A single-instance provider's check: an absent id or its own passes, any other throws
50483
+ * `ExportInstanceUnknownError`.
50484
+ */
50485
+ function assertOwnExportInstance(addon, own, instanceId) {
50486
+ if (instanceId !== void 0 && instanceId !== own) throw new ExportInstanceUnknownError(addon, instanceId);
50487
+ }
50373
50488
  var LinkStateSchema = _enum([
50374
50489
  "unlinked",
50375
50490
  "linked",
@@ -50420,10 +50535,14 @@ var ExposedDeviceSchema = object({
50420
50535
  capabilities: array(string()).optional()
50421
50536
  });
50422
50537
  var ExposeInputSchema = object({
50538
+ instanceId: InstanceIdSchema$1,
50423
50539
  deviceId: string(),
50424
50540
  capabilities: array(string()).optional()
50425
50541
  });
50426
- var UnexposeInputSchema = object({ deviceId: string() });
50542
+ var UnexposeInputSchema = object({
50543
+ instanceId: InstanceIdSchema$1,
50544
+ deviceId: string()
50545
+ });
50427
50546
  /**
50428
50547
  * What an exporter may expose besides devices (D968). An action and a
50429
50548
  * notification target are LIST ENTRIES, never devices (D954): they enter an
@@ -50452,8 +50571,14 @@ var ExposedEntitySchema = object({
50452
50571
  entity: ExportEntityRefSchema,
50453
50572
  exposedAs: string().optional()
50454
50573
  });
50455
- var ExposeEntityInputSchema = object({ entity: ExportEntityRefSchema });
50456
- var UnexposeEntityInputSchema = object({ entity: ExportEntityRefSchema });
50574
+ var ExposeEntityInputSchema = object({
50575
+ instanceId: InstanceIdSchema$1,
50576
+ entity: ExportEntityRefSchema
50577
+ });
50578
+ var UnexposeEntityInputSchema = object({
50579
+ instanceId: InstanceIdSchema$1,
50580
+ entity: ExportEntityRefSchema
50581
+ });
50457
50582
  var deviceExportCapability = {
50458
50583
  name: "device-export",
50459
50584
  scope: "system",
@@ -50473,9 +50598,10 @@ var deviceExportCapability = {
50473
50598
  */
50474
50599
  exposesDeviceSettings: true,
50475
50600
  methods: {
50476
- getStatus: method(_void(), DeviceExportStatusSchema),
50477
- listSupportedDeviceKinds: method(_void(), array(DeviceKindSchema)),
50478
- listExposedDevices: method(_void(), array(ExposedDeviceSchema)),
50601
+ getStatus: method(InstancePinSchema, DeviceExportStatusSchema),
50602
+ listInstances: method(_void(), array(ExportInstanceSchema)),
50603
+ listSupportedDeviceKinds: method(InstancePinSchema, array(DeviceKindSchema)),
50604
+ listExposedDevices: method(InstancePinSchema, array(ExposedDeviceSchema)),
50479
50605
  exposeDevice: method(ExposeInputSchema, _void(), {
50480
50606
  kind: "mutation",
50481
50607
  auth: "admin"
@@ -50485,7 +50611,7 @@ var deviceExportCapability = {
50485
50611
  auth: "admin"
50486
50612
  }),
50487
50613
  listSupportedEntityKinds: optionalMethod(_void(), array(ExportEntityKindSchema)),
50488
- listExposedEntities: optionalMethod(_void(), array(ExposedEntitySchema)),
50614
+ listExposedEntities: optionalMethod(InstancePinSchema, array(ExposedEntitySchema)),
50489
50615
  exposeEntity: optionalMethod(ExposeEntityInputSchema, _void(), {
50490
50616
  kind: "mutation",
50491
50617
  auth: "admin"
@@ -53690,15 +53816,15 @@ var FanPresetCaptureResultSchema = object({
53690
53816
  items: array(FanCaptureItemSchema),
53691
53817
  omitted: array(FanCaptureOmissionSchema)
53692
53818
  });
53693
- var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
53819
+ var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
53694
53820
  DeviceType.Fan;
53695
- method(deviceInput$1, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$1.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
53821
+ method(deviceInput$2, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$2.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
53696
53822
  kind: "mutation",
53697
53823
  auth: "admin"
53698
- }), method(deviceInput$1.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
53824
+ }), method(deviceInput$2.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
53699
53825
  kind: "mutation",
53700
53826
  auth: "protected"
53701
- }), method(deviceInput$1.extend({
53827
+ }), method(deviceInput$2.extend({
53702
53828
  fields: array(FanCaptureFieldSchema).optional(),
53703
53829
  steps: array(ActionStepSchema).max(20).default([])
53704
53830
  }), FanPresetCaptureResultSchema, { auth: "protected" });
@@ -54238,13 +54364,50 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
54238
54364
  */
54239
54365
  var ConfigSchemaPassthrough$3 = custom();
54240
54366
  var IntegrationInstanceIdSchema = string().min(1);
54367
+ var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
54368
+ /**
54369
+ * One kind of instance a provider can create (an adapter, an account type). The sign-in and
54370
+ * connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
54371
+ * hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
54372
+ * interactive account link (popup) and may carry `{{brokerId}}`, which the UI replaces with the
54373
+ * instance id.
54374
+ */
54375
+ var IntegrationInstanceKindSchema = object({
54376
+ /** Stable id of the kind, sent back as `createInstance.kind`. */
54377
+ id: string().min(1),
54378
+ label: string().min(1),
54379
+ /** The kind signs in through a server-held interactive session. */
54380
+ signIn: object({
54381
+ basePath: string().min(1),
54382
+ methods: array(_enum(["device-code", "proxy"])).optional()
54383
+ }).optional(),
54384
+ /** Relative hub path to start an interactive account link of an instance of this kind. */
54385
+ connectPath: string().min(1).optional(),
54386
+ /** Relative hub path to disconnect that account. */
54387
+ disconnectPath: string().min(1).optional()
54388
+ });
54241
54389
  var IntegrationInstanceDescriptionSchema = object({
54242
54390
  /** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
54243
- instanceMode: _enum(["single", "multiple"]),
54391
+ instanceMode: IntegrationInstanceModeSchema,
54244
54392
  /** What the instance is, for the UI (`destination`, `relay`, `account`). */
54245
54393
  kind: string(),
54246
54394
  /** True when `testInstance` really probes the remote. */
54247
- canTest: boolean()
54395
+ canTest: boolean(),
54396
+ /**
54397
+ * The kinds an instance can be of. Absent or one entry: nothing to choose; more than one: the
54398
+ * Add flow asks which first and sends it as `createInstance.kind`.
54399
+ */
54400
+ kinds: array(IntegrationInstanceKindSchema).optional(),
54401
+ /**
54402
+ * The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
54403
+ * devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
54404
+ */
54405
+ allowRestoreId: boolean().optional(),
54406
+ /**
54407
+ * `createInstance` without an `id` works: the provider mints it. Absent means the caller must
54408
+ * send an id (the UI then mints an opaque one).
54409
+ */
54410
+ mintsId: boolean().optional()
54248
54411
  });
54249
54412
  var IntegrationInstanceStatusSchema = object({
54250
54413
  state: _enum([
@@ -54253,7 +54416,9 @@ var IntegrationInstanceStatusSchema = object({
54253
54416
  "error",
54254
54417
  "unknown"
54255
54418
  ]),
54256
- detail: string().optional()
54419
+ detail: string().optional(),
54420
+ /** A short human word for the state ("Signed in", "Token expired"); shown instead of `state`. */
54421
+ label: string().optional()
54257
54422
  });
54258
54423
  var IntegrationInstanceSchema = object({
54259
54424
  id: IntegrationInstanceIdSchema,
@@ -54265,9 +54430,13 @@ var IntegrationInstanceSchema = object({
54265
54430
  * (`enabled !== false`, so a row written before the field existed is on).
54266
54431
  */
54267
54432
  enabled: boolean(),
54433
+ /** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
54434
+ kind: string().optional(),
54268
54435
  /** Values for the instance form; a secret is a `SecretFieldView`, never text. */
54269
54436
  formValues: record(string(), unknown()),
54270
- status: IntegrationInstanceStatusSchema.optional()
54437
+ status: IntegrationInstanceStatusSchema.optional(),
54438
+ /** Epoch ms of the last probe of the remote that produced `status`; absent when never checked. */
54439
+ lastCheckedAt: number().optional()
54271
54440
  });
54272
54441
  var IntegrationInstancePatchSchema = object({
54273
54442
  id: IntegrationInstanceIdSchema,
@@ -54276,8 +54445,9 @@ var IntegrationInstancePatchSchema = object({
54276
54445
  values: record(string(), unknown())
54277
54446
  });
54278
54447
  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({
54279
- id: IntegrationInstanceIdSchema,
54280
- name: string().min(1)
54448
+ id: IntegrationInstanceIdSchema.optional(),
54449
+ name: string().min(1),
54450
+ kind: string().min(1).optional()
54281
54451
  }), object({ id: string() }), {
54282
54452
  kind: "mutation",
54283
54453
  auth: "admin"
@@ -56098,6 +56268,11 @@ var LogEntrySchema = object({
56098
56268
  * flight, and not asking for the next slice ends the scan.
56099
56269
  */
56100
56270
  var LogReadQuerySchema = object({
56271
+ /**
56272
+ * Which destination INSTANCE answers (a destination addon may hold several records). Absent ⇒
56273
+ * the provider's first readable one, so a caller written before instances existed is unchanged.
56274
+ */
56275
+ instanceId: string().min(1).max(200).optional(),
56101
56276
  /** Correlates `cancelRead`. Caller-chosen, unique per in-flight read. */
56102
56277
  requestId: string().min(1).max(64).optional(),
56103
56278
  /** The device the line is about (`tags.deviceId`, numeric). */
@@ -56160,6 +56335,8 @@ var LogReadResultSchema = object({
56160
56335
  /** True when `cancelRead` ended this slice early. */
56161
56336
  cancelled: boolean().optional()
56162
56337
  });
56338
+ /** Names one destination instance; absent ⇒ the provider's first readable one. */
56339
+ var LogInstanceSelectorSchema = object({ instanceId: string().min(1).max(200).optional() });
56163
56340
  var LogReadCapabilitiesSchema = object({
56164
56341
  /** False ⇒ this destination only ships lines (console, forwarder, an unconfigured Loki). */
56165
56342
  readable: boolean(),
@@ -56178,7 +56355,7 @@ var LogReadCapabilitiesSchema = object({
56178
56355
  /** How far back the store reaches, when the provider knows (days). */
56179
56356
  retentionDays: number().nullable()
56180
56357
  });
56181
- 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() }), {
56358
+ 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() }), {
56182
56359
  kind: "mutation",
56183
56360
  auth: "admin"
56184
56361
  });
@@ -67750,6 +67927,49 @@ object({
67750
67927
  DeviceType.PetFeeder,
67751
67928
  DeviceType.Heater
67752
67929
  ].filter((type) => type !== DeviceType.Sensor);
67930
+ var PowerSourceRefusalReasonSchema = _enum([
67931
+ "no-power-source",
67932
+ "switch-missing",
67933
+ "switch-offline",
67934
+ "switch-unknown",
67935
+ "restart-in-progress",
67936
+ "switch-call-failed"
67937
+ ]);
67938
+ var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
67939
+ accepted: literal(false),
67940
+ reason: PowerSourceRefusalReasonSchema,
67941
+ /** One line for the operator, naming the switch. */
67942
+ message: string()
67943
+ })]);
67944
+ var PowerSourceInfoSchema = object({
67945
+ /** False when the device has no power source linked; the rest is then empty. */
67946
+ linked: boolean(),
67947
+ switchDeviceId: number().nullable(),
67948
+ switchName: string().nullable(),
67949
+ /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
67950
+ switchOn: boolean().nullable(),
67951
+ switchOnline: boolean().nullable(),
67952
+ restartInProgress: boolean(),
67953
+ offSeconds: number().int()
67954
+ });
67955
+ object({
67956
+ /** Null while the switch has not reported: unknown is never `false` (D393). */
67957
+ switchOn: boolean().nullable(),
67958
+ offSeconds: number().int(),
67959
+ lastFetchedAt: number()
67960
+ });
67961
+ 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;
67962
+ var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
67963
+ systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
67964
+ kind: "mutation",
67965
+ auth: "admin"
67966
+ }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
67967
+ kind: "mutation",
67968
+ auth: "admin"
67969
+ }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
67970
+ kind: "mutation",
67971
+ auth: "admin"
67972
+ });
67753
67973
  /**
67754
67974
  * Presence cap. Models HA `person.*` and `device_tracker.*` entities
67755
67975
  * on `DeviceType.Presence`. Read-only — no setters: presence is
@@ -76017,6 +76237,25 @@ function buildDescriptor(capName, kind) {
76017
76237
  * contributes one entry per bound cap present in this map.
76018
76238
  */
76019
76239
  var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
76240
+ /**
76241
+ * What a remote key is CALLED and what it LOOKS like, for every role (D963),
76242
+ * shared by the admin UI and the viewer. A role is data on the wire; each
76243
+ * client resolves its name from `label` (English and Italian side by side) and
76244
+ * its glyph from `icon`, a lucide id from the shared icon catalogue — the
76245
+ * server sends an id, a client maps it to its own icon set.
76246
+ *
76247
+ * `legend` is text printed on the key INSTEAD of a glyph (a digit has no
76248
+ * pictogram): a client that can draw text shows it, one that cannot falls back
76249
+ * to `icon`.
76250
+ */
76251
+ function digit(n) {
76252
+ return {
76253
+ label: t(n, n),
76254
+ icon: "hash",
76255
+ legend: n
76256
+ };
76257
+ }
76258
+ digit("0"), digit("1"), digit("2"), digit("3"), digit("4"), digit("5"), digit("6"), digit("7"), digit("8"), digit("9");
76020
76259
  DeviceFeature.MediaPlayerPower, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious;
76021
76260
  var btn = (idSuffix, row, col, init) => ({
76022
76261
  idSuffix,
@@ -76144,6 +76383,34 @@ discriminatedUnion("kind", [object({
76144
76383
  kind: literal("pronto"),
76145
76384
  code: string()
76146
76385
  })]);
76386
+ /**
76387
+ * Propose a running threshold from a device's own power history (planning#405).
76388
+ *
76389
+ * Pure and deterministic: the same series gives the same answer. The series is
76390
+ * a HELD-VALUE step series — a point's value stands until the next point — which
76391
+ * is how device-history stores a gauge, so "time at a level" is exact, not a
76392
+ * count of samples.
76393
+ *
76394
+ * 1. idle floor F = time-weighted median; noise ceiling N = highest value seen
76395
+ * near F. A device that is not near one level most of the time has no floor.
76396
+ * 2. coarse activity = above max(2N, N + 5 W); consecutive stretches are episodes.
76397
+ * 3. gaps between episodes split in two by the largest log-scale jump (>= 3x):
76398
+ * the short ones are pauses INSIDE a run (a soak), the long ones separate runs.
76399
+ * 4. T = geometric mean of N and the plateau's 10th percentile, snapped to a
76400
+ * grid a person would type; stop dwell covers the longest pause; start dwell
76401
+ * covers the longest standby blip above T.
76402
+ * 5. the numbers are proved by REPLAY through the real `dwell` evaluation: each
76403
+ * run must hold exactly one true interval and nothing may flap outside.
76404
+ */
76405
+ var SECOND_MS = 1e3;
76406
+ var MINUTE_MS$1 = 60 * SECOND_MS;
76407
+ 24 * (60 * MINUTE_MS$1);
76408
+ 10 * MINUTE_MS$1;
76409
+ 30 * SECOND_MS;
76410
+ 60 * SECOND_MS;
76411
+ 20 * MINUTE_MS$1;
76412
+ 10 * SECOND_MS;
76413
+ 10 * SECOND_MS;
76147
76414
  DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverStoppable, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
76148
76415
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
76149
76416
  String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
@@ -77685,6 +77952,13 @@ Object.freeze({
77685
77952
  access: "create",
77686
77953
  role: "admin"
77687
77954
  },
77955
+ "coreBlocks.proposeRunningThreshold": {
77956
+ capName: "core-blocks",
77957
+ capScope: "system",
77958
+ addonId: null,
77959
+ access: "view",
77960
+ role: "admin"
77961
+ },
77688
77962
  "coreBlocks.reportAutomationRun": {
77689
77963
  capName: "core-blocks",
77690
77964
  capScope: "system",
@@ -78196,6 +78470,13 @@ Object.freeze({
78196
78470
  access: "view",
78197
78471
  role: "admin"
78198
78472
  },
78473
+ "deviceExport.listInstances": {
78474
+ capName: "device-export",
78475
+ capScope: "system",
78476
+ addonId: null,
78477
+ access: "view",
78478
+ role: "admin"
78479
+ },
78199
78480
  "deviceExport.listSupportedDeviceKinds": {
78200
78481
  capName: "device-export",
78201
78482
  capScope: "system",
@@ -87168,6 +87449,11 @@ Object.freeze({
87168
87449
  form: "single",
87169
87450
  optional: false
87170
87451
  }],
87452
+ "coreBlocks.proposeRunningThreshold": [{
87453
+ name: "deviceId",
87454
+ form: "single",
87455
+ optional: false
87456
+ }],
87171
87457
  "cover.close": [{
87172
87458
  name: "deviceId",
87173
87459
  form: "single",
@@ -89831,99 +90117,6 @@ Object.freeze({
89831
90117
  "network-access": "ingress",
89832
90118
  "smtp-provider": "email"
89833
90119
  });
89834
- /**
89835
- * A saved Customize assignment (D936). The schema is the type: callers use
89836
- * `z.infer`, they do not restate the shape.
89837
- */
89838
- var OverrideSourceSchema = object({
89839
- addonId: string().min(1),
89840
- stableId: string().min(1),
89841
- cap: string().min(1),
89842
- fieldPath: string().min(1)
89843
- });
89844
- var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
89845
- object({ kind: literal("identity") }),
89846
- object({ kind: literal("invert") }),
89847
- object({
89848
- kind: literal("threshold"),
89849
- comparison: _enum(["gte", "lte"]),
89850
- threshold: number(),
89851
- startDwellMs: number().nonnegative(),
89852
- stopDwellMs: number().nonnegative()
89853
- }),
89854
- object({
89855
- kind: literal("linear"),
89856
- scale: number(),
89857
- offset: number(),
89858
- clampMin: number().optional(),
89859
- clampMax: number().optional()
89860
- }),
89861
- object({
89862
- kind: literal("enum-map"),
89863
- mapping: record(string(), string().nullable())
89864
- }),
89865
- object({ kind: literal("number") })
89866
- ]);
89867
- var ScalarOverrideDraftSchema = object({
89868
- kind: literal("scalar"),
89869
- cap: string().min(1),
89870
- targetId: string().min(1),
89871
- source: OverrideSourceSchema,
89872
- transform: CustomizeTransformDraftSchema
89873
- });
89874
- var KeyedArrayOverrideDraftSchema = object({
89875
- kind: literal("keyedArray"),
89876
- cap: string().min(1),
89877
- targetId: string().min(1),
89878
- key: string().min(1),
89879
- label: string().min(1),
89880
- fieldPath: string().min(1),
89881
- source: OverrideSourceSchema,
89882
- transform: CustomizeTransformDraftSchema
89883
- });
89884
- var PulseOverrideDraftSchema = object({
89885
- kind: literal("pulse"),
89886
- cap: string().min(1),
89887
- targetId: string().min(1),
89888
- enabled: boolean(),
89889
- debounceMs: number().nonnegative(),
89890
- edges: array(_enum([
89891
- "rising",
89892
- "button",
89893
- "native-event"
89894
- ])).min(1).optional(),
89895
- sources: array(OverrideSourceSchema).min(1)
89896
- });
89897
- var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
89898
- "in-addition",
89899
- "confirm",
89900
- "replace"
89901
- ]).optional() });
89902
- discriminatedUnion("kind", [
89903
- ScalarOverrideDraftSchema,
89904
- KeyedArrayOverrideDraftSchema,
89905
- PulseOverrideDraftSchema,
89906
- object({
89907
- kind: literal("span"),
89908
- cap: string().min(1),
89909
- targetId: string().min(1),
89910
- timeoutMs: number().nonnegative(),
89911
- cooldownMs: number().nonnegative().optional(),
89912
- sources: array(SpanSourceDraftSchema)
89913
- })
89914
- ]);
89915
- object({
89916
- targetId: string().min(1),
89917
- configured: boolean(),
89918
- source: _enum(["native", "assigned"]),
89919
- state: _enum([
89920
- "active",
89921
- "stale",
89922
- "released",
89923
- "unavailable"
89924
- ]),
89925
- reason: string().nullable()
89926
- });
89927
90120
  var G711_SCALE_CORRECTION_DB = {
89928
90121
  PCMU: 20 * Math.log10(4),
89929
90122
  PCMA: 20 * Math.log10(8)
@@ -158119,8 +158312,10 @@ var ExportHapAddon = class extends BaseAddon {
158119
158312
  this.subscribeDeviceReadyForReconcile();
158120
158313
  this.subscribeStorageLocationsForClips();
158121
158314
  this.disposeSharedRebuildTimers();
158315
+ const ownInstance = (instanceId) => assertOwnExportInstance("export-hap", EXPORT_HAP_ADDON_ID, instanceId);
158122
158316
  const provider = {
158123
- getStatus: async () => {
158317
+ getStatus: async (input) => {
158318
+ ownInstance(statusInstanceOf(input));
158124
158319
  const anyPaired = Array.from(this.exposed.values()).some((m) => accessoryPaired(m.accessory));
158125
158320
  const linkState = this.lastError ? "error" : anyPaired ? "linked" : "unlinked";
158126
158321
  const setup = this.buildSetupBlock();
@@ -158131,19 +158326,38 @@ var ExportHapAddon = class extends BaseAddon {
158131
158326
  ...setup ? { setup } : {}
158132
158327
  };
158133
158328
  },
158134
- listSupportedDeviceKinds: async () => [...HAP_EXPORTABLE_DEVICE_TYPES],
158135
- listExposedDevices: async () => Array.from(this.exposed.entries()).map(([deviceId, m]) => {
158136
- const entry = this.config.exposed.find((e) => e.deviceId === deviceId);
158137
- return {
158138
- deviceId,
158139
- exposedAs: m.accessory.displayName,
158140
- ...entry?.capabilities ? { capabilities: [...entry.capabilities] } : {}
158141
- };
158142
- }),
158143
- exposeDevice: async ({ deviceId, capabilities }) => this.exposeDevice(deviceId, capabilities),
158144
- unexposeDevice: async ({ deviceId }) => this.unexposeDevice(deviceId),
158329
+ listInstances: async () => [{
158330
+ instanceId: EXPORT_HAP_ADDON_ID,
158331
+ name: "HomeKit",
158332
+ enabled: true,
158333
+ kind: "hap-bridge"
158334
+ }],
158335
+ listSupportedDeviceKinds: async ({ instanceId }) => {
158336
+ ownInstance(instanceId);
158337
+ return [...HAP_EXPORTABLE_DEVICE_TYPES];
158338
+ },
158339
+ listExposedDevices: async ({ instanceId }) => {
158340
+ ownInstance(instanceId);
158341
+ return Array.from(this.exposed.entries()).map(([deviceId, m]) => {
158342
+ const entry = this.config.exposed.find((e) => e.deviceId === deviceId);
158343
+ return {
158344
+ deviceId,
158345
+ exposedAs: m.accessory.displayName,
158346
+ ...entry?.capabilities ? { capabilities: [...entry.capabilities] } : {}
158347
+ };
158348
+ });
158349
+ },
158350
+ exposeDevice: async ({ instanceId, deviceId, capabilities }) => {
158351
+ ownInstance(instanceId);
158352
+ return this.exposeDevice(deviceId, capabilities);
158353
+ },
158354
+ unexposeDevice: async ({ instanceId, deviceId }) => {
158355
+ ownInstance(instanceId);
158356
+ return this.unexposeDevice(deviceId);
158357
+ },
158145
158358
  listSupportedEntityKinds: async () => ["device", "action"],
158146
- listExposedEntities: async () => {
158359
+ listExposedEntities: async ({ instanceId }) => {
158360
+ ownInstance(instanceId);
158147
158361
  await this.actionExports?.reconcile();
158148
158362
  return [...Array.from(this.exposed.entries()).map(([deviceId, m]) => ({
158149
158363
  entity: {
@@ -158153,12 +158367,14 @@ var ExportHapAddon = class extends BaseAddon {
158153
158367
  exposedAs: m.accessory.displayName
158154
158368
  })), ...this.actionExports?.list() ?? []];
158155
158369
  },
158156
- exposeEntity: async ({ entity }) => {
158370
+ exposeEntity: async ({ instanceId, entity }) => {
158371
+ ownInstance(instanceId);
158157
158372
  if (entity.kind === "device") return this.exposeDevice(entity.deviceId);
158158
158373
  if (entity.kind === "action") return this.requireActionExports().expose(entity.actionId);
158159
158374
  throw new Error("export-hap: a notification target cannot be exported to HomeKit");
158160
158375
  },
158161
- unexposeEntity: async ({ entity }) => {
158376
+ unexposeEntity: async ({ instanceId, entity }) => {
158377
+ ownInstance(instanceId);
158162
158378
  if (entity.kind === "device") return this.unexposeDevice(entity.deviceId);
158163
158379
  if (entity.kind === "action") return this.requireActionExports().unexpose(entity.actionId);
158164
158380
  throw new Error("export-hap: a notification target cannot be exported to HomeKit");