@camstack/addon-export-hap 1.2.113 → 1.2.114
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 +496 -60
- package/dist/hap-export.addon.mjs +496 -60
- package/package.json +1 -1
|
@@ -72,7 +72,7 @@ function carryForward(base, existing, keys) {
|
|
|
72
72
|
return out;
|
|
73
73
|
}
|
|
74
74
|
//#endregion
|
|
75
|
-
//#region ../types/dist/event-category-
|
|
75
|
+
//#region ../types/dist/event-category-BVDXG4tB.mjs
|
|
76
76
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
77
77
|
EventCategory["SystemBoot"] = "system.boot";
|
|
78
78
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -689,6 +689,20 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
689
689
|
* pull-reconcile from the provider's `getStatus` on reconnect. */
|
|
690
690
|
EventCategory["MeshNetworkChanged"] = "network.mesh.changed";
|
|
691
691
|
EventCategory["BackupCompleted"] = "backup.completed";
|
|
692
|
+
/**
|
|
693
|
+
* A whole backup RUN finished — every destination attempted, win or lose.
|
|
694
|
+
*
|
|
695
|
+
* `backup.completed` fires once per DESTINATION, which is the right grain for
|
|
696
|
+
* a progress UI and the wrong one for a notification: an operator with three
|
|
697
|
+
* destinations would be told three times. And a run where two of three
|
|
698
|
+
* destinations succeeded is not a clean success — a single "backup
|
|
699
|
+
* completed" that hid the failed one would be a lie, so the count of each is
|
|
700
|
+
* carried here and the message says both.
|
|
701
|
+
*
|
|
702
|
+
* Emitted by the backup orchestrator only after the destination loop, so a
|
|
703
|
+
* run that dies during the BUILD phase produces no completion at all.
|
|
704
|
+
*/
|
|
705
|
+
EventCategory["BackupRunCompleted"] = "backup.run-completed";
|
|
692
706
|
EventCategory["BackupRestored"] = "backup.restored";
|
|
693
707
|
EventCategory["NotificationDispatched"] = "notification.dispatched";
|
|
694
708
|
EventCategory["NotificationFailed"] = "notification.failed";
|
|
@@ -5419,7 +5433,7 @@ var ZodIssueCode = {
|
|
|
5419
5433
|
var ZodFirstPartyTypeKind;
|
|
5420
5434
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5421
5435
|
//#endregion
|
|
5422
|
-
//#region ../types/dist/sleep-
|
|
5436
|
+
//#region ../types/dist/sleep-DEuj7E3j.mjs
|
|
5423
5437
|
/**
|
|
5424
5438
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5425
5439
|
* window to float samples (D455).
|
|
@@ -8047,6 +8061,28 @@ var EncodeProfileSchema = object({
|
|
|
8047
8061
|
outputArgs: array(string()).optional()
|
|
8048
8062
|
});
|
|
8049
8063
|
/**
|
|
8064
|
+
* THE target rule: which of two sizes serves a consumer better.
|
|
8065
|
+
*
|
|
8066
|
+
* "Prefer at or above the target so the consumer downscales instead of
|
|
8067
|
+
* upscaling; among those the SMALLEST, because the extra pixels are thrown
|
|
8068
|
+
* away and the decode is not; among the rest the LARGEST, because it is the
|
|
8069
|
+
* closest we can get." One sentence, and until now it was written twice — once
|
|
8070
|
+
* here in lines, once in `stream-selection.ts` in pixels, for the same two
|
|
8071
|
+
* exporters. The two agreed, which is luck, not a property.
|
|
8072
|
+
*
|
|
8073
|
+
* The `size` is whatever measure the caller ranks by: the cap ranks by LINES
|
|
8074
|
+
* (a consumer's requirement is stated in p), the RTSP picker by PIXELS (it
|
|
8075
|
+
* compares entries of possibly different aspect). The rule is the same either
|
|
8076
|
+
* way and the measure is the caller's business.
|
|
8077
|
+
*
|
|
8078
|
+
* Returns a sort delta: negative when `a` should come first.
|
|
8079
|
+
*/
|
|
8080
|
+
function compareToTarget(a, b, target) {
|
|
8081
|
+
const aReaches = a >= target;
|
|
8082
|
+
if (aReaches !== b >= target) return aReaches ? -1 : 1;
|
|
8083
|
+
return aReaches ? a - b : b - a;
|
|
8084
|
+
}
|
|
8085
|
+
/**
|
|
8050
8086
|
* The shape every live egress starts from: H.264 Baseline 3.1 at 720p25.
|
|
8051
8087
|
* Baseline because it is the one profile every consumer in this repo decodes
|
|
8052
8088
|
* (Echo, iOS, an old browser); 3.1 because that is what the SDPs advertise.
|
|
@@ -9959,6 +9995,47 @@ var LogChannelWindowSchema = object({
|
|
|
9959
9995
|
/** `null` = every camera. A non-empty list narrows to those numeric ids. */
|
|
9960
9996
|
deviceIds: array(number().int()).readonly().nullable()
|
|
9961
9997
|
});
|
|
9998
|
+
/**
|
|
9999
|
+
* Shared stream-selection picker for export addons.
|
|
10000
|
+
*
|
|
10001
|
+
* Both `addon-export-alexa` and `addon-export-hap` resolve the
|
|
10002
|
+
* operator's `streamPreference` setting against the broker's RTSP
|
|
10003
|
+
* entries before dialling a camera. Each addon used to roll its own:
|
|
10004
|
+
* Alexa had `pickPreferredRtspEntry` under `handlers/`, HAP had an
|
|
10005
|
+
* inline `"prefer /mid, then /high, then first"` chain inside its
|
|
10006
|
+
* camera-streams mapper. The chains drifted (Alexa honoured
|
|
10007
|
+
* `streamPreference`, HAP didn't; only Alexa got the smart
|
|
10008
|
+
* resolution-targeted auto-pick) and the cross-addon import rule
|
|
10009
|
+
* blocks deduping in either direction.
|
|
10010
|
+
*
|
|
10011
|
+
* Lifting the picker into `@camstack/types` lets every exporter call
|
|
10012
|
+
* the same code path with the consumer's target resolution baked into
|
|
10013
|
+
* the call site — Alexa passes 1280×720, HomeKit passes 1920×1080,
|
|
10014
|
+
* the picker handles the rest.
|
|
10015
|
+
*
|
|
10016
|
+
* Selection algorithm:
|
|
10017
|
+
* - pref === '<profile>' → profile-keyed entries (from
|
|
10018
|
+
* `getProfileRtspEntries`) match on `e.profile`;
|
|
10019
|
+
* legacy raw entries match on the brokerId
|
|
10020
|
+
* suffix (`brokerId` ENDS WITH `/${pref}`, shape
|
|
10021
|
+
* `${deviceId}/${camStreamId}`). Addons store the
|
|
10022
|
+
* bare profile/camStream id in their
|
|
10023
|
+
* `ExportDeviceSettings.streamPreference`. Falls
|
|
10024
|
+
* back to 'auto' when no enabled entry matches
|
|
10025
|
+
* either way.
|
|
10026
|
+
* - pref === 'auto' → when `targetResolution` is given, pick the
|
|
10027
|
+
* entry whose source resolution is closest to
|
|
10028
|
+
* it (prefer ≥ target so the consumer
|
|
10029
|
+
* downscales instead of upscaling). Without a
|
|
10030
|
+
* target, fall back to first-enabled. If no
|
|
10031
|
+
* entry advertises a resolution at all
|
|
10032
|
+
* (broker hasn't probed yet), also fall back
|
|
10033
|
+
* to first-enabled so cold start still serves.
|
|
10034
|
+
*
|
|
10035
|
+
* Returns `null` when nothing is publishable — callers fold that into
|
|
10036
|
+
* the consumer's "no stream" error (Alexa: STREAM_TYPE_UNSUPPORTED;
|
|
10037
|
+
* HAP: a thrown error inside `startFfmpegForSession`).
|
|
10038
|
+
*/
|
|
9962
10039
|
function pickPreferredRtspEntry(entries, pref, deviceId, options = {}) {
|
|
9963
10040
|
if (entries.length === 0) return null;
|
|
9964
10041
|
const prefix = `${deviceId}/`;
|
|
@@ -9988,30 +10065,23 @@ function pickPreferredRtspEntry(entries, pref, deviceId, options = {}) {
|
|
|
9988
10065
|
return toPicked(eligible[0]);
|
|
9989
10066
|
}
|
|
9990
10067
|
/**
|
|
9991
|
-
* Pick the entry whose `resolution` is closest to `target
|
|
9992
|
-
*
|
|
9993
|
-
*
|
|
9994
|
-
*
|
|
9995
|
-
*
|
|
10068
|
+
* Pick the entry whose `resolution` is closest to `target`, by the ONE target
|
|
10069
|
+
* rule ({@link compareToTarget}): prefer at or above the target so the consumer
|
|
10070
|
+
* downscales instead of upscaling; among those the smallest; among the rest the
|
|
10071
|
+
* largest.
|
|
10072
|
+
*
|
|
10073
|
+
* This function used to implement that rule itself, in pixels, while
|
|
10074
|
+
* `rankStreams` implemented it again in lines — the same sentence written twice
|
|
10075
|
+
* for the same two exporters, agreeing by luck rather than by construction.
|
|
10076
|
+
* Only the MEASURE is this picker's own: it compares whole pixel counts because
|
|
10077
|
+
* its entries can differ in aspect, where the cap's requirement is stated in p.
|
|
9996
10078
|
*/
|
|
9997
10079
|
function pickClosestResolution(entries, target) {
|
|
9998
10080
|
const targetPixels = target.width * target.height;
|
|
9999
|
-
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
const pixels = e.resolution.width * e.resolution.height;
|
|
10004
|
-
if (pixels >= targetPixels) {
|
|
10005
|
-
if (!bestAbove || pixels < bestAbove.pixels) bestAbove = {
|
|
10006
|
-
entry: e,
|
|
10007
|
-
pixels
|
|
10008
|
-
};
|
|
10009
|
-
} else if (!bestBelow || pixels > bestBelow.pixels) bestBelow = {
|
|
10010
|
-
entry: e,
|
|
10011
|
-
pixels
|
|
10012
|
-
};
|
|
10013
|
-
}
|
|
10014
|
-
return bestAbove?.entry ?? bestBelow?.entry;
|
|
10081
|
+
return [...entries.flatMap((entry) => entry.resolution === void 0 ? [] : [{
|
|
10082
|
+
entry,
|
|
10083
|
+
pixels: entry.resolution.width * entry.resolution.height
|
|
10084
|
+
}])].sort((a, b) => compareToTarget(a.pixels, b.pixels, targetPixels))[0]?.entry;
|
|
10015
10085
|
}
|
|
10016
10086
|
var MODEL_FORMATS = [
|
|
10017
10087
|
"onnx",
|
|
@@ -12199,6 +12269,58 @@ method(ListInputSchema, array(BrokerInfoSchema$1)), method(GetInputSchema, Broke
|
|
|
12199
12269
|
auth: "admin"
|
|
12200
12270
|
}), method(GetStateInputSchema, unknown().nullable()), method(_void(), RegistryStatusSchema);
|
|
12201
12271
|
DeviceType.Camera;
|
|
12272
|
+
/**
|
|
12273
|
+
* The signals a device can emit to WAKE its own stream.
|
|
12274
|
+
*
|
|
12275
|
+
* A camera whose stream is built on demand sleeps until something asks for it,
|
|
12276
|
+
* and "something" cannot be a consumer that is merely attached — a Frigate-style
|
|
12277
|
+
* puller holds a session open for ever, and treating that as demand would keep
|
|
12278
|
+
* a battery camera awake for ever, which is the whole thing the battery is for
|
|
12279
|
+
* (D173). So the wake has to come from the CAMERA: an event it noticed by
|
|
12280
|
+
* itself, with no stream running.
|
|
12281
|
+
*
|
|
12282
|
+
* ## The vocabulary is the PROVIDER'S, not ours
|
|
12283
|
+
*
|
|
12284
|
+
* Like `consumables`, this cap declares no vocabulary of its own. A provider
|
|
12285
|
+
* names each signal with a `code` it chooses and a `label` an operator reads.
|
|
12286
|
+
* Reolink offers motion and camera-native detection; another provider may offer
|
|
12287
|
+
* a tamper, a doorbell press, a PIR, or something no camera in this fleet has
|
|
12288
|
+
* yet. A fixed enum here would mean every new signal is a framework release.
|
|
12289
|
+
*
|
|
12290
|
+
* It is deliberately NOT derived from the caps a device already binds. Whether
|
|
12291
|
+
* a camera CAN push firmware motion is expressed by `motionSources` containing
|
|
12292
|
+
* `'onboard'`, and whether it does AI on-camera by the `native-object-detection`
|
|
12293
|
+
* binding — but both answer "what drives the detection pipeline", which is a
|
|
12294
|
+
* different question from "what may wake a sleeping stream". A camera can do
|
|
12295
|
+
* the first and not be trusted with the second, and the operator picks per
|
|
12296
|
+
* camera. Two questions, two authorities.
|
|
12297
|
+
*
|
|
12298
|
+
* ## Availability is not permission
|
|
12299
|
+
*
|
|
12300
|
+
* `listSignals` says what the device CAN emit. Whether a given signal actually
|
|
12301
|
+
* wakes the stream is the operator's per-camera choice, held by the broker
|
|
12302
|
+
* alongside the cooldown — see the stream-broker cap's wake settings. A
|
|
12303
|
+
* provider declaring a signal is not a provider enabling it.
|
|
12304
|
+
*/
|
|
12305
|
+
/** One signal a device can emit. */
|
|
12306
|
+
var StreamSignalSchema = object({
|
|
12307
|
+
/** Stable id chosen by the provider, e.g. `'motion'`, `'person'`, `'tamper'`. */
|
|
12308
|
+
code: string().min(1),
|
|
12309
|
+
/** What an operator reads in the picker. The provider's own wording. */
|
|
12310
|
+
label: string().min(1),
|
|
12311
|
+
/**
|
|
12312
|
+
* Whether the provider recommends this signal ON when a camera is first set
|
|
12313
|
+
* up. A provider knows which of its signals are cheap and reliable; an
|
|
12314
|
+
* operator should not have to discover that by trial. Reolink recommends
|
|
12315
|
+
* both of its own.
|
|
12316
|
+
*/
|
|
12317
|
+
recommended: boolean()
|
|
12318
|
+
});
|
|
12319
|
+
object({
|
|
12320
|
+
signals: array(StreamSignalSchema),
|
|
12321
|
+
lastFetchedAt: number()
|
|
12322
|
+
});
|
|
12323
|
+
Object.values(DeviceType), method(_void(), array(StreamSignalSchema).readonly());
|
|
12202
12324
|
/** Stream delivery format. (Relocated from the retired `streaming-engine` cap.) */
|
|
12203
12325
|
var StreamFormatSchema = _enum([
|
|
12204
12326
|
"webrtc",
|
|
@@ -12595,6 +12717,22 @@ var EgressTranscodeSchema = object({
|
|
|
12595
12717
|
camStreamId: string().nullable()
|
|
12596
12718
|
});
|
|
12597
12719
|
method(object({
|
|
12720
|
+
deviceId: number().int().nonnegative(),
|
|
12721
|
+
/** The provider's signal code. */
|
|
12722
|
+
code: string().min(1),
|
|
12723
|
+
/** Ms epoch. Absent ⇒ now. */
|
|
12724
|
+
at: number().optional()
|
|
12725
|
+
}), object({
|
|
12726
|
+
/** Whether the broker acted on it, and if not, why. */
|
|
12727
|
+
accepted: boolean(),
|
|
12728
|
+
reason: _enum([
|
|
12729
|
+
"woke",
|
|
12730
|
+
"hold-extended",
|
|
12731
|
+
"not-enabled",
|
|
12732
|
+
"no-consumer",
|
|
12733
|
+
"unknown-code"
|
|
12734
|
+
])
|
|
12735
|
+
}), { kind: "mutation" }), method(object({
|
|
12598
12736
|
deviceId: number().int().nonnegative(),
|
|
12599
12737
|
camStreamId: string().min(1),
|
|
12600
12738
|
kind: CamStreamKindSchema,
|
|
@@ -12849,6 +12987,16 @@ var PickStreamRequirementsSchema = object({
|
|
|
12849
12987
|
acceptCodecs: array(StreamCodecSchema).readonly().optional(),
|
|
12850
12988
|
/** Minimum vertical resolution. Streams shorter than this are dropped. */
|
|
12851
12989
|
minHeight: number().int().positive().optional(),
|
|
12990
|
+
/**
|
|
12991
|
+
* Maximum vertical resolution. Streams TALLER than this are dropped.
|
|
12992
|
+
*
|
|
12993
|
+
* A consumer can have a ceiling as real as its floor: Alexa documents
|
|
12994
|
+
* 480p to 1080p, and a 4K stream is as unusable to an Echo as a 360p one.
|
|
12995
|
+
* Without this the ceiling had to be re-implemented by every caller — and
|
|
12996
|
+
* one caller implementing it privately is how a second scoring authority
|
|
12997
|
+
* gets born.
|
|
12998
|
+
*/
|
|
12999
|
+
maxHeight: number().int().positive().optional(),
|
|
12852
13000
|
/** Minimum horizontal resolution. */
|
|
12853
13001
|
minWidth: number().int().positive().optional(),
|
|
12854
13002
|
/**
|
|
@@ -12865,7 +13013,22 @@ var PickStreamRequirementsSchema = object({
|
|
|
12865
13013
|
* transcoded" guard: if the device is already serving the consumer's
|
|
12866
13014
|
* codec end-to-end, there's nothing to optimise.
|
|
12867
13015
|
*/
|
|
12868
|
-
requireSiblingCodec: array(StreamCodecSchema).readonly().optional()
|
|
13016
|
+
requireSiblingCodec: array(StreamCodecSchema).readonly().optional(),
|
|
13017
|
+
/**
|
|
13018
|
+
* Whether a stream the consumer CANNOT decode may still be picked, on the
|
|
13019
|
+
* understanding that it will be transcoded.
|
|
13020
|
+
*
|
|
13021
|
+
* Default `false` — today's behaviour, and the right one for a bypass
|
|
13022
|
+
* question ("is there a stream I can forward untouched?"). Set `true` to
|
|
13023
|
+
* ask the larger question: "what is the best stream for me, transcoding if
|
|
13024
|
+
* I must?" A stream that satisfies `acceptCodecs` always outranks one that
|
|
13025
|
+
* does not, so a passthrough is never lost to a transcode; the answer says
|
|
13026
|
+
* which it is in {@link PickedCamStreamSchema.transcodes}.
|
|
13027
|
+
*
|
|
13028
|
+
* This is what lets one picker serve both the bypass and the full source
|
|
13029
|
+
* choice, instead of a consumer scoring privately when the bypass misses.
|
|
13030
|
+
*/
|
|
13031
|
+
allowTranscode: boolean().optional()
|
|
12869
13032
|
}).readonly();
|
|
12870
13033
|
var PickStreamPreferencesSchema = object({
|
|
12871
13034
|
/**
|
|
@@ -12879,12 +13042,32 @@ var PickStreamPreferencesSchema = object({
|
|
|
12879
13042
|
* picks the tallest stream; `'lowest'` picks the shortest (used by
|
|
12880
13043
|
* memory-constrained consumers / Apple Home guest sessions).
|
|
12881
13044
|
*/
|
|
12882
|
-
resolutionPreference: _enum(["highest", "lowest"]).optional()
|
|
13045
|
+
resolutionPreference: _enum(["highest", "lowest"]).optional(),
|
|
13046
|
+
/**
|
|
13047
|
+
* The height the consumer actually wants to DELIVER.
|
|
13048
|
+
*
|
|
13049
|
+
* Not a constraint — an ordering. With it set, the SMALLEST stream at or
|
|
13050
|
+
* above the target wins, and only if nothing reaches it does the tallest
|
|
13051
|
+
* take over. Pulling 1296 lines to draw 720 on a 1280x800 Echo panel costs
|
|
13052
|
+
* a decode and buys nothing, and `resolutionPreference: 'highest'` cannot
|
|
13053
|
+
* express that: it says "as big as possible", which is a different wish.
|
|
13054
|
+
*
|
|
13055
|
+
* Ignored when absent, so every existing caller keeps its ordering.
|
|
13056
|
+
*/
|
|
13057
|
+
targetHeight: number().int().positive().optional()
|
|
12883
13058
|
}).readonly();
|
|
12884
13059
|
var PickedCamStreamSchema = object({
|
|
12885
13060
|
camStreamId: string(),
|
|
12886
13061
|
codec: string().optional(),
|
|
12887
13062
|
resolution: CamStreamResolutionSchema.optional(),
|
|
13063
|
+
/**
|
|
13064
|
+
* Whether serving this stream requires a decode + re-encode.
|
|
13065
|
+
*
|
|
13066
|
+
* `false` is a stream the consumer can take as it stands. Only ever `true`
|
|
13067
|
+
* when the caller asked for it with `allowTranscode`, so a caller that did
|
|
13068
|
+
* not ask cannot be handed a cost it never agreed to pay.
|
|
13069
|
+
*/
|
|
13070
|
+
transcodes: boolean(),
|
|
12888
13071
|
/** One-line explanation of why this stream won — for logs / debug UI. */
|
|
12889
13072
|
reason: string()
|
|
12890
13073
|
});
|
|
@@ -17154,6 +17337,8 @@ var NcSystemEventKindSchema = _enum([
|
|
|
17154
17337
|
"device-enabled",
|
|
17155
17338
|
"device-battery-low",
|
|
17156
17339
|
"device-battery-normal",
|
|
17340
|
+
"device-consumable-low",
|
|
17341
|
+
"device-consumable-normal",
|
|
17157
17342
|
"stream-online",
|
|
17158
17343
|
"stream-offline",
|
|
17159
17344
|
"node-online",
|
|
@@ -17172,6 +17357,7 @@ var NcSystemEventKindSchema = _enum([
|
|
|
17172
17357
|
"addon-updated",
|
|
17173
17358
|
"server-updated",
|
|
17174
17359
|
"export-completed",
|
|
17360
|
+
"backup-completed",
|
|
17175
17361
|
"camera-online",
|
|
17176
17362
|
"camera-offline",
|
|
17177
17363
|
"camera-disabled",
|
|
@@ -24413,10 +24599,28 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
|
|
|
24413
24599
|
}), boolean()), method(object({
|
|
24414
24600
|
deviceId: number().int().nonnegative(),
|
|
24415
24601
|
sessionId: string()
|
|
24416
|
-
}), object({
|
|
24417
|
-
|
|
24418
|
-
|
|
24419
|
-
|
|
24602
|
+
}), object({
|
|
24603
|
+
pendingRenegotiation: object({
|
|
24604
|
+
target: WebrtcStreamTargetSchema,
|
|
24605
|
+
epoch: number()
|
|
24606
|
+
}).nullable(),
|
|
24607
|
+
/**
|
|
24608
|
+
* Whether the session still EXISTS.
|
|
24609
|
+
*
|
|
24610
|
+
* A consumer that holds a resource for the life of a session needs to
|
|
24611
|
+
* be able to ask, because a session does not always end the way it
|
|
24612
|
+
* began. Measured on this hub 2026-09-13: an Echo that got stuck never
|
|
24613
|
+
* sent `SessionDisconnected`, so the Alexa exporter's
|
|
24614
|
+
* `releaseEgressTranscode` never ran, and a 2304x1296 HEVC to 720p
|
|
24615
|
+
* H.264 transcode kept running for NOBODY for more than twenty
|
|
24616
|
+
* minutes. The WebRTC session had logged `WebRTC session closed`
|
|
24617
|
+
* minutes earlier — the broker knew; the holder had no way to ask.
|
|
24618
|
+
*
|
|
24619
|
+
* `false` for a session id the provider has never heard of, which is
|
|
24620
|
+
* the same answer as "it ended": either way nothing is holding it up.
|
|
24621
|
+
*/
|
|
24622
|
+
alive: boolean()
|
|
24623
|
+
}));
|
|
24420
24624
|
object({
|
|
24421
24625
|
/** All accessory children of the parent. */
|
|
24422
24626
|
childDeviceIds: array(number()).readonly(),
|
|
@@ -36981,6 +37185,12 @@ Object.freeze({
|
|
|
36981
37185
|
addonId: null,
|
|
36982
37186
|
access: "create"
|
|
36983
37187
|
},
|
|
37188
|
+
"streamBroker.reportStreamSignal": {
|
|
37189
|
+
capName: "stream-broker",
|
|
37190
|
+
capScope: "system",
|
|
37191
|
+
addonId: null,
|
|
37192
|
+
access: "create"
|
|
37193
|
+
},
|
|
36984
37194
|
"streamBroker.restartProfile": {
|
|
36985
37195
|
capName: "stream-broker",
|
|
36986
37196
|
capScope: "system",
|
|
@@ -37065,6 +37275,12 @@ Object.freeze({
|
|
|
37065
37275
|
addonId: null,
|
|
37066
37276
|
access: "create"
|
|
37067
37277
|
},
|
|
37278
|
+
"streamSignals.listSignals": {
|
|
37279
|
+
capName: "stream-signals",
|
|
37280
|
+
capScope: "device",
|
|
37281
|
+
addonId: null,
|
|
37282
|
+
access: "view"
|
|
37283
|
+
},
|
|
37068
37284
|
"switch.setState": {
|
|
37069
37285
|
capName: "switch",
|
|
37070
37286
|
capScope: "device",
|
|
@@ -39437,6 +39653,11 @@ Object.freeze({
|
|
|
39437
39653
|
form: "single",
|
|
39438
39654
|
optional: false
|
|
39439
39655
|
}],
|
|
39656
|
+
"streamBroker.reportStreamSignal": [{
|
|
39657
|
+
name: "deviceId",
|
|
39658
|
+
form: "single",
|
|
39659
|
+
optional: false
|
|
39660
|
+
}],
|
|
39440
39661
|
"streamBroker.restartProfile": [{
|
|
39441
39662
|
name: "deviceId",
|
|
39442
39663
|
form: "single",
|
|
@@ -87058,6 +87279,123 @@ function clearPairingFiles(accessoryUuid, logger) {
|
|
|
87058
87279
|
} });
|
|
87059
87280
|
}
|
|
87060
87281
|
}
|
|
87282
|
+
/**
|
|
87283
|
+
* Whether this device's accessory belongs on the bridge.
|
|
87284
|
+
*
|
|
87285
|
+
* A camera is `false` whatever the operator picked — the answer is HomeKit's,
|
|
87286
|
+
* not ours, and an operator who switched it on before the field was gated must
|
|
87287
|
+
* not end up with a camera nobody can pair.
|
|
87288
|
+
*
|
|
87289
|
+
* Absent means ON for everything else: the field did not exist for entries
|
|
87290
|
+
* persisted before it, and the default the operator asked for is the bridge.
|
|
87291
|
+
*/
|
|
87292
|
+
function shouldBridge(input) {
|
|
87293
|
+
if (input.mapperKind === "camera") return false;
|
|
87294
|
+
return input.useBridge !== false;
|
|
87295
|
+
}
|
|
87296
|
+
/** Whether the bridge has room for one more. */
|
|
87297
|
+
function bridgeHasRoom(current) {
|
|
87298
|
+
return current < 149;
|
|
87299
|
+
}
|
|
87300
|
+
//#endregion
|
|
87301
|
+
//#region src/bridge-host.ts
|
|
87302
|
+
/**
|
|
87303
|
+
* THE bridge accessory — one per node, created on demand, holding every
|
|
87304
|
+
* non-camera accessory the operator routed onto it.
|
|
87305
|
+
*
|
|
87306
|
+
* One mDNS advertisement, one HAP connection, one pairing, N accessories
|
|
87307
|
+
* inside. The alternative — what this addon did until now — gives every
|
|
87308
|
+
* switch, sensor and alarm panel its own port, its own advertisement and its
|
|
87309
|
+
* own "Add Accessory" in the Home app. Cameras stay standalone, because
|
|
87310
|
+
* HomeKit forbids bridging them (`bridge-policy.ts`).
|
|
87311
|
+
*
|
|
87312
|
+
* ONE bridge, deliberately. The ceiling is 149 accessories
|
|
87313
|
+
* ({@link MAX_BRIDGED_ACCESSORIES}) and this hub exposes 46 devices in total,
|
|
87314
|
+
* cameras included; a second bridge is a thing to build when the count
|
|
87315
|
+
* approaches the ceiling, not before, and the refusal at the ceiling is
|
|
87316
|
+
* explicit rather than a library throw.
|
|
87317
|
+
*
|
|
87318
|
+
* The bridge is LAZY: it is published the first time an accessory needs it,
|
|
87319
|
+
* so a fleet of nothing but cameras advertises no empty bridge. It is not
|
|
87320
|
+
* unpublished when the last accessory leaves — an unpublish would drop the
|
|
87321
|
+
* pairing record the operator already entered a code for, and an empty bridge
|
|
87322
|
+
* in the Home app is a far smaller cost than a re-pair.
|
|
87323
|
+
*/
|
|
87324
|
+
var BridgeHost = class {
|
|
87325
|
+
opts;
|
|
87326
|
+
bridge = null;
|
|
87327
|
+
published = false;
|
|
87328
|
+
constructor(opts) {
|
|
87329
|
+
this.opts = opts;
|
|
87330
|
+
}
|
|
87331
|
+
/** The live bridge accessory, or `null` before anything needed one. */
|
|
87332
|
+
get accessory() {
|
|
87333
|
+
return this.bridge;
|
|
87334
|
+
}
|
|
87335
|
+
/** How many accessories are riding it right now. */
|
|
87336
|
+
get size() {
|
|
87337
|
+
return this.bridge?.bridgedAccessories.length ?? 0;
|
|
87338
|
+
}
|
|
87339
|
+
/**
|
|
87340
|
+
* Put an accessory on the bridge, publishing the bridge if this is the
|
|
87341
|
+
* first. Returns `false` — without throwing, and having logged — when the
|
|
87342
|
+
* bridge is full: the caller then falls back to standalone, which is worse
|
|
87343
|
+
* for the operator and still works.
|
|
87344
|
+
*/
|
|
87345
|
+
async add(accessory) {
|
|
87346
|
+
const bridge = this.ensure();
|
|
87347
|
+
if (!bridgeHasRoom(bridge.bridgedAccessories.length)) {
|
|
87348
|
+
this.opts.logger.warn("export-hap: the bridge is FULL — publishing standalone instead", { meta: {
|
|
87349
|
+
uuid: accessory.UUID,
|
|
87350
|
+
bridged: bridge.bridgedAccessories.length,
|
|
87351
|
+
max: 149
|
|
87352
|
+
} });
|
|
87353
|
+
return false;
|
|
87354
|
+
}
|
|
87355
|
+
bridge.addBridgedAccessory(accessory);
|
|
87356
|
+
await this.publishOnce();
|
|
87357
|
+
return true;
|
|
87358
|
+
}
|
|
87359
|
+
/** Take an accessory off the bridge. A bridged accessory is never
|
|
87360
|
+
* `unpublish`ed — it has no server of its own. */
|
|
87361
|
+
remove(accessory) {
|
|
87362
|
+
if (this.bridge === null) return;
|
|
87363
|
+
if (!this.bridge.bridgedAccessories.some((a) => a.UUID === accessory.UUID)) return;
|
|
87364
|
+
this.bridge.removeBridgedAccessory(accessory, false);
|
|
87365
|
+
}
|
|
87366
|
+
/** Whether this accessory is currently on the bridge. */
|
|
87367
|
+
holds(accessory) {
|
|
87368
|
+
return this.bridge?.bridgedAccessories.some((a) => a.UUID === accessory.UUID) ?? false;
|
|
87369
|
+
}
|
|
87370
|
+
/** Tear the bridge down — process shutdown only. */
|
|
87371
|
+
async dispose() {
|
|
87372
|
+
if (this.bridge === null || !this.published) return;
|
|
87373
|
+
await unpublishAccessory(this.bridge, this.opts.logger);
|
|
87374
|
+
this.published = false;
|
|
87375
|
+
}
|
|
87376
|
+
ensure() {
|
|
87377
|
+
if (this.bridge !== null) return this.bridge;
|
|
87378
|
+
const bridge = new import_dist.Accessory(this.opts.displayName, this.opts.uuid);
|
|
87379
|
+
bridge.category = import_dist.Categories.BRIDGE;
|
|
87380
|
+
this.bridge = bridge;
|
|
87381
|
+
return bridge;
|
|
87382
|
+
}
|
|
87383
|
+
async publishOnce() {
|
|
87384
|
+
if (this.published || this.bridge === null) return;
|
|
87385
|
+
if (this.opts.publish !== void 0) await this.opts.publish(this.bridge, this.opts.pincode);
|
|
87386
|
+
else await publishStandalone(this.bridge, {
|
|
87387
|
+
pincode: this.opts.pincode,
|
|
87388
|
+
port: 0,
|
|
87389
|
+
bind: this.opts.bind,
|
|
87390
|
+
logger: this.opts.logger
|
|
87391
|
+
});
|
|
87392
|
+
this.published = true;
|
|
87393
|
+
this.opts.logger.info("export-hap: the bridge is published", { meta: {
|
|
87394
|
+
displayName: this.opts.displayName,
|
|
87395
|
+
uuid: this.opts.uuid
|
|
87396
|
+
} });
|
|
87397
|
+
}
|
|
87398
|
+
};
|
|
87061
87399
|
//#endregion
|
|
87062
87400
|
//#region src/hap-setup-uri.ts
|
|
87063
87401
|
function errMsg$15(e) {
|
|
@@ -99465,6 +99803,19 @@ async function startFfmpegForSession(bctx, session, sessionId, video, advertised
|
|
|
99465
99803
|
} });
|
|
99466
99804
|
throw new Error(`export-hap: no enabled RTSP entries for device ${numericDeviceId}`);
|
|
99467
99805
|
}
|
|
99806
|
+
if (fit.kind === "transcode" && bctx.options.hapDeviceSettings?.allowTranscode === false) {
|
|
99807
|
+
startLog.warn("export-hap: stream start REFUSED — transcoding is switched off", {
|
|
99808
|
+
tags: { deviceId: numericDeviceId },
|
|
99809
|
+
meta: {
|
|
99810
|
+
sessionId,
|
|
99811
|
+
streamPreference: pref,
|
|
99812
|
+
negotiated: `${video.width}x${video.height}`,
|
|
99813
|
+
pickedProfile: fit.profile,
|
|
99814
|
+
pickedCodec: fit.picked.codec ?? "unknown"
|
|
99815
|
+
}
|
|
99816
|
+
});
|
|
99817
|
+
throw new Error(`export-hap: device ${numericDeviceId} needs a transcode and transcoding is switched off`);
|
|
99818
|
+
}
|
|
99468
99819
|
const picked = fit.picked;
|
|
99469
99820
|
const rtspUrl = picked.url;
|
|
99470
99821
|
const slot = brokerStreams.find((s) => s.profile === fit.profile);
|
|
@@ -102584,6 +102935,12 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
102584
102935
|
* hardware init.
|
|
102585
102936
|
*/
|
|
102586
102937
|
decodeMemos = createHapDecodeMemos();
|
|
102938
|
+
/**
|
|
102939
|
+
* THE bridge. Lazily created and published the first time a non-camera
|
|
102940
|
+
* accessory needs it; never torn down while the addon runs, because an
|
|
102941
|
+
* unpublish would drop a pairing the operator already entered a code for.
|
|
102942
|
+
*/
|
|
102943
|
+
bridgeHost = null;
|
|
102587
102944
|
constructor() {
|
|
102588
102945
|
super({ ...DEFAULT_CONFIG });
|
|
102589
102946
|
}
|
|
@@ -102591,6 +102948,13 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
102591
102948
|
const identity = await this.ensureIdentity();
|
|
102592
102949
|
this.pincode = identity.pincode;
|
|
102593
102950
|
this.bind = this.config.interfaceName || void 0;
|
|
102951
|
+
this.bridgeHost = new BridgeHost({
|
|
102952
|
+
displayName: this.config.bridgeName,
|
|
102953
|
+
uuid: identity.uuid,
|
|
102954
|
+
pincode: identity.pincode,
|
|
102955
|
+
bind: this.bind,
|
|
102956
|
+
logger: this.ctx.logger
|
|
102957
|
+
});
|
|
102594
102958
|
try {
|
|
102595
102959
|
await initHapStorage(path.join(this.ctx.dataDir, "hap-store"));
|
|
102596
102960
|
} catch (err) {
|
|
@@ -102619,6 +102983,7 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
102619
102983
|
}
|
|
102620
102984
|
this.ctx.addDisposer(async () => {
|
|
102621
102985
|
await this.detachAll();
|
|
102986
|
+
await this.bridgeHost?.dispose();
|
|
102622
102987
|
});
|
|
102623
102988
|
this.subscribeDeviceProvisionedForReconcile();
|
|
102624
102989
|
this.subscribeDeviceReadyForReconcile();
|
|
@@ -102775,16 +103140,24 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
102775
103140
|
decodeMemos: this.decodeMemos,
|
|
102776
103141
|
hapDeviceSettings: {
|
|
102777
103142
|
streamPreference: entrySettings.streamPreference ?? "auto",
|
|
102778
|
-
hksvRecording: resolveHksvRecording(entrySettings)
|
|
103143
|
+
hksvRecording: resolveHksvRecording(entrySettings),
|
|
103144
|
+
allowTranscode: entrySettings.allowTranscode !== false
|
|
102779
103145
|
}
|
|
102780
103146
|
}
|
|
102781
103147
|
});
|
|
102782
|
-
|
|
102783
|
-
|
|
102784
|
-
|
|
102785
|
-
bind: this.bind,
|
|
102786
|
-
logger: this.ctx.logger
|
|
103148
|
+
const wantsBridge = shouldBridge({
|
|
103149
|
+
mapperKind: entry.mapperKind,
|
|
103150
|
+
useBridge: entry.settings?.useBridge
|
|
102787
103151
|
});
|
|
103152
|
+
for (const accessory of mapper.accessories) {
|
|
103153
|
+
if (wantsBridge && this.bridgeHost !== null && await this.bridgeHost.add(accessory)) continue;
|
|
103154
|
+
await publishStandalone(accessory, {
|
|
103155
|
+
pincode: this.pincode,
|
|
103156
|
+
port: 0,
|
|
103157
|
+
bind: this.bind,
|
|
103158
|
+
logger: this.ctx.logger
|
|
103159
|
+
});
|
|
103160
|
+
}
|
|
102788
103161
|
this.exposed.set(entry.deviceId, mapper);
|
|
102789
103162
|
return { childAccessoryUuids: [] };
|
|
102790
103163
|
}
|
|
@@ -102797,7 +103170,13 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
102797
103170
|
const mapper = this.exposed.get(deviceId);
|
|
102798
103171
|
if (!mapper) return;
|
|
102799
103172
|
this.exposed.delete(deviceId);
|
|
102800
|
-
for (const accessory of mapper.accessories)
|
|
103173
|
+
for (const accessory of mapper.accessories) {
|
|
103174
|
+
if (this.bridgeHost?.holds(accessory) === true) {
|
|
103175
|
+
this.bridgeHost.remove(accessory);
|
|
103176
|
+
continue;
|
|
103177
|
+
}
|
|
103178
|
+
await unpublishAccessory(accessory, this.ctx.logger);
|
|
103179
|
+
}
|
|
102801
103180
|
await mapper.dispose().catch((err) => {
|
|
102802
103181
|
this.ctx.logger.withTags({ deviceId: Number.parseInt(deviceId, 10) }).warn("export-hap: mapper dispose failed", { meta: { error: errMsg(err) } });
|
|
102803
103182
|
});
|
|
@@ -103092,42 +103471,79 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
103092
103471
|
const enabledKey = `hap:${deviceId}:enabled`;
|
|
103093
103472
|
const streamPreferenceKey = `hap:${deviceId}:streamPreference`;
|
|
103094
103473
|
const hksvKey = `hap:${deviceId}:hksvRecording`;
|
|
103474
|
+
const useBridgeKey = `hap:${deviceId}:useBridge`;
|
|
103475
|
+
const allowTranscodeKey = `hap:${deviceId}:allowTranscode`;
|
|
103095
103476
|
const mapper = this.exposed.get(String(deviceId)) ?? null;
|
|
103096
103477
|
const paired = mapper ? accessoryPaired(mapper.accessory) : false;
|
|
103478
|
+
const bridged = mapper !== null && this.bridgeHost?.holds(mapper.accessory) === true;
|
|
103097
103479
|
const name = entry?.displayName ?? `Device ${deviceId}`;
|
|
103098
|
-
const
|
|
103480
|
+
const bridgePaired = this.bridgeHost?.accessory !== null && this.bridgeHost?.accessory !== void 0 ? accessoryPaired(this.bridgeHost.accessory) : false;
|
|
103481
|
+
const statusLabel = !enabled ? "Not exposed" : bridged ? bridgePaired ? `On the “${this.config.bridgeName}” bridge, as “${name}”` : `On the “${this.config.bridgeName}” bridge, as “${name}” — the BRIDGE is not paired yet. In iOS Home: + → Add Accessory → “${this.config.bridgeName}”, then enter setup code ${this.config.identity.pincode}. Every bridged device arrives with it.` : paired ? `Paired — exposed as “${name}”` : `Exposed as “${name}” — not paired yet. In iOS Home: + → Add Accessory → “${name}”, then enter setup code ${this.config.identity.pincode}.`;
|
|
103482
|
+
const qrSource = bridged ? this.bridgeHost?.accessory ?? null : mapper?.accessory ?? null;
|
|
103099
103483
|
let qrValue = "";
|
|
103100
|
-
if (
|
|
103101
|
-
qrValue =
|
|
103484
|
+
if (qrSource) try {
|
|
103485
|
+
qrValue = qrSource.setupURI();
|
|
103102
103486
|
} catch (err) {
|
|
103103
103487
|
this.ctx.logger.withTags({ deviceId }).debug("export-hap: setupURI failed for per-device contribution", { meta: { error: errMsg(err) } });
|
|
103104
103488
|
}
|
|
103105
|
-
const
|
|
103106
|
-
type: "select",
|
|
103107
|
-
key: streamPreferenceKey,
|
|
103108
|
-
label: "Source stream (HomeKit)",
|
|
103109
|
-
description: "Which camstack profile slot HomeKit pulls. Auto = the broker picks the slot closest to 1080p at session start.",
|
|
103110
|
-
options: HAP_STREAM_PREFERENCE_OPTIONS,
|
|
103111
|
-
required: true,
|
|
103112
|
-
value: settings.streamPreference,
|
|
103113
|
-
showWhen: {
|
|
103114
|
-
field: enabledKey,
|
|
103115
|
-
equals: true
|
|
103116
|
-
},
|
|
103117
|
-
immediate: true
|
|
103118
|
-
}, {
|
|
103489
|
+
const bridgeFields = kind === "camera" ? [] : [{
|
|
103119
103490
|
type: "boolean",
|
|
103120
|
-
key:
|
|
103121
|
-
label: "
|
|
103122
|
-
description: "
|
|
103491
|
+
key: useBridgeKey,
|
|
103492
|
+
label: "Export through the bridge",
|
|
103493
|
+
description: "Publish this device inside the shared CamStack bridge — one pairing and one entry in Add Accessory for every non-camera device, instead of one each. Turning this off gives it its own advertisement. Either way the switch REBUILDS the accessory and it must be added to the Home app again.",
|
|
103123
103494
|
style: "switch",
|
|
103124
|
-
value:
|
|
103495
|
+
value: shouldBridge({
|
|
103496
|
+
mapperKind: kind,
|
|
103497
|
+
useBridge: settings.useBridge
|
|
103498
|
+
}),
|
|
103125
103499
|
showWhen: {
|
|
103126
103500
|
field: enabledKey,
|
|
103127
103501
|
equals: true
|
|
103128
103502
|
},
|
|
103129
103503
|
immediate: true
|
|
103130
103504
|
}];
|
|
103505
|
+
const cameraFields = kind !== "camera" ? [] : [
|
|
103506
|
+
{
|
|
103507
|
+
type: "select",
|
|
103508
|
+
key: streamPreferenceKey,
|
|
103509
|
+
label: "Source stream (HomeKit)",
|
|
103510
|
+
description: "Which camstack profile slot HomeKit pulls. Auto = the broker picks the slot closest to 1080p at session start.",
|
|
103511
|
+
options: HAP_STREAM_PREFERENCE_OPTIONS,
|
|
103512
|
+
required: true,
|
|
103513
|
+
value: settings.streamPreference,
|
|
103514
|
+
showWhen: {
|
|
103515
|
+
field: enabledKey,
|
|
103516
|
+
equals: true
|
|
103517
|
+
},
|
|
103518
|
+
immediate: true
|
|
103519
|
+
},
|
|
103520
|
+
{
|
|
103521
|
+
type: "boolean",
|
|
103522
|
+
key: hksvKey,
|
|
103523
|
+
label: "HomeKit recording (Secure Video)",
|
|
103524
|
+
description: "Offer “Stream and Allow Recording” in iOS Home. Requires iCloud+ and a home hub. Keeps a continuous 8s prebuffer for this camera (~0.7% of one CPU core, H.264 sources only).",
|
|
103525
|
+
style: "switch",
|
|
103526
|
+
value: resolveHksvRecording(settings),
|
|
103527
|
+
showWhen: {
|
|
103528
|
+
field: enabledKey,
|
|
103529
|
+
equals: true
|
|
103530
|
+
},
|
|
103531
|
+
immediate: true
|
|
103532
|
+
},
|
|
103533
|
+
{
|
|
103534
|
+
type: "boolean",
|
|
103535
|
+
key: allowTranscodeKey,
|
|
103536
|
+
label: "Allow transcoding for HomeKit",
|
|
103537
|
+
description: "Let the hub re-encode this camera when the resolution HomeKit negotiated cannot be served by a direct copy. Off means only a stream that can be forwarded as-is is offered — cheaper, but a session HomeKit negotiates outside what the camera publishes will be refused instead of transcoded.",
|
|
103538
|
+
style: "switch",
|
|
103539
|
+
value: settings.allowTranscode !== false,
|
|
103540
|
+
showWhen: {
|
|
103541
|
+
field: enabledKey,
|
|
103542
|
+
equals: true
|
|
103543
|
+
},
|
|
103544
|
+
immediate: true
|
|
103545
|
+
}
|
|
103546
|
+
];
|
|
103131
103547
|
return {
|
|
103132
103548
|
tabs: [{
|
|
103133
103549
|
id: "export",
|
|
@@ -103172,6 +103588,7 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
103172
103588
|
value: enabled,
|
|
103173
103589
|
immediate: true
|
|
103174
103590
|
},
|
|
103591
|
+
...bridgeFields,
|
|
103175
103592
|
...cameraFields
|
|
103176
103593
|
]
|
|
103177
103594
|
}]
|
|
@@ -103197,14 +103614,20 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
103197
103614
|
const enabledKey = `hap:${deviceId}:enabled`;
|
|
103198
103615
|
const streamPreferenceKey = `hap:${deviceId}:streamPreference`;
|
|
103199
103616
|
const hksvKey = `hap:${deviceId}:hksvRecording`;
|
|
103617
|
+
const useBridgeKey = `hap:${deviceId}:useBridge`;
|
|
103618
|
+
const allowTranscodeKey = `hap:${deviceId}:allowTranscode`;
|
|
103200
103619
|
const enabledValue = enabledKey in patch ? Boolean(patch[enabledKey]) : wasEnabled;
|
|
103201
103620
|
const streamPreferenceRaw = streamPreferenceKey in patch ? patch[streamPreferenceKey] : current?.settings?.streamPreference;
|
|
103202
103621
|
const streamPreference = typeof streamPreferenceRaw === "string" && streamPreferenceRaw.trim().length > 0 ? streamPreferenceRaw : "auto";
|
|
103203
103622
|
const hksvRecording = hksvKey in patch ? Boolean(patch[hksvKey]) : resolveHksvRecording(current?.settings);
|
|
103623
|
+
const useBridge = useBridgeKey in patch ? Boolean(patch[useBridgeKey]) : current?.settings?.useBridge !== false;
|
|
103624
|
+
const allowTranscode = allowTranscodeKey in patch ? Boolean(patch[allowTranscodeKey]) : current?.settings?.allowTranscode !== false;
|
|
103204
103625
|
const nextSettings = {
|
|
103205
103626
|
...current?.settings ?? DEFAULT_DEVICE_SETTINGS,
|
|
103206
103627
|
streamPreference,
|
|
103207
|
-
hksvRecording
|
|
103628
|
+
hksvRecording,
|
|
103629
|
+
useBridge,
|
|
103630
|
+
allowTranscode
|
|
103208
103631
|
};
|
|
103209
103632
|
if (!enabledValue) {
|
|
103210
103633
|
if (wasEnabled) await this.unexposeDevice(deviceIdStr);
|
|
@@ -103217,8 +103640,17 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
103217
103640
|
}
|
|
103218
103641
|
const currentPref = current?.settings?.streamPreference ?? "auto";
|
|
103219
103642
|
const currentHksv = resolveHksvRecording(current?.settings);
|
|
103643
|
+
const mapperKind = current?.mapperKind ?? "generic";
|
|
103644
|
+
const wasBridged = shouldBridge({
|
|
103645
|
+
mapperKind,
|
|
103646
|
+
useBridge: current?.settings?.useBridge
|
|
103647
|
+
});
|
|
103648
|
+
const willBridge = shouldBridge({
|
|
103649
|
+
mapperKind,
|
|
103650
|
+
useBridge
|
|
103651
|
+
});
|
|
103220
103652
|
await this.updateEntrySettings(deviceIdStr, nextSettings);
|
|
103221
|
-
if (currentPref !== streamPreference || currentHksv !== hksvRecording) {
|
|
103653
|
+
if (currentPref !== streamPreference || currentHksv !== hksvRecording || wasBridged !== willBridge) {
|
|
103222
103654
|
log.info("export-hap: per-camera export settings changed — refreshing accessory", { meta: {
|
|
103223
103655
|
streamPreference: {
|
|
103224
103656
|
from: currentPref,
|
|
@@ -103227,10 +103659,14 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
103227
103659
|
hksvRecording: {
|
|
103228
103660
|
from: currentHksv,
|
|
103229
103661
|
to: hksvRecording
|
|
103662
|
+
},
|
|
103663
|
+
bridged: {
|
|
103664
|
+
from: wasBridged,
|
|
103665
|
+
to: willBridge
|
|
103230
103666
|
}
|
|
103231
103667
|
} });
|
|
103232
103668
|
try {
|
|
103233
|
-
await this.unexposeDevice(deviceIdStr, { clearPairing:
|
|
103669
|
+
await this.unexposeDevice(deviceIdStr, { clearPairing: wasBridged !== willBridge });
|
|
103234
103670
|
await this.exposeDevice(deviceIdStr);
|
|
103235
103671
|
} catch (err) {
|
|
103236
103672
|
log.warn("export-hap: failed to refresh accessory after a settings change", { meta: { error: errMsg(err) } });
|