@camstack/addon-export-hap 1.2.112 → 1.2.113

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.
@@ -7420,7 +7420,7 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
7420
7420
  input: unknown()
7421
7421
  }), unknown(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
7422
7422
  //#endregion
7423
- //#region ../types/dist/canonical-hash-rO1sRmEK.mjs
7423
+ //#region ../types/dist/canonical-hash-Ch5bSjFG.mjs
7424
7424
  var AUDIO_ENCODER_BY_CODEC = {
7425
7425
  opus: "libopus",
7426
7426
  aac: "aac",
@@ -7523,6 +7523,7 @@ function buildVideoArgs(video, outputArgs) {
7523
7523
  ];
7524
7524
  if (video.preset !== void 0) args.push("-preset", video.preset);
7525
7525
  if (video.tune !== void 0) args.push("-tune", video.tune);
7526
+ if (video.singleSlicePerFrame === true && video.encoder === "libx264") args.push("-x264-params", "sliced-threads=0");
7526
7527
  if (video.profile !== void 0) args.push("-profile:v", video.profile);
7527
7528
  if (video.level !== void 0) args.push("-level", video.level);
7528
7529
  if (video.pixelFormat !== void 0) args.push("-pix_fmt", video.pixelFormat);
@@ -7924,7 +7925,7 @@ import { errMsg } from '@camstack/types'
7924
7925
  * Extract a human-readable message from an unknown error value.
7925
7926
  * Replaces the ubiquitous `errMsg(err)` pattern.
7926
7927
  */
7927
- function errMsg$15(err) {
7928
+ function errMsg$16(err) {
7928
7929
  if (err instanceof Error) return err.message;
7929
7930
  if (typeof err === "string") return err;
7930
7931
  return String(err);
@@ -8001,7 +8002,23 @@ var EncodeProfileSchema = object({
8001
8002
  "zerolatency",
8002
8003
  "film",
8003
8004
  "animation"
8004
- ]).optional()
8005
+ ]).optional(),
8006
+ /**
8007
+ * ONE slice per access unit.
8008
+ *
8009
+ * `-tune zerolatency` turns on x264's sliced threads, and a frame then leaves
8010
+ * the encoder as five NAL slices that share one RTP timestamp and carry one
8011
+ * marker bit. A libwebrtc depacketiser sees five frame-starts and one
8012
+ * frame-end per frame: the first pictures render and the video then freezes
8013
+ * for good while the audio, on its own plane, plays on. Measured on this hub
8014
+ * 2026-09-13 against the Echo, and reduced to one slice by this flag alone.
8015
+ *
8016
+ * A NAMED field and not a raw flag, because {@link EgressEncodeSchema} omits
8017
+ * `outputArgs` on purpose: an opaque array is part of the sharing key, so two
8018
+ * consumers meaning the same thing spelled differently would stop sharing one
8019
+ * child. Absent means "whatever the encoder does" — today's behaviour.
8020
+ */
8021
+ singleSlicePerFrame: boolean().optional()
8005
8022
  }),
8006
8023
  audio: union([literal("passthrough"), object({
8007
8024
  codec: _enum([
@@ -8051,7 +8068,7 @@ var BASE_LIVE_EGRESS_PROFILE = {
8051
8068
  audio: "passthrough"
8052
8069
  };
8053
8070
  ({ ...BASE_LIVE_EGRESS_PROFILE }), { ...BASE_LIVE_EGRESS_PROFILE.video };
8054
- ({ ...BASE_LIVE_EGRESS_PROFILE });
8071
+ ({ ...BASE_LIVE_EGRESS_PROFILE }), { ...BASE_LIVE_EGRESS_PROFILE.video };
8055
8072
  /** VBV window for a consumer whose budget is enforced per second (HomeKit). */
8056
8073
  var RATE_CONTROL_TIGHT = {
8057
8074
  kind: "cbr",
@@ -16974,7 +16991,7 @@ var AlarmArmModeSchema = _enum([
16974
16991
  "vacation",
16975
16992
  "custom_bypass"
16976
16993
  ]);
16977
- object({
16994
+ var AlarmPanelStatusSchema = object({
16978
16995
  /** Current lifecycle state. */
16979
16996
  state: AlarmStateSchema,
16980
16997
  /** Subset of arm modes the panel accepts. UI renders one button per
@@ -40208,7 +40225,7 @@ var Fmp4FragmentChild = class {
40208
40225
  meta: {
40209
40226
  sourceId: this.args.sourceId,
40210
40227
  decodeHwAccel: requested,
40211
- error: errMsg$15(err)
40228
+ error: errMsg$16(err)
40212
40229
  }
40213
40230
  });
40214
40231
  this.killChild();
@@ -40387,7 +40404,7 @@ var Fmp4FragmentChild = class {
40387
40404
  tags: { deviceId: this.args.deviceId },
40388
40405
  meta: {
40389
40406
  sourceId: this.args.sourceId,
40390
- error: errMsg$15(err)
40407
+ error: errMsg$16(err)
40391
40408
  }
40392
40409
  });
40393
40410
  }
@@ -87043,7 +87060,7 @@ function clearPairingFiles(accessoryUuid, logger) {
87043
87060
  }
87044
87061
  //#endregion
87045
87062
  //#region src/hap-setup-uri.ts
87046
- function errMsg$14(e) {
87063
+ function errMsg$15(e) {
87047
87064
  return e instanceof Error ? e.message : String(e);
87048
87065
  }
87049
87066
  /**
@@ -87070,7 +87087,7 @@ function firstExposedAccessorySetupUri(exposed, logger) {
87070
87087
  try {
87071
87088
  return first.setupURI();
87072
87089
  } catch (err) {
87073
- logger.debug("export-hap: setupURI failed on first exposed accessory", { meta: { error: errMsg$14(err) } });
87090
+ logger.debug("export-hap: setupURI failed on first exposed accessory", { meta: { error: errMsg$15(err) } });
87074
87091
  return;
87075
87092
  }
87076
87093
  }
@@ -87423,7 +87440,7 @@ async function buildBattery(bctx) {
87423
87440
  const status = await proxy.battery?.getStatus({});
87424
87441
  if (status !== void 0 && status !== null) applyToService(service, status);
87425
87442
  } catch (err) {
87426
- log.debug("export-hap: battery getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$13(err) } });
87443
+ log.debug("export-hap: battery getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$14(err) } });
87427
87444
  }
87428
87445
  const unsubscribes = [];
87429
87446
  if (proxy.state.battery) {
@@ -87442,7 +87459,7 @@ async function buildBattery(bctx) {
87442
87459
  function applyToService(service, status) {
87443
87460
  applyUpdates(service, batteryCharacteristicUpdates(status));
87444
87461
  }
87445
- function errMsg$13(err) {
87462
+ function errMsg$14(err) {
87446
87463
  return err instanceof Error ? err.message : String(err);
87447
87464
  }
87448
87465
  //#endregion
@@ -98194,7 +98211,7 @@ var VIDEO_LOOPBACK_RCVBUF_BYTES = 8 * 1024 * 1024;
98194
98211
  * not burst size.
98195
98212
  */
98196
98213
  var AUDIO_LOOPBACK_RCVBUF_BYTES = 1024 * 1024;
98197
- function errMsg$12(err) {
98214
+ function errMsg$13(err) {
98198
98215
  return err instanceof Error ? err.message : String(err);
98199
98216
  }
98200
98217
  /**
@@ -98209,13 +98226,13 @@ function applyReceiveBuffer(socket, requestedBytes) {
98209
98226
  try {
98210
98227
  socket.setRecvBufferSize(requestedBytes);
98211
98228
  } catch (err) {
98212
- error = errMsg$12(err);
98229
+ error = errMsg$13(err);
98213
98230
  }
98214
98231
  let effectiveBytes = null;
98215
98232
  try {
98216
98233
  effectiveBytes = socket.getRecvBufferSize();
98217
98234
  } catch (err) {
98218
- if (error === null) error = errMsg$12(err);
98235
+ if (error === null) error = errMsg$13(err);
98219
98236
  }
98220
98237
  return {
98221
98238
  requestedBytes,
@@ -98475,20 +98492,20 @@ function buildCameraStreamingDelegate(bctx, advertised) {
98475
98492
  delegate: {
98476
98493
  handleSnapshotRequest(request, callback) {
98477
98494
  handleSnapshot(bctx, request).then((buf) => callback(void 0, buf)).catch((err) => {
98478
- log.warn("export-hap: snapshot failed", { meta: { error: errMsg$11(err) } });
98479
- callback(err instanceof Error ? err : new Error(errMsg$11(err)));
98495
+ log.warn("export-hap: snapshot failed", { meta: { error: errMsg$12(err) } });
98496
+ callback(err instanceof Error ? err : new Error(errMsg$12(err)));
98480
98497
  });
98481
98498
  },
98482
98499
  prepareStream(request, callback) {
98483
98500
  prepareStream(request, sessions, bctx).then((resp) => callback(void 0, resp)).catch((err) => {
98484
- log.warn("export-hap: prepareStream failed", { meta: { error: errMsg$11(err) } });
98485
- callback(err instanceof Error ? err : new Error(errMsg$11(err)));
98501
+ log.warn("export-hap: prepareStream failed", { meta: { error: errMsg$12(err) } });
98502
+ callback(err instanceof Error ? err : new Error(errMsg$12(err)));
98486
98503
  });
98487
98504
  },
98488
98505
  handleStreamRequest(request, callback) {
98489
98506
  handleStreamRequest(request, sessions, bctx, advertised).then(() => callback()).catch((err) => {
98490
- log.warn("export-hap: handleStreamRequest failed", { meta: { error: errMsg$11(err) } });
98491
- callback(err instanceof Error ? err : new Error(errMsg$11(err)));
98507
+ log.warn("export-hap: handleStreamRequest failed", { meta: { error: errMsg$12(err) } });
98508
+ callback(err instanceof Error ? err : new Error(errMsg$12(err)));
98492
98509
  });
98493
98510
  }
98494
98511
  },
@@ -98604,7 +98621,7 @@ async function prepareStream(request, sessions, bctx) {
98604
98621
  closeSocket(audioUdp);
98605
98622
  closeSocket(videoLoopUdp);
98606
98623
  closeSocket(audioLoopUdp);
98607
- throw new Error(`export-hap: outbound SrtpSession init failed: ${errMsg$11(err)}`, { cause: err });
98624
+ throw new Error(`export-hap: outbound SrtpSession init failed: ${errMsg$12(err)}`, { cause: err });
98608
98625
  }
98609
98626
  let upstreamAudioSrtp = null;
98610
98627
  try {
@@ -98618,7 +98635,7 @@ async function prepareStream(request, sessions, bctx) {
98618
98635
  profile: import_src.ProtectionProfileAes128CmHmacSha1_80
98619
98636
  });
98620
98637
  } catch (err) {
98621
- bctx.ctx.logger.withTags({ deviceId: bctx.numericDeviceId }).warn("export-hap: SrtpSession init failed (upstream audio decrypt disabled)", { meta: { error: errMsg$11(err) } });
98638
+ bctx.ctx.logger.withTags({ deviceId: bctx.numericDeviceId }).warn("export-hap: SrtpSession init failed (upstream audio decrypt disabled)", { meta: { error: errMsg$12(err) } });
98622
98639
  }
98623
98640
  const videoSsrc = randomSsrc();
98624
98641
  const audioSsrc = randomSsrc();
@@ -98735,7 +98752,7 @@ async function prepareStream(request, sessions, bctx) {
98735
98752
  });
98736
98753
  audioUdp.on("message", (packet, rinfo) => {
98737
98754
  handleIncomingAudioRtp(session, packet, rinfo.address, bctx).catch((err) => {
98738
- bctx.ctx.logger.withTags({ deviceId: bctx.numericDeviceId }).debug("export-hap: incoming-audio handler error (dropped)", { meta: { error: errMsg$11(err) } });
98755
+ bctx.ctx.logger.withTags({ deviceId: bctx.numericDeviceId }).debug("export-hap: incoming-audio handler error (dropped)", { meta: { error: errMsg$12(err) } });
98739
98756
  });
98740
98757
  });
98741
98758
  logLoopbackBuffer(tagLog, request.sessionID, "video", videoLoop.buffer);
@@ -98931,7 +98948,7 @@ function readControllerRtcp(session, leg, packet, log) {
98931
98948
  } catch (err) {
98932
98949
  drop(session, "inbound-rtcp-decrypt-failed");
98933
98950
  storeReceiverReports(session, leg, recordUnreadableRtcp(tally));
98934
- logUnreadableRtcp(session, leg, `decrypt: ${errMsg$11(err)}`, log);
98951
+ logUnreadableRtcp(session, leg, `decrypt: ${errMsg$12(err)}`, log);
98935
98952
  return;
98936
98953
  }
98937
98954
  const outcome = ingestDecryptedRtcp(plaintext, tally);
@@ -99697,7 +99714,7 @@ async function handleIncomingAudioRtp(session, packet, sourceAddress, bctx) {
99697
99714
  session.upstreamRtpDecryptFailures += 1;
99698
99715
  if (session.upstreamRtpDecryptFailures % 100 === 1) log.debug("export-hap: SRTP decrypt failed (rate-limited)", { meta: {
99699
99716
  failures: session.upstreamRtpDecryptFailures,
99700
- error: errMsg$11(err)
99717
+ error: errMsg$12(err)
99701
99718
  } });
99702
99719
  return;
99703
99720
  }
@@ -99711,7 +99728,7 @@ async function handleIncomingAudioRtp(session, packet, sourceAddress, bctx) {
99711
99728
  rtpPayloadType = parsedRtp.header.payloadType;
99712
99729
  } catch (err) {
99713
99730
  drop(session, "upstream-parse-failed");
99714
- log.debug("export-hap: RTP parse failed after decrypt", { meta: { error: errMsg$11(err) } });
99731
+ log.debug("export-hap: RTP parse failed after decrypt", { meta: { error: errMsg$12(err) } });
99715
99732
  return;
99716
99733
  }
99717
99734
  const negotiatedAudioPt = session.lastStartParams?.audioPt;
@@ -99735,7 +99752,7 @@ async function handleIncomingAudioRtp(session, packet, sourceAddress, bctx) {
99735
99752
  if (session.intercomTalkSessionId === null) {
99736
99753
  session.intercomTalkSessionId = "";
99737
99754
  const opened = await openIntercomTalkSession(bctx).catch((err) => {
99738
- log.warn("export-hap: intercom.startTalkSession failed", { meta: { error: errMsg$11(err) } });
99755
+ log.warn("export-hap: intercom.startTalkSession failed", { meta: { error: errMsg$12(err) } });
99739
99756
  return null;
99740
99757
  });
99741
99758
  if (opened) {
@@ -99762,7 +99779,7 @@ async function handleIncomingAudioRtp(session, packet, sourceAddress, bctx) {
99762
99779
  drop(session, "upstream-push-failed");
99763
99780
  log.debug("export-hap: intercom.pushTalkAudio failed (will re-open on next frame)", { meta: {
99764
99781
  sequenceNumber: session.intercomPcmSequence,
99765
- error: errMsg$11(err)
99782
+ error: errMsg$12(err)
99766
99783
  } });
99767
99784
  session.intercomTalkSessionId = null;
99768
99785
  }
@@ -99794,7 +99811,7 @@ async function closeIntercomTalkSession(session, bctx) {
99794
99811
  } catch (err) {
99795
99812
  log.debug("export-hap: intercom.endTalkSession failed (continuing)", { meta: {
99796
99813
  sessionId,
99797
- error: errMsg$11(err)
99814
+ error: errMsg$12(err)
99798
99815
  } });
99799
99816
  }
99800
99817
  }
@@ -99819,7 +99836,7 @@ function closeSocket(udp) {
99819
99836
  function randomSsrc() {
99820
99837
  return Math.floor(Math.random() * 2147483646) + 1 | 0;
99821
99838
  }
99822
- function errMsg$11(err) {
99839
+ function errMsg$12(err) {
99823
99840
  return err instanceof Error ? err.message : String(err);
99824
99841
  }
99825
99842
  //#endregion
@@ -99903,14 +99920,14 @@ async function buildDoorbell(input) {
99903
99920
  }
99904
99921
  log.info("export-hap: doorbell SINGLE_PRESS pushed to HomeKit", { meta: { ...delivery } });
99905
99922
  } catch (err) {
99906
- log.warn("export-hap: ringDoorbell() failed", { meta: { error: errMsg$10(err) } });
99923
+ log.warn("export-hap: ringDoorbell() failed", { meta: { error: errMsg$11(err) } });
99907
99924
  }
99908
99925
  });
99909
99926
  return { async dispose() {
99910
99927
  unsubscribe();
99911
99928
  } };
99912
99929
  }
99913
- function errMsg$10(err) {
99930
+ function errMsg$11(err) {
99914
99931
  return err instanceof Error ? err.message : String(err);
99915
99932
  }
99916
99933
  //#endregion
@@ -99958,7 +99975,7 @@ async function buildMotionSensor(bctx, existing = null) {
99958
99975
  const detected = await proxy.motion?.isDetected({});
99959
99976
  if (typeof detected === "boolean") motionService.updateCharacteristic(import_dist.Characteristic.MotionDetected, detected);
99960
99977
  } catch (err) {
99961
- ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: initial motion hydrate failed (non-fatal)", { meta: { error: errMsg$9(err) } });
99978
+ ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: initial motion hydrate failed (non-fatal)", { meta: { error: errMsg$10(err) } });
99962
99979
  }
99963
99980
  let resetTimer = null;
99964
99981
  const armReset = () => {
@@ -99992,7 +100009,7 @@ async function buildMotionSensor(bctx, existing = null) {
99992
100009
  }
99993
100010
  } };
99994
100011
  }
99995
- function errMsg$9(err) {
100012
+ function errMsg$10(err) {
99996
100013
  return err instanceof Error ? err.message : String(err);
99997
100014
  }
99998
100015
  //#endregion
@@ -100023,7 +100040,7 @@ async function buildPrivacySwitch(bctx) {
100023
100040
  const status = await proxy.privacyMask?.getStatus({});
100024
100041
  if (status && typeof status.enabled === "boolean") service.updateCharacteristic(import_dist.Characteristic.On, status.enabled);
100025
100042
  } catch (err) {
100026
- log.debug("export-hap: privacy-mask getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$8(err) } });
100043
+ log.debug("export-hap: privacy-mask getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$9(err) } });
100027
100044
  }
100028
100045
  service.getCharacteristic(import_dist.Characteristic.On).onSet(async (value) => {
100029
100046
  const enabled = value === true;
@@ -100032,7 +100049,7 @@ async function buildPrivacySwitch(bctx) {
100032
100049
  } catch (err) {
100033
100050
  log.warn("export-hap: privacy-mask setMask failed", { meta: {
100034
100051
  enabled,
100035
- error: errMsg$8(err)
100052
+ error: errMsg$9(err)
100036
100053
  } });
100037
100054
  }
100038
100055
  });
@@ -100050,7 +100067,7 @@ async function buildPrivacySwitch(bctx) {
100050
100067
  } catch {}
100051
100068
  } };
100052
100069
  }
100053
- function errMsg$8(err) {
100070
+ function errMsg$9(err) {
100054
100071
  return err instanceof Error ? err.message : String(err);
100055
100072
  }
100056
100073
  //#endregion
@@ -100141,7 +100158,7 @@ async function buildPtz(bctx) {
100141
100158
  } catch (err) {
100142
100159
  log.warn("export-hap: ptz.goToPreset failed", { meta: {
100143
100160
  presetId: preset.id,
100144
- error: errMsg$7(err)
100161
+ error: errMsg$8(err)
100145
100162
  } });
100146
100163
  }
100147
100164
  armReset(() => service.updateCharacteristic(import_dist.Characteristic.On, false), MOMENTARY_RESET_MS);
@@ -100159,14 +100176,14 @@ async function buildPtz(bctx) {
100159
100176
  try {
100160
100177
  await proxy.ptz?.stop({});
100161
100178
  } catch (err) {
100162
- log.debug("export-hap: ptz.stop failed (non-fatal)", { meta: { error: errMsg$7(err) } });
100179
+ log.debug("export-hap: ptz.stop failed (non-fatal)", { meta: { error: errMsg$8(err) } });
100163
100180
  }
100164
100181
  service.updateCharacteristic(import_dist.Characteristic.On, false);
100165
100182
  }, options.ptzPulseMs);
100166
100183
  } catch (err) {
100167
100184
  log.warn("export-hap: ptz.continuousMove failed", { meta: {
100168
100185
  dir: dir.label,
100169
- error: errMsg$7(err)
100186
+ error: errMsg$8(err)
100170
100187
  } });
100171
100188
  service.updateCharacteristic(import_dist.Characteristic.On, false);
100172
100189
  }
@@ -100189,7 +100206,7 @@ async function readPresets(bctx) {
100189
100206
  name: p.name
100190
100207
  }));
100191
100208
  } catch (err) {
100192
- ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: ptz.getPresets failed (non-fatal)", { meta: { error: errMsg$7(err) } });
100209
+ ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: ptz.getPresets failed (non-fatal)", { meta: { error: errMsg$8(err) } });
100193
100210
  return [];
100194
100211
  }
100195
100212
  }
@@ -100204,7 +100221,7 @@ async function tryBuildAutotrack(bctx) {
100204
100221
  const status = await proxy.ptzAutotrack.getStatus({});
100205
100222
  if (status && typeof status.enabled === "boolean") service.updateCharacteristic(import_dist.Characteristic.On, status.enabled);
100206
100223
  } catch (err) {
100207
- log.debug("export-hap: ptzAutotrack.getStatus failed (non-fatal)", { meta: { error: errMsg$7(err) } });
100224
+ log.debug("export-hap: ptzAutotrack.getStatus failed (non-fatal)", { meta: { error: errMsg$8(err) } });
100208
100225
  }
100209
100226
  service.getCharacteristic(import_dist.Characteristic.On).onSet(async (value) => {
100210
100227
  const enabled = value === true;
@@ -100213,13 +100230,13 @@ async function tryBuildAutotrack(bctx) {
100213
100230
  } catch (err) {
100214
100231
  log.warn("export-hap: ptzAutotrack.setEnabled failed", { meta: {
100215
100232
  enabled,
100216
- error: errMsg$7(err)
100233
+ error: errMsg$8(err)
100217
100234
  } });
100218
100235
  }
100219
100236
  });
100220
100237
  return { async dispose() {} };
100221
100238
  }
100222
- function errMsg$7(err) {
100239
+ function errMsg$8(err) {
100223
100240
  return err instanceof Error ? err.message : String(err);
100224
100241
  }
100225
100242
  //#endregion
@@ -101250,13 +101267,13 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
101250
101267
  const switchStatus = await proxy.switch?.getStatus({});
101251
101268
  if (switchStatus && typeof switchStatus.on === "boolean") service.updateCharacteristic(import_dist.Characteristic.On, switchStatus.on);
101252
101269
  } catch (err) {
101253
- log.debug("export-hap: child switch.getStatus failed (non-fatal)", { meta: { error: errMsg$6(err) } });
101270
+ log.debug("export-hap: child switch.getStatus failed (non-fatal)", { meta: { error: errMsg$7(err) } });
101254
101271
  }
101255
101272
  if (useLightbulb) try {
101256
101273
  const status = await proxy.brightness?.getStatus({});
101257
101274
  if (status && typeof status.percentage === "number") service.updateCharacteristic(import_dist.Characteristic.Brightness, status.percentage);
101258
101275
  } catch (err) {
101259
- log.debug("export-hap: child brightness.getStatus failed (non-fatal)", { meta: { error: errMsg$6(err) } });
101276
+ log.debug("export-hap: child brightness.getStatus failed (non-fatal)", { meta: { error: errMsg$7(err) } });
101260
101277
  }
101261
101278
  if (hasSwitch) service.getCharacteristic(import_dist.Characteristic.On).onSet(async (value) => {
101262
101279
  const on = value === true;
@@ -101265,7 +101282,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
101265
101282
  } catch (err) {
101266
101283
  log.warn("export-hap: child switch.setState failed", { meta: {
101267
101284
  on,
101268
- error: errMsg$6(err)
101285
+ error: errMsg$7(err)
101269
101286
  } });
101270
101287
  }
101271
101288
  });
@@ -101277,7 +101294,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
101277
101294
  } catch (err) {
101278
101295
  log.warn("export-hap: child brightness.setBrightness failed", { meta: {
101279
101296
  percentage,
101280
- error: errMsg$6(err)
101297
+ error: errMsg$7(err)
101281
101298
  } });
101282
101299
  }
101283
101300
  });
@@ -101300,7 +101317,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
101300
101317
  } catch {}
101301
101318
  } };
101302
101319
  }
101303
- function errMsg$6(err) {
101320
+ function errMsg$7(err) {
101304
101321
  return err instanceof Error ? err.message : String(err);
101305
101322
  }
101306
101323
  //#endregion
@@ -101327,7 +101344,7 @@ async function buildChildServicesFor(input) {
101327
101344
  for (const h of handles) try {
101328
101345
  await h.dispose();
101329
101346
  } catch (err) {
101330
- ctx.logger.withTags({ deviceId: parentNumericId }).debug("export-hap: child service dispose failed (continuing)", { meta: { error: errMsg$5(err) } });
101347
+ ctx.logger.withTags({ deviceId: parentNumericId }).debug("export-hap: child service dispose failed (continuing)", { meta: { error: errMsg$6(err) } });
101331
101348
  }
101332
101349
  } };
101333
101350
  }
@@ -101343,7 +101360,7 @@ async function listChildren(ctx, parentNumericId) {
101343
101360
  features: Array.isArray(c.features) ? c.features.filter((f) => typeof f === "string") : []
101344
101361
  }));
101345
101362
  } catch (err) {
101346
- ctx.logger.withTags({ deviceId: parentNumericId }).debug("export-hap: deviceManager.getChildren failed (non-fatal)", { meta: { error: errMsg$5(err) } });
101363
+ ctx.logger.withTags({ deviceId: parentNumericId }).debug("export-hap: deviceManager.getChildren failed (non-fatal)", { meta: { error: errMsg$6(err) } });
101347
101364
  return [];
101348
101365
  }
101349
101366
  }
@@ -101359,7 +101376,7 @@ function asDeviceType(raw) {
101359
101376
  for (const value of Object.values(DeviceType)) if (value === lower) return value;
101360
101377
  return DeviceType.Generic;
101361
101378
  }
101362
- function errMsg$5(err) {
101379
+ function errMsg$6(err) {
101363
101380
  return err instanceof Error ? err.message : String(err);
101364
101381
  }
101365
101382
  //#endregion
@@ -101381,12 +101398,18 @@ var SUPPORTED_MAPPER_KINDS = ["camera", "generic"];
101381
101398
  * doctrine the HA exporter writes down, and the thing that confined the
101382
101399
  * previous exporter to cameras when it was ignored.
101383
101400
  *
101384
- * Tier A: the types whose HomeKit services exist today and need no
101385
- * feature-dependent shape. `cover`, `climate`, `fan`, `valve`, `humidifier`,
101386
- * `water-heater`, `alarm-panel`, `button` and `media-player` are deliberately
101401
+ * Tier A plus `alarm-panel`: the types whose HomeKit services exist today and
101402
+ * need no feature-dependent shape. `cover`, `climate`, `fan`, `valve`,
101403
+ * `humidifier`, `water-heater`, `button` and `media-player` are deliberately
101387
101404
  * absent — each needs a service whose semantics the table cannot yet honour,
101388
101405
  * and offering the tab before the mapping exists is how an operator gets an
101389
101406
  * accessory that pairs and does nothing.
101407
+ *
101408
+ * `alarm-panel` is no longer one of them. It maps to `Service.SecuritySystem`
101409
+ * (`builders/generic/security-system.ts`), and the two things the table could
101410
+ * not previously honour are now honoured explicitly: HomeKit is only ever
101411
+ * offered the arm modes the panel accepts, and a panel that requires a PIN
101412
+ * refuses the write out loud instead of pretending to arm.
101390
101413
  */
101391
101414
  var HAP_EXPORTABLE_DEVICE_TYPES = [
101392
101415
  DeviceType.Camera,
@@ -101396,6 +101419,7 @@ var HAP_EXPORTABLE_DEVICE_TYPES = [
101396
101419
  DeviceType.Sensor,
101397
101420
  DeviceType.Lock,
101398
101421
  DeviceType.Presence,
101422
+ DeviceType.AlarmPanel,
101399
101423
  DeviceType.Generic
101400
101424
  ];
101401
101425
  /**
@@ -101521,17 +101545,17 @@ async function buildCameraAccessory(input) {
101521
101545
  for (const h of handles) try {
101522
101546
  await h.dispose();
101523
101547
  } catch (err) {
101524
- log.debug("export-hap: builder dispose failed (continuing)", { meta: { error: errMsg$4(err) } });
101548
+ log.debug("export-hap: builder dispose failed (continuing)", { meta: { error: errMsg$5(err) } });
101525
101549
  }
101526
101550
  try {
101527
101551
  await streams.dispose();
101528
101552
  } catch (err) {
101529
- log.debug("export-hap: streams dispose failed", { meta: { error: errMsg$4(err) } });
101553
+ log.debug("export-hap: streams dispose failed", { meta: { error: errMsg$5(err) } });
101530
101554
  }
101531
101555
  }
101532
101556
  };
101533
101557
  }
101534
- function errMsg$4(err) {
101558
+ function errMsg$5(err) {
101535
101559
  return err instanceof Error ? err.message : String(err);
101536
101560
  }
101537
101561
  //#endregion
@@ -101560,7 +101584,7 @@ function errMsg$4(err) {
101560
101584
  * counterpart on this service and is deliberately not wired — a Switch that
101561
101585
  * silently buzzes a door open would be a second knob nobody asked for.
101562
101586
  */
101563
- var SUBTYPE = "lock-control";
101587
+ var SUBTYPE$1 = "lock-control";
101564
101588
  var readLock = reader(LockControlStatusSchema.pick({ state: true }), (status) => {
101565
101589
  const current = status.state === "locked" ? import_dist.Characteristic.LockCurrentState.SECURED : status.state === "unlocked" ? import_dist.Characteristic.LockCurrentState.UNSECURED : status.state === "jammed" ? import_dist.Characteristic.LockCurrentState.JAMMED : import_dist.Characteristic.LockCurrentState.UNKNOWN;
101566
101590
  const target = status.state === "locked" || status.state === "locking" ? import_dist.Characteristic.LockTargetState.SECURED : status.state === "unlocked" || status.state === "unlocking" ? import_dist.Characteristic.LockTargetState.UNSECURED : null;
@@ -101576,7 +101600,7 @@ async function buildLockMechanism(bctx) {
101576
101600
  const { ctx, accessory, proxy, numericDeviceId, displayName } = bctx;
101577
101601
  const log = ctx.logger.withTags({ deviceId: numericDeviceId });
101578
101602
  const label = hapServiceName([displayName], `Lock ${numericDeviceId}`);
101579
- const service = accessory.addService(import_dist.Service.LockMechanism, label, SUBTYPE);
101603
+ const service = accessory.addService(import_dist.Service.LockMechanism, label, SUBTYPE$1);
101580
101604
  applyServiceLabel(service, label);
101581
101605
  const apply = (status, source) => {
101582
101606
  const updates = readLock(status);
@@ -101590,7 +101614,7 @@ async function buildLockMechanism(bctx) {
101590
101614
  const status = await proxy.lockControl?.getStatus({});
101591
101615
  if (status !== void 0 && status !== null) apply(status, "getStatus");
101592
101616
  } catch (err) {
101593
- log.debug("export-hap: lock getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$3(err) } });
101617
+ log.debug("export-hap: lock getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$4(err) } });
101594
101618
  }
101595
101619
  service.getCharacteristic(import_dist.Characteristic.LockTargetState).onSet(async (value) => {
101596
101620
  const secure = value === import_dist.Characteristic.LockTargetState.SECURED;
@@ -101600,7 +101624,7 @@ async function buildLockMechanism(bctx) {
101600
101624
  } catch (err) {
101601
101625
  log.warn("export-hap: lock command failed", { meta: {
101602
101626
  secure,
101603
- error: errMsg$3(err)
101627
+ error: errMsg$4(err)
101604
101628
  } });
101605
101629
  }
101606
101630
  });
@@ -101614,6 +101638,296 @@ async function buildLockMechanism(bctx) {
101614
101638
  } catch {}
101615
101639
  } };
101616
101640
  }
101641
+ function errMsg$4(err) {
101642
+ return err instanceof Error ? err.message : String(err);
101643
+ }
101644
+ //#endregion
101645
+ //#region src/mappers/builders/generic/security-state.ts
101646
+ /** Is this a settled arm state worth remembering? */
101647
+ function armedMemoOf(state) {
101648
+ return state === "armed_home" || state === "armed_away" || state === "armed_night" || state === "armed_vacation" || state === "armed_custom_bypass" ? state : null;
101649
+ }
101650
+ function currentForArmed(state) {
101651
+ switch (state) {
101652
+ case "armed_home":
101653
+ case "armed_custom_bypass": return import_dist.Characteristic.SecuritySystemCurrentState.STAY_ARM;
101654
+ case "armed_night": return import_dist.Characteristic.SecuritySystemCurrentState.NIGHT_ARM;
101655
+ default: return import_dist.Characteristic.SecuritySystemCurrentState.AWAY_ARM;
101656
+ }
101657
+ }
101658
+ function targetForArmed(state) {
101659
+ switch (state) {
101660
+ case "armed_home":
101661
+ case "armed_custom_bypass": return import_dist.Characteristic.SecuritySystemTargetState.STAY_ARM;
101662
+ case "armed_night": return import_dist.Characteristic.SecuritySystemTargetState.NIGHT_ARM;
101663
+ default: return import_dist.Characteristic.SecuritySystemTargetState.AWAY_ARM;
101664
+ }
101665
+ }
101666
+ function securityStateFor(state, memo) {
101667
+ const settled = armedMemoOf(state);
101668
+ if (settled !== null) return {
101669
+ current: currentForArmed(settled),
101670
+ target: targetForArmed(settled)
101671
+ };
101672
+ switch (state) {
101673
+ case "disarmed": return {
101674
+ current: import_dist.Characteristic.SecuritySystemCurrentState.DISARMED,
101675
+ target: import_dist.Characteristic.SecuritySystemTargetState.DISARM
101676
+ };
101677
+ case "arming": return {
101678
+ current: import_dist.Characteristic.SecuritySystemCurrentState.DISARMED,
101679
+ target: memo === null ? null : targetForArmed(memo)
101680
+ };
101681
+ case "disarming": return {
101682
+ current: memo === null ? import_dist.Characteristic.SecuritySystemCurrentState.DISARMED : currentForArmed(memo),
101683
+ target: import_dist.Characteristic.SecuritySystemTargetState.DISARM
101684
+ };
101685
+ case "pending": return {
101686
+ current: memo === null ? import_dist.Characteristic.SecuritySystemCurrentState.DISARMED : currentForArmed(memo),
101687
+ target: memo === null ? null : targetForArmed(memo)
101688
+ };
101689
+ default: return {
101690
+ current: import_dist.Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED,
101691
+ target: memo === null ? null : targetForArmed(memo)
101692
+ };
101693
+ }
101694
+ }
101695
+ /**
101696
+ * The arm mode behind a HomeKit target, or `null` for DISARM and for anything
101697
+ * outside the four values HomeKit defines.
101698
+ *
101699
+ * `null` is not an error the caller can ignore: DISARM is a different COMMAND,
101700
+ * and a value HomeKit never sends is a write this builder refuses to translate.
101701
+ */
101702
+ function alarmArmModeFor(target) {
101703
+ switch (target) {
101704
+ case import_dist.Characteristic.SecuritySystemTargetState.STAY_ARM: return "home";
101705
+ case import_dist.Characteristic.SecuritySystemTargetState.AWAY_ARM: return "away";
101706
+ case import_dist.Characteristic.SecuritySystemTargetState.NIGHT_ARM: return "night";
101707
+ default: return null;
101708
+ }
101709
+ }
101710
+ //#endregion
101711
+ //#region src/mappers/builders/generic/security-target.ts
101712
+ /**
101713
+ * The panel modes behind each HomeKit target, PRIMARY first.
101714
+ *
101715
+ * The primary is the mode `alarmArmModeFor` names; the secondary is the other
101716
+ * mode `security-state.ts` reports through the same HomeKit value, so the two
101717
+ * modules agree in both directions by construction.
101718
+ */
101719
+ var MODES_BY_TARGET = new Map([
101720
+ [import_dist.Characteristic.SecuritySystemTargetState.STAY_ARM, ["home", "custom_bypass"]],
101721
+ [import_dist.Characteristic.SecuritySystemTargetState.AWAY_ARM, ["away", "vacation"]],
101722
+ [import_dist.Characteristic.SecuritySystemTargetState.NIGHT_ARM, ["night"]]
101723
+ ]);
101724
+ /** Arm targets in the order HomeKit numbers them; DISARM is appended last. */
101725
+ var ARM_TARGETS = [
101726
+ import_dist.Characteristic.SecuritySystemTargetState.STAY_ARM,
101727
+ import_dist.Characteristic.SecuritySystemTargetState.AWAY_ARM,
101728
+ import_dist.Characteristic.SecuritySystemTargetState.NIGHT_ARM
101729
+ ];
101730
+ /**
101731
+ * The `validValues` for `SecuritySystemTargetState`, or `null` to leave
101732
+ * HomeKit's own four values in place.
101733
+ *
101734
+ * DISARM is always present: disarming is not one of the panel's arm modes and
101735
+ * a panel that cannot be disarmed is not a thing this cap can express.
101736
+ */
101737
+ function targetValidValuesFor(availableModes) {
101738
+ if (availableModes.length === 0) return null;
101739
+ return [...ARM_TARGETS.filter((target) => (MODES_BY_TARGET.get(target) ?? []).some((mode) => availableModes.includes(mode))), import_dist.Characteristic.SecuritySystemTargetState.DISARM];
101740
+ }
101741
+ /**
101742
+ * The arm mode to send for a HomeKit target, or `null` when there is none.
101743
+ *
101744
+ * `null` is not a shrug the caller may swallow: DISARM is a different command,
101745
+ * and an arm target the panel accepts no mode for is a write this module
101746
+ * refuses to translate rather than guess at.
101747
+ */
101748
+ function armModeForTarget(target, availableModes) {
101749
+ const primary = alarmArmModeFor(target);
101750
+ if (primary === null) return null;
101751
+ if (availableModes.length === 0) return primary;
101752
+ return (MODES_BY_TARGET.get(target) ?? [primary]).find((mode) => availableModes.includes(mode)) ?? null;
101753
+ }
101754
+ //#endregion
101755
+ //#region src/mappers/builders/generic/security-system.ts
101756
+ /**
101757
+ * `alarm-panel` → `Service.SecuritySystem`.
101758
+ *
101759
+ * The lock builder's shape (a current/target pair, a hydrate, an `onSet`, a
101760
+ * slice subscription, a dispose) applied to the one device on the fleet where
101761
+ * reporting a state that is not true has a consequence worse than a stalled
101762
+ * motor. The mapping itself is NOT here: `security-state.ts` owns what the
101763
+ * panel's state looks like to HomeKit and `security-target.ts` owns what
101764
+ * HomeKit may ask for, both pure and both tested on their own. This file is
101765
+ * the service around them.
101766
+ *
101767
+ * ## The memo
101768
+ *
101769
+ * `pending`, `disarming` and `triggered` do not carry the mode the panel was
101770
+ * armed to — only the last settled state knows it. This builder is the caller
101771
+ * `security-state.ts` describes: it remembers the last settled arm and forgets
101772
+ * it on `disarmed`, because a memo that outlives a disarm makes the next
101773
+ * `arming` claim a target nobody asked for.
101774
+ *
101775
+ * The memo is deliberately NOT seeded from the controller's own write. HomeKit
101776
+ * already holds the target the operator just set; not writing it back is
101777
+ * exactly right. The cost is a panel armed from its own keypad during an exit
101778
+ * delay, where the target stays at whatever HomeKit last knew — a stale target
101779
+ * for the length of the delay, against inventing an intent, and the invention
101780
+ * is worse.
101781
+ *
101782
+ * ## `requiresCode`: the arm is REFUSED, not attempted
101783
+ *
101784
+ * HomeKit's SecuritySystem has no PIN prompt — there is no characteristic for
101785
+ * it and no way to ask the operator mid-write. So a panel that requires a code
101786
+ * cannot be armed or disarmed from the Home app, and this builder says so
101787
+ * twice: the write fails with `INSUFFICIENT_AUTHORIZATION` (iOS renders the
101788
+ * tile's failure) and a WARN names the device, the command and the mode.
101789
+ *
101790
+ * Sending the command code-less and letting the panel reject it was the
101791
+ * alternative. It is worse: the refusal costs a round trip, it is
101792
+ * indistinguishable from a broken panel in the log, and repeated code-less
101793
+ * attempts are what locks a real alarm panel out.
101794
+ */
101795
+ var SUBTYPE = "alarm-panel";
101796
+ /** The subset of the status this builder reads. */
101797
+ var PanelReadSchema = AlarmPanelStatusSchema.pick({
101798
+ state: true,
101799
+ availableModes: true,
101800
+ requiresCode: true
101801
+ });
101802
+ /**
101803
+ * Turn a panel status into characteristic writes, folding the memo.
101804
+ *
101805
+ * A payload that does not match the cap's own schema yields NO updates and
101806
+ * leaves the memo alone — it is a status we could not read, not a panel that
101807
+ * changed. The caller logs the drop; a frozen characteristic is otherwise
101808
+ * indistinguishable from a quiet panel.
101809
+ */
101810
+ function securityUpdatesFor(status, memo) {
101811
+ const parsed = PanelReadSchema.safeParse(status);
101812
+ if (!parsed.success) return {
101813
+ updates: [],
101814
+ memo,
101815
+ panel: null
101816
+ };
101817
+ const nextMemo = parsed.data.state === "disarmed" ? null : armedMemoOf(parsed.data.state) ?? memo;
101818
+ const { current, target } = securityStateFor(parsed.data.state, nextMemo);
101819
+ return {
101820
+ updates: [{
101821
+ characteristic: import_dist.Characteristic.SecuritySystemCurrentState,
101822
+ value: current
101823
+ }, ...target === null ? [] : [{
101824
+ characteristic: import_dist.Characteristic.SecuritySystemTargetState,
101825
+ value: target
101826
+ }]],
101827
+ memo: nextMemo,
101828
+ panel: {
101829
+ availableModes: parsed.data.availableModes,
101830
+ requiresCode: parsed.data.requiresCode
101831
+ }
101832
+ };
101833
+ }
101834
+ async function buildSecuritySystem(bctx) {
101835
+ const { ctx, accessory, proxy, numericDeviceId, displayName } = bctx;
101836
+ const log = ctx.logger.withTags({ deviceId: numericDeviceId });
101837
+ const label = hapServiceName([displayName], `Alarm ${numericDeviceId}`);
101838
+ const service = accessory.addService(import_dist.Service.SecuritySystem, label, SUBTYPE);
101839
+ applyServiceLabel(service, label);
101840
+ let memo = null;
101841
+ let availableModes = [];
101842
+ let requiresCode = false;
101843
+ /** Only log the `validValues` narrowing when it actually changes. */
101844
+ let lastValidValues = "";
101845
+ const applyValidValues = () => {
101846
+ const validValues = targetValidValuesFor(availableModes);
101847
+ if (validValues === null) {
101848
+ if (lastValidValues !== "unconstrained") {
101849
+ lastValidValues = "unconstrained";
101850
+ log.info("export-hap: alarm panel named no arm modes — leaving HomeKit’s targets unconstrained", { meta: { subtype: SUBTYPE } });
101851
+ }
101852
+ return;
101853
+ }
101854
+ const key = validValues.join(",");
101855
+ if (key === lastValidValues) return;
101856
+ lastValidValues = key;
101857
+ service.getCharacteristic(import_dist.Characteristic.SecuritySystemTargetState).setProps({ validValues: [...validValues] });
101858
+ log.info("export-hap: alarm panel target constrained to the modes it accepts", { meta: {
101859
+ subtype: SUBTYPE,
101860
+ availableModes: [...availableModes],
101861
+ validValues
101862
+ } });
101863
+ };
101864
+ const apply = (status, source) => {
101865
+ const next = securityUpdatesFor(status, memo);
101866
+ if (next.updates.length === 0) {
101867
+ log.debug("export-hap: alarm panel status did not match the cap schema — no update", { meta: {
101868
+ subtype: SUBTYPE,
101869
+ source
101870
+ } });
101871
+ return;
101872
+ }
101873
+ memo = next.memo;
101874
+ if (next.panel !== null) {
101875
+ availableModes = next.panel.availableModes;
101876
+ requiresCode = next.panel.requiresCode;
101877
+ applyValidValues();
101878
+ }
101879
+ applyUpdates(service, next.updates);
101880
+ };
101881
+ try {
101882
+ const status = await proxy.alarmPanel?.getStatus({});
101883
+ if (status !== void 0 && status !== null) apply(status, "getStatus");
101884
+ } catch (err) {
101885
+ log.debug("export-hap: alarm panel getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$3(err) } });
101886
+ }
101887
+ service.getCharacteristic(import_dist.Characteristic.SecuritySystemTargetState).onSet(async (value) => {
101888
+ const target = typeof value === "number" ? value : Number(value);
101889
+ const disarm = target === import_dist.Characteristic.SecuritySystemTargetState.DISARM;
101890
+ const mode = disarm ? null : armModeForTarget(target, availableModes);
101891
+ if (requiresCode) {
101892
+ log.warn("export-hap: alarm panel requires a PIN — HomeKit cannot supply one, command REFUSED", { meta: {
101893
+ subtype: SUBTYPE,
101894
+ command: disarm ? "disarm" : "arm",
101895
+ mode,
101896
+ target
101897
+ } });
101898
+ throw new import_dist.HapStatusError(import_dist.HAPStatus.INSUFFICIENT_AUTHORIZATION);
101899
+ }
101900
+ if (!disarm && mode === null) {
101901
+ log.warn("export-hap: alarm panel cannot honour this HomeKit arm target — REFUSED", { meta: {
101902
+ subtype: SUBTYPE,
101903
+ target,
101904
+ availableModes: [...availableModes]
101905
+ } });
101906
+ throw new import_dist.HapStatusError(import_dist.HAPStatus.INVALID_VALUE_IN_REQUEST);
101907
+ }
101908
+ try {
101909
+ if (mode === null) await proxy.alarmPanel?.disarm({});
101910
+ else await proxy.alarmPanel?.arm({ mode });
101911
+ } catch (err) {
101912
+ log.warn("export-hap: alarm panel command failed", { meta: {
101913
+ subtype: SUBTYPE,
101914
+ command: mode === null ? "disarm" : "arm",
101915
+ mode,
101916
+ error: errMsg$3(err)
101917
+ } });
101918
+ throw new import_dist.HapStatusError(import_dist.HAPStatus.SERVICE_COMMUNICATION_FAILURE);
101919
+ }
101920
+ });
101921
+ const unsubscribe = proxy.state.alarmPanel?.subscribe((value) => {
101922
+ if (value === void 0 || value === null) return;
101923
+ apply(value, "slice");
101924
+ }) ?? null;
101925
+ return { async dispose() {
101926
+ try {
101927
+ unsubscribe?.();
101928
+ } catch {}
101929
+ } };
101930
+ }
101617
101931
  function errMsg$3(err) {
101618
101932
  return err instanceof Error ? err.message : String(err);
101619
101933
  }
@@ -101688,11 +102002,16 @@ function errMsg$2(err) {
101688
102002
  *
101689
102003
  * ## Tier
101690
102004
  *
101691
- * Tier A only: the caps whose HomeKit service exists today and needs no
101692
- * feature-dependent shape (`cover` needs `cover-positionable`, `climate-control`
101693
- * needs the dual-setpoint split, `alarm-panel` must survive a refused `arm`).
101694
- * Those are a separate task; adding a row here must never mean adding a service
101695
- * whose semantics this file cannot fully honour.
102005
+ * Tier A, plus `alarm-panel`: the caps whose HomeKit service exists today and
102006
+ * needs no feature-dependent shape. `cover` still needs `cover-positionable`
102007
+ * and `climate-control` the dual-setpoint split; those are a separate task,
102008
+ * and adding a row here must never mean adding a service whose semantics this
102009
+ * file cannot fully honour.
102010
+ *
102011
+ * `alarm-panel` earned its row by answering the two questions that kept it
102012
+ * out: a target the panel would refuse is never offered (`availableModes` →
102013
+ * `validValues`, `security-target.ts`) and an arm a PIN-gated panel cannot
102014
+ * accept is refused out loud rather than attempted (`security-system.ts`).
101696
102015
  */
101697
102016
  /** HomeKit's floor for `CurrentAmbientLightLevel`; 0 lux is out of range. */
101698
102017
  var MIN_LUX = 1e-4;
@@ -101834,6 +102153,14 @@ var HAP_CAP_SERVICES = [
101834
102153
  displayName: name
101835
102154
  })
101836
102155
  },
102156
+ {
102157
+ caps: ["alarm-panel"],
102158
+ label: "Alarm",
102159
+ build: ({ bctx, name }) => buildSecuritySystem({
102160
+ ...bctx,
102161
+ displayName: name
102162
+ })
102163
+ },
101837
102164
  {
101838
102165
  caps: ["battery"],
101839
102166
  label: BATTERY_SPEC.label,
@@ -101871,7 +102198,8 @@ var ACCESSORY_CATEGORY_BY_TYPE = {
101871
102198
  [DeviceType.Siren]: import_dist.Categories.SWITCH,
101872
102199
  [DeviceType.Lock]: import_dist.Categories.DOOR_LOCK,
101873
102200
  [DeviceType.Sensor]: import_dist.Categories.SENSOR,
101874
- [DeviceType.Presence]: import_dist.Categories.SENSOR
102201
+ [DeviceType.Presence]: import_dist.Categories.SENSOR,
102202
+ [DeviceType.AlarmPanel]: import_dist.Categories.SECURITY_SYSTEM
101875
102203
  };
101876
102204
  function accessoryCategoryFor(deviceType) {
101877
102205
  return ACCESSORY_CATEGORY_BY_TYPE[deviceType] ?? import_dist.Categories.OTHER;