@camstack/addon-export-hap 1.2.111 → 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.
- package/dist/hap-export.addon.js +540 -75
- package/dist/hap-export.addon.mjs +540 -75
- package/package.json +1 -1
|
@@ -5419,7 +5419,7 @@ var ZodIssueCode = {
|
|
|
5419
5419
|
var ZodFirstPartyTypeKind;
|
|
5420
5420
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5421
5421
|
//#endregion
|
|
5422
|
-
//#region ../types/dist/sleep-
|
|
5422
|
+
//#region ../types/dist/sleep-DBKu2-U5.mjs
|
|
5423
5423
|
/**
|
|
5424
5424
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5425
5425
|
* window to float samples (D455).
|
|
@@ -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-
|
|
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$
|
|
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
|
|
@@ -20551,13 +20568,109 @@ var SummariesQueryInput = object({
|
|
|
20551
20568
|
deviceIds: array(number()).min(1),
|
|
20552
20569
|
since: number().optional(),
|
|
20553
20570
|
until: number().optional(),
|
|
20554
|
-
limit: number().int().min(1).max(200).default(50)
|
|
20571
|
+
limit: number().int().min(1).max(200).default(50),
|
|
20572
|
+
/** The same member-wise filter {@link listRecentSummaries} takes — one
|
|
20573
|
+
* meaning of "dog" on every summary surface. */
|
|
20574
|
+
classes: array(string().min(1).max(60)).max(40).optional()
|
|
20555
20575
|
});
|
|
20556
|
-
var SummariesPageSchema = object({ summaries: array(SummarySchema).readonly() });
|
|
20557
20576
|
var SummaryDetailSchema = object({
|
|
20558
20577
|
summary: SummarySchema,
|
|
20559
|
-
/**
|
|
20560
|
-
|
|
20578
|
+
/** Members in absorption order, oldest join first. */
|
|
20579
|
+
members: array(object({
|
|
20580
|
+
trackId: string(),
|
|
20581
|
+
/**
|
|
20582
|
+
* The track's class at the time it JOINED, or `null` when it was unresolved
|
|
20583
|
+
* and the track no longer exists to fill it.
|
|
20584
|
+
*
|
|
20585
|
+
* The join, not the latest opinion: class voting can re-decide a track's
|
|
20586
|
+
* class afterwards, and a group's composition is the history of who came
|
|
20587
|
+
* together. A consumer counts these to badge a thumbnail — "two people and a
|
|
20588
|
+
* dog" — rather than being handed a second, denormalised tally that would
|
|
20589
|
+
* drift from the members it claims to describe.
|
|
20590
|
+
*/
|
|
20591
|
+
className: string().nullable(),
|
|
20592
|
+
/** `primary` is the one member that carries the group's identity. */
|
|
20593
|
+
role: _enum([
|
|
20594
|
+
"primary",
|
|
20595
|
+
"sibling",
|
|
20596
|
+
"child"
|
|
20597
|
+
]).nullable(),
|
|
20598
|
+
joinedAt: number(),
|
|
20599
|
+
/** Tier 1 — the sub-class (`dog`, `van`), resolved from the member's track
|
|
20600
|
+
* at read time. Absent when nothing resolved, never an empty string. */
|
|
20601
|
+
label: string().optional(),
|
|
20602
|
+
/** Tier 2 — the instance: a person's name, a plate. Absent when the pipeline
|
|
20603
|
+
* recognised nobody, and absent for a member whose track has been pruned —
|
|
20604
|
+
* a thumbnail that names the wrong person is worse than one naming nobody. */
|
|
20605
|
+
subLabel: string().optional()
|
|
20606
|
+
})).readonly()
|
|
20607
|
+
});
|
|
20608
|
+
/**
|
|
20609
|
+
* What a LIST of groups carries: the envelope plus what it is MADE OF.
|
|
20610
|
+
*
|
|
20611
|
+
* Coarse on purpose — the operator's rule is "only the rough data on the list,
|
|
20612
|
+
* we extend when we notice we need more". Enough to draw the card ("two people
|
|
20613
|
+
* and a dog") and no more. The MEMBERS, their names and the per-member links
|
|
20614
|
+
* are on {@link getSummary}: shipping every member of every group so a client
|
|
20615
|
+
* can count them turns a page of two hundred groups into a thousand records to
|
|
20616
|
+
* draw two hundred badges.
|
|
20617
|
+
*/
|
|
20618
|
+
var SummaryListItemSchema = object({
|
|
20619
|
+
summary: SummarySchema,
|
|
20620
|
+
/** Class counts, most numerous first; `className: null` is a member whose
|
|
20621
|
+
* class never resolved, counted so the counts add up to `memberCount`. */
|
|
20622
|
+
classes: array(object({
|
|
20623
|
+
className: string().nullable(),
|
|
20624
|
+
count: number().int().positive()
|
|
20625
|
+
})).readonly()
|
|
20626
|
+
});
|
|
20627
|
+
var SummariesPageSchema = object({ summaries: array(SummaryListItemSchema).readonly() });
|
|
20628
|
+
/**
|
|
20629
|
+
* The paged feed, deliberately the SAME shape as {@link RecentTracksQueryInput}.
|
|
20630
|
+
*
|
|
20631
|
+
* The reel on the cameras page and the Events gallery both ride a cursor, so a
|
|
20632
|
+
* summaries feed that could only answer "the last N for these cameras"
|
|
20633
|
+
* (`listSummaries`) would make groups available in the timeline and nowhere
|
|
20634
|
+
* else. Two feeds with different ordering contracts would be two ideas of what
|
|
20635
|
+
* "newest" means, on one screen.
|
|
20636
|
+
*/
|
|
20637
|
+
var RecentSummariesQueryInput = object({
|
|
20638
|
+
/** Devices to merge. An empty array yields an empty page. */
|
|
20639
|
+
deviceIds: array(number()),
|
|
20640
|
+
/** Window lower bound on `lastActiveAt` (inclusive). */
|
|
20641
|
+
since: number().optional(),
|
|
20642
|
+
/** Window upper bound on `lastActiveAt` (inclusive). */
|
|
20643
|
+
until: number().optional(),
|
|
20644
|
+
limit: number().int().min(1).max(500).default(100),
|
|
20645
|
+
/** Opaque continuation cursor from a previous page's `nextCursor`. */
|
|
20646
|
+
cursor: string().optional(),
|
|
20647
|
+
/**
|
|
20648
|
+
* Restrict to these classes — THE SAME FIELD `listRecentTracks` takes, and
|
|
20649
|
+
* deliberately the same name: the events filter tree emits one list of ticked
|
|
20650
|
+
* taxonomy nodes, and a summaries feed that called it something else would
|
|
20651
|
+
* make the operator's one filter component produce two shapes.
|
|
20652
|
+
*
|
|
20653
|
+
* A question about the MEMBERS: a group matches when ANY of them does. "Show
|
|
20654
|
+
* me the arrivals with a dog" has to return the group of four people who had
|
|
20655
|
+
* one with them; a filter on the group's own fields could only ever answer
|
|
20656
|
+
* about its primary.
|
|
20657
|
+
*
|
|
20658
|
+
* Matched against all THREE tiers of a member — the class (`animal`), the
|
|
20659
|
+
* sub-class (`dog`) and the instance (a name, a plate) — because which tier a
|
|
20660
|
+
* ticked node lives on is the taxonomy's business, not the caller's. `dog` is
|
|
20661
|
+
* an event kind in the tree and a tier-1 label on an `animal` track; a filter
|
|
20662
|
+
* that read only the class would answer "animal" and never "dog".
|
|
20663
|
+
*
|
|
20664
|
+
* ABSENT or EMPTY means no filter — absent is not a selection of none.
|
|
20665
|
+
*/
|
|
20666
|
+
classes: array(string().min(1).max(60)).max(40).optional()
|
|
20667
|
+
});
|
|
20668
|
+
var RecentSummariesPageSchema = object({
|
|
20669
|
+
/** Ordered by (`lastActiveAt` DESC, id DESC). Same light item as
|
|
20670
|
+
* {@link listSummaries} — one list shape, so a card renders the same
|
|
20671
|
+
* whichever feed drew it. */
|
|
20672
|
+
summaries: array(SummaryListItemSchema).readonly(),
|
|
20673
|
+
nextCursor: string().nullable()
|
|
20561
20674
|
});
|
|
20562
20675
|
var RecentTracksPageSchema = object({
|
|
20563
20676
|
/** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
|
|
@@ -20971,7 +21084,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
20971
21084
|
classes: array(string()).optional(),
|
|
20972
21085
|
/** See {@link ExcludeSourcesDoc}. */
|
|
20973
21086
|
excludeSources: array(TrackSourceSchema).optional()
|
|
20974
|
-
}), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(SummariesQueryInput, SummariesPageSchema), method(object({ id: string() }), SummaryDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
|
|
21087
|
+
}), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(SummariesQueryInput, SummariesPageSchema), method(RecentSummariesQueryInput, RecentSummariesPageSchema), method(object({ id: string() }), SummaryDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
|
|
20975
21088
|
kind: "mutation",
|
|
20976
21089
|
auth: "admin"
|
|
20977
21090
|
}), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({ deviceIds: array(number()).min(1).max(200) }), array(EventKindsForDeviceSchema).readonly()), method(object({
|
|
@@ -30622,7 +30735,29 @@ var LoggingSettingsPatchSchema = object({
|
|
|
30622
30735
|
* disarmed the channels it did not mention would make the Levels page and
|
|
30623
30736
|
* the Diagnostics page fight over the same value.
|
|
30624
30737
|
*/
|
|
30625
|
-
channels: array(LogChannelWindowPatchSchema).readonly().optional()
|
|
30738
|
+
channels: array(LogChannelWindowPatchSchema).readonly().optional(),
|
|
30739
|
+
/**
|
|
30740
|
+
* How many days the analytics OPS LOG is kept — the audit trail of what
|
|
30741
|
+
* retention actually deleted.
|
|
30742
|
+
*
|
|
30743
|
+
* It lives HERE, on the logging document, and not on the analytics addon's
|
|
30744
|
+
* settings form, on the operator's instruction: every other log-ish window in
|
|
30745
|
+
* this system is configured through this one document, and a retention audit
|
|
30746
|
+
* configured somewhere else is a second place to look when the question is
|
|
30747
|
+
* "what happened to my data".
|
|
30748
|
+
*
|
|
30749
|
+
* That placement has a cost worth stating: this document ships in the
|
|
30750
|
+
* framework closure, so this knob needs a published `@camstack/server` while
|
|
30751
|
+
* the four windows beside it (D485) reach a node on `camstack deploy`.
|
|
30752
|
+
*
|
|
30753
|
+
* `retention-model.ts` argued this one must NOT follow a device window,
|
|
30754
|
+
* because the audit trail is the history of the SWEEP and not of the camera.
|
|
30755
|
+
* That argument stands and is untouched — what changes is that 30 days stops
|
|
30756
|
+
* being a constant nobody can reach. `0` keeps it forever. The floor is 1 day
|
|
30757
|
+
* rather than 0-as-delete: an audit log truncated to nothing is precisely the
|
|
30758
|
+
* state in which the next 9.5 GiB leak cannot be explained.
|
|
30759
|
+
*/
|
|
30760
|
+
opsLogRetentionDays: number().int().min(0).max(3650).optional()
|
|
30626
30761
|
});
|
|
30627
30762
|
/**
|
|
30628
30763
|
* Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
|
|
@@ -30695,6 +30830,14 @@ var LoggingSettingsStateSchema = object({
|
|
|
30695
30830
|
channels: array(LogChannelDescriptorSchema).readonly(),
|
|
30696
30831
|
/** The channels ARMED right now, each with its deadline. */
|
|
30697
30832
|
activeChannels: array(LogChannelWindowStateSchema).readonly(),
|
|
30833
|
+
/**
|
|
30834
|
+
* The ops-log window in days, as it is in force. `0` = kept forever.
|
|
30835
|
+
*
|
|
30836
|
+
* Reported rather than left to the caller's memory of what it wrote: this is
|
|
30837
|
+
* the value the analytics sweep will actually use, and an operator asking how
|
|
30838
|
+
* long their audit trail lives should not have to infer it from a default.
|
|
30839
|
+
*/
|
|
30840
|
+
opsLogRetentionDays: number().int().min(0),
|
|
30698
30841
|
persisted: boolean()
|
|
30699
30842
|
});
|
|
30700
30843
|
method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), method(_void(), FeatureManifestSchema), method(_void(), array(NetworkAddressSchema).readonly()), method(_void(), unknown().nullable(), { auth: "admin" }), method(record(string(), unknown()), _null(), {
|
|
@@ -34870,6 +35013,12 @@ Object.freeze({
|
|
|
34870
35013
|
addonId: null,
|
|
34871
35014
|
access: "view"
|
|
34872
35015
|
},
|
|
35016
|
+
"pipelineAnalytics.listRecentSummaries": {
|
|
35017
|
+
capName: "pipeline-analytics",
|
|
35018
|
+
capScope: "device",
|
|
35019
|
+
addonId: null,
|
|
35020
|
+
access: "view"
|
|
35021
|
+
},
|
|
34873
35022
|
"pipelineAnalytics.listRecentTracks": {
|
|
34874
35023
|
capName: "pipeline-analytics",
|
|
34875
35024
|
capScope: "device",
|
|
@@ -38697,6 +38846,11 @@ Object.freeze({
|
|
|
38697
38846
|
form: "single",
|
|
38698
38847
|
optional: true
|
|
38699
38848
|
}],
|
|
38849
|
+
"pipelineAnalytics.listRecentSummaries": [{
|
|
38850
|
+
name: "deviceIds",
|
|
38851
|
+
form: "array",
|
|
38852
|
+
optional: false
|
|
38853
|
+
}],
|
|
38700
38854
|
"pipelineAnalytics.listRecentTracks": [{
|
|
38701
38855
|
name: "deviceIds",
|
|
38702
38856
|
form: "array",
|
|
@@ -40071,7 +40225,7 @@ var Fmp4FragmentChild = class {
|
|
|
40071
40225
|
meta: {
|
|
40072
40226
|
sourceId: this.args.sourceId,
|
|
40073
40227
|
decodeHwAccel: requested,
|
|
40074
|
-
error: errMsg$
|
|
40228
|
+
error: errMsg$16(err)
|
|
40075
40229
|
}
|
|
40076
40230
|
});
|
|
40077
40231
|
this.killChild();
|
|
@@ -40250,7 +40404,7 @@ var Fmp4FragmentChild = class {
|
|
|
40250
40404
|
tags: { deviceId: this.args.deviceId },
|
|
40251
40405
|
meta: {
|
|
40252
40406
|
sourceId: this.args.sourceId,
|
|
40253
|
-
error: errMsg$
|
|
40407
|
+
error: errMsg$16(err)
|
|
40254
40408
|
}
|
|
40255
40409
|
});
|
|
40256
40410
|
}
|
|
@@ -86906,7 +87060,7 @@ function clearPairingFiles(accessoryUuid, logger) {
|
|
|
86906
87060
|
}
|
|
86907
87061
|
//#endregion
|
|
86908
87062
|
//#region src/hap-setup-uri.ts
|
|
86909
|
-
function errMsg$
|
|
87063
|
+
function errMsg$15(e) {
|
|
86910
87064
|
return e instanceof Error ? e.message : String(e);
|
|
86911
87065
|
}
|
|
86912
87066
|
/**
|
|
@@ -86933,7 +87087,7 @@ function firstExposedAccessorySetupUri(exposed, logger) {
|
|
|
86933
87087
|
try {
|
|
86934
87088
|
return first.setupURI();
|
|
86935
87089
|
} catch (err) {
|
|
86936
|
-
logger.debug("export-hap: setupURI failed on first exposed accessory", { meta: { error: errMsg$
|
|
87090
|
+
logger.debug("export-hap: setupURI failed on first exposed accessory", { meta: { error: errMsg$15(err) } });
|
|
86937
87091
|
return;
|
|
86938
87092
|
}
|
|
86939
87093
|
}
|
|
@@ -87286,7 +87440,7 @@ async function buildBattery(bctx) {
|
|
|
87286
87440
|
const status = await proxy.battery?.getStatus({});
|
|
87287
87441
|
if (status !== void 0 && status !== null) applyToService(service, status);
|
|
87288
87442
|
} catch (err) {
|
|
87289
|
-
log.debug("export-hap: battery getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$
|
|
87443
|
+
log.debug("export-hap: battery getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$14(err) } });
|
|
87290
87444
|
}
|
|
87291
87445
|
const unsubscribes = [];
|
|
87292
87446
|
if (proxy.state.battery) {
|
|
@@ -87305,7 +87459,7 @@ async function buildBattery(bctx) {
|
|
|
87305
87459
|
function applyToService(service, status) {
|
|
87306
87460
|
applyUpdates(service, batteryCharacteristicUpdates(status));
|
|
87307
87461
|
}
|
|
87308
|
-
function errMsg$
|
|
87462
|
+
function errMsg$14(err) {
|
|
87309
87463
|
return err instanceof Error ? err.message : String(err);
|
|
87310
87464
|
}
|
|
87311
87465
|
//#endregion
|
|
@@ -98057,7 +98211,7 @@ var VIDEO_LOOPBACK_RCVBUF_BYTES = 8 * 1024 * 1024;
|
|
|
98057
98211
|
* not burst size.
|
|
98058
98212
|
*/
|
|
98059
98213
|
var AUDIO_LOOPBACK_RCVBUF_BYTES = 1024 * 1024;
|
|
98060
|
-
function errMsg$
|
|
98214
|
+
function errMsg$13(err) {
|
|
98061
98215
|
return err instanceof Error ? err.message : String(err);
|
|
98062
98216
|
}
|
|
98063
98217
|
/**
|
|
@@ -98072,13 +98226,13 @@ function applyReceiveBuffer(socket, requestedBytes) {
|
|
|
98072
98226
|
try {
|
|
98073
98227
|
socket.setRecvBufferSize(requestedBytes);
|
|
98074
98228
|
} catch (err) {
|
|
98075
|
-
error = errMsg$
|
|
98229
|
+
error = errMsg$13(err);
|
|
98076
98230
|
}
|
|
98077
98231
|
let effectiveBytes = null;
|
|
98078
98232
|
try {
|
|
98079
98233
|
effectiveBytes = socket.getRecvBufferSize();
|
|
98080
98234
|
} catch (err) {
|
|
98081
|
-
if (error === null) error = errMsg$
|
|
98235
|
+
if (error === null) error = errMsg$13(err);
|
|
98082
98236
|
}
|
|
98083
98237
|
return {
|
|
98084
98238
|
requestedBytes,
|
|
@@ -98338,20 +98492,20 @@ function buildCameraStreamingDelegate(bctx, advertised) {
|
|
|
98338
98492
|
delegate: {
|
|
98339
98493
|
handleSnapshotRequest(request, callback) {
|
|
98340
98494
|
handleSnapshot(bctx, request).then((buf) => callback(void 0, buf)).catch((err) => {
|
|
98341
|
-
log.warn("export-hap: snapshot failed", { meta: { error: errMsg$
|
|
98342
|
-
callback(err instanceof Error ? err : new Error(errMsg$
|
|
98495
|
+
log.warn("export-hap: snapshot failed", { meta: { error: errMsg$12(err) } });
|
|
98496
|
+
callback(err instanceof Error ? err : new Error(errMsg$12(err)));
|
|
98343
98497
|
});
|
|
98344
98498
|
},
|
|
98345
98499
|
prepareStream(request, callback) {
|
|
98346
98500
|
prepareStream(request, sessions, bctx).then((resp) => callback(void 0, resp)).catch((err) => {
|
|
98347
|
-
log.warn("export-hap: prepareStream failed", { meta: { error: errMsg$
|
|
98348
|
-
callback(err instanceof Error ? err : new Error(errMsg$
|
|
98501
|
+
log.warn("export-hap: prepareStream failed", { meta: { error: errMsg$12(err) } });
|
|
98502
|
+
callback(err instanceof Error ? err : new Error(errMsg$12(err)));
|
|
98349
98503
|
});
|
|
98350
98504
|
},
|
|
98351
98505
|
handleStreamRequest(request, callback) {
|
|
98352
98506
|
handleStreamRequest(request, sessions, bctx, advertised).then(() => callback()).catch((err) => {
|
|
98353
|
-
log.warn("export-hap: handleStreamRequest failed", { meta: { error: errMsg$
|
|
98354
|
-
callback(err instanceof Error ? err : new Error(errMsg$
|
|
98507
|
+
log.warn("export-hap: handleStreamRequest failed", { meta: { error: errMsg$12(err) } });
|
|
98508
|
+
callback(err instanceof Error ? err : new Error(errMsg$12(err)));
|
|
98355
98509
|
});
|
|
98356
98510
|
}
|
|
98357
98511
|
},
|
|
@@ -98467,7 +98621,7 @@ async function prepareStream(request, sessions, bctx) {
|
|
|
98467
98621
|
closeSocket(audioUdp);
|
|
98468
98622
|
closeSocket(videoLoopUdp);
|
|
98469
98623
|
closeSocket(audioLoopUdp);
|
|
98470
|
-
throw new Error(`export-hap: outbound SrtpSession init failed: ${errMsg$
|
|
98624
|
+
throw new Error(`export-hap: outbound SrtpSession init failed: ${errMsg$12(err)}`, { cause: err });
|
|
98471
98625
|
}
|
|
98472
98626
|
let upstreamAudioSrtp = null;
|
|
98473
98627
|
try {
|
|
@@ -98481,7 +98635,7 @@ async function prepareStream(request, sessions, bctx) {
|
|
|
98481
98635
|
profile: import_src.ProtectionProfileAes128CmHmacSha1_80
|
|
98482
98636
|
});
|
|
98483
98637
|
} catch (err) {
|
|
98484
|
-
bctx.ctx.logger.withTags({ deviceId: bctx.numericDeviceId }).warn("export-hap: SrtpSession init failed (upstream audio decrypt disabled)", { meta: { error: errMsg$
|
|
98638
|
+
bctx.ctx.logger.withTags({ deviceId: bctx.numericDeviceId }).warn("export-hap: SrtpSession init failed (upstream audio decrypt disabled)", { meta: { error: errMsg$12(err) } });
|
|
98485
98639
|
}
|
|
98486
98640
|
const videoSsrc = randomSsrc();
|
|
98487
98641
|
const audioSsrc = randomSsrc();
|
|
@@ -98598,7 +98752,7 @@ async function prepareStream(request, sessions, bctx) {
|
|
|
98598
98752
|
});
|
|
98599
98753
|
audioUdp.on("message", (packet, rinfo) => {
|
|
98600
98754
|
handleIncomingAudioRtp(session, packet, rinfo.address, bctx).catch((err) => {
|
|
98601
|
-
bctx.ctx.logger.withTags({ deviceId: bctx.numericDeviceId }).debug("export-hap: incoming-audio handler error (dropped)", { meta: { error: errMsg$
|
|
98755
|
+
bctx.ctx.logger.withTags({ deviceId: bctx.numericDeviceId }).debug("export-hap: incoming-audio handler error (dropped)", { meta: { error: errMsg$12(err) } });
|
|
98602
98756
|
});
|
|
98603
98757
|
});
|
|
98604
98758
|
logLoopbackBuffer(tagLog, request.sessionID, "video", videoLoop.buffer);
|
|
@@ -98794,7 +98948,7 @@ function readControllerRtcp(session, leg, packet, log) {
|
|
|
98794
98948
|
} catch (err) {
|
|
98795
98949
|
drop(session, "inbound-rtcp-decrypt-failed");
|
|
98796
98950
|
storeReceiverReports(session, leg, recordUnreadableRtcp(tally));
|
|
98797
|
-
logUnreadableRtcp(session, leg, `decrypt: ${errMsg$
|
|
98951
|
+
logUnreadableRtcp(session, leg, `decrypt: ${errMsg$12(err)}`, log);
|
|
98798
98952
|
return;
|
|
98799
98953
|
}
|
|
98800
98954
|
const outcome = ingestDecryptedRtcp(plaintext, tally);
|
|
@@ -99560,7 +99714,7 @@ async function handleIncomingAudioRtp(session, packet, sourceAddress, bctx) {
|
|
|
99560
99714
|
session.upstreamRtpDecryptFailures += 1;
|
|
99561
99715
|
if (session.upstreamRtpDecryptFailures % 100 === 1) log.debug("export-hap: SRTP decrypt failed (rate-limited)", { meta: {
|
|
99562
99716
|
failures: session.upstreamRtpDecryptFailures,
|
|
99563
|
-
error: errMsg$
|
|
99717
|
+
error: errMsg$12(err)
|
|
99564
99718
|
} });
|
|
99565
99719
|
return;
|
|
99566
99720
|
}
|
|
@@ -99574,7 +99728,7 @@ async function handleIncomingAudioRtp(session, packet, sourceAddress, bctx) {
|
|
|
99574
99728
|
rtpPayloadType = parsedRtp.header.payloadType;
|
|
99575
99729
|
} catch (err) {
|
|
99576
99730
|
drop(session, "upstream-parse-failed");
|
|
99577
|
-
log.debug("export-hap: RTP parse failed after decrypt", { meta: { error: errMsg$
|
|
99731
|
+
log.debug("export-hap: RTP parse failed after decrypt", { meta: { error: errMsg$12(err) } });
|
|
99578
99732
|
return;
|
|
99579
99733
|
}
|
|
99580
99734
|
const negotiatedAudioPt = session.lastStartParams?.audioPt;
|
|
@@ -99598,7 +99752,7 @@ async function handleIncomingAudioRtp(session, packet, sourceAddress, bctx) {
|
|
|
99598
99752
|
if (session.intercomTalkSessionId === null) {
|
|
99599
99753
|
session.intercomTalkSessionId = "";
|
|
99600
99754
|
const opened = await openIntercomTalkSession(bctx).catch((err) => {
|
|
99601
|
-
log.warn("export-hap: intercom.startTalkSession failed", { meta: { error: errMsg$
|
|
99755
|
+
log.warn("export-hap: intercom.startTalkSession failed", { meta: { error: errMsg$12(err) } });
|
|
99602
99756
|
return null;
|
|
99603
99757
|
});
|
|
99604
99758
|
if (opened) {
|
|
@@ -99625,7 +99779,7 @@ async function handleIncomingAudioRtp(session, packet, sourceAddress, bctx) {
|
|
|
99625
99779
|
drop(session, "upstream-push-failed");
|
|
99626
99780
|
log.debug("export-hap: intercom.pushTalkAudio failed (will re-open on next frame)", { meta: {
|
|
99627
99781
|
sequenceNumber: session.intercomPcmSequence,
|
|
99628
|
-
error: errMsg$
|
|
99782
|
+
error: errMsg$12(err)
|
|
99629
99783
|
} });
|
|
99630
99784
|
session.intercomTalkSessionId = null;
|
|
99631
99785
|
}
|
|
@@ -99657,7 +99811,7 @@ async function closeIntercomTalkSession(session, bctx) {
|
|
|
99657
99811
|
} catch (err) {
|
|
99658
99812
|
log.debug("export-hap: intercom.endTalkSession failed (continuing)", { meta: {
|
|
99659
99813
|
sessionId,
|
|
99660
|
-
error: errMsg$
|
|
99814
|
+
error: errMsg$12(err)
|
|
99661
99815
|
} });
|
|
99662
99816
|
}
|
|
99663
99817
|
}
|
|
@@ -99682,7 +99836,7 @@ function closeSocket(udp) {
|
|
|
99682
99836
|
function randomSsrc() {
|
|
99683
99837
|
return Math.floor(Math.random() * 2147483646) + 1 | 0;
|
|
99684
99838
|
}
|
|
99685
|
-
function errMsg$
|
|
99839
|
+
function errMsg$12(err) {
|
|
99686
99840
|
return err instanceof Error ? err.message : String(err);
|
|
99687
99841
|
}
|
|
99688
99842
|
//#endregion
|
|
@@ -99766,14 +99920,14 @@ async function buildDoorbell(input) {
|
|
|
99766
99920
|
}
|
|
99767
99921
|
log.info("export-hap: doorbell SINGLE_PRESS pushed to HomeKit", { meta: { ...delivery } });
|
|
99768
99922
|
} catch (err) {
|
|
99769
|
-
log.warn("export-hap: ringDoorbell() failed", { meta: { error: errMsg$
|
|
99923
|
+
log.warn("export-hap: ringDoorbell() failed", { meta: { error: errMsg$11(err) } });
|
|
99770
99924
|
}
|
|
99771
99925
|
});
|
|
99772
99926
|
return { async dispose() {
|
|
99773
99927
|
unsubscribe();
|
|
99774
99928
|
} };
|
|
99775
99929
|
}
|
|
99776
|
-
function errMsg$
|
|
99930
|
+
function errMsg$11(err) {
|
|
99777
99931
|
return err instanceof Error ? err.message : String(err);
|
|
99778
99932
|
}
|
|
99779
99933
|
//#endregion
|
|
@@ -99821,7 +99975,7 @@ async function buildMotionSensor(bctx, existing = null) {
|
|
|
99821
99975
|
const detected = await proxy.motion?.isDetected({});
|
|
99822
99976
|
if (typeof detected === "boolean") motionService.updateCharacteristic(import_dist.Characteristic.MotionDetected, detected);
|
|
99823
99977
|
} catch (err) {
|
|
99824
|
-
ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: initial motion hydrate failed (non-fatal)", { meta: { error: errMsg$
|
|
99978
|
+
ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: initial motion hydrate failed (non-fatal)", { meta: { error: errMsg$10(err) } });
|
|
99825
99979
|
}
|
|
99826
99980
|
let resetTimer = null;
|
|
99827
99981
|
const armReset = () => {
|
|
@@ -99855,7 +100009,7 @@ async function buildMotionSensor(bctx, existing = null) {
|
|
|
99855
100009
|
}
|
|
99856
100010
|
} };
|
|
99857
100011
|
}
|
|
99858
|
-
function errMsg$
|
|
100012
|
+
function errMsg$10(err) {
|
|
99859
100013
|
return err instanceof Error ? err.message : String(err);
|
|
99860
100014
|
}
|
|
99861
100015
|
//#endregion
|
|
@@ -99886,7 +100040,7 @@ async function buildPrivacySwitch(bctx) {
|
|
|
99886
100040
|
const status = await proxy.privacyMask?.getStatus({});
|
|
99887
100041
|
if (status && typeof status.enabled === "boolean") service.updateCharacteristic(import_dist.Characteristic.On, status.enabled);
|
|
99888
100042
|
} catch (err) {
|
|
99889
|
-
log.debug("export-hap: privacy-mask getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$
|
|
100043
|
+
log.debug("export-hap: privacy-mask getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$9(err) } });
|
|
99890
100044
|
}
|
|
99891
100045
|
service.getCharacteristic(import_dist.Characteristic.On).onSet(async (value) => {
|
|
99892
100046
|
const enabled = value === true;
|
|
@@ -99895,7 +100049,7 @@ async function buildPrivacySwitch(bctx) {
|
|
|
99895
100049
|
} catch (err) {
|
|
99896
100050
|
log.warn("export-hap: privacy-mask setMask failed", { meta: {
|
|
99897
100051
|
enabled,
|
|
99898
|
-
error: errMsg$
|
|
100052
|
+
error: errMsg$9(err)
|
|
99899
100053
|
} });
|
|
99900
100054
|
}
|
|
99901
100055
|
});
|
|
@@ -99913,7 +100067,7 @@ async function buildPrivacySwitch(bctx) {
|
|
|
99913
100067
|
} catch {}
|
|
99914
100068
|
} };
|
|
99915
100069
|
}
|
|
99916
|
-
function errMsg$
|
|
100070
|
+
function errMsg$9(err) {
|
|
99917
100071
|
return err instanceof Error ? err.message : String(err);
|
|
99918
100072
|
}
|
|
99919
100073
|
//#endregion
|
|
@@ -100004,7 +100158,7 @@ async function buildPtz(bctx) {
|
|
|
100004
100158
|
} catch (err) {
|
|
100005
100159
|
log.warn("export-hap: ptz.goToPreset failed", { meta: {
|
|
100006
100160
|
presetId: preset.id,
|
|
100007
|
-
error: errMsg$
|
|
100161
|
+
error: errMsg$8(err)
|
|
100008
100162
|
} });
|
|
100009
100163
|
}
|
|
100010
100164
|
armReset(() => service.updateCharacteristic(import_dist.Characteristic.On, false), MOMENTARY_RESET_MS);
|
|
@@ -100022,14 +100176,14 @@ async function buildPtz(bctx) {
|
|
|
100022
100176
|
try {
|
|
100023
100177
|
await proxy.ptz?.stop({});
|
|
100024
100178
|
} catch (err) {
|
|
100025
|
-
log.debug("export-hap: ptz.stop failed (non-fatal)", { meta: { error: errMsg$
|
|
100179
|
+
log.debug("export-hap: ptz.stop failed (non-fatal)", { meta: { error: errMsg$8(err) } });
|
|
100026
100180
|
}
|
|
100027
100181
|
service.updateCharacteristic(import_dist.Characteristic.On, false);
|
|
100028
100182
|
}, options.ptzPulseMs);
|
|
100029
100183
|
} catch (err) {
|
|
100030
100184
|
log.warn("export-hap: ptz.continuousMove failed", { meta: {
|
|
100031
100185
|
dir: dir.label,
|
|
100032
|
-
error: errMsg$
|
|
100186
|
+
error: errMsg$8(err)
|
|
100033
100187
|
} });
|
|
100034
100188
|
service.updateCharacteristic(import_dist.Characteristic.On, false);
|
|
100035
100189
|
}
|
|
@@ -100052,7 +100206,7 @@ async function readPresets(bctx) {
|
|
|
100052
100206
|
name: p.name
|
|
100053
100207
|
}));
|
|
100054
100208
|
} catch (err) {
|
|
100055
|
-
ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: ptz.getPresets failed (non-fatal)", { meta: { error: errMsg$
|
|
100209
|
+
ctx.logger.withTags({ deviceId: numericDeviceId }).debug("export-hap: ptz.getPresets failed (non-fatal)", { meta: { error: errMsg$8(err) } });
|
|
100056
100210
|
return [];
|
|
100057
100211
|
}
|
|
100058
100212
|
}
|
|
@@ -100067,7 +100221,7 @@ async function tryBuildAutotrack(bctx) {
|
|
|
100067
100221
|
const status = await proxy.ptzAutotrack.getStatus({});
|
|
100068
100222
|
if (status && typeof status.enabled === "boolean") service.updateCharacteristic(import_dist.Characteristic.On, status.enabled);
|
|
100069
100223
|
} catch (err) {
|
|
100070
|
-
log.debug("export-hap: ptzAutotrack.getStatus failed (non-fatal)", { meta: { error: errMsg$
|
|
100224
|
+
log.debug("export-hap: ptzAutotrack.getStatus failed (non-fatal)", { meta: { error: errMsg$8(err) } });
|
|
100071
100225
|
}
|
|
100072
100226
|
service.getCharacteristic(import_dist.Characteristic.On).onSet(async (value) => {
|
|
100073
100227
|
const enabled = value === true;
|
|
@@ -100076,13 +100230,13 @@ async function tryBuildAutotrack(bctx) {
|
|
|
100076
100230
|
} catch (err) {
|
|
100077
100231
|
log.warn("export-hap: ptzAutotrack.setEnabled failed", { meta: {
|
|
100078
100232
|
enabled,
|
|
100079
|
-
error: errMsg$
|
|
100233
|
+
error: errMsg$8(err)
|
|
100080
100234
|
} });
|
|
100081
100235
|
}
|
|
100082
100236
|
});
|
|
100083
100237
|
return { async dispose() {} };
|
|
100084
100238
|
}
|
|
100085
|
-
function errMsg$
|
|
100239
|
+
function errMsg$8(err) {
|
|
100086
100240
|
return err instanceof Error ? err.message : String(err);
|
|
100087
100241
|
}
|
|
100088
100242
|
//#endregion
|
|
@@ -101113,13 +101267,13 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
|
|
|
101113
101267
|
const switchStatus = await proxy.switch?.getStatus({});
|
|
101114
101268
|
if (switchStatus && typeof switchStatus.on === "boolean") service.updateCharacteristic(import_dist.Characteristic.On, switchStatus.on);
|
|
101115
101269
|
} catch (err) {
|
|
101116
|
-
log.debug("export-hap: child switch.getStatus failed (non-fatal)", { meta: { error: errMsg$
|
|
101270
|
+
log.debug("export-hap: child switch.getStatus failed (non-fatal)", { meta: { error: errMsg$7(err) } });
|
|
101117
101271
|
}
|
|
101118
101272
|
if (useLightbulb) try {
|
|
101119
101273
|
const status = await proxy.brightness?.getStatus({});
|
|
101120
101274
|
if (status && typeof status.percentage === "number") service.updateCharacteristic(import_dist.Characteristic.Brightness, status.percentage);
|
|
101121
101275
|
} catch (err) {
|
|
101122
|
-
log.debug("export-hap: child brightness.getStatus failed (non-fatal)", { meta: { error: errMsg$
|
|
101276
|
+
log.debug("export-hap: child brightness.getStatus failed (non-fatal)", { meta: { error: errMsg$7(err) } });
|
|
101123
101277
|
}
|
|
101124
101278
|
if (hasSwitch) service.getCharacteristic(import_dist.Characteristic.On).onSet(async (value) => {
|
|
101125
101279
|
const on = value === true;
|
|
@@ -101128,7 +101282,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
|
|
|
101128
101282
|
} catch (err) {
|
|
101129
101283
|
log.warn("export-hap: child switch.setState failed", { meta: {
|
|
101130
101284
|
on,
|
|
101131
|
-
error: errMsg$
|
|
101285
|
+
error: errMsg$7(err)
|
|
101132
101286
|
} });
|
|
101133
101287
|
}
|
|
101134
101288
|
});
|
|
@@ -101140,7 +101294,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
|
|
|
101140
101294
|
} catch (err) {
|
|
101141
101295
|
log.warn("export-hap: child brightness.setBrightness failed", { meta: {
|
|
101142
101296
|
percentage,
|
|
101143
|
-
error: errMsg$
|
|
101297
|
+
error: errMsg$7(err)
|
|
101144
101298
|
} });
|
|
101145
101299
|
}
|
|
101146
101300
|
});
|
|
@@ -101163,7 +101317,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
|
|
|
101163
101317
|
} catch {}
|
|
101164
101318
|
} };
|
|
101165
101319
|
}
|
|
101166
|
-
function errMsg$
|
|
101320
|
+
function errMsg$7(err) {
|
|
101167
101321
|
return err instanceof Error ? err.message : String(err);
|
|
101168
101322
|
}
|
|
101169
101323
|
//#endregion
|
|
@@ -101190,7 +101344,7 @@ async function buildChildServicesFor(input) {
|
|
|
101190
101344
|
for (const h of handles) try {
|
|
101191
101345
|
await h.dispose();
|
|
101192
101346
|
} catch (err) {
|
|
101193
|
-
ctx.logger.withTags({ deviceId: parentNumericId }).debug("export-hap: child service dispose failed (continuing)", { meta: { error: errMsg$
|
|
101347
|
+
ctx.logger.withTags({ deviceId: parentNumericId }).debug("export-hap: child service dispose failed (continuing)", { meta: { error: errMsg$6(err) } });
|
|
101194
101348
|
}
|
|
101195
101349
|
} };
|
|
101196
101350
|
}
|
|
@@ -101206,7 +101360,7 @@ async function listChildren(ctx, parentNumericId) {
|
|
|
101206
101360
|
features: Array.isArray(c.features) ? c.features.filter((f) => typeof f === "string") : []
|
|
101207
101361
|
}));
|
|
101208
101362
|
} catch (err) {
|
|
101209
|
-
ctx.logger.withTags({ deviceId: parentNumericId }).debug("export-hap: deviceManager.getChildren failed (non-fatal)", { meta: { error: errMsg$
|
|
101363
|
+
ctx.logger.withTags({ deviceId: parentNumericId }).debug("export-hap: deviceManager.getChildren failed (non-fatal)", { meta: { error: errMsg$6(err) } });
|
|
101210
101364
|
return [];
|
|
101211
101365
|
}
|
|
101212
101366
|
}
|
|
@@ -101222,7 +101376,7 @@ function asDeviceType(raw) {
|
|
|
101222
101376
|
for (const value of Object.values(DeviceType)) if (value === lower) return value;
|
|
101223
101377
|
return DeviceType.Generic;
|
|
101224
101378
|
}
|
|
101225
|
-
function errMsg$
|
|
101379
|
+
function errMsg$6(err) {
|
|
101226
101380
|
return err instanceof Error ? err.message : String(err);
|
|
101227
101381
|
}
|
|
101228
101382
|
//#endregion
|
|
@@ -101244,12 +101398,18 @@ var SUPPORTED_MAPPER_KINDS = ["camera", "generic"];
|
|
|
101244
101398
|
* doctrine the HA exporter writes down, and the thing that confined the
|
|
101245
101399
|
* previous exporter to cameras when it was ignored.
|
|
101246
101400
|
*
|
|
101247
|
-
* Tier A
|
|
101248
|
-
* feature-dependent shape. `cover`, `climate`, `fan`, `valve`,
|
|
101249
|
-
* `
|
|
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
|
|
101250
101404
|
* absent — each needs a service whose semantics the table cannot yet honour,
|
|
101251
101405
|
* and offering the tab before the mapping exists is how an operator gets an
|
|
101252
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.
|
|
101253
101413
|
*/
|
|
101254
101414
|
var HAP_EXPORTABLE_DEVICE_TYPES = [
|
|
101255
101415
|
DeviceType.Camera,
|
|
@@ -101259,6 +101419,7 @@ var HAP_EXPORTABLE_DEVICE_TYPES = [
|
|
|
101259
101419
|
DeviceType.Sensor,
|
|
101260
101420
|
DeviceType.Lock,
|
|
101261
101421
|
DeviceType.Presence,
|
|
101422
|
+
DeviceType.AlarmPanel,
|
|
101262
101423
|
DeviceType.Generic
|
|
101263
101424
|
];
|
|
101264
101425
|
/**
|
|
@@ -101384,17 +101545,17 @@ async function buildCameraAccessory(input) {
|
|
|
101384
101545
|
for (const h of handles) try {
|
|
101385
101546
|
await h.dispose();
|
|
101386
101547
|
} catch (err) {
|
|
101387
|
-
log.debug("export-hap: builder dispose failed (continuing)", { meta: { error: errMsg$
|
|
101548
|
+
log.debug("export-hap: builder dispose failed (continuing)", { meta: { error: errMsg$5(err) } });
|
|
101388
101549
|
}
|
|
101389
101550
|
try {
|
|
101390
101551
|
await streams.dispose();
|
|
101391
101552
|
} catch (err) {
|
|
101392
|
-
log.debug("export-hap: streams dispose failed", { meta: { error: errMsg$
|
|
101553
|
+
log.debug("export-hap: streams dispose failed", { meta: { error: errMsg$5(err) } });
|
|
101393
101554
|
}
|
|
101394
101555
|
}
|
|
101395
101556
|
};
|
|
101396
101557
|
}
|
|
101397
|
-
function errMsg$
|
|
101558
|
+
function errMsg$5(err) {
|
|
101398
101559
|
return err instanceof Error ? err.message : String(err);
|
|
101399
101560
|
}
|
|
101400
101561
|
//#endregion
|
|
@@ -101423,7 +101584,7 @@ function errMsg$4(err) {
|
|
|
101423
101584
|
* counterpart on this service and is deliberately not wired — a Switch that
|
|
101424
101585
|
* silently buzzes a door open would be a second knob nobody asked for.
|
|
101425
101586
|
*/
|
|
101426
|
-
var SUBTYPE = "lock-control";
|
|
101587
|
+
var SUBTYPE$1 = "lock-control";
|
|
101427
101588
|
var readLock = reader(LockControlStatusSchema.pick({ state: true }), (status) => {
|
|
101428
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;
|
|
101429
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;
|
|
@@ -101439,7 +101600,7 @@ async function buildLockMechanism(bctx) {
|
|
|
101439
101600
|
const { ctx, accessory, proxy, numericDeviceId, displayName } = bctx;
|
|
101440
101601
|
const log = ctx.logger.withTags({ deviceId: numericDeviceId });
|
|
101441
101602
|
const label = hapServiceName([displayName], `Lock ${numericDeviceId}`);
|
|
101442
|
-
const service = accessory.addService(import_dist.Service.LockMechanism, label, SUBTYPE);
|
|
101603
|
+
const service = accessory.addService(import_dist.Service.LockMechanism, label, SUBTYPE$1);
|
|
101443
101604
|
applyServiceLabel(service, label);
|
|
101444
101605
|
const apply = (status, source) => {
|
|
101445
101606
|
const updates = readLock(status);
|
|
@@ -101453,7 +101614,7 @@ async function buildLockMechanism(bctx) {
|
|
|
101453
101614
|
const status = await proxy.lockControl?.getStatus({});
|
|
101454
101615
|
if (status !== void 0 && status !== null) apply(status, "getStatus");
|
|
101455
101616
|
} catch (err) {
|
|
101456
|
-
log.debug("export-hap: lock getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$
|
|
101617
|
+
log.debug("export-hap: lock getStatus hydrate failed (non-fatal)", { meta: { error: errMsg$4(err) } });
|
|
101457
101618
|
}
|
|
101458
101619
|
service.getCharacteristic(import_dist.Characteristic.LockTargetState).onSet(async (value) => {
|
|
101459
101620
|
const secure = value === import_dist.Characteristic.LockTargetState.SECURED;
|
|
@@ -101463,7 +101624,7 @@ async function buildLockMechanism(bctx) {
|
|
|
101463
101624
|
} catch (err) {
|
|
101464
101625
|
log.warn("export-hap: lock command failed", { meta: {
|
|
101465
101626
|
secure,
|
|
101466
|
-
error: errMsg$
|
|
101627
|
+
error: errMsg$4(err)
|
|
101467
101628
|
} });
|
|
101468
101629
|
}
|
|
101469
101630
|
});
|
|
@@ -101477,6 +101638,296 @@ async function buildLockMechanism(bctx) {
|
|
|
101477
101638
|
} catch {}
|
|
101478
101639
|
} };
|
|
101479
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
|
+
}
|
|
101480
101931
|
function errMsg$3(err) {
|
|
101481
101932
|
return err instanceof Error ? err.message : String(err);
|
|
101482
101933
|
}
|
|
@@ -101551,11 +102002,16 @@ function errMsg$2(err) {
|
|
|
101551
102002
|
*
|
|
101552
102003
|
* ## Tier
|
|
101553
102004
|
*
|
|
101554
|
-
* Tier A
|
|
101555
|
-
* feature-dependent shape
|
|
101556
|
-
*
|
|
101557
|
-
*
|
|
101558
|
-
*
|
|
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`).
|
|
101559
102015
|
*/
|
|
101560
102016
|
/** HomeKit's floor for `CurrentAmbientLightLevel`; 0 lux is out of range. */
|
|
101561
102017
|
var MIN_LUX = 1e-4;
|
|
@@ -101697,6 +102153,14 @@ var HAP_CAP_SERVICES = [
|
|
|
101697
102153
|
displayName: name
|
|
101698
102154
|
})
|
|
101699
102155
|
},
|
|
102156
|
+
{
|
|
102157
|
+
caps: ["alarm-panel"],
|
|
102158
|
+
label: "Alarm",
|
|
102159
|
+
build: ({ bctx, name }) => buildSecuritySystem({
|
|
102160
|
+
...bctx,
|
|
102161
|
+
displayName: name
|
|
102162
|
+
})
|
|
102163
|
+
},
|
|
101700
102164
|
{
|
|
101701
102165
|
caps: ["battery"],
|
|
101702
102166
|
label: BATTERY_SPEC.label,
|
|
@@ -101734,7 +102198,8 @@ var ACCESSORY_CATEGORY_BY_TYPE = {
|
|
|
101734
102198
|
[DeviceType.Siren]: import_dist.Categories.SWITCH,
|
|
101735
102199
|
[DeviceType.Lock]: import_dist.Categories.DOOR_LOCK,
|
|
101736
102200
|
[DeviceType.Sensor]: import_dist.Categories.SENSOR,
|
|
101737
|
-
[DeviceType.Presence]: import_dist.Categories.SENSOR
|
|
102201
|
+
[DeviceType.Presence]: import_dist.Categories.SENSOR,
|
|
102202
|
+
[DeviceType.AlarmPanel]: import_dist.Categories.SECURITY_SYSTEM
|
|
101738
102203
|
};
|
|
101739
102204
|
function accessoryCategoryFor(deviceType) {
|
|
101740
102205
|
return ACCESSORY_CATEGORY_BY_TYPE[deviceType] ?? import_dist.Categories.OTHER;
|