@camstack/addon-export-hap 1.2.113 → 1.2.115
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 +770 -67
- package/dist/hap-export.addon.mjs +770 -67
- package/package.json +1 -1
package/dist/hap-export.addon.js
CHANGED
|
@@ -84,7 +84,7 @@ function carryForward(base, existing, keys) {
|
|
|
84
84
|
return out;
|
|
85
85
|
}
|
|
86
86
|
//#endregion
|
|
87
|
-
//#region ../types/dist/event-category-
|
|
87
|
+
//#region ../types/dist/event-category-BVDXG4tB.mjs
|
|
88
88
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
89
89
|
EventCategory["SystemBoot"] = "system.boot";
|
|
90
90
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -701,6 +701,20 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
701
701
|
* pull-reconcile from the provider's `getStatus` on reconnect. */
|
|
702
702
|
EventCategory["MeshNetworkChanged"] = "network.mesh.changed";
|
|
703
703
|
EventCategory["BackupCompleted"] = "backup.completed";
|
|
704
|
+
/**
|
|
705
|
+
* A whole backup RUN finished — every destination attempted, win or lose.
|
|
706
|
+
*
|
|
707
|
+
* `backup.completed` fires once per DESTINATION, which is the right grain for
|
|
708
|
+
* a progress UI and the wrong one for a notification: an operator with three
|
|
709
|
+
* destinations would be told three times. And a run where two of three
|
|
710
|
+
* destinations succeeded is not a clean success — a single "backup
|
|
711
|
+
* completed" that hid the failed one would be a lie, so the count of each is
|
|
712
|
+
* carried here and the message says both.
|
|
713
|
+
*
|
|
714
|
+
* Emitted by the backup orchestrator only after the destination loop, so a
|
|
715
|
+
* run that dies during the BUILD phase produces no completion at all.
|
|
716
|
+
*/
|
|
717
|
+
EventCategory["BackupRunCompleted"] = "backup.run-completed";
|
|
704
718
|
EventCategory["BackupRestored"] = "backup.restored";
|
|
705
719
|
EventCategory["NotificationDispatched"] = "notification.dispatched";
|
|
706
720
|
EventCategory["NotificationFailed"] = "notification.failed";
|
|
@@ -5431,7 +5445,7 @@ var ZodIssueCode = {
|
|
|
5431
5445
|
var ZodFirstPartyTypeKind;
|
|
5432
5446
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5433
5447
|
//#endregion
|
|
5434
|
-
//#region ../types/dist/sleep-
|
|
5448
|
+
//#region ../types/dist/sleep-BDR76Ykr.mjs
|
|
5435
5449
|
/**
|
|
5436
5450
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5437
5451
|
* window to float samples (D455).
|
|
@@ -8059,6 +8073,28 @@ var EncodeProfileSchema = object({
|
|
|
8059
8073
|
outputArgs: array(string()).optional()
|
|
8060
8074
|
});
|
|
8061
8075
|
/**
|
|
8076
|
+
* THE target rule: which of two sizes serves a consumer better.
|
|
8077
|
+
*
|
|
8078
|
+
* "Prefer at or above the target so the consumer downscales instead of
|
|
8079
|
+
* upscaling; among those the SMALLEST, because the extra pixels are thrown
|
|
8080
|
+
* away and the decode is not; among the rest the LARGEST, because it is the
|
|
8081
|
+
* closest we can get." One sentence, and until now it was written twice — once
|
|
8082
|
+
* here in lines, once in `stream-selection.ts` in pixels, for the same two
|
|
8083
|
+
* exporters. The two agreed, which is luck, not a property.
|
|
8084
|
+
*
|
|
8085
|
+
* The `size` is whatever measure the caller ranks by: the cap ranks by LINES
|
|
8086
|
+
* (a consumer's requirement is stated in p), the RTSP picker by PIXELS (it
|
|
8087
|
+
* compares entries of possibly different aspect). The rule is the same either
|
|
8088
|
+
* way and the measure is the caller's business.
|
|
8089
|
+
*
|
|
8090
|
+
* Returns a sort delta: negative when `a` should come first.
|
|
8091
|
+
*/
|
|
8092
|
+
function compareToTarget(a, b, target) {
|
|
8093
|
+
const aReaches = a >= target;
|
|
8094
|
+
if (aReaches !== b >= target) return aReaches ? -1 : 1;
|
|
8095
|
+
return aReaches ? a - b : b - a;
|
|
8096
|
+
}
|
|
8097
|
+
/**
|
|
8062
8098
|
* The shape every live egress starts from: H.264 Baseline 3.1 at 720p25.
|
|
8063
8099
|
* Baseline because it is the one profile every consumer in this repo decodes
|
|
8064
8100
|
* (Echo, iOS, an old browser); 3.1 because that is what the SDPs advertise.
|
|
@@ -9971,6 +10007,47 @@ var LogChannelWindowSchema = object({
|
|
|
9971
10007
|
/** `null` = every camera. A non-empty list narrows to those numeric ids. */
|
|
9972
10008
|
deviceIds: array(number().int()).readonly().nullable()
|
|
9973
10009
|
});
|
|
10010
|
+
/**
|
|
10011
|
+
* Shared stream-selection picker for export addons.
|
|
10012
|
+
*
|
|
10013
|
+
* Both `addon-export-alexa` and `addon-export-hap` resolve the
|
|
10014
|
+
* operator's `streamPreference` setting against the broker's RTSP
|
|
10015
|
+
* entries before dialling a camera. Each addon used to roll its own:
|
|
10016
|
+
* Alexa had `pickPreferredRtspEntry` under `handlers/`, HAP had an
|
|
10017
|
+
* inline `"prefer /mid, then /high, then first"` chain inside its
|
|
10018
|
+
* camera-streams mapper. The chains drifted (Alexa honoured
|
|
10019
|
+
* `streamPreference`, HAP didn't; only Alexa got the smart
|
|
10020
|
+
* resolution-targeted auto-pick) and the cross-addon import rule
|
|
10021
|
+
* blocks deduping in either direction.
|
|
10022
|
+
*
|
|
10023
|
+
* Lifting the picker into `@camstack/types` lets every exporter call
|
|
10024
|
+
* the same code path with the consumer's target resolution baked into
|
|
10025
|
+
* the call site — Alexa passes 1280×720, HomeKit passes 1920×1080,
|
|
10026
|
+
* the picker handles the rest.
|
|
10027
|
+
*
|
|
10028
|
+
* Selection algorithm:
|
|
10029
|
+
* - pref === '<profile>' → profile-keyed entries (from
|
|
10030
|
+
* `getProfileRtspEntries`) match on `e.profile`;
|
|
10031
|
+
* legacy raw entries match on the brokerId
|
|
10032
|
+
* suffix (`brokerId` ENDS WITH `/${pref}`, shape
|
|
10033
|
+
* `${deviceId}/${camStreamId}`). Addons store the
|
|
10034
|
+
* bare profile/camStream id in their
|
|
10035
|
+
* `ExportDeviceSettings.streamPreference`. Falls
|
|
10036
|
+
* back to 'auto' when no enabled entry matches
|
|
10037
|
+
* either way.
|
|
10038
|
+
* - pref === 'auto' → when `targetResolution` is given, pick the
|
|
10039
|
+
* entry whose source resolution is closest to
|
|
10040
|
+
* it (prefer ≥ target so the consumer
|
|
10041
|
+
* downscales instead of upscaling). Without a
|
|
10042
|
+
* target, fall back to first-enabled. If no
|
|
10043
|
+
* entry advertises a resolution at all
|
|
10044
|
+
* (broker hasn't probed yet), also fall back
|
|
10045
|
+
* to first-enabled so cold start still serves.
|
|
10046
|
+
*
|
|
10047
|
+
* Returns `null` when nothing is publishable — callers fold that into
|
|
10048
|
+
* the consumer's "no stream" error (Alexa: STREAM_TYPE_UNSUPPORTED;
|
|
10049
|
+
* HAP: a thrown error inside `startFfmpegForSession`).
|
|
10050
|
+
*/
|
|
9974
10051
|
function pickPreferredRtspEntry(entries, pref, deviceId, options = {}) {
|
|
9975
10052
|
if (entries.length === 0) return null;
|
|
9976
10053
|
const prefix = `${deviceId}/`;
|
|
@@ -10000,30 +10077,23 @@ function pickPreferredRtspEntry(entries, pref, deviceId, options = {}) {
|
|
|
10000
10077
|
return toPicked(eligible[0]);
|
|
10001
10078
|
}
|
|
10002
10079
|
/**
|
|
10003
|
-
* Pick the entry whose `resolution` is closest to `target
|
|
10004
|
-
*
|
|
10005
|
-
*
|
|
10006
|
-
*
|
|
10007
|
-
*
|
|
10080
|
+
* Pick the entry whose `resolution` is closest to `target`, by the ONE target
|
|
10081
|
+
* rule ({@link compareToTarget}): prefer at or above the target so the consumer
|
|
10082
|
+
* downscales instead of upscaling; among those the smallest; among the rest the
|
|
10083
|
+
* largest.
|
|
10084
|
+
*
|
|
10085
|
+
* This function used to implement that rule itself, in pixels, while
|
|
10086
|
+
* `rankStreams` implemented it again in lines — the same sentence written twice
|
|
10087
|
+
* for the same two exporters, agreeing by luck rather than by construction.
|
|
10088
|
+
* Only the MEASURE is this picker's own: it compares whole pixel counts because
|
|
10089
|
+
* its entries can differ in aspect, where the cap's requirement is stated in p.
|
|
10008
10090
|
*/
|
|
10009
10091
|
function pickClosestResolution(entries, target) {
|
|
10010
10092
|
const targetPixels = target.width * target.height;
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
const pixels = e.resolution.width * e.resolution.height;
|
|
10016
|
-
if (pixels >= targetPixels) {
|
|
10017
|
-
if (!bestAbove || pixels < bestAbove.pixels) bestAbove = {
|
|
10018
|
-
entry: e,
|
|
10019
|
-
pixels
|
|
10020
|
-
};
|
|
10021
|
-
} else if (!bestBelow || pixels > bestBelow.pixels) bestBelow = {
|
|
10022
|
-
entry: e,
|
|
10023
|
-
pixels
|
|
10024
|
-
};
|
|
10025
|
-
}
|
|
10026
|
-
return bestAbove?.entry ?? bestBelow?.entry;
|
|
10093
|
+
return [...entries.flatMap((entry) => entry.resolution === void 0 ? [] : [{
|
|
10094
|
+
entry,
|
|
10095
|
+
pixels: entry.resolution.width * entry.resolution.height
|
|
10096
|
+
}])].sort((a, b) => compareToTarget(a.pixels, b.pixels, targetPixels))[0]?.entry;
|
|
10027
10097
|
}
|
|
10028
10098
|
var MODEL_FORMATS = [
|
|
10029
10099
|
"onnx",
|
|
@@ -12211,6 +12281,58 @@ method(ListInputSchema, array(BrokerInfoSchema$1)), method(GetInputSchema, Broke
|
|
|
12211
12281
|
auth: "admin"
|
|
12212
12282
|
}), method(GetStateInputSchema, unknown().nullable()), method(_void(), RegistryStatusSchema);
|
|
12213
12283
|
DeviceType.Camera;
|
|
12284
|
+
/**
|
|
12285
|
+
* The signals a device can emit to WAKE its own stream.
|
|
12286
|
+
*
|
|
12287
|
+
* A camera whose stream is built on demand sleeps until something asks for it,
|
|
12288
|
+
* and "something" cannot be a consumer that is merely attached — a Frigate-style
|
|
12289
|
+
* puller holds a session open for ever, and treating that as demand would keep
|
|
12290
|
+
* a battery camera awake for ever, which is the whole thing the battery is for
|
|
12291
|
+
* (D173). So the wake has to come from the CAMERA: an event it noticed by
|
|
12292
|
+
* itself, with no stream running.
|
|
12293
|
+
*
|
|
12294
|
+
* ## The vocabulary is the PROVIDER'S, not ours
|
|
12295
|
+
*
|
|
12296
|
+
* Like `consumables`, this cap declares no vocabulary of its own. A provider
|
|
12297
|
+
* names each signal with a `code` it chooses and a `label` an operator reads.
|
|
12298
|
+
* Reolink offers motion and camera-native detection; another provider may offer
|
|
12299
|
+
* a tamper, a doorbell press, a PIR, or something no camera in this fleet has
|
|
12300
|
+
* yet. A fixed enum here would mean every new signal is a framework release.
|
|
12301
|
+
*
|
|
12302
|
+
* It is deliberately NOT derived from the caps a device already binds. Whether
|
|
12303
|
+
* a camera CAN push firmware motion is expressed by `motionSources` containing
|
|
12304
|
+
* `'onboard'`, and whether it does AI on-camera by the `native-object-detection`
|
|
12305
|
+
* binding — but both answer "what drives the detection pipeline", which is a
|
|
12306
|
+
* different question from "what may wake a sleeping stream". A camera can do
|
|
12307
|
+
* the first and not be trusted with the second, and the operator picks per
|
|
12308
|
+
* camera. Two questions, two authorities.
|
|
12309
|
+
*
|
|
12310
|
+
* ## Availability is not permission
|
|
12311
|
+
*
|
|
12312
|
+
* `listSignals` says what the device CAN emit. Whether a given signal actually
|
|
12313
|
+
* wakes the stream is the operator's per-camera choice, held by the broker
|
|
12314
|
+
* alongside the cooldown — see the stream-broker cap's wake settings. A
|
|
12315
|
+
* provider declaring a signal is not a provider enabling it.
|
|
12316
|
+
*/
|
|
12317
|
+
/** One signal a device can emit. */
|
|
12318
|
+
var StreamSignalSchema = object({
|
|
12319
|
+
/** Stable id chosen by the provider, e.g. `'motion'`, `'person'`, `'tamper'`. */
|
|
12320
|
+
code: string().min(1),
|
|
12321
|
+
/** What an operator reads in the picker. The provider's own wording. */
|
|
12322
|
+
label: string().min(1),
|
|
12323
|
+
/**
|
|
12324
|
+
* Whether the provider recommends this signal ON when a camera is first set
|
|
12325
|
+
* up. A provider knows which of its signals are cheap and reliable; an
|
|
12326
|
+
* operator should not have to discover that by trial. Reolink recommends
|
|
12327
|
+
* both of its own.
|
|
12328
|
+
*/
|
|
12329
|
+
recommended: boolean()
|
|
12330
|
+
});
|
|
12331
|
+
object({
|
|
12332
|
+
signals: array(StreamSignalSchema),
|
|
12333
|
+
lastFetchedAt: number()
|
|
12334
|
+
});
|
|
12335
|
+
Object.values(DeviceType), method(_void(), array(StreamSignalSchema).readonly());
|
|
12214
12336
|
/** Stream delivery format. (Relocated from the retired `streaming-engine` cap.) */
|
|
12215
12337
|
var StreamFormatSchema = _enum([
|
|
12216
12338
|
"webrtc",
|
|
@@ -12607,6 +12729,22 @@ var EgressTranscodeSchema = object({
|
|
|
12607
12729
|
camStreamId: string().nullable()
|
|
12608
12730
|
});
|
|
12609
12731
|
method(object({
|
|
12732
|
+
deviceId: number().int().nonnegative(),
|
|
12733
|
+
/** The provider's signal code. */
|
|
12734
|
+
code: string().min(1),
|
|
12735
|
+
/** Ms epoch. Absent ⇒ now. */
|
|
12736
|
+
at: number().optional()
|
|
12737
|
+
}), object({
|
|
12738
|
+
/** Whether the broker acted on it, and if not, why. */
|
|
12739
|
+
accepted: boolean(),
|
|
12740
|
+
reason: _enum([
|
|
12741
|
+
"woke",
|
|
12742
|
+
"hold-extended",
|
|
12743
|
+
"not-enabled",
|
|
12744
|
+
"no-consumer",
|
|
12745
|
+
"unknown-code"
|
|
12746
|
+
])
|
|
12747
|
+
}), { kind: "mutation" }), method(object({
|
|
12610
12748
|
deviceId: number().int().nonnegative(),
|
|
12611
12749
|
camStreamId: string().min(1),
|
|
12612
12750
|
kind: CamStreamKindSchema,
|
|
@@ -12861,6 +12999,16 @@ var PickStreamRequirementsSchema = object({
|
|
|
12861
12999
|
acceptCodecs: array(StreamCodecSchema).readonly().optional(),
|
|
12862
13000
|
/** Minimum vertical resolution. Streams shorter than this are dropped. */
|
|
12863
13001
|
minHeight: number().int().positive().optional(),
|
|
13002
|
+
/**
|
|
13003
|
+
* Maximum vertical resolution. Streams TALLER than this are dropped.
|
|
13004
|
+
*
|
|
13005
|
+
* A consumer can have a ceiling as real as its floor: Alexa documents
|
|
13006
|
+
* 480p to 1080p, and a 4K stream is as unusable to an Echo as a 360p one.
|
|
13007
|
+
* Without this the ceiling had to be re-implemented by every caller — and
|
|
13008
|
+
* one caller implementing it privately is how a second scoring authority
|
|
13009
|
+
* gets born.
|
|
13010
|
+
*/
|
|
13011
|
+
maxHeight: number().int().positive().optional(),
|
|
12864
13012
|
/** Minimum horizontal resolution. */
|
|
12865
13013
|
minWidth: number().int().positive().optional(),
|
|
12866
13014
|
/**
|
|
@@ -12877,7 +13025,22 @@ var PickStreamRequirementsSchema = object({
|
|
|
12877
13025
|
* transcoded" guard: if the device is already serving the consumer's
|
|
12878
13026
|
* codec end-to-end, there's nothing to optimise.
|
|
12879
13027
|
*/
|
|
12880
|
-
requireSiblingCodec: array(StreamCodecSchema).readonly().optional()
|
|
13028
|
+
requireSiblingCodec: array(StreamCodecSchema).readonly().optional(),
|
|
13029
|
+
/**
|
|
13030
|
+
* Whether a stream the consumer CANNOT decode may still be picked, on the
|
|
13031
|
+
* understanding that it will be transcoded.
|
|
13032
|
+
*
|
|
13033
|
+
* Default `false` — today's behaviour, and the right one for a bypass
|
|
13034
|
+
* question ("is there a stream I can forward untouched?"). Set `true` to
|
|
13035
|
+
* ask the larger question: "what is the best stream for me, transcoding if
|
|
13036
|
+
* I must?" A stream that satisfies `acceptCodecs` always outranks one that
|
|
13037
|
+
* does not, so a passthrough is never lost to a transcode; the answer says
|
|
13038
|
+
* which it is in {@link PickedCamStreamSchema.transcodes}.
|
|
13039
|
+
*
|
|
13040
|
+
* This is what lets one picker serve both the bypass and the full source
|
|
13041
|
+
* choice, instead of a consumer scoring privately when the bypass misses.
|
|
13042
|
+
*/
|
|
13043
|
+
allowTranscode: boolean().optional()
|
|
12881
13044
|
}).readonly();
|
|
12882
13045
|
var PickStreamPreferencesSchema = object({
|
|
12883
13046
|
/**
|
|
@@ -12891,12 +13054,32 @@ var PickStreamPreferencesSchema = object({
|
|
|
12891
13054
|
* picks the tallest stream; `'lowest'` picks the shortest (used by
|
|
12892
13055
|
* memory-constrained consumers / Apple Home guest sessions).
|
|
12893
13056
|
*/
|
|
12894
|
-
resolutionPreference: _enum(["highest", "lowest"]).optional()
|
|
13057
|
+
resolutionPreference: _enum(["highest", "lowest"]).optional(),
|
|
13058
|
+
/**
|
|
13059
|
+
* The height the consumer actually wants to DELIVER.
|
|
13060
|
+
*
|
|
13061
|
+
* Not a constraint — an ordering. With it set, the SMALLEST stream at or
|
|
13062
|
+
* above the target wins, and only if nothing reaches it does the tallest
|
|
13063
|
+
* take over. Pulling 1296 lines to draw 720 on a 1280x800 Echo panel costs
|
|
13064
|
+
* a decode and buys nothing, and `resolutionPreference: 'highest'` cannot
|
|
13065
|
+
* express that: it says "as big as possible", which is a different wish.
|
|
13066
|
+
*
|
|
13067
|
+
* Ignored when absent, so every existing caller keeps its ordering.
|
|
13068
|
+
*/
|
|
13069
|
+
targetHeight: number().int().positive().optional()
|
|
12895
13070
|
}).readonly();
|
|
12896
13071
|
var PickedCamStreamSchema = object({
|
|
12897
13072
|
camStreamId: string(),
|
|
12898
13073
|
codec: string().optional(),
|
|
12899
13074
|
resolution: CamStreamResolutionSchema.optional(),
|
|
13075
|
+
/**
|
|
13076
|
+
* Whether serving this stream requires a decode + re-encode.
|
|
13077
|
+
*
|
|
13078
|
+
* `false` is a stream the consumer can take as it stands. Only ever `true`
|
|
13079
|
+
* when the caller asked for it with `allowTranscode`, so a caller that did
|
|
13080
|
+
* not ask cannot be handed a cost it never agreed to pay.
|
|
13081
|
+
*/
|
|
13082
|
+
transcodes: boolean(),
|
|
12900
13083
|
/** One-line explanation of why this stream won — for logs / debug UI. */
|
|
12901
13084
|
reason: string()
|
|
12902
13085
|
});
|
|
@@ -17166,6 +17349,8 @@ var NcSystemEventKindSchema = _enum([
|
|
|
17166
17349
|
"device-enabled",
|
|
17167
17350
|
"device-battery-low",
|
|
17168
17351
|
"device-battery-normal",
|
|
17352
|
+
"device-consumable-low",
|
|
17353
|
+
"device-consumable-normal",
|
|
17169
17354
|
"stream-online",
|
|
17170
17355
|
"stream-offline",
|
|
17171
17356
|
"node-online",
|
|
@@ -17184,6 +17369,7 @@ var NcSystemEventKindSchema = _enum([
|
|
|
17184
17369
|
"addon-updated",
|
|
17185
17370
|
"server-updated",
|
|
17186
17371
|
"export-completed",
|
|
17372
|
+
"backup-completed",
|
|
17187
17373
|
"camera-online",
|
|
17188
17374
|
"camera-offline",
|
|
17189
17375
|
"camera-disabled",
|
|
@@ -18506,6 +18692,48 @@ var NcAlarmConfigSchema = object({
|
|
|
18506
18692
|
settings: NcAlarmSettingsSchema,
|
|
18507
18693
|
coverage: array(NcAlarmModeCoverageSchema)
|
|
18508
18694
|
});
|
|
18695
|
+
/**
|
|
18696
|
+
* ONE rule's demand on ONE camera's clip ring.
|
|
18697
|
+
*
|
|
18698
|
+
* A rule, not a camera: the broker takes the MAX over the asks that reach a
|
|
18699
|
+
* camera, so the answer stays a faithful description of the rules and the
|
|
18700
|
+
* bounding (the byte budget, the broker's own ceiling) stays where the cost
|
|
18701
|
+
* lives. A camera that appears in no ask is being told **nothing** — which is
|
|
18702
|
+
* a different thing from never having been told, and only the envelope
|
|
18703
|
+
* (`rulesLoaded`) can tell those apart.
|
|
18704
|
+
*/
|
|
18705
|
+
var NcClipRetentionAskSchema = object({
|
|
18706
|
+
/**
|
|
18707
|
+
* The camera this ask is about. **Absent = every camera**, which is what a
|
|
18708
|
+
* rule with no `conditions.devices` means: it can fire anywhere, so it is
|
|
18709
|
+
* asking everywhere.
|
|
18710
|
+
*/
|
|
18711
|
+
deviceId: number().int().nonnegative().optional(),
|
|
18712
|
+
/** Seconds of history the rule needs held for it. Never zero — a rule that
|
|
18713
|
+
* needs nothing produces no ask at all. */
|
|
18714
|
+
seconds: number().min(0).max(60),
|
|
18715
|
+
/** The profile the rule cuts from, when it named one. Absent = the cheapest
|
|
18716
|
+
* assigned, which is what the cut defaults to. */
|
|
18717
|
+
profile: CamProfileSchema.optional(),
|
|
18718
|
+
/** Who is asking — so a retention the operator did not expect names a rule. */
|
|
18719
|
+
ruleId: string(),
|
|
18720
|
+
ruleName: string(),
|
|
18721
|
+
/** Why this many seconds: the rule's own window, or the occupancy ceiling. */
|
|
18722
|
+
reason: _enum(["window", "occupancy"])
|
|
18723
|
+
});
|
|
18724
|
+
/**
|
|
18725
|
+
* The whole answer, with the one bit that keeps absence from reading as zero.
|
|
18726
|
+
*
|
|
18727
|
+
* `rulesLoaded` is false until the rule ledger has completed a load at least
|
|
18728
|
+
* once. A centre that is up but has not read its rules yet answers with an
|
|
18729
|
+
* empty ask list that means nothing at all — applying it would drop every
|
|
18730
|
+
* camera's ring to zero for the first events after a restart, which is the
|
|
18731
|
+
* footage this mechanism exists to keep.
|
|
18732
|
+
*/
|
|
18733
|
+
var NcClipRetentionPlanSchema = object({
|
|
18734
|
+
rulesLoaded: boolean(),
|
|
18735
|
+
asks: array(NcClipRetentionAskSchema).readonly()
|
|
18736
|
+
});
|
|
18509
18737
|
method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), method(object({ ruleId: string() }), object({ rule: NcRuleSchema.nullable() }), { auth: "admin" }), method(object({ rule: NcRuleInputSchema }), object({ rule: NcRuleSchema }), {
|
|
18510
18738
|
kind: "mutation",
|
|
18511
18739
|
auth: "admin",
|
|
@@ -18526,7 +18754,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
18526
18754
|
}), object({ success: literal(true) }), {
|
|
18527
18755
|
kind: "mutation",
|
|
18528
18756
|
auth: "admin"
|
|
18529
|
-
}), method(object({}), object({ mutedDeviceIds: array(number().int()).readonly() }), { auth: "admin" }), method(object({
|
|
18757
|
+
}), method(object({}), NcClipRetentionPlanSchema, { auth: "admin" }), method(object({}), object({ mutedDeviceIds: array(number().int()).readonly() }), { auth: "admin" }), method(object({
|
|
18530
18758
|
deviceId: number().int(),
|
|
18531
18759
|
muted: boolean()
|
|
18532
18760
|
}), object({ success: literal(true) }), {
|
|
@@ -21060,6 +21288,33 @@ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
|
|
|
21060
21288
|
* solid is this track", cheaper than re-deriving it from a trajectory. */
|
|
21061
21289
|
framesMatched: number().int()
|
|
21062
21290
|
})).readonly() });
|
|
21291
|
+
/**
|
|
21292
|
+
* The long-term series a camera produces. A closed union so a typo cannot
|
|
21293
|
+
* invent one, and the ONE declaration of it — the addon's `AnalyticsLtsSeries`
|
|
21294
|
+
* is an alias of this, not a second list.
|
|
21295
|
+
*/
|
|
21296
|
+
var AnalyticsLtsSeriesSchema = _enum([
|
|
21297
|
+
"motion",
|
|
21298
|
+
"audio-dbfs",
|
|
21299
|
+
"battery",
|
|
21300
|
+
"occupancy"
|
|
21301
|
+
]);
|
|
21302
|
+
/**
|
|
21303
|
+
* One closed 5-minute bucket of a long-term series.
|
|
21304
|
+
*
|
|
21305
|
+
* `samples` is how many readings the bucket folded — it is the ACTIVITY for a
|
|
21306
|
+
* series like `motion`, and the confidence for one like `occupancy`. A bucket
|
|
21307
|
+
* that exists at all was measured; a bucket that is absent was not, which is a
|
|
21308
|
+
* different claim from zero and the reason this is a sparse series.
|
|
21309
|
+
*/
|
|
21310
|
+
var LtsBucketSchema = object({
|
|
21311
|
+
scope: string(),
|
|
21312
|
+
bucketStart: number().int(),
|
|
21313
|
+
samples: number().int().nonnegative(),
|
|
21314
|
+
sum: number(),
|
|
21315
|
+
min: number(),
|
|
21316
|
+
max: number()
|
|
21317
|
+
});
|
|
21063
21318
|
DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
|
|
21064
21319
|
deviceId: number(),
|
|
21065
21320
|
trackId: string()
|
|
@@ -21106,6 +21361,14 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
21106
21361
|
kinds: array(string()).optional(),
|
|
21107
21362
|
limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
|
|
21108
21363
|
}), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(KeyEventBatchQueryInput, array(KeyEventsForDeviceSchema).readonly()), method(object({
|
|
21364
|
+
deviceId: number(),
|
|
21365
|
+
series: AnalyticsLtsSeriesSchema,
|
|
21366
|
+
/** Omit for EVERY scope of this series in the range. */
|
|
21367
|
+
scope: string().optional(),
|
|
21368
|
+
from: number(),
|
|
21369
|
+
to: number(),
|
|
21370
|
+
limit: number().int().positive().optional()
|
|
21371
|
+
}), array(LtsBucketSchema).readonly()), method(object({
|
|
21109
21372
|
deviceId: number(),
|
|
21110
21373
|
since: number(),
|
|
21111
21374
|
until: number(),
|
|
@@ -21724,6 +21987,14 @@ var MotionSourceEnum = _enum([
|
|
|
21724
21987
|
*/
|
|
21725
21988
|
var MotionSourcesSchema = array(MotionSourceEnum);
|
|
21726
21989
|
/**
|
|
21990
|
+
* Which root detectors a camera runs. Deliberately the SAME vocabulary
|
|
21991
|
+
* post-analysis already tags every detection with (`DetectionSource`) rather
|
|
21992
|
+
* than a second spelling of the same two ideas — the value an operator picks
|
|
21993
|
+
* here is the value that comes back on the track, the overlay and the debug
|
|
21994
|
+
* row.
|
|
21995
|
+
*/
|
|
21996
|
+
var DetectionSourcesSchema = array(DetectionSourceSchema);
|
|
21997
|
+
/**
|
|
21727
21998
|
* Input shape for `pipeline-runner.reportMotion` cap method. Exported
|
|
21728
21999
|
* so cap-side consumers (the orchestrator forward, the runner addon's
|
|
21729
22000
|
* cap implementation, tests) can reuse the type instead of redeclaring
|
|
@@ -21874,6 +22145,35 @@ var RunnerCameraConfigSchema = object({
|
|
|
21874
22145
|
* events; the orchestrator forwards to `reportMotion`.
|
|
21875
22146
|
*/
|
|
21876
22147
|
motionSources: MotionSourcesSchema.default(["analyzer"]),
|
|
22148
|
+
/**
|
|
22149
|
+
* WHICH root detector runs for this camera. The detection counterpart of
|
|
22150
|
+
* {@link motionSources}, same shape and same discipline: a per-camera list
|
|
22151
|
+
* of sources the system understands, vendor-agnostic, owned here.
|
|
22152
|
+
*
|
|
22153
|
+
* - `pipeline` — this runner's own root step on decoded pixels (`steps`).
|
|
22154
|
+
* - `onboard` — the CAMERA's own detector, admitted only when it is named
|
|
22155
|
+
* here. Its boxes reach post-analysis on the same
|
|
22156
|
+
* `PipelineInferenceResult` payload as the pipeline's, so an onboard-born
|
|
22157
|
+
* track gets the same tracker, the same overlay and the same detail
|
|
22158
|
+
* subtree (face / plate / embedding).
|
|
22159
|
+
*
|
|
22160
|
+
* `['onboard']` alone is the REPLACEMENT: this runner's root step does not
|
|
22161
|
+
* run, and that is where a camera with a usable onboard detector buys back
|
|
22162
|
+
* its share of the accelerator. It saves the root inference, not the decode
|
|
22163
|
+
* — the detail subtree still needs pixels to cut crops from.
|
|
22164
|
+
*
|
|
22165
|
+
* A camera whose onboard detections carry no geometry cannot serve as a root
|
|
22166
|
+
* step at all (there is nothing to track), and the cap that knows this says
|
|
22167
|
+
* so on `native-object-detection.getOptions().geometry`. On Reolink that is
|
|
22168
|
+
* every battery camera: the boxes ride a sub-stream a battery camera never
|
|
22169
|
+
* attaches, so such a camera stays on `['pipeline']` and its onboard AI is
|
|
22170
|
+
* worth exactly what it already is — a wake signal with a class.
|
|
22171
|
+
*
|
|
22172
|
+
* Defaults to `['pipeline']`, which is byte-for-byte today's behaviour: a
|
|
22173
|
+
* vendor never turns a detector on for the operator, and neither does a
|
|
22174
|
+
* default.
|
|
22175
|
+
*/
|
|
22176
|
+
detectionSources: DetectionSourcesSchema.default(["pipeline"]),
|
|
21877
22177
|
pipelineEnabled: boolean().default(true),
|
|
21878
22178
|
/** Ordered tree of video steps. Absent → runner skips video detection. */
|
|
21879
22179
|
steps: array(PipelineStepInputSchema).readonly().optional(),
|
|
@@ -22055,7 +22355,47 @@ var RunnerLocalMetricsSchema = object({
|
|
|
22055
22355
|
queueDepth: number(),
|
|
22056
22356
|
frameLazy: FrameLazyMetricsSchema.optional()
|
|
22057
22357
|
});
|
|
22358
|
+
/**
|
|
22359
|
+
* Pipeline Runner capability — runtime detection workhorse.
|
|
22360
|
+
*
|
|
22361
|
+
* One instance per node. Receives camera assignments from
|
|
22362
|
+
* `addon-pipeline-orchestrator`, subscribes to the local stream-broker for
|
|
22363
|
+
* decoded frames, drains motion + detection queues, calls the local
|
|
22364
|
+
* `motion-detection` and `pipeline-executor` capabilities, and emits typed
|
|
22365
|
+
* `pipeline.inference-result` and `detection.motion-analysis` events on
|
|
22366
|
+
* the bus.
|
|
22367
|
+
*
|
|
22368
|
+
* Distinct from `pipeline-orchestrator` (the hub-side load balancer) — the
|
|
22369
|
+
* runner has zero knowledge of other agents, no global state, and never
|
|
22370
|
+
* makes assignment decisions itself.
|
|
22371
|
+
*/
|
|
22372
|
+
/**
|
|
22373
|
+
* Why a runner declined to look at a camera out of band. Named rather than a
|
|
22374
|
+
* bare `false`: a camera asleep on battery (D173), one attached elsewhere, one
|
|
22375
|
+
* already mid-session and one already bursting are four different facts, and a
|
|
22376
|
+
* caller told only "no" cannot tell a protection from a bug.
|
|
22377
|
+
*/
|
|
22378
|
+
var OccupancyBurstRefusalSchema = _enum([
|
|
22379
|
+
"not-attached",
|
|
22380
|
+
"battery-asleep",
|
|
22381
|
+
"not-watching",
|
|
22382
|
+
"already-bursting"
|
|
22383
|
+
]);
|
|
22058
22384
|
method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mutation" }), method(object({ deviceId: number() }), object({ success: literal(true) }), { kind: "mutation" }), method(ReportMotionInputSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), RunnerLocalLoadSchema), method(_void(), RunnerLocalMetricsSchema), method(object({ deviceId: number() }), CameraMetricsSchema.nullable()), method(_void(), array(CameraMetricsWithDeviceIdSchema).readonly()), method(_void(), array(number()).readonly()), method(object({
|
|
22385
|
+
deviceId: number(),
|
|
22386
|
+
/** How many frames to collect. The caller sizes this against what its
|
|
22387
|
+
* own confirmation needs; the runner clamps it to the field's range. */
|
|
22388
|
+
frames: number().int().positive().optional(),
|
|
22389
|
+
/** Why, for the log. A burst nobody can attribute is a cost nobody can
|
|
22390
|
+
* defend — the periodic one at least has a timer to point at. */
|
|
22391
|
+
reason: string()
|
|
22392
|
+
}), object({
|
|
22393
|
+
started: boolean(),
|
|
22394
|
+
refusedBecause: OccupancyBurstRefusalSchema.optional()
|
|
22395
|
+
}), {
|
|
22396
|
+
auth: "admin",
|
|
22397
|
+
kind: "mutation"
|
|
22398
|
+
}), method(object({
|
|
22059
22399
|
handle: FrameHandleSchema,
|
|
22060
22400
|
bbox: NativeCropBboxSchema,
|
|
22061
22401
|
maxWidth: number().int().positive().optional(),
|
|
@@ -24425,10 +24765,28 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
|
|
|
24425
24765
|
}), boolean()), method(object({
|
|
24426
24766
|
deviceId: number().int().nonnegative(),
|
|
24427
24767
|
sessionId: string()
|
|
24428
|
-
}), object({
|
|
24429
|
-
|
|
24430
|
-
|
|
24431
|
-
|
|
24768
|
+
}), object({
|
|
24769
|
+
pendingRenegotiation: object({
|
|
24770
|
+
target: WebrtcStreamTargetSchema,
|
|
24771
|
+
epoch: number()
|
|
24772
|
+
}).nullable(),
|
|
24773
|
+
/**
|
|
24774
|
+
* Whether the session still EXISTS.
|
|
24775
|
+
*
|
|
24776
|
+
* A consumer that holds a resource for the life of a session needs to
|
|
24777
|
+
* be able to ask, because a session does not always end the way it
|
|
24778
|
+
* began. Measured on this hub 2026-09-13: an Echo that got stuck never
|
|
24779
|
+
* sent `SessionDisconnected`, so the Alexa exporter's
|
|
24780
|
+
* `releaseEgressTranscode` never ran, and a 2304x1296 HEVC to 720p
|
|
24781
|
+
* H.264 transcode kept running for NOBODY for more than twenty
|
|
24782
|
+
* minutes. The WebRTC session had logged `WebRTC session closed`
|
|
24783
|
+
* minutes earlier — the broker knew; the holder had no way to ask.
|
|
24784
|
+
*
|
|
24785
|
+
* `false` for a session id the provider has never heard of, which is
|
|
24786
|
+
* the same answer as "it ended": either way nothing is holding it up.
|
|
24787
|
+
*/
|
|
24788
|
+
alive: boolean()
|
|
24789
|
+
}));
|
|
24432
24790
|
object({
|
|
24433
24791
|
/** All accessory children of the parent. */
|
|
24434
24792
|
childDeviceIds: array(number()).readonly(),
|
|
@@ -27542,7 +27900,7 @@ var NativeDetectionSchema = object({
|
|
|
27542
27900
|
/** Firmware-provided confidence [0..1]. Reolink pushes don't carry it → undefined. */
|
|
27543
27901
|
confidence: number().min(0).max(1).optional()
|
|
27544
27902
|
});
|
|
27545
|
-
object({
|
|
27903
|
+
var NativeObjectDetectionStatusSchema = object({
|
|
27546
27904
|
/**
|
|
27547
27905
|
* Last observed instance per class. Missing entries mean the class
|
|
27548
27906
|
* is supported but nothing has been seen since the provider started.
|
|
@@ -27559,14 +27917,56 @@ object({
|
|
|
27559
27917
|
supportedClasses: array(NativeObjectClassEnum).readonly(),
|
|
27560
27918
|
/**
|
|
27561
27919
|
* Whether forwarding of onboard AI detections is enabled for this device.
|
|
27562
|
-
*
|
|
27563
|
-
*
|
|
27920
|
+
*
|
|
27921
|
+
* Cold-start OFF on every camera. A vendor does not decide which detector a
|
|
27922
|
+
* camera runs — that is the operator's choice, and it is made where every
|
|
27923
|
+
* other detection choice is made. `geometry` on
|
|
27924
|
+
* {@link NativeObjectDetectionOptionsSchema} is how the form says what the
|
|
27925
|
+
* choice would buy this particular camera.
|
|
27564
27926
|
*/
|
|
27565
27927
|
enabled: boolean()
|
|
27566
|
-
})
|
|
27928
|
+
});
|
|
27929
|
+
/**
|
|
27930
|
+
* WHEN a camera's onboard detections carry geometry.
|
|
27931
|
+
*
|
|
27932
|
+
* - `boxed` — always. The provider holds a standing channel for the boxes, so
|
|
27933
|
+
* a detection is a trackable subject whenever the camera sees one.
|
|
27934
|
+
* - `while-streaming` — only while some stream of this camera is already open.
|
|
27935
|
+
* The boxes ride the video's own side-channel rather than a feed of their
|
|
27936
|
+
* own, so they cost nothing and they exist only when something is pulling.
|
|
27937
|
+
* On Reolink this is every BATTERY camera: a persistent second feed is real
|
|
27938
|
+
* radio drain, but a camera that is awake is awake precisely because
|
|
27939
|
+
* something is in front of it, and its stream is already being pulled.
|
|
27940
|
+
* - `flag-only` — never. The firmware ships the class and nothing else; the
|
|
27941
|
+
* pipeline needs geometry to make a subject, so such a push reaches the
|
|
27942
|
+
* tracker as motion and no further.
|
|
27943
|
+
*
|
|
27944
|
+
* Reported and not inferred, because the operator's question in front of the
|
|
27945
|
+
* picker is "what do I get", and these are three different answers (D14: the
|
|
27946
|
+
* derived form is only as honest as `getOptions`).
|
|
27947
|
+
*/
|
|
27948
|
+
var NativeObjectGeometryEnum = _enum([
|
|
27949
|
+
"boxed",
|
|
27950
|
+
"while-streaming",
|
|
27951
|
+
"flag-only"
|
|
27952
|
+
]);
|
|
27953
|
+
var NativeObjectDetectionOptionsSchema = object({
|
|
27954
|
+
/** Classes this firmware can detect — the same list the status reports. */
|
|
27955
|
+
supportedClasses: array(NativeObjectClassEnum).readonly(),
|
|
27956
|
+
/** What a detection from this camera carries. */
|
|
27957
|
+
geometry: NativeObjectGeometryEnum
|
|
27958
|
+
});
|
|
27959
|
+
var NativeObjectDetectionSettingsPatchSchema = object({ enabled: boolean().optional() });
|
|
27960
|
+
NativeObjectDetectionStatusSchema.extend({
|
|
27567
27961
|
/** Required by createRuntimeStateBridge — epoch ms of last refresh. */
|
|
27568
27962
|
lastFetchedAt: number() });
|
|
27569
|
-
DeviceType.Camera, method(object({
|
|
27963
|
+
DeviceType.Camera, method(object({ deviceId: number() }), NativeObjectDetectionOptionsSchema), method(object({
|
|
27964
|
+
deviceId: number(),
|
|
27965
|
+
settings: NativeObjectDetectionSettingsPatchSchema
|
|
27966
|
+
}), _void(), {
|
|
27967
|
+
kind: "mutation",
|
|
27968
|
+
auth: "admin"
|
|
27969
|
+
}), method(object({
|
|
27570
27970
|
deviceId: number(),
|
|
27571
27971
|
enabled: boolean()
|
|
27572
27972
|
}), _void(), {
|
|
@@ -31390,7 +31790,28 @@ var PerScopeBreakdownSchema = object({
|
|
|
31390
31790
|
/** Total tracked objects in this scope (frame / zone / unzoned). */
|
|
31391
31791
|
totalObjects: number().int().nonnegative(),
|
|
31392
31792
|
/** Per-class count. Keys are macro class names (e.g. `person`, `car`). */
|
|
31393
|
-
byClass: record(string(), number().int().nonnegative())
|
|
31793
|
+
byClass: record(string(), number().int().nonnegative()),
|
|
31794
|
+
/**
|
|
31795
|
+
* Of `totalObjects`, how many are STANDING — objects the census holds,
|
|
31796
|
+
* present but not going anywhere (a parked car, a bin, a statue).
|
|
31797
|
+
*
|
|
31798
|
+
* The operator's question about a scene has two halves and they answer
|
|
31799
|
+
* different things: "what is parked here" is stable for hours and must not
|
|
31800
|
+
* flap, while "who is walking through" is the thing an alert is about. One
|
|
31801
|
+
* number could only serve one of them, and `totalObjects` served the first
|
|
31802
|
+
* badly — a passer-by moved it and every occupancy rule saw a change.
|
|
31803
|
+
*
|
|
31804
|
+
* `standing + transient === totalObjects`, always. The total keeps its old
|
|
31805
|
+
* meaning exactly, so no rule written against it changes behaviour.
|
|
31806
|
+
*
|
|
31807
|
+
* ABSENT means UNKNOWN, never zero (D393): a snapshot from a node older than
|
|
31808
|
+
* this field cannot say, and a reader that folds absence in as 0 reports "no
|
|
31809
|
+
* parked objects here" about a camera whose lot is full.
|
|
31810
|
+
*/
|
|
31811
|
+
standingObjects: number().int().nonnegative().optional(),
|
|
31812
|
+
/** Of `totalObjects`, how many are passing through. See `standingObjects` —
|
|
31813
|
+
* same absence rule. */
|
|
31814
|
+
transientObjects: number().int().nonnegative().optional()
|
|
31394
31815
|
});
|
|
31395
31816
|
var ZoneScopeBreakdownSchema = PerScopeBreakdownSchema.extend({
|
|
31396
31817
|
zoneId: string(),
|
|
@@ -34329,12 +34750,24 @@ Object.freeze({
|
|
|
34329
34750
|
addonId: null,
|
|
34330
34751
|
access: "create"
|
|
34331
34752
|
},
|
|
34753
|
+
"nativeObjectDetection.getOptions": {
|
|
34754
|
+
capName: "native-object-detection",
|
|
34755
|
+
capScope: "device",
|
|
34756
|
+
addonId: null,
|
|
34757
|
+
access: "view"
|
|
34758
|
+
},
|
|
34332
34759
|
"nativeObjectDetection.setEnabled": {
|
|
34333
34760
|
capName: "native-object-detection",
|
|
34334
34761
|
capScope: "device",
|
|
34335
34762
|
addonId: null,
|
|
34336
34763
|
access: "create"
|
|
34337
34764
|
},
|
|
34765
|
+
"nativeObjectDetection.setSettings": {
|
|
34766
|
+
capName: "native-object-detection",
|
|
34767
|
+
capScope: "device",
|
|
34768
|
+
addonId: null,
|
|
34769
|
+
access: "create"
|
|
34770
|
+
},
|
|
34338
34771
|
"navigation.getFeatures": {
|
|
34339
34772
|
capName: "navigation",
|
|
34340
34773
|
capScope: "device",
|
|
@@ -34599,6 +35032,12 @@ Object.freeze({
|
|
|
34599
35032
|
addonId: null,
|
|
34600
35033
|
access: "view"
|
|
34601
35034
|
},
|
|
35035
|
+
"notificationRules.getClipRetentionAsks": {
|
|
35036
|
+
capName: "notification-rules",
|
|
35037
|
+
capScope: "system",
|
|
35038
|
+
addonId: null,
|
|
35039
|
+
access: "view"
|
|
35040
|
+
},
|
|
34602
35041
|
"notificationRules.getConditionCatalog": {
|
|
34603
35042
|
capName: "notification-rules",
|
|
34604
35043
|
capScope: "system",
|
|
@@ -35109,6 +35548,12 @@ Object.freeze({
|
|
|
35109
35548
|
addonId: null,
|
|
35110
35549
|
access: "create"
|
|
35111
35550
|
},
|
|
35551
|
+
"pipelineAnalytics.readLongTermSeries": {
|
|
35552
|
+
capName: "pipeline-analytics",
|
|
35553
|
+
capScope: "device",
|
|
35554
|
+
addonId: null,
|
|
35555
|
+
access: "view"
|
|
35556
|
+
},
|
|
35112
35557
|
"pipelineAnalytics.rebuildObjectEmbeddings": {
|
|
35113
35558
|
capName: "pipeline-analytics",
|
|
35114
35559
|
capScope: "device",
|
|
@@ -35781,6 +36226,12 @@ Object.freeze({
|
|
|
35781
36226
|
addonId: null,
|
|
35782
36227
|
access: "create"
|
|
35783
36228
|
},
|
|
36229
|
+
"pipelineRunner.requestOccupancyBurst": {
|
|
36230
|
+
capName: "pipeline-runner",
|
|
36231
|
+
capScope: "system",
|
|
36232
|
+
addonId: null,
|
|
36233
|
+
access: "create"
|
|
36234
|
+
},
|
|
35784
36235
|
"pipelineRunner.runDetailSubtree": {
|
|
35785
36236
|
capName: "pipeline-runner",
|
|
35786
36237
|
capScope: "system",
|
|
@@ -36993,6 +37444,12 @@ Object.freeze({
|
|
|
36993
37444
|
addonId: null,
|
|
36994
37445
|
access: "create"
|
|
36995
37446
|
},
|
|
37447
|
+
"streamBroker.reportStreamSignal": {
|
|
37448
|
+
capName: "stream-broker",
|
|
37449
|
+
capScope: "system",
|
|
37450
|
+
addonId: null,
|
|
37451
|
+
access: "create"
|
|
37452
|
+
},
|
|
36996
37453
|
"streamBroker.restartProfile": {
|
|
36997
37454
|
capName: "stream-broker",
|
|
36998
37455
|
capScope: "system",
|
|
@@ -37077,6 +37534,12 @@ Object.freeze({
|
|
|
37077
37534
|
addonId: null,
|
|
37078
37535
|
access: "create"
|
|
37079
37536
|
},
|
|
37537
|
+
"streamSignals.listSignals": {
|
|
37538
|
+
capName: "stream-signals",
|
|
37539
|
+
capScope: "device",
|
|
37540
|
+
addonId: null,
|
|
37541
|
+
access: "view"
|
|
37542
|
+
},
|
|
37080
37543
|
"switch.setState": {
|
|
37081
37544
|
capName: "switch",
|
|
37082
37545
|
capScope: "device",
|
|
@@ -38549,11 +39012,21 @@ Object.freeze({
|
|
|
38549
39012
|
form: "single",
|
|
38550
39013
|
optional: false
|
|
38551
39014
|
}],
|
|
39015
|
+
"nativeObjectDetection.getOptions": [{
|
|
39016
|
+
name: "deviceId",
|
|
39017
|
+
form: "single",
|
|
39018
|
+
optional: false
|
|
39019
|
+
}],
|
|
38552
39020
|
"nativeObjectDetection.setEnabled": [{
|
|
38553
39021
|
name: "deviceId",
|
|
38554
39022
|
form: "single",
|
|
38555
39023
|
optional: false
|
|
38556
39024
|
}],
|
|
39025
|
+
"nativeObjectDetection.setSettings": [{
|
|
39026
|
+
name: "deviceId",
|
|
39027
|
+
form: "single",
|
|
39028
|
+
optional: false
|
|
39029
|
+
}],
|
|
38557
39030
|
"navigation.getFeatures": [{
|
|
38558
39031
|
name: "deviceId",
|
|
38559
39032
|
form: "single",
|
|
@@ -38903,6 +39376,11 @@ Object.freeze({
|
|
|
38903
39376
|
form: "single",
|
|
38904
39377
|
optional: false
|
|
38905
39378
|
}],
|
|
39379
|
+
"pipelineAnalytics.readLongTermSeries": [{
|
|
39380
|
+
name: "deviceId",
|
|
39381
|
+
form: "single",
|
|
39382
|
+
optional: false
|
|
39383
|
+
}],
|
|
38906
39384
|
"pipelineAnalytics.rebuildObjectEmbeddings": [{
|
|
38907
39385
|
name: "deviceId",
|
|
38908
39386
|
form: "single",
|
|
@@ -39093,6 +39571,11 @@ Object.freeze({
|
|
|
39093
39571
|
form: "single",
|
|
39094
39572
|
optional: false
|
|
39095
39573
|
}],
|
|
39574
|
+
"pipelineRunner.requestOccupancyBurst": [{
|
|
39575
|
+
name: "deviceId",
|
|
39576
|
+
form: "single",
|
|
39577
|
+
optional: false
|
|
39578
|
+
}],
|
|
39096
39579
|
"pipelineRunner.runDetailSubtree": [{
|
|
39097
39580
|
name: "deviceId",
|
|
39098
39581
|
form: "single",
|
|
@@ -39449,6 +39932,11 @@ Object.freeze({
|
|
|
39449
39932
|
form: "single",
|
|
39450
39933
|
optional: false
|
|
39451
39934
|
}],
|
|
39935
|
+
"streamBroker.reportStreamSignal": [{
|
|
39936
|
+
name: "deviceId",
|
|
39937
|
+
form: "single",
|
|
39938
|
+
optional: false
|
|
39939
|
+
}],
|
|
39452
39940
|
"streamBroker.restartProfile": [{
|
|
39453
39941
|
name: "deviceId",
|
|
39454
39942
|
form: "single",
|
|
@@ -87070,6 +87558,123 @@ function clearPairingFiles(accessoryUuid, logger) {
|
|
|
87070
87558
|
} });
|
|
87071
87559
|
}
|
|
87072
87560
|
}
|
|
87561
|
+
/**
|
|
87562
|
+
* Whether this device's accessory belongs on the bridge.
|
|
87563
|
+
*
|
|
87564
|
+
* A camera is `false` whatever the operator picked — the answer is HomeKit's,
|
|
87565
|
+
* not ours, and an operator who switched it on before the field was gated must
|
|
87566
|
+
* not end up with a camera nobody can pair.
|
|
87567
|
+
*
|
|
87568
|
+
* Absent means ON for everything else: the field did not exist for entries
|
|
87569
|
+
* persisted before it, and the default the operator asked for is the bridge.
|
|
87570
|
+
*/
|
|
87571
|
+
function shouldBridge(input) {
|
|
87572
|
+
if (input.mapperKind === "camera") return false;
|
|
87573
|
+
return input.useBridge !== false;
|
|
87574
|
+
}
|
|
87575
|
+
/** Whether the bridge has room for one more. */
|
|
87576
|
+
function bridgeHasRoom(current) {
|
|
87577
|
+
return current < 149;
|
|
87578
|
+
}
|
|
87579
|
+
//#endregion
|
|
87580
|
+
//#region src/bridge-host.ts
|
|
87581
|
+
/**
|
|
87582
|
+
* THE bridge accessory — one per node, created on demand, holding every
|
|
87583
|
+
* non-camera accessory the operator routed onto it.
|
|
87584
|
+
*
|
|
87585
|
+
* One mDNS advertisement, one HAP connection, one pairing, N accessories
|
|
87586
|
+
* inside. The alternative — what this addon did until now — gives every
|
|
87587
|
+
* switch, sensor and alarm panel its own port, its own advertisement and its
|
|
87588
|
+
* own "Add Accessory" in the Home app. Cameras stay standalone, because
|
|
87589
|
+
* HomeKit forbids bridging them (`bridge-policy.ts`).
|
|
87590
|
+
*
|
|
87591
|
+
* ONE bridge, deliberately. The ceiling is 149 accessories
|
|
87592
|
+
* ({@link MAX_BRIDGED_ACCESSORIES}) and this hub exposes 46 devices in total,
|
|
87593
|
+
* cameras included; a second bridge is a thing to build when the count
|
|
87594
|
+
* approaches the ceiling, not before, and the refusal at the ceiling is
|
|
87595
|
+
* explicit rather than a library throw.
|
|
87596
|
+
*
|
|
87597
|
+
* The bridge is LAZY: it is published the first time an accessory needs it,
|
|
87598
|
+
* so a fleet of nothing but cameras advertises no empty bridge. It is not
|
|
87599
|
+
* unpublished when the last accessory leaves — an unpublish would drop the
|
|
87600
|
+
* pairing record the operator already entered a code for, and an empty bridge
|
|
87601
|
+
* in the Home app is a far smaller cost than a re-pair.
|
|
87602
|
+
*/
|
|
87603
|
+
var BridgeHost = class {
|
|
87604
|
+
opts;
|
|
87605
|
+
bridge = null;
|
|
87606
|
+
published = false;
|
|
87607
|
+
constructor(opts) {
|
|
87608
|
+
this.opts = opts;
|
|
87609
|
+
}
|
|
87610
|
+
/** The live bridge accessory, or `null` before anything needed one. */
|
|
87611
|
+
get accessory() {
|
|
87612
|
+
return this.bridge;
|
|
87613
|
+
}
|
|
87614
|
+
/** How many accessories are riding it right now. */
|
|
87615
|
+
get size() {
|
|
87616
|
+
return this.bridge?.bridgedAccessories.length ?? 0;
|
|
87617
|
+
}
|
|
87618
|
+
/**
|
|
87619
|
+
* Put an accessory on the bridge, publishing the bridge if this is the
|
|
87620
|
+
* first. Returns `false` — without throwing, and having logged — when the
|
|
87621
|
+
* bridge is full: the caller then falls back to standalone, which is worse
|
|
87622
|
+
* for the operator and still works.
|
|
87623
|
+
*/
|
|
87624
|
+
async add(accessory) {
|
|
87625
|
+
const bridge = this.ensure();
|
|
87626
|
+
if (!bridgeHasRoom(bridge.bridgedAccessories.length)) {
|
|
87627
|
+
this.opts.logger.warn("export-hap: the bridge is FULL — publishing standalone instead", { meta: {
|
|
87628
|
+
uuid: accessory.UUID,
|
|
87629
|
+
bridged: bridge.bridgedAccessories.length,
|
|
87630
|
+
max: 149
|
|
87631
|
+
} });
|
|
87632
|
+
return false;
|
|
87633
|
+
}
|
|
87634
|
+
bridge.addBridgedAccessory(accessory);
|
|
87635
|
+
await this.publishOnce();
|
|
87636
|
+
return true;
|
|
87637
|
+
}
|
|
87638
|
+
/** Take an accessory off the bridge. A bridged accessory is never
|
|
87639
|
+
* `unpublish`ed — it has no server of its own. */
|
|
87640
|
+
remove(accessory) {
|
|
87641
|
+
if (this.bridge === null) return;
|
|
87642
|
+
if (!this.bridge.bridgedAccessories.some((a) => a.UUID === accessory.UUID)) return;
|
|
87643
|
+
this.bridge.removeBridgedAccessory(accessory, false);
|
|
87644
|
+
}
|
|
87645
|
+
/** Whether this accessory is currently on the bridge. */
|
|
87646
|
+
holds(accessory) {
|
|
87647
|
+
return this.bridge?.bridgedAccessories.some((a) => a.UUID === accessory.UUID) ?? false;
|
|
87648
|
+
}
|
|
87649
|
+
/** Tear the bridge down — process shutdown only. */
|
|
87650
|
+
async dispose() {
|
|
87651
|
+
if (this.bridge === null || !this.published) return;
|
|
87652
|
+
await unpublishAccessory(this.bridge, this.opts.logger);
|
|
87653
|
+
this.published = false;
|
|
87654
|
+
}
|
|
87655
|
+
ensure() {
|
|
87656
|
+
if (this.bridge !== null) return this.bridge;
|
|
87657
|
+
const bridge = new import_dist.Accessory(this.opts.displayName, this.opts.uuid);
|
|
87658
|
+
bridge.category = import_dist.Categories.BRIDGE;
|
|
87659
|
+
this.bridge = bridge;
|
|
87660
|
+
return bridge;
|
|
87661
|
+
}
|
|
87662
|
+
async publishOnce() {
|
|
87663
|
+
if (this.published || this.bridge === null) return;
|
|
87664
|
+
if (this.opts.publish !== void 0) await this.opts.publish(this.bridge, this.opts.pincode);
|
|
87665
|
+
else await publishStandalone(this.bridge, {
|
|
87666
|
+
pincode: this.opts.pincode,
|
|
87667
|
+
port: 0,
|
|
87668
|
+
bind: this.opts.bind,
|
|
87669
|
+
logger: this.opts.logger
|
|
87670
|
+
});
|
|
87671
|
+
this.published = true;
|
|
87672
|
+
this.opts.logger.info("export-hap: the bridge is published", { meta: {
|
|
87673
|
+
displayName: this.opts.displayName,
|
|
87674
|
+
uuid: this.opts.uuid
|
|
87675
|
+
} });
|
|
87676
|
+
}
|
|
87677
|
+
};
|
|
87073
87678
|
//#endregion
|
|
87074
87679
|
//#region src/hap-setup-uri.ts
|
|
87075
87680
|
function errMsg$15(e) {
|
|
@@ -99477,6 +100082,19 @@ async function startFfmpegForSession(bctx, session, sessionId, video, advertised
|
|
|
99477
100082
|
} });
|
|
99478
100083
|
throw new Error(`export-hap: no enabled RTSP entries for device ${numericDeviceId}`);
|
|
99479
100084
|
}
|
|
100085
|
+
if (fit.kind === "transcode" && bctx.options.hapDeviceSettings?.allowTranscode === false) {
|
|
100086
|
+
startLog.warn("export-hap: stream start REFUSED — transcoding is switched off", {
|
|
100087
|
+
tags: { deviceId: numericDeviceId },
|
|
100088
|
+
meta: {
|
|
100089
|
+
sessionId,
|
|
100090
|
+
streamPreference: pref,
|
|
100091
|
+
negotiated: `${video.width}x${video.height}`,
|
|
100092
|
+
pickedProfile: fit.profile,
|
|
100093
|
+
pickedCodec: fit.picked.codec ?? "unknown"
|
|
100094
|
+
}
|
|
100095
|
+
});
|
|
100096
|
+
throw new Error(`export-hap: device ${numericDeviceId} needs a transcode and transcoding is switched off`);
|
|
100097
|
+
}
|
|
99480
100098
|
const picked = fit.picked;
|
|
99481
100099
|
const rtspUrl = picked.url;
|
|
99482
100100
|
const slot = brokerStreams.find((s) => s.profile === fit.profile);
|
|
@@ -102596,6 +103214,12 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
102596
103214
|
* hardware init.
|
|
102597
103215
|
*/
|
|
102598
103216
|
decodeMemos = createHapDecodeMemos();
|
|
103217
|
+
/**
|
|
103218
|
+
* THE bridge. Lazily created and published the first time a non-camera
|
|
103219
|
+
* accessory needs it; never torn down while the addon runs, because an
|
|
103220
|
+
* unpublish would drop a pairing the operator already entered a code for.
|
|
103221
|
+
*/
|
|
103222
|
+
bridgeHost = null;
|
|
102599
103223
|
constructor() {
|
|
102600
103224
|
super({ ...DEFAULT_CONFIG });
|
|
102601
103225
|
}
|
|
@@ -102603,6 +103227,13 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
102603
103227
|
const identity = await this.ensureIdentity();
|
|
102604
103228
|
this.pincode = identity.pincode;
|
|
102605
103229
|
this.bind = this.config.interfaceName || void 0;
|
|
103230
|
+
this.bridgeHost = new BridgeHost({
|
|
103231
|
+
displayName: this.config.bridgeName,
|
|
103232
|
+
uuid: identity.uuid,
|
|
103233
|
+
pincode: identity.pincode,
|
|
103234
|
+
bind: this.bind,
|
|
103235
|
+
logger: this.ctx.logger
|
|
103236
|
+
});
|
|
102606
103237
|
try {
|
|
102607
103238
|
await initHapStorage(node_path.join(this.ctx.dataDir, "hap-store"));
|
|
102608
103239
|
} catch (err) {
|
|
@@ -102631,6 +103262,7 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
102631
103262
|
}
|
|
102632
103263
|
this.ctx.addDisposer(async () => {
|
|
102633
103264
|
await this.detachAll();
|
|
103265
|
+
await this.bridgeHost?.dispose();
|
|
102634
103266
|
});
|
|
102635
103267
|
this.subscribeDeviceProvisionedForReconcile();
|
|
102636
103268
|
this.subscribeDeviceReadyForReconcile();
|
|
@@ -102787,16 +103419,24 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
102787
103419
|
decodeMemos: this.decodeMemos,
|
|
102788
103420
|
hapDeviceSettings: {
|
|
102789
103421
|
streamPreference: entrySettings.streamPreference ?? "auto",
|
|
102790
|
-
hksvRecording: resolveHksvRecording(entrySettings)
|
|
103422
|
+
hksvRecording: resolveHksvRecording(entrySettings),
|
|
103423
|
+
allowTranscode: entrySettings.allowTranscode !== false
|
|
102791
103424
|
}
|
|
102792
103425
|
}
|
|
102793
103426
|
});
|
|
102794
|
-
|
|
102795
|
-
|
|
102796
|
-
|
|
102797
|
-
bind: this.bind,
|
|
102798
|
-
logger: this.ctx.logger
|
|
103427
|
+
const wantsBridge = shouldBridge({
|
|
103428
|
+
mapperKind: entry.mapperKind,
|
|
103429
|
+
useBridge: entry.settings?.useBridge
|
|
102799
103430
|
});
|
|
103431
|
+
for (const accessory of mapper.accessories) {
|
|
103432
|
+
if (wantsBridge && this.bridgeHost !== null && await this.bridgeHost.add(accessory)) continue;
|
|
103433
|
+
await publishStandalone(accessory, {
|
|
103434
|
+
pincode: this.pincode,
|
|
103435
|
+
port: 0,
|
|
103436
|
+
bind: this.bind,
|
|
103437
|
+
logger: this.ctx.logger
|
|
103438
|
+
});
|
|
103439
|
+
}
|
|
102800
103440
|
this.exposed.set(entry.deviceId, mapper);
|
|
102801
103441
|
return { childAccessoryUuids: [] };
|
|
102802
103442
|
}
|
|
@@ -102809,7 +103449,13 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
102809
103449
|
const mapper = this.exposed.get(deviceId);
|
|
102810
103450
|
if (!mapper) return;
|
|
102811
103451
|
this.exposed.delete(deviceId);
|
|
102812
|
-
for (const accessory of mapper.accessories)
|
|
103452
|
+
for (const accessory of mapper.accessories) {
|
|
103453
|
+
if (this.bridgeHost?.holds(accessory) === true) {
|
|
103454
|
+
this.bridgeHost.remove(accessory);
|
|
103455
|
+
continue;
|
|
103456
|
+
}
|
|
103457
|
+
await unpublishAccessory(accessory, this.ctx.logger);
|
|
103458
|
+
}
|
|
102813
103459
|
await mapper.dispose().catch((err) => {
|
|
102814
103460
|
this.ctx.logger.withTags({ deviceId: Number.parseInt(deviceId, 10) }).warn("export-hap: mapper dispose failed", { meta: { error: errMsg(err) } });
|
|
102815
103461
|
});
|
|
@@ -103104,42 +103750,79 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
103104
103750
|
const enabledKey = `hap:${deviceId}:enabled`;
|
|
103105
103751
|
const streamPreferenceKey = `hap:${deviceId}:streamPreference`;
|
|
103106
103752
|
const hksvKey = `hap:${deviceId}:hksvRecording`;
|
|
103753
|
+
const useBridgeKey = `hap:${deviceId}:useBridge`;
|
|
103754
|
+
const allowTranscodeKey = `hap:${deviceId}:allowTranscode`;
|
|
103107
103755
|
const mapper = this.exposed.get(String(deviceId)) ?? null;
|
|
103108
103756
|
const paired = mapper ? accessoryPaired(mapper.accessory) : false;
|
|
103757
|
+
const bridged = mapper !== null && this.bridgeHost?.holds(mapper.accessory) === true;
|
|
103109
103758
|
const name = entry?.displayName ?? `Device ${deviceId}`;
|
|
103110
|
-
const
|
|
103759
|
+
const bridgePaired = this.bridgeHost?.accessory !== null && this.bridgeHost?.accessory !== void 0 ? accessoryPaired(this.bridgeHost.accessory) : false;
|
|
103760
|
+
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}.`;
|
|
103761
|
+
const qrSource = bridged ? this.bridgeHost?.accessory ?? null : mapper?.accessory ?? null;
|
|
103111
103762
|
let qrValue = "";
|
|
103112
|
-
if (
|
|
103113
|
-
qrValue =
|
|
103763
|
+
if (qrSource) try {
|
|
103764
|
+
qrValue = qrSource.setupURI();
|
|
103114
103765
|
} catch (err) {
|
|
103115
103766
|
this.ctx.logger.withTags({ deviceId }).debug("export-hap: setupURI failed for per-device contribution", { meta: { error: errMsg(err) } });
|
|
103116
103767
|
}
|
|
103117
|
-
const
|
|
103118
|
-
type: "select",
|
|
103119
|
-
key: streamPreferenceKey,
|
|
103120
|
-
label: "Source stream (HomeKit)",
|
|
103121
|
-
description: "Which camstack profile slot HomeKit pulls. Auto = the broker picks the slot closest to 1080p at session start.",
|
|
103122
|
-
options: HAP_STREAM_PREFERENCE_OPTIONS,
|
|
103123
|
-
required: true,
|
|
103124
|
-
value: settings.streamPreference,
|
|
103125
|
-
showWhen: {
|
|
103126
|
-
field: enabledKey,
|
|
103127
|
-
equals: true
|
|
103128
|
-
},
|
|
103129
|
-
immediate: true
|
|
103130
|
-
}, {
|
|
103768
|
+
const bridgeFields = kind === "camera" ? [] : [{
|
|
103131
103769
|
type: "boolean",
|
|
103132
|
-
key:
|
|
103133
|
-
label: "
|
|
103134
|
-
description: "
|
|
103770
|
+
key: useBridgeKey,
|
|
103771
|
+
label: "Export through the bridge",
|
|
103772
|
+
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.",
|
|
103135
103773
|
style: "switch",
|
|
103136
|
-
value:
|
|
103774
|
+
value: shouldBridge({
|
|
103775
|
+
mapperKind: kind,
|
|
103776
|
+
useBridge: settings.useBridge
|
|
103777
|
+
}),
|
|
103137
103778
|
showWhen: {
|
|
103138
103779
|
field: enabledKey,
|
|
103139
103780
|
equals: true
|
|
103140
103781
|
},
|
|
103141
103782
|
immediate: true
|
|
103142
103783
|
}];
|
|
103784
|
+
const cameraFields = kind !== "camera" ? [] : [
|
|
103785
|
+
{
|
|
103786
|
+
type: "select",
|
|
103787
|
+
key: streamPreferenceKey,
|
|
103788
|
+
label: "Source stream (HomeKit)",
|
|
103789
|
+
description: "Which camstack profile slot HomeKit pulls. Auto = the broker picks the slot closest to 1080p at session start.",
|
|
103790
|
+
options: HAP_STREAM_PREFERENCE_OPTIONS,
|
|
103791
|
+
required: true,
|
|
103792
|
+
value: settings.streamPreference,
|
|
103793
|
+
showWhen: {
|
|
103794
|
+
field: enabledKey,
|
|
103795
|
+
equals: true
|
|
103796
|
+
},
|
|
103797
|
+
immediate: true
|
|
103798
|
+
},
|
|
103799
|
+
{
|
|
103800
|
+
type: "boolean",
|
|
103801
|
+
key: hksvKey,
|
|
103802
|
+
label: "HomeKit recording (Secure Video)",
|
|
103803
|
+
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).",
|
|
103804
|
+
style: "switch",
|
|
103805
|
+
value: resolveHksvRecording(settings),
|
|
103806
|
+
showWhen: {
|
|
103807
|
+
field: enabledKey,
|
|
103808
|
+
equals: true
|
|
103809
|
+
},
|
|
103810
|
+
immediate: true
|
|
103811
|
+
},
|
|
103812
|
+
{
|
|
103813
|
+
type: "boolean",
|
|
103814
|
+
key: allowTranscodeKey,
|
|
103815
|
+
label: "Allow transcoding for HomeKit",
|
|
103816
|
+
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.",
|
|
103817
|
+
style: "switch",
|
|
103818
|
+
value: settings.allowTranscode !== false,
|
|
103819
|
+
showWhen: {
|
|
103820
|
+
field: enabledKey,
|
|
103821
|
+
equals: true
|
|
103822
|
+
},
|
|
103823
|
+
immediate: true
|
|
103824
|
+
}
|
|
103825
|
+
];
|
|
103143
103826
|
return {
|
|
103144
103827
|
tabs: [{
|
|
103145
103828
|
id: "export",
|
|
@@ -103184,6 +103867,7 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
103184
103867
|
value: enabled,
|
|
103185
103868
|
immediate: true
|
|
103186
103869
|
},
|
|
103870
|
+
...bridgeFields,
|
|
103187
103871
|
...cameraFields
|
|
103188
103872
|
]
|
|
103189
103873
|
}]
|
|
@@ -103209,14 +103893,20 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
103209
103893
|
const enabledKey = `hap:${deviceId}:enabled`;
|
|
103210
103894
|
const streamPreferenceKey = `hap:${deviceId}:streamPreference`;
|
|
103211
103895
|
const hksvKey = `hap:${deviceId}:hksvRecording`;
|
|
103896
|
+
const useBridgeKey = `hap:${deviceId}:useBridge`;
|
|
103897
|
+
const allowTranscodeKey = `hap:${deviceId}:allowTranscode`;
|
|
103212
103898
|
const enabledValue = enabledKey in patch ? Boolean(patch[enabledKey]) : wasEnabled;
|
|
103213
103899
|
const streamPreferenceRaw = streamPreferenceKey in patch ? patch[streamPreferenceKey] : current?.settings?.streamPreference;
|
|
103214
103900
|
const streamPreference = typeof streamPreferenceRaw === "string" && streamPreferenceRaw.trim().length > 0 ? streamPreferenceRaw : "auto";
|
|
103215
103901
|
const hksvRecording = hksvKey in patch ? Boolean(patch[hksvKey]) : resolveHksvRecording(current?.settings);
|
|
103902
|
+
const useBridge = useBridgeKey in patch ? Boolean(patch[useBridgeKey]) : current?.settings?.useBridge !== false;
|
|
103903
|
+
const allowTranscode = allowTranscodeKey in patch ? Boolean(patch[allowTranscodeKey]) : current?.settings?.allowTranscode !== false;
|
|
103216
103904
|
const nextSettings = {
|
|
103217
103905
|
...current?.settings ?? DEFAULT_DEVICE_SETTINGS,
|
|
103218
103906
|
streamPreference,
|
|
103219
|
-
hksvRecording
|
|
103907
|
+
hksvRecording,
|
|
103908
|
+
useBridge,
|
|
103909
|
+
allowTranscode
|
|
103220
103910
|
};
|
|
103221
103911
|
if (!enabledValue) {
|
|
103222
103912
|
if (wasEnabled) await this.unexposeDevice(deviceIdStr);
|
|
@@ -103229,8 +103919,17 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
103229
103919
|
}
|
|
103230
103920
|
const currentPref = current?.settings?.streamPreference ?? "auto";
|
|
103231
103921
|
const currentHksv = resolveHksvRecording(current?.settings);
|
|
103922
|
+
const mapperKind = current?.mapperKind ?? "generic";
|
|
103923
|
+
const wasBridged = shouldBridge({
|
|
103924
|
+
mapperKind,
|
|
103925
|
+
useBridge: current?.settings?.useBridge
|
|
103926
|
+
});
|
|
103927
|
+
const willBridge = shouldBridge({
|
|
103928
|
+
mapperKind,
|
|
103929
|
+
useBridge
|
|
103930
|
+
});
|
|
103232
103931
|
await this.updateEntrySettings(deviceIdStr, nextSettings);
|
|
103233
|
-
if (currentPref !== streamPreference || currentHksv !== hksvRecording) {
|
|
103932
|
+
if (currentPref !== streamPreference || currentHksv !== hksvRecording || wasBridged !== willBridge) {
|
|
103234
103933
|
log.info("export-hap: per-camera export settings changed — refreshing accessory", { meta: {
|
|
103235
103934
|
streamPreference: {
|
|
103236
103935
|
from: currentPref,
|
|
@@ -103239,10 +103938,14 @@ var ExportHapAddon = class extends BaseAddon {
|
|
|
103239
103938
|
hksvRecording: {
|
|
103240
103939
|
from: currentHksv,
|
|
103241
103940
|
to: hksvRecording
|
|
103941
|
+
},
|
|
103942
|
+
bridged: {
|
|
103943
|
+
from: wasBridged,
|
|
103944
|
+
to: willBridge
|
|
103242
103945
|
}
|
|
103243
103946
|
} });
|
|
103244
103947
|
try {
|
|
103245
|
-
await this.unexposeDevice(deviceIdStr, { clearPairing:
|
|
103948
|
+
await this.unexposeDevice(deviceIdStr, { clearPairing: wasBridged !== willBridge });
|
|
103246
103949
|
await this.exposeDevice(deviceIdStr);
|
|
103247
103950
|
} catch (err) {
|
|
103248
103951
|
log.warn("export-hap: failed to refresh accessory after a settings change", { meta: { error: errMsg(err) } });
|