@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.
@@ -7432,7 +7432,7 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
7432
7432
  input: unknown()
7433
7433
  }), unknown(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
7434
7434
  //#endregion
7435
- //#region ../types/dist/canonical-hash-rO1sRmEK.mjs
7435
+ //#region ../types/dist/canonical-hash-Ch5bSjFG.mjs
7436
7436
  var AUDIO_ENCODER_BY_CODEC = {
7437
7437
  opus: "libopus",
7438
7438
  aac: "aac",
@@ -7535,6 +7535,7 @@ function buildVideoArgs(video, outputArgs) {
7535
7535
  ];
7536
7536
  if (video.preset !== void 0) args.push("-preset", video.preset);
7537
7537
  if (video.tune !== void 0) args.push("-tune", video.tune);
7538
+ if (video.singleSlicePerFrame === true && video.encoder === "libx264") args.push("-x264-params", "sliced-threads=0");
7538
7539
  if (video.profile !== void 0) args.push("-profile:v", video.profile);
7539
7540
  if (video.level !== void 0) args.push("-level", video.level);
7540
7541
  if (video.pixelFormat !== void 0) args.push("-pix_fmt", video.pixelFormat);
@@ -7936,7 +7937,7 @@ import { errMsg } from '@camstack/types'
7936
7937
  * Extract a human-readable message from an unknown error value.
7937
7938
  * Replaces the ubiquitous `errMsg(err)` pattern.
7938
7939
  */
7939
- function errMsg$15(err) {
7940
+ function errMsg$16(err) {
7940
7941
  if (err instanceof Error) return err.message;
7941
7942
  if (typeof err === "string") return err;
7942
7943
  return String(err);
@@ -8013,7 +8014,23 @@ var EncodeProfileSchema = object({
8013
8014
  "zerolatency",
8014
8015
  "film",
8015
8016
  "animation"
8016
- ]).optional()
8017
+ ]).optional(),
8018
+ /**
8019
+ * ONE slice per access unit.
8020
+ *
8021
+ * `-tune zerolatency` turns on x264's sliced threads, and a frame then leaves
8022
+ * the encoder as five NAL slices that share one RTP timestamp and carry one
8023
+ * marker bit. A libwebrtc depacketiser sees five frame-starts and one
8024
+ * frame-end per frame: the first pictures render and the video then freezes
8025
+ * for good while the audio, on its own plane, plays on. Measured on this hub
8026
+ * 2026-09-13 against the Echo, and reduced to one slice by this flag alone.
8027
+ *
8028
+ * A NAMED field and not a raw flag, because {@link EgressEncodeSchema} omits
8029
+ * `outputArgs` on purpose: an opaque array is part of the sharing key, so two
8030
+ * consumers meaning the same thing spelled differently would stop sharing one
8031
+ * child. Absent means "whatever the encoder does" — today's behaviour.
8032
+ */
8033
+ singleSlicePerFrame: boolean().optional()
8017
8034
  }),
8018
8035
  audio: union([literal("passthrough"), object({
8019
8036
  codec: _enum([
@@ -8063,7 +8080,7 @@ var BASE_LIVE_EGRESS_PROFILE = {
8063
8080
  audio: "passthrough"
8064
8081
  };
8065
8082
  ({ ...BASE_LIVE_EGRESS_PROFILE }), { ...BASE_LIVE_EGRESS_PROFILE.video };
8066
- ({ ...BASE_LIVE_EGRESS_PROFILE });
8083
+ ({ ...BASE_LIVE_EGRESS_PROFILE }), { ...BASE_LIVE_EGRESS_PROFILE.video };
8067
8084
  /** VBV window for a consumer whose budget is enforced per second (HomeKit). */
8068
8085
  var RATE_CONTROL_TIGHT = {
8069
8086
  kind: "cbr",
@@ -16986,7 +17003,7 @@ var AlarmArmModeSchema = _enum([
16986
17003
  "vacation",
16987
17004
  "custom_bypass"
16988
17005
  ]);
16989
- object({
17006
+ var AlarmPanelStatusSchema = object({
16990
17007
  /** Current lifecycle state. */
16991
17008
  state: AlarmStateSchema,
16992
17009
  /** Subset of arm modes the panel accepts. UI renders one button per
@@ -40220,7 +40237,7 @@ var Fmp4FragmentChild = class {
40220
40237
  meta: {
40221
40238
  sourceId: this.args.sourceId,
40222
40239
  decodeHwAccel: requested,
40223
- error: errMsg$15(err)
40240
+ error: errMsg$16(err)
40224
40241
  }
40225
40242
  });
40226
40243
  this.killChild();
@@ -40399,7 +40416,7 @@ var Fmp4FragmentChild = class {
40399
40416
  tags: { deviceId: this.args.deviceId },
40400
40417
  meta: {
40401
40418
  sourceId: this.args.sourceId,
40402
- error: errMsg$15(err)
40419
+ error: errMsg$16(err)
40403
40420
  }
40404
40421
  });
40405
40422
  }
@@ -87055,7 +87072,7 @@ function clearPairingFiles(accessoryUuid, logger) {
87055
87072
  }
87056
87073
  //#endregion
87057
87074
  //#region src/hap-setup-uri.ts
87058
- function errMsg$14(e) {
87075
+ function errMsg$15(e) {
87059
87076
  return e instanceof Error ? e.message : String(e);
87060
87077
  }
87061
87078
  /**
@@ -87082,7 +87099,7 @@ function firstExposedAccessorySetupUri(exposed, logger) {
87082
87099
  try {
87083
87100
  return first.setupURI();
87084
87101
  } catch (err) {
87085
- logger.debug("export-hap: setupURI failed on first exposed accessory", { meta: { error: errMsg$14(err) } });
87102
+ logger.debug("export-hap: setupURI failed on first exposed accessory", { meta: { error: errMsg$15(err) } });
87086
87103
  return;
87087
87104
  }
87088
87105
  }
@@ -87435,7 +87452,7 @@ async function buildBattery(bctx) {
87435
87452
  const status = await proxy.battery?.getStatus({});
87436
87453
  if (status !== void 0 && status !== null) applyToService(service, status);
87437
87454
  } catch (err) {
87438
- log.debug("export-hap: battery getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$13(err) } });
87455
+ log.debug("export-hap: battery getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$14(err) } });
87439
87456
  }
87440
87457
  const unsubscribes = [];
87441
87458
  if (proxy.state.battery) {
@@ -87454,7 +87471,7 @@ async function buildBattery(bctx) {
87454
87471
  function applyToService(service, status) {
87455
87472
  applyUpdates(service, batteryCharacteristicUpdates(status));
87456
87473
  }
87457
- function errMsg$13(err) {
87474
+ function errMsg$14(err) {
87458
87475
  return err instanceof Error ? err.message : String(err);
87459
87476
  }
87460
87477
  //#endregion
@@ -98206,7 +98223,7 @@ var VIDEO_LOOPBACK_RCVBUF_BYTES = 8 * 1024 * 1024;
98206
98223
  * not burst size.
98207
98224
  */
98208
98225
  var AUDIO_LOOPBACK_RCVBUF_BYTES = 1024 * 1024;
98209
- function errMsg$12(err) {
98226
+ function errMsg$13(err) {
98210
98227
  return err instanceof Error ? err.message : String(err);
98211
98228
  }
98212
98229
  /**
@@ -98221,13 +98238,13 @@ function applyReceiveBuffer(socket, requestedBytes) {
98221
98238
  try {
98222
98239
  socket.setRecvBufferSize(requestedBytes);
98223
98240
  } catch (err) {
98224
- error = errMsg$12(err);
98241
+ error = errMsg$13(err);
98225
98242
  }
98226
98243
  let effectiveBytes = null;
98227
98244
  try {
98228
98245
  effectiveBytes = socket.getRecvBufferSize();
98229
98246
  } catch (err) {
98230
- if (error === null) error = errMsg$12(err);
98247
+ if (error === null) error = errMsg$13(err);
98231
98248
  }
98232
98249
  return {
98233
98250
  requestedBytes,
@@ -98487,20 +98504,20 @@ function buildCameraStreamingDelegate(bctx, advertised) {
98487
98504
  delegate: {
98488
98505
  handleSnapshotRequest(request, callback) {
98489
98506
  handleSnapshot(bctx, request).then((buf) => callback(void 0, buf)).catch((err) => {
98490
- log.warn("export-hap: snapshot failed", { meta: { error: errMsg$11(err) } });
98491
- callback(err instanceof Error ? err : new Error(errMsg$11(err)));
98507
+ log.warn("export-hap: snapshot failed", { meta: { error: errMsg$12(err) } });
98508
+ callback(err instanceof Error ? err : new Error(errMsg$12(err)));
98492
98509
  });
98493
98510
  },
98494
98511
  prepareStream(request, callback) {
98495
98512
  prepareStream(request, sessions, bctx).then((resp) => callback(void 0, resp)).catch((err) => {
98496
- log.warn("export-hap: prepareStream failed", { meta: { error: errMsg$11(err) } });
98497
- callback(err instanceof Error ? err : new Error(errMsg$11(err)));
98513
+ log.warn("export-hap: prepareStream failed", { meta: { error: errMsg$12(err) } });
98514
+ callback(err instanceof Error ? err : new Error(errMsg$12(err)));
98498
98515
  });
98499
98516
  },
98500
98517
  handleStreamRequest(request, callback) {
98501
98518
  handleStreamRequest(request, sessions, bctx, advertised).then(() => callback()).catch((err) => {
98502
- log.warn("export-hap: handleStreamRequest failed", { meta: { error: errMsg$11(err) } });
98503
- callback(err instanceof Error ? err : new Error(errMsg$11(err)));
98519
+ log.warn("export-hap: handleStreamRequest failed", { meta: { error: errMsg$12(err) } });
98520
+ callback(err instanceof Error ? err : new Error(errMsg$12(err)));
98504
98521
  });
98505
98522
  }
98506
98523
  },
@@ -98616,7 +98633,7 @@ async function prepareStream(request, sessions, bctx) {
98616
98633
  closeSocket(audioUdp);
98617
98634
  closeSocket(videoLoopUdp);
98618
98635
  closeSocket(audioLoopUdp);
98619
- throw new Error(`export-hap: outbound SrtpSession init failed: ${errMsg$11(err)}`, { cause: err });
98636
+ throw new Error(`export-hap: outbound SrtpSession init failed: ${errMsg$12(err)}`, { cause: err });
98620
98637
  }
98621
98638
  let upstreamAudioSrtp = null;
98622
98639
  try {
@@ -98630,7 +98647,7 @@ async function prepareStream(request, sessions, bctx) {
98630
98647
  profile: import_src.ProtectionProfileAes128CmHmacSha1_80
98631
98648
  });
98632
98649
  } catch (err) {
98633
- bctx.ctx.logger.withTags({ deviceId: bctx.numericDeviceId }).warn("export-hap: SrtpSession init failed (upstream audio decrypt disabled)", { meta: { error: errMsg$11(err) } });
98650
+ bctx.ctx.logger.withTags({ deviceId: bctx.numericDeviceId }).warn("export-hap: SrtpSession init failed (upstream audio decrypt disabled)", { meta: { error: errMsg$12(err) } });
98634
98651
  }
98635
98652
  const videoSsrc = randomSsrc();
98636
98653
  const audioSsrc = randomSsrc();
@@ -98747,7 +98764,7 @@ async function prepareStream(request, sessions, bctx) {
98747
98764
  });
98748
98765
  audioUdp.on("message", (packet, rinfo) => {
98749
98766
  handleIncomingAudioRtp(session, packet, rinfo.address, bctx).catch((err) => {
98750
- bctx.ctx.logger.withTags({ deviceId: bctx.numericDeviceId }).debug("export-hap: incoming-audio handler error (dropped)", { meta: { error: errMsg$11(err) } });
98767
+ bctx.ctx.logger.withTags({ deviceId: bctx.numericDeviceId }).debug("export-hap: incoming-audio handler error (dropped)", { meta: { error: errMsg$12(err) } });
98751
98768
  });
98752
98769
  });
98753
98770
  logLoopbackBuffer(tagLog, request.sessionID, "video", videoLoop.buffer);
@@ -98943,7 +98960,7 @@ function readControllerRtcp(session, leg, packet, log) {
98943
98960
  } catch (err) {
98944
98961
  drop(session, "inbound-rtcp-decrypt-failed");
98945
98962
  storeReceiverReports(session, leg, recordUnreadableRtcp(tally));
98946
- logUnreadableRtcp(session, leg, `decrypt: ${errMsg$11(err)}`, log);
98963
+ logUnreadableRtcp(session, leg, `decrypt: ${errMsg$12(err)}`, log);
98947
98964
  return;
98948
98965
  }
98949
98966
  const outcome = ingestDecryptedRtcp(plaintext, tally);
@@ -99709,7 +99726,7 @@ async function handleIncomingAudioRtp(session, packet, sourceAddress, bctx) {
99709
99726
  session.upstreamRtpDecryptFailures += 1;
99710
99727
  if (session.upstreamRtpDecryptFailures % 100 === 1) log.debug("export-hap: SRTP decrypt failed (rate-limited)", { meta: {
99711
99728
  failures: session.upstreamRtpDecryptFailures,
99712
- error: errMsg$11(err)
99729
+ error: errMsg$12(err)
99713
99730
  } });
99714
99731
  return;
99715
99732
  }
@@ -99723,7 +99740,7 @@ async function handleIncomingAudioRtp(session, packet, sourceAddress, bctx) {
99723
99740
  rtpPayloadType = parsedRtp.header.payloadType;
99724
99741
  } catch (err) {
99725
99742
  drop(session, "upstream-parse-failed");
99726
- log.debug("export-hap: RTP parse failed after decrypt", { meta: { error: errMsg$11(err) } });
99743
+ log.debug("export-hap: RTP parse failed after decrypt", { meta: { error: errMsg$12(err) } });
99727
99744
  return;
99728
99745
  }
99729
99746
  const negotiatedAudioPt = session.lastStartParams?.audioPt;
@@ -99747,7 +99764,7 @@ async function handleIncomingAudioRtp(session, packet, sourceAddress, bctx) {
99747
99764
  if (session.intercomTalkSessionId === null) {
99748
99765
  session.intercomTalkSessionId = "";
99749
99766
  const opened = await openIntercomTalkSession(bctx).catch((err) => {
99750
- log.warn("export-hap: intercom.startTalkSession failed", { meta: { error: errMsg$11(err) } });
99767
+ log.warn("export-hap: intercom.startTalkSession failed", { meta: { error: errMsg$12(err) } });
99751
99768
  return null;
99752
99769
  });
99753
99770
  if (opened) {
@@ -99774,7 +99791,7 @@ async function handleIncomingAudioRtp(session, packet, sourceAddress, bctx) {
99774
99791
  drop(session, "upstream-push-failed");
99775
99792
  log.debug("export-hap: intercom.pushTalkAudio failed (will re-open on next frame)", { meta: {
99776
99793
  sequenceNumber: session.intercomPcmSequence,
99777
- error: errMsg$11(err)
99794
+ error: errMsg$12(err)
99778
99795
  } });
99779
99796
  session.intercomTalkSessionId = null;
99780
99797
  }
@@ -99806,7 +99823,7 @@ async function closeIntercomTalkSession(session, bctx) {
99806
99823
  } catch (err) {
99807
99824
  log.debug("export-hap: intercom.endTalkSession failed (continuing)", { meta: {
99808
99825
  sessionId,
99809
- error: errMsg$11(err)
99826
+ error: errMsg$12(err)
99810
99827
  } });
99811
99828
  }
99812
99829
  }
@@ -99831,7 +99848,7 @@ function closeSocket(udp) {
99831
99848
  function randomSsrc() {
99832
99849
  return Math.floor(Math.random() * 2147483646) + 1 | 0;
99833
99850
  }
99834
- function errMsg$11(err) {
99851
+ function errMsg$12(err) {
99835
99852
  return err instanceof Error ? err.message : String(err);
99836
99853
  }
99837
99854
  //#endregion
@@ -99915,14 +99932,14 @@ async function buildDoorbell(input) {
99915
99932
  }
99916
99933
  log.info("export-hap: doorbell SINGLE_PRESS pushed to HomeKit", { meta: { ...delivery } });
99917
99934
  } catch (err) {
99918
- log.warn("export-hap: ringDoorbell() failed", { meta: { error: errMsg$10(err) } });
99935
+ log.warn("export-hap: ringDoorbell() failed", { meta: { error: errMsg$11(err) } });
99919
99936
  }
99920
99937
  });
99921
99938
  return { async dispose() {
99922
99939
  unsubscribe();
99923
99940
  } };
99924
99941
  }
99925
- function errMsg$10(err) {
99942
+ function errMsg$11(err) {
99926
99943
  return err instanceof Error ? err.message : String(err);
99927
99944
  }
99928
99945
  //#endregion
@@ -99970,7 +99987,7 @@ async function buildMotionSensor(bctx, existing = null) {
99970
99987
  const detected = await proxy.motion?.isDetected({});
99971
99988
  if (typeof detected === "boolean") motionService.updateCharacteristic(import_dist.Characteristic.MotionDetected, detected);
99972
99989
  } catch (err) {
99973
- ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: initial motion hydrate failed (non-fatal)", { meta: { error: errMsg$9(err) } });
99990
+ ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: initial motion hydrate failed (non-fatal)", { meta: { error: errMsg$10(err) } });
99974
99991
  }
99975
99992
  let resetTimer = null;
99976
99993
  const armReset = () => {
@@ -100004,7 +100021,7 @@ async function buildMotionSensor(bctx, existing = null) {
100004
100021
  }
100005
100022
  } };
100006
100023
  }
100007
- function errMsg$9(err) {
100024
+ function errMsg$10(err) {
100008
100025
  return err instanceof Error ? err.message : String(err);
100009
100026
  }
100010
100027
  //#endregion
@@ -100035,7 +100052,7 @@ async function buildPrivacySwitch(bctx) {
100035
100052
  const status = await proxy.privacyMask?.getStatus({});
100036
100053
  if (status && typeof status.enabled === "boolean") service.updateCharacteristic(import_dist.Characteristic.On, status.enabled);
100037
100054
  } catch (err) {
100038
- log.debug("export-hap: privacy-mask getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$8(err) } });
100055
+ log.debug("export-hap: privacy-mask getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$9(err) } });
100039
100056
  }
100040
100057
  service.getCharacteristic(import_dist.Characteristic.On).onSet(async (value) => {
100041
100058
  const enabled = value === true;
@@ -100044,7 +100061,7 @@ async function buildPrivacySwitch(bctx) {
100044
100061
  } catch (err) {
100045
100062
  log.warn("export-hap: privacy-mask setMask failed", { meta: {
100046
100063
  enabled,
100047
- error: errMsg$8(err)
100064
+ error: errMsg$9(err)
100048
100065
  } });
100049
100066
  }
100050
100067
  });
@@ -100062,7 +100079,7 @@ async function buildPrivacySwitch(bctx) {
100062
100079
  } catch {}
100063
100080
  } };
100064
100081
  }
100065
- function errMsg$8(err) {
100082
+ function errMsg$9(err) {
100066
100083
  return err instanceof Error ? err.message : String(err);
100067
100084
  }
100068
100085
  //#endregion
@@ -100153,7 +100170,7 @@ async function buildPtz(bctx) {
100153
100170
  } catch (err) {
100154
100171
  log.warn("export-hap: ptz.goToPreset failed", { meta: {
100155
100172
  presetId: preset.id,
100156
- error: errMsg$7(err)
100173
+ error: errMsg$8(err)
100157
100174
  } });
100158
100175
  }
100159
100176
  armReset(() => service.updateCharacteristic(import_dist.Characteristic.On, false), MOMENTARY_RESET_MS);
@@ -100171,14 +100188,14 @@ async function buildPtz(bctx) {
100171
100188
  try {
100172
100189
  await proxy.ptz?.stop({});
100173
100190
  } catch (err) {
100174
- log.debug("export-hap: ptz.stop failed (non-fatal)", { meta: { error: errMsg$7(err) } });
100191
+ log.debug("export-hap: ptz.stop failed (non-fatal)", { meta: { error: errMsg$8(err) } });
100175
100192
  }
100176
100193
  service.updateCharacteristic(import_dist.Characteristic.On, false);
100177
100194
  }, options.ptzPulseMs);
100178
100195
  } catch (err) {
100179
100196
  log.warn("export-hap: ptz.continuousMove failed", { meta: {
100180
100197
  dir: dir.label,
100181
- error: errMsg$7(err)
100198
+ error: errMsg$8(err)
100182
100199
  } });
100183
100200
  service.updateCharacteristic(import_dist.Characteristic.On, false);
100184
100201
  }
@@ -100201,7 +100218,7 @@ async function readPresets(bctx) {
100201
100218
  name: p.name
100202
100219
  }));
100203
100220
  } catch (err) {
100204
- ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: ptz.getPresets failed (non-fatal)", { meta: { error: errMsg$7(err) } });
100221
+ ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: ptz.getPresets failed (non-fatal)", { meta: { error: errMsg$8(err) } });
100205
100222
  return [];
100206
100223
  }
100207
100224
  }
@@ -100216,7 +100233,7 @@ async function tryBuildAutotrack(bctx) {
100216
100233
  const status = await proxy.ptzAutotrack.getStatus({});
100217
100234
  if (status && typeof status.enabled === "boolean") service.updateCharacteristic(import_dist.Characteristic.On, status.enabled);
100218
100235
  } catch (err) {
100219
- log.debug("export-hap: ptzAutotrack.getStatus failed (non-fatal)", { meta: { error: errMsg$7(err) } });
100236
+ log.debug("export-hap: ptzAutotrack.getStatus failed (non-fatal)", { meta: { error: errMsg$8(err) } });
100220
100237
  }
100221
100238
  service.getCharacteristic(import_dist.Characteristic.On).onSet(async (value) => {
100222
100239
  const enabled = value === true;
@@ -100225,13 +100242,13 @@ async function tryBuildAutotrack(bctx) {
100225
100242
  } catch (err) {
100226
100243
  log.warn("export-hap: ptzAutotrack.setEnabled failed", { meta: {
100227
100244
  enabled,
100228
- error: errMsg$7(err)
100245
+ error: errMsg$8(err)
100229
100246
  } });
100230
100247
  }
100231
100248
  });
100232
100249
  return { async dispose() {} };
100233
100250
  }
100234
- function errMsg$7(err) {
100251
+ function errMsg$8(err) {
100235
100252
  return err instanceof Error ? err.message : String(err);
100236
100253
  }
100237
100254
  //#endregion
@@ -101262,13 +101279,13 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
101262
101279
  const switchStatus = await proxy.switch?.getStatus({});
101263
101280
  if (switchStatus && typeof switchStatus.on === "boolean") service.updateCharacteristic(import_dist.Characteristic.On, switchStatus.on);
101264
101281
  } catch (err) {
101265
- log.debug("export-hap: child switch.getStatus failed (non-fatal)", { meta: { error: errMsg$6(err) } });
101282
+ log.debug("export-hap: child switch.getStatus failed (non-fatal)", { meta: { error: errMsg$7(err) } });
101266
101283
  }
101267
101284
  if (useLightbulb) try {
101268
101285
  const status = await proxy.brightness?.getStatus({});
101269
101286
  if (status && typeof status.percentage === "number") service.updateCharacteristic(import_dist.Characteristic.Brightness, status.percentage);
101270
101287
  } catch (err) {
101271
- log.debug("export-hap: child brightness.getStatus failed (non-fatal)", { meta: { error: errMsg$6(err) } });
101288
+ log.debug("export-hap: child brightness.getStatus failed (non-fatal)", { meta: { error: errMsg$7(err) } });
101272
101289
  }
101273
101290
  if (hasSwitch) service.getCharacteristic(import_dist.Characteristic.On).onSet(async (value) => {
101274
101291
  const on = value === true;
@@ -101277,7 +101294,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
101277
101294
  } catch (err) {
101278
101295
  log.warn("export-hap: child switch.setState failed", { meta: {
101279
101296
  on,
101280
- error: errMsg$6(err)
101297
+ error: errMsg$7(err)
101281
101298
  } });
101282
101299
  }
101283
101300
  });
@@ -101289,7 +101306,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
101289
101306
  } catch (err) {
101290
101307
  log.warn("export-hap: child brightness.setBrightness failed", { meta: {
101291
101308
  percentage,
101292
- error: errMsg$6(err)
101309
+ error: errMsg$7(err)
101293
101310
  } });
101294
101311
  }
101295
101312
  });
@@ -101312,7 +101329,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
101312
101329
  } catch {}
101313
101330
  } };
101314
101331
  }
101315
- function errMsg$6(err) {
101332
+ function errMsg$7(err) {
101316
101333
  return err instanceof Error ? err.message : String(err);
101317
101334
  }
101318
101335
  //#endregion
@@ -101339,7 +101356,7 @@ async function buildChildServicesFor(input) {
101339
101356
  for (const h of handles) try {
101340
101357
  await h.dispose();
101341
101358
  } catch (err) {
101342
- ctx.logger.withTags({ deviceId: parentNumericId }).debug("export-hap: child service dispose failed (continuing)", { meta: { error: errMsg$5(err) } });
101359
+ ctx.logger.withTags({ deviceId: parentNumericId }).debug("export-hap: child service dispose failed (continuing)", { meta: { error: errMsg$6(err) } });
101343
101360
  }
101344
101361
  } };
101345
101362
  }
@@ -101355,7 +101372,7 @@ async function listChildren(ctx, parentNumericId) {
101355
101372
  features: Array.isArray(c.features) ? c.features.filter((f) => typeof f === "string") : []
101356
101373
  }));
101357
101374
  } catch (err) {
101358
- ctx.logger.withTags({ deviceId: parentNumericId }).debug("export-hap: deviceManager.getChildren failed (non-fatal)", { meta: { error: errMsg$5(err) } });
101375
+ ctx.logger.withTags({ deviceId: parentNumericId }).debug("export-hap: deviceManager.getChildren failed (non-fatal)", { meta: { error: errMsg$6(err) } });
101359
101376
  return [];
101360
101377
  }
101361
101378
  }
@@ -101371,7 +101388,7 @@ function asDeviceType(raw) {
101371
101388
  for (const value of Object.values(DeviceType)) if (value === lower) return value;
101372
101389
  return DeviceType.Generic;
101373
101390
  }
101374
- function errMsg$5(err) {
101391
+ function errMsg$6(err) {
101375
101392
  return err instanceof Error ? err.message : String(err);
101376
101393
  }
101377
101394
  //#endregion
@@ -101393,12 +101410,18 @@ var SUPPORTED_MAPPER_KINDS = ["camera", "generic"];
101393
101410
  * doctrine the HA exporter writes down, and the thing that confined the
101394
101411
  * previous exporter to cameras when it was ignored.
101395
101412
  *
101396
- * Tier A: the types whose HomeKit services exist today and need no
101397
- * feature-dependent shape. `cover`, `climate`, `fan`, `valve`, `humidifier`,
101398
- * `water-heater`, `alarm-panel`, `button` and `media-player` are deliberately
101413
+ * Tier A plus `alarm-panel`: the types whose HomeKit services exist today and
101414
+ * need no feature-dependent shape. `cover`, `climate`, `fan`, `valve`,
101415
+ * `humidifier`, `water-heater`, `button` and `media-player` are deliberately
101399
101416
  * absent — each needs a service whose semantics the table cannot yet honour,
101400
101417
  * and offering the tab before the mapping exists is how an operator gets an
101401
101418
  * accessory that pairs and does nothing.
101419
+ *
101420
+ * `alarm-panel` is no longer one of them. It maps to `Service.SecuritySystem`
101421
+ * (`builders/generic/security-system.ts`), and the two things the table could
101422
+ * not previously honour are now honoured explicitly: HomeKit is only ever
101423
+ * offered the arm modes the panel accepts, and a panel that requires a PIN
101424
+ * refuses the write out loud instead of pretending to arm.
101402
101425
  */
101403
101426
  var HAP_EXPORTABLE_DEVICE_TYPES = [
101404
101427
  DeviceType.Camera,
@@ -101408,6 +101431,7 @@ var HAP_EXPORTABLE_DEVICE_TYPES = [
101408
101431
  DeviceType.Sensor,
101409
101432
  DeviceType.Lock,
101410
101433
  DeviceType.Presence,
101434
+ DeviceType.AlarmPanel,
101411
101435
  DeviceType.Generic
101412
101436
  ];
101413
101437
  /**
@@ -101533,17 +101557,17 @@ async function buildCameraAccessory(input) {
101533
101557
  for (const h of handles) try {
101534
101558
  await h.dispose();
101535
101559
  } catch (err) {
101536
- log.debug("export-hap: builder dispose failed (continuing)", { meta: { error: errMsg$4(err) } });
101560
+ log.debug("export-hap: builder dispose failed (continuing)", { meta: { error: errMsg$5(err) } });
101537
101561
  }
101538
101562
  try {
101539
101563
  await streams.dispose();
101540
101564
  } catch (err) {
101541
- log.debug("export-hap: streams dispose failed", { meta: { error: errMsg$4(err) } });
101565
+ log.debug("export-hap: streams dispose failed", { meta: { error: errMsg$5(err) } });
101542
101566
  }
101543
101567
  }
101544
101568
  };
101545
101569
  }
101546
- function errMsg$4(err) {
101570
+ function errMsg$5(err) {
101547
101571
  return err instanceof Error ? err.message : String(err);
101548
101572
  }
101549
101573
  //#endregion
@@ -101572,7 +101596,7 @@ function errMsg$4(err) {
101572
101596
  * counterpart on this service and is deliberately not wired — a Switch that
101573
101597
  * silently buzzes a door open would be a second knob nobody asked for.
101574
101598
  */
101575
- var SUBTYPE = "lock-control";
101599
+ var SUBTYPE$1 = "lock-control";
101576
101600
  var readLock = reader(LockControlStatusSchema.pick({ state: true }), (status) => {
101577
101601
  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;
101578
101602
  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;
@@ -101588,7 +101612,7 @@ async function buildLockMechanism(bctx) {
101588
101612
  const { ctx, accessory, proxy, numericDeviceId, displayName } = bctx;
101589
101613
  const log = ctx.logger.withTags({ deviceId: numericDeviceId });
101590
101614
  const label = hapServiceName([displayName], `Lock ${numericDeviceId}`);
101591
- const service = accessory.addService(import_dist.Service.LockMechanism, label, SUBTYPE);
101615
+ const service = accessory.addService(import_dist.Service.LockMechanism, label, SUBTYPE$1);
101592
101616
  applyServiceLabel(service, label);
101593
101617
  const apply = (status, source) => {
101594
101618
  const updates = readLock(status);
@@ -101602,7 +101626,7 @@ async function buildLockMechanism(bctx) {
101602
101626
  const status = await proxy.lockControl?.getStatus({});
101603
101627
  if (status !== void 0 && status !== null) apply(status, "getStatus");
101604
101628
  } catch (err) {
101605
- log.debug("export-hap: lock getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$3(err) } });
101629
+ log.debug("export-hap: lock getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$4(err) } });
101606
101630
  }
101607
101631
  service.getCharacteristic(import_dist.Characteristic.LockTargetState).onSet(async (value) => {
101608
101632
  const secure = value === import_dist.Characteristic.LockTargetState.SECURED;
@@ -101612,7 +101636,7 @@ async function buildLockMechanism(bctx) {
101612
101636
  } catch (err) {
101613
101637
  log.warn("export-hap: lock command failed", { meta: {
101614
101638
  secure,
101615
- error: errMsg$3(err)
101639
+ error: errMsg$4(err)
101616
101640
  } });
101617
101641
  }
101618
101642
  });
@@ -101626,6 +101650,296 @@ async function buildLockMechanism(bctx) {
101626
101650
  } catch {}
101627
101651
  } };
101628
101652
  }
101653
+ function errMsg$4(err) {
101654
+ return err instanceof Error ? err.message : String(err);
101655
+ }
101656
+ //#endregion
101657
+ //#region src/mappers/builders/generic/security-state.ts
101658
+ /** Is this a settled arm state worth remembering? */
101659
+ function armedMemoOf(state) {
101660
+ return state === "armed_home" || state === "armed_away" || state === "armed_night" || state === "armed_vacation" || state === "armed_custom_bypass" ? state : null;
101661
+ }
101662
+ function currentForArmed(state) {
101663
+ switch (state) {
101664
+ case "armed_home":
101665
+ case "armed_custom_bypass": return import_dist.Characteristic.SecuritySystemCurrentState.STAY_ARM;
101666
+ case "armed_night": return import_dist.Characteristic.SecuritySystemCurrentState.NIGHT_ARM;
101667
+ default: return import_dist.Characteristic.SecuritySystemCurrentState.AWAY_ARM;
101668
+ }
101669
+ }
101670
+ function targetForArmed(state) {
101671
+ switch (state) {
101672
+ case "armed_home":
101673
+ case "armed_custom_bypass": return import_dist.Characteristic.SecuritySystemTargetState.STAY_ARM;
101674
+ case "armed_night": return import_dist.Characteristic.SecuritySystemTargetState.NIGHT_ARM;
101675
+ default: return import_dist.Characteristic.SecuritySystemTargetState.AWAY_ARM;
101676
+ }
101677
+ }
101678
+ function securityStateFor(state, memo) {
101679
+ const settled = armedMemoOf(state);
101680
+ if (settled !== null) return {
101681
+ current: currentForArmed(settled),
101682
+ target: targetForArmed(settled)
101683
+ };
101684
+ switch (state) {
101685
+ case "disarmed": return {
101686
+ current: import_dist.Characteristic.SecuritySystemCurrentState.DISARMED,
101687
+ target: import_dist.Characteristic.SecuritySystemTargetState.DISARM
101688
+ };
101689
+ case "arming": return {
101690
+ current: import_dist.Characteristic.SecuritySystemCurrentState.DISARMED,
101691
+ target: memo === null ? null : targetForArmed(memo)
101692
+ };
101693
+ case "disarming": return {
101694
+ current: memo === null ? import_dist.Characteristic.SecuritySystemCurrentState.DISARMED : currentForArmed(memo),
101695
+ target: import_dist.Characteristic.SecuritySystemTargetState.DISARM
101696
+ };
101697
+ case "pending": return {
101698
+ current: memo === null ? import_dist.Characteristic.SecuritySystemCurrentState.DISARMED : currentForArmed(memo),
101699
+ target: memo === null ? null : targetForArmed(memo)
101700
+ };
101701
+ default: return {
101702
+ current: import_dist.Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED,
101703
+ target: memo === null ? null : targetForArmed(memo)
101704
+ };
101705
+ }
101706
+ }
101707
+ /**
101708
+ * The arm mode behind a HomeKit target, or `null` for DISARM and for anything
101709
+ * outside the four values HomeKit defines.
101710
+ *
101711
+ * `null` is not an error the caller can ignore: DISARM is a different COMMAND,
101712
+ * and a value HomeKit never sends is a write this builder refuses to translate.
101713
+ */
101714
+ function alarmArmModeFor(target) {
101715
+ switch (target) {
101716
+ case import_dist.Characteristic.SecuritySystemTargetState.STAY_ARM: return "home";
101717
+ case import_dist.Characteristic.SecuritySystemTargetState.AWAY_ARM: return "away";
101718
+ case import_dist.Characteristic.SecuritySystemTargetState.NIGHT_ARM: return "night";
101719
+ default: return null;
101720
+ }
101721
+ }
101722
+ //#endregion
101723
+ //#region src/mappers/builders/generic/security-target.ts
101724
+ /**
101725
+ * The panel modes behind each HomeKit target, PRIMARY first.
101726
+ *
101727
+ * The primary is the mode `alarmArmModeFor` names; the secondary is the other
101728
+ * mode `security-state.ts` reports through the same HomeKit value, so the two
101729
+ * modules agree in both directions by construction.
101730
+ */
101731
+ var MODES_BY_TARGET = new Map([
101732
+ [import_dist.Characteristic.SecuritySystemTargetState.STAY_ARM, ["home", "custom_bypass"]],
101733
+ [import_dist.Characteristic.SecuritySystemTargetState.AWAY_ARM, ["away", "vacation"]],
101734
+ [import_dist.Characteristic.SecuritySystemTargetState.NIGHT_ARM, ["night"]]
101735
+ ]);
101736
+ /** Arm targets in the order HomeKit numbers them; DISARM is appended last. */
101737
+ var ARM_TARGETS = [
101738
+ import_dist.Characteristic.SecuritySystemTargetState.STAY_ARM,
101739
+ import_dist.Characteristic.SecuritySystemTargetState.AWAY_ARM,
101740
+ import_dist.Characteristic.SecuritySystemTargetState.NIGHT_ARM
101741
+ ];
101742
+ /**
101743
+ * The `validValues` for `SecuritySystemTargetState`, or `null` to leave
101744
+ * HomeKit's own four values in place.
101745
+ *
101746
+ * DISARM is always present: disarming is not one of the panel's arm modes and
101747
+ * a panel that cannot be disarmed is not a thing this cap can express.
101748
+ */
101749
+ function targetValidValuesFor(availableModes) {
101750
+ if (availableModes.length === 0) return null;
101751
+ return [...ARM_TARGETS.filter((target) => (MODES_BY_TARGET.get(target) ?? []).some((mode) => availableModes.includes(mode))), import_dist.Characteristic.SecuritySystemTargetState.DISARM];
101752
+ }
101753
+ /**
101754
+ * The arm mode to send for a HomeKit target, or `null` when there is none.
101755
+ *
101756
+ * `null` is not a shrug the caller may swallow: DISARM is a different command,
101757
+ * and an arm target the panel accepts no mode for is a write this module
101758
+ * refuses to translate rather than guess at.
101759
+ */
101760
+ function armModeForTarget(target, availableModes) {
101761
+ const primary = alarmArmModeFor(target);
101762
+ if (primary === null) return null;
101763
+ if (availableModes.length === 0) return primary;
101764
+ return (MODES_BY_TARGET.get(target) ?? [primary]).find((mode) => availableModes.includes(mode)) ?? null;
101765
+ }
101766
+ //#endregion
101767
+ //#region src/mappers/builders/generic/security-system.ts
101768
+ /**
101769
+ * `alarm-panel` → `Service.SecuritySystem`.
101770
+ *
101771
+ * The lock builder's shape (a current/target pair, a hydrate, an `onSet`, a
101772
+ * slice subscription, a dispose) applied to the one device on the fleet where
101773
+ * reporting a state that is not true has a consequence worse than a stalled
101774
+ * motor. The mapping itself is NOT here: `security-state.ts` owns what the
101775
+ * panel's state looks like to HomeKit and `security-target.ts` owns what
101776
+ * HomeKit may ask for, both pure and both tested on their own. This file is
101777
+ * the service around them.
101778
+ *
101779
+ * ## The memo
101780
+ *
101781
+ * `pending`, `disarming` and `triggered` do not carry the mode the panel was
101782
+ * armed to — only the last settled state knows it. This builder is the caller
101783
+ * `security-state.ts` describes: it remembers the last settled arm and forgets
101784
+ * it on `disarmed`, because a memo that outlives a disarm makes the next
101785
+ * `arming` claim a target nobody asked for.
101786
+ *
101787
+ * The memo is deliberately NOT seeded from the controller's own write. HomeKit
101788
+ * already holds the target the operator just set; not writing it back is
101789
+ * exactly right. The cost is a panel armed from its own keypad during an exit
101790
+ * delay, where the target stays at whatever HomeKit last knew — a stale target
101791
+ * for the length of the delay, against inventing an intent, and the invention
101792
+ * is worse.
101793
+ *
101794
+ * ## `requiresCode`: the arm is REFUSED, not attempted
101795
+ *
101796
+ * HomeKit's SecuritySystem has no PIN prompt — there is no characteristic for
101797
+ * it and no way to ask the operator mid-write. So a panel that requires a code
101798
+ * cannot be armed or disarmed from the Home app, and this builder says so
101799
+ * twice: the write fails with `INSUFFICIENT_AUTHORIZATION` (iOS renders the
101800
+ * tile's failure) and a WARN names the device, the command and the mode.
101801
+ *
101802
+ * Sending the command code-less and letting the panel reject it was the
101803
+ * alternative. It is worse: the refusal costs a round trip, it is
101804
+ * indistinguishable from a broken panel in the log, and repeated code-less
101805
+ * attempts are what locks a real alarm panel out.
101806
+ */
101807
+ var SUBTYPE = "alarm-panel";
101808
+ /** The subset of the status this builder reads. */
101809
+ var PanelReadSchema = AlarmPanelStatusSchema.pick({
101810
+ state: true,
101811
+ availableModes: true,
101812
+ requiresCode: true
101813
+ });
101814
+ /**
101815
+ * Turn a panel status into characteristic writes, folding the memo.
101816
+ *
101817
+ * A payload that does not match the cap's own schema yields NO updates and
101818
+ * leaves the memo alone — it is a status we could not read, not a panel that
101819
+ * changed. The caller logs the drop; a frozen characteristic is otherwise
101820
+ * indistinguishable from a quiet panel.
101821
+ */
101822
+ function securityUpdatesFor(status, memo) {
101823
+ const parsed = PanelReadSchema.safeParse(status);
101824
+ if (!parsed.success) return {
101825
+ updates: [],
101826
+ memo,
101827
+ panel: null
101828
+ };
101829
+ const nextMemo = parsed.data.state === "disarmed" ? null : armedMemoOf(parsed.data.state) ?? memo;
101830
+ const { current, target } = securityStateFor(parsed.data.state, nextMemo);
101831
+ return {
101832
+ updates: [{
101833
+ characteristic: import_dist.Characteristic.SecuritySystemCurrentState,
101834
+ value: current
101835
+ }, ...target === null ? [] : [{
101836
+ characteristic: import_dist.Characteristic.SecuritySystemTargetState,
101837
+ value: target
101838
+ }]],
101839
+ memo: nextMemo,
101840
+ panel: {
101841
+ availableModes: parsed.data.availableModes,
101842
+ requiresCode: parsed.data.requiresCode
101843
+ }
101844
+ };
101845
+ }
101846
+ async function buildSecuritySystem(bctx) {
101847
+ const { ctx, accessory, proxy, numericDeviceId, displayName } = bctx;
101848
+ const log = ctx.logger.withTags({ deviceId: numericDeviceId });
101849
+ const label = hapServiceName([displayName], `Alarm ${numericDeviceId}`);
101850
+ const service = accessory.addService(import_dist.Service.SecuritySystem, label, SUBTYPE);
101851
+ applyServiceLabel(service, label);
101852
+ let memo = null;
101853
+ let availableModes = [];
101854
+ let requiresCode = false;
101855
+ /** Only log the `validValues` narrowing when it actually changes. */
101856
+ let lastValidValues = "";
101857
+ const applyValidValues = () => {
101858
+ const validValues = targetValidValuesFor(availableModes);
101859
+ if (validValues === null) {
101860
+ if (lastValidValues !== "unconstrained") {
101861
+ lastValidValues = "unconstrained";
101862
+ log.info("export-hap: alarm panel named no arm modes — leaving HomeKit’s targets unconstrained", { meta: { subtype: SUBTYPE } });
101863
+ }
101864
+ return;
101865
+ }
101866
+ const key = validValues.join(",");
101867
+ if (key === lastValidValues) return;
101868
+ lastValidValues = key;
101869
+ service.getCharacteristic(import_dist.Characteristic.SecuritySystemTargetState).setProps({ validValues: [...validValues] });
101870
+ log.info("export-hap: alarm panel target constrained to the modes it accepts", { meta: {
101871
+ subtype: SUBTYPE,
101872
+ availableModes: [...availableModes],
101873
+ validValues
101874
+ } });
101875
+ };
101876
+ const apply = (status, source) => {
101877
+ const next = securityUpdatesFor(status, memo);
101878
+ if (next.updates.length === 0) {
101879
+ log.debug("export-hap: alarm panel status did not match the cap schema — no update", { meta: {
101880
+ subtype: SUBTYPE,
101881
+ source
101882
+ } });
101883
+ return;
101884
+ }
101885
+ memo = next.memo;
101886
+ if (next.panel !== null) {
101887
+ availableModes = next.panel.availableModes;
101888
+ requiresCode = next.panel.requiresCode;
101889
+ applyValidValues();
101890
+ }
101891
+ applyUpdates(service, next.updates);
101892
+ };
101893
+ try {
101894
+ const status = await proxy.alarmPanel?.getStatus({});
101895
+ if (status !== void 0 && status !== null) apply(status, "getStatus");
101896
+ } catch (err) {
101897
+ log.debug("export-hap: alarm panel getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$3(err) } });
101898
+ }
101899
+ service.getCharacteristic(import_dist.Characteristic.SecuritySystemTargetState).onSet(async (value) => {
101900
+ const target = typeof value === "number" ? value : Number(value);
101901
+ const disarm = target === import_dist.Characteristic.SecuritySystemTargetState.DISARM;
101902
+ const mode = disarm ? null : armModeForTarget(target, availableModes);
101903
+ if (requiresCode) {
101904
+ log.warn("export-hap: alarm panel requires a PIN — HomeKit cannot supply one, command REFUSED", { meta: {
101905
+ subtype: SUBTYPE,
101906
+ command: disarm ? "disarm" : "arm",
101907
+ mode,
101908
+ target
101909
+ } });
101910
+ throw new import_dist.HapStatusError(import_dist.HAPStatus.INSUFFICIENT_AUTHORIZATION);
101911
+ }
101912
+ if (!disarm && mode === null) {
101913
+ log.warn("export-hap: alarm panel cannot honour this HomeKit arm target — REFUSED", { meta: {
101914
+ subtype: SUBTYPE,
101915
+ target,
101916
+ availableModes: [...availableModes]
101917
+ } });
101918
+ throw new import_dist.HapStatusError(import_dist.HAPStatus.INVALID_VALUE_IN_REQUEST);
101919
+ }
101920
+ try {
101921
+ if (mode === null) await proxy.alarmPanel?.disarm({});
101922
+ else await proxy.alarmPanel?.arm({ mode });
101923
+ } catch (err) {
101924
+ log.warn("export-hap: alarm panel command failed", { meta: {
101925
+ subtype: SUBTYPE,
101926
+ command: mode === null ? "disarm" : "arm",
101927
+ mode,
101928
+ error: errMsg$3(err)
101929
+ } });
101930
+ throw new import_dist.HapStatusError(import_dist.HAPStatus.SERVICE_COMMUNICATION_FAILURE);
101931
+ }
101932
+ });
101933
+ const unsubscribe = proxy.state.alarmPanel?.subscribe((value) => {
101934
+ if (value === void 0 || value === null) return;
101935
+ apply(value, "slice");
101936
+ }) ?? null;
101937
+ return { async dispose() {
101938
+ try {
101939
+ unsubscribe?.();
101940
+ } catch {}
101941
+ } };
101942
+ }
101629
101943
  function errMsg$3(err) {
101630
101944
  return err instanceof Error ? err.message : String(err);
101631
101945
  }
@@ -101700,11 +102014,16 @@ function errMsg$2(err) {
101700
102014
  *
101701
102015
  * ## Tier
101702
102016
  *
101703
- * Tier A only: the caps whose HomeKit service exists today and needs no
101704
- * feature-dependent shape (`cover` needs `cover-positionable`, `climate-control`
101705
- * needs the dual-setpoint split, `alarm-panel` must survive a refused `arm`).
101706
- * Those are a separate task; adding a row here must never mean adding a service
101707
- * whose semantics this file cannot fully honour.
102017
+ * Tier A, plus `alarm-panel`: the caps whose HomeKit service exists today and
102018
+ * needs no feature-dependent shape. `cover` still needs `cover-positionable`
102019
+ * and `climate-control` the dual-setpoint split; those are a separate task,
102020
+ * and adding a row here must never mean adding a service whose semantics this
102021
+ * file cannot fully honour.
102022
+ *
102023
+ * `alarm-panel` earned its row by answering the two questions that kept it
102024
+ * out: a target the panel would refuse is never offered (`availableModes` →
102025
+ * `validValues`, `security-target.ts`) and an arm a PIN-gated panel cannot
102026
+ * accept is refused out loud rather than attempted (`security-system.ts`).
101708
102027
  */
101709
102028
  /** HomeKit's floor for `CurrentAmbientLightLevel`; 0 lux is out of range. */
101710
102029
  var MIN_LUX = 1e-4;
@@ -101846,6 +102165,14 @@ var HAP_CAP_SERVICES = [
101846
102165
  displayName: name
101847
102166
  })
101848
102167
  },
102168
+ {
102169
+ caps: ["alarm-panel"],
102170
+ label: "Alarm",
102171
+ build: ({ bctx, name }) => buildSecuritySystem({
102172
+ ...bctx,
102173
+ displayName: name
102174
+ })
102175
+ },
101849
102176
  {
101850
102177
  caps: ["battery"],
101851
102178
  label: BATTERY_SPEC.label,
@@ -101883,7 +102210,8 @@ var ACCESSORY_CATEGORY_BY_TYPE = {
101883
102210
  [DeviceType.Siren]: import_dist.Categories.SWITCH,
101884
102211
  [DeviceType.Lock]: import_dist.Categories.DOOR_LOCK,
101885
102212
  [DeviceType.Sensor]: import_dist.Categories.SENSOR,
101886
- [DeviceType.Presence]: import_dist.Categories.SENSOR
102213
+ [DeviceType.Presence]: import_dist.Categories.SENSOR,
102214
+ [DeviceType.AlarmPanel]: import_dist.Categories.SECURITY_SYSTEM
101887
102215
  };
101888
102216
  function accessoryCategoryFor(deviceType) {
101889
102217
  return ACCESSORY_CATEGORY_BY_TYPE[deviceType] ?? import_dist.Categories.OTHER;