@camstack/addon-provider-reolink 1.2.245 → 1.2.246
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/CHANGELOG.md +6 -0
- package/dist/addon.js +232 -41
- package/dist/addon.mjs +232 -41
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.246] - 2026-11-19
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- The NVR / Home Hub sleep-state reconcile of its cameras is now scheduled by the core instead of a timer in the session; it still reads only the NVR and never wakes a camera.
|
|
15
|
+
|
|
10
16
|
## [1.2.245] - 2026-11-18
|
|
11
17
|
|
|
12
18
|
### Changed
|
package/dist/addon.js
CHANGED
|
@@ -106821,7 +106821,7 @@ var ZodIssueCode = {
|
|
|
106821
106821
|
var ZodFirstPartyTypeKind;
|
|
106822
106822
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
106823
106823
|
//#endregion
|
|
106824
|
-
//#region ../types/dist/runtime-capabilities-
|
|
106824
|
+
//#region ../types/dist/runtime-capabilities-B36VcCR6.mjs
|
|
106825
106825
|
/**
|
|
106826
106826
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
106827
106827
|
* window to float samples (D455).
|
|
@@ -111435,14 +111435,104 @@ var SubscribeAudioChunksInputSchema = object({
|
|
|
111435
111435
|
var SubscribeAudioChunksResultSchema = object({
|
|
111436
111436
|
/** Opaque id passed to `pullAudioChunks` / `unsubscribeAudioChunks`. */
|
|
111437
111437
|
subscriptionId: string() });
|
|
111438
|
-
var
|
|
111439
|
-
|
|
111440
|
-
|
|
111441
|
-
|
|
111442
|
-
|
|
111443
|
-
|
|
111444
|
-
|
|
111438
|
+
var BrokerStatusSchema = _enum([
|
|
111439
|
+
"idle",
|
|
111440
|
+
"connecting",
|
|
111441
|
+
"streaming",
|
|
111442
|
+
"error",
|
|
111443
|
+
"stopped"
|
|
111444
|
+
]);
|
|
111445
|
+
/**
|
|
111446
|
+
* The encode a derived stream's feeder was last spawned with — the read-only
|
|
111447
|
+
* "effective encode". Read off the ffmpeg argv that runs, so it cannot drift
|
|
111448
|
+
* from what the operator's profile and the carrier's rules resolved to.
|
|
111449
|
+
*/
|
|
111450
|
+
var DerivedEffectiveEncodeSchema = object({
|
|
111451
|
+
/** `-c:v` of the argv (`libx264`, a hardware encoder, `copy`); null when absent. */
|
|
111452
|
+
encoder: string().nullable(),
|
|
111453
|
+
/** Output frame rate; null when the source cadence passes through unmeasured. */
|
|
111454
|
+
fps: number$1().nullable(),
|
|
111455
|
+
gopFrames: number$1(),
|
|
111456
|
+
/** ABR target (`-b:v`), kbps. */
|
|
111457
|
+
targetKbps: number$1().nullable(),
|
|
111458
|
+
/** Ceiling (`-maxrate`), kbps. */
|
|
111459
|
+
capKbps: number$1().nullable(),
|
|
111460
|
+
bufsizeKbps: number$1().nullable(),
|
|
111461
|
+
/**
|
|
111462
|
+
* `copy` = source audio untouched, `aac` = re-encoded, `profile` = operator's
|
|
111463
|
+
* encode, `none` = the operator dropped the track.
|
|
111464
|
+
*/
|
|
111465
|
+
audio: _enum([
|
|
111466
|
+
"copy",
|
|
111467
|
+
"aac",
|
|
111468
|
+
"profile",
|
|
111469
|
+
"none"
|
|
111470
|
+
])
|
|
111471
|
+
});
|
|
111472
|
+
/**
|
|
111473
|
+
* A derived stream's source: a **profile** slot (follows whatever physical
|
|
111474
|
+
* stream that profile is assigned to) or a **camStream** (pinned to one
|
|
111475
|
+
* physical stream regardless of assignment).
|
|
111476
|
+
*/
|
|
111477
|
+
var DerivedSourceRefSchema = union([object({
|
|
111478
|
+
kind: literal("profile"),
|
|
111479
|
+
profile: _enum([
|
|
111480
|
+
"high",
|
|
111481
|
+
"mid",
|
|
111482
|
+
"low"
|
|
111483
|
+
])
|
|
111484
|
+
}), object({
|
|
111485
|
+
kind: literal("camStream"),
|
|
111486
|
+
camStreamId: string()
|
|
111487
|
+
})]);
|
|
111488
|
+
object({
|
|
111489
|
+
width: number$1().nullable(),
|
|
111490
|
+
height: number$1().nullable(),
|
|
111491
|
+
fps: number$1().nullable(),
|
|
111492
|
+
idrIntervalMs: number$1().nullable(),
|
|
111493
|
+
/** `h264` / `h265` when observed. */
|
|
111494
|
+
videoCodec: _enum(["h264", "h265"]).nullable(),
|
|
111495
|
+
/** Upper-cased SDP name (`AAC`, `PCMU`) when the source has an audio track. */
|
|
111496
|
+
audioCodec: string().nullable()
|
|
111497
|
+
});
|
|
111498
|
+
/**
|
|
111499
|
+
* The full effective encode of a derived-stream profile: the stats the broker
|
|
111500
|
+
* publishes in `getBrokerStats.derivedEncode` plus the resolved geometry, the
|
|
111501
|
+
* flags that say WHY a number differs from the request, and the ffmpeg output
|
|
111502
|
+
* argv. One function (`computeDerivedEncode`) produces it for both the
|
|
111503
|
+
* broker's start path and `previewDerivedEncode`.
|
|
111504
|
+
*/
|
|
111505
|
+
var DerivedEncodePreviewSchema = DerivedEffectiveEncodeSchema.extend({
|
|
111506
|
+
/** Final picture size; `null` when neither the profile nor the source names it. */
|
|
111507
|
+
width: number$1().nullable(),
|
|
111508
|
+
height: number$1().nullable(),
|
|
111509
|
+
/** `h264` / `h265` re-encode, `copy` remux; `null` is never returned (the encoder always resolves). */
|
|
111510
|
+
videoCodec: _enum([
|
|
111511
|
+
"h264",
|
|
111512
|
+
"h265",
|
|
111513
|
+
"copy"
|
|
111445
111514
|
]),
|
|
111515
|
+
requestedFps: number$1().nullable(),
|
|
111516
|
+
/** The requested fps exceeded the source and the source cadence won. */
|
|
111517
|
+
fpsClampedToSource: boolean(),
|
|
111518
|
+
/** Lowest bitrate accepted for this geometry x fps; `null` when unknown. */
|
|
111519
|
+
floorKbps: number$1().nullable(),
|
|
111520
|
+
/** The explicit bitrate was below the floor and was raised to it. */
|
|
111521
|
+
raisedToFloor: boolean(),
|
|
111522
|
+
/** What the profile asked for when it was raised; `null` otherwise. */
|
|
111523
|
+
requestedKbps: number$1().nullable(),
|
|
111524
|
+
/** Seconds between keyframes; `null` when the output cadence is unknown. */
|
|
111525
|
+
keyframeIntervalSec: number$1().nullable(),
|
|
111526
|
+
/** The ffmpeg argv, with the source loopback URL in `-i`. */
|
|
111527
|
+
args: array(string())
|
|
111528
|
+
});
|
|
111529
|
+
/** Result of `previewDerivedEncode`: a plan, or the reason there is none. */
|
|
111530
|
+
var PreviewDerivedEncodeResultSchema = discriminatedUnion("kind", [object({
|
|
111531
|
+
kind: literal("preview"),
|
|
111532
|
+
preview: DerivedEncodePreviewSchema
|
|
111533
|
+
}), object({ kind: literal("no-source") })]);
|
|
111534
|
+
var BrokerStatsSchema = object({
|
|
111535
|
+
status: BrokerStatusSchema,
|
|
111446
111536
|
inputFps: number$1(),
|
|
111447
111537
|
encodedSubscribers: number$1(),
|
|
111448
111538
|
uptimeMs: number$1(),
|
|
@@ -111482,7 +111572,9 @@ var BrokerStatsSchema = object({
|
|
|
111482
111572
|
* alone that the mute is on the packet path and not merely persisted.
|
|
111483
111573
|
*/
|
|
111484
111574
|
audioMuted: boolean().optional(),
|
|
111485
|
-
audioMutedDropped: number$1().optional()
|
|
111575
|
+
audioMutedDropped: number$1().optional(),
|
|
111576
|
+
/** Present for a derived broker once its feeder has spawned at least once. */
|
|
111577
|
+
derivedEncode: DerivedEffectiveEncodeSchema.optional()
|
|
111486
111578
|
});
|
|
111487
111579
|
/**
|
|
111488
111580
|
* Exporter-facing "profile restream" entry. Returned by
|
|
@@ -124010,7 +124102,7 @@ function sleep(ms) {
|
|
|
124010
124102
|
return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
|
|
124011
124103
|
}
|
|
124012
124104
|
//#endregion
|
|
124013
|
-
//#region ../types/dist/implemented-methods-
|
|
124105
|
+
//#region ../types/dist/implemented-methods-BUBqZ2a0.mjs
|
|
124014
124106
|
/**
|
|
124015
124107
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
124016
124108
|
*
|
|
@@ -126635,10 +126727,16 @@ looseObject({
|
|
|
126635
126727
|
TargetSchema.omit({ id: true });
|
|
126636
126728
|
var EncodeProfileSchema = object({
|
|
126637
126729
|
video: object({
|
|
126730
|
+
/**
|
|
126731
|
+
* `h264` / `h265` re-encode into that codec; `source` re-encodes in whatever
|
|
126732
|
+
* codec the source speaks (a resize that keeps the codec); `copy` remuxes
|
|
126733
|
+
* with no encode at all (so no resize either).
|
|
126734
|
+
*/
|
|
126638
126735
|
codec: _enum([
|
|
126639
126736
|
"h264",
|
|
126640
126737
|
"h265",
|
|
126641
|
-
"copy"
|
|
126738
|
+
"copy",
|
|
126739
|
+
"source"
|
|
126642
126740
|
]),
|
|
126643
126741
|
profile: _enum([
|
|
126644
126742
|
"baseline",
|
|
@@ -126690,12 +126788,14 @@ var EncodeProfileSchema = object({
|
|
|
126690
126788
|
singleSlicePerFrame: boolean().optional()
|
|
126691
126789
|
}),
|
|
126692
126790
|
audio: union([literal("passthrough"), object({
|
|
126791
|
+
/** `none` drops the audio track (`-an`); `copy` carries the source's. */
|
|
126693
126792
|
codec: _enum([
|
|
126694
126793
|
"opus",
|
|
126695
126794
|
"aac",
|
|
126696
126795
|
"pcmu",
|
|
126697
126796
|
"pcma",
|
|
126698
|
-
"copy"
|
|
126797
|
+
"copy",
|
|
126798
|
+
"none"
|
|
126699
126799
|
]),
|
|
126700
126800
|
bitrateKbps: number$1().int().positive().optional(),
|
|
126701
126801
|
sampleRateHz: number$1().int().positive().optional(),
|
|
@@ -158041,7 +158141,11 @@ method(object({
|
|
|
158041
158141
|
}).nullable(), {
|
|
158042
158142
|
kind: "mutation",
|
|
158043
158143
|
auth: "admin"
|
|
158044
|
-
}), method(_void(), array(CameraStreamSchema).readonly()), method(_void(), array(ProfileSlotSchema).readonly()), method(object({ brokerId: string() }), BrokerStatsSchema), method(object({
|
|
158144
|
+
}), method(_void(), array(CameraStreamSchema).readonly()), method(_void(), array(ProfileSlotSchema).readonly()), method(object({ brokerId: string() }), BrokerStatsSchema), method(object({
|
|
158145
|
+
deviceId: number$1().int().nonnegative(),
|
|
158146
|
+
profile: EncodeProfileSchema,
|
|
158147
|
+
source: DerivedSourceRefSchema.optional()
|
|
158148
|
+
}), PreviewDerivedEncodeResultSchema), method(object({ brokerId: string() }), object({
|
|
158045
158149
|
probed: boolean(),
|
|
158046
158150
|
summary: string()
|
|
158047
158151
|
}), {
|
|
@@ -166042,15 +166146,28 @@ var DeviceStateRefreshInputSchema = object({
|
|
|
166042
166146
|
var DeviceStateResubscribeInputSchema = object({ deviceId: number$1().int().nonnegative() });
|
|
166043
166147
|
var DeviceStateRefreshResultSchema = object({ ok: literal(true) });
|
|
166044
166148
|
var NOT_OPERATOR_FACING = "the core schedules state refreshes itself; an operator never asks for one";
|
|
166045
|
-
|
|
166046
|
-
|
|
166047
|
-
|
|
166048
|
-
|
|
166049
|
-
|
|
166050
|
-
|
|
166051
|
-
|
|
166052
|
-
|
|
166053
|
-
|
|
166149
|
+
var deviceStateRefreshCapability = {
|
|
166150
|
+
name: "device-state-refresh",
|
|
166151
|
+
scope: "device",
|
|
166152
|
+
deviceNative: true,
|
|
166153
|
+
mode: "singleton",
|
|
166154
|
+
methods: {
|
|
166155
|
+
refresh: method(DeviceStateRefreshInputSchema, DeviceStateRefreshResultSchema, {
|
|
166156
|
+
kind: "mutation",
|
|
166157
|
+
auth: "admin",
|
|
166158
|
+
notOperatorFacing: NOT_OPERATOR_FACING
|
|
166159
|
+
}),
|
|
166160
|
+
resubscribe: method(DeviceStateResubscribeInputSchema, DeviceStateRefreshResultSchema, {
|
|
166161
|
+
kind: "mutation",
|
|
166162
|
+
auth: "admin",
|
|
166163
|
+
notOperatorFacing: NOT_OPERATOR_FACING
|
|
166164
|
+
})
|
|
166165
|
+
},
|
|
166166
|
+
vocabulary: {
|
|
166167
|
+
noun: t("State refresh", "Aggiornamento dello stato"),
|
|
166168
|
+
order: 3247
|
|
166169
|
+
}
|
|
166170
|
+
};
|
|
166054
166171
|
/**
|
|
166055
166172
|
* Generic device-level status snapshot. Auto-registered by `BaseDevice`
|
|
166056
166173
|
* for every device, regardless of provider — the kernel needs a uniform
|
|
@@ -178489,7 +178606,13 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
178489
178606
|
/** Pool deaths inside the current window. */
|
|
178490
178607
|
deaths: number$1(),
|
|
178491
178608
|
/** The last death's message. */
|
|
178492
|
-
lastError: string()
|
|
178609
|
+
lastError: string(),
|
|
178610
|
+
/**
|
|
178611
|
+
* Present when the device is ABSENT rather than dead: the runtime
|
|
178612
|
+
* itself enumerates no such device (`no-gpu-device` — OpenVINO sees
|
|
178613
|
+
* no supported GPU; driver/runtime does not support this iGPU).
|
|
178614
|
+
*/
|
|
178615
|
+
absentReason: _enum(["no-gpu-device"]).optional()
|
|
178493
178616
|
})).readonly() })), method(object({
|
|
178494
178617
|
nodeId: string(),
|
|
178495
178618
|
deviceKey: string()
|
|
@@ -179383,7 +179506,8 @@ var StatelessStepRefusalSchema = _enum([
|
|
|
179383
179506
|
"unknown-step",
|
|
179384
179507
|
"model-not-servable",
|
|
179385
179508
|
"unreadable-frame",
|
|
179386
|
-
"execution-failed"
|
|
179509
|
+
"execution-failed",
|
|
179510
|
+
"no-eligible-device"
|
|
179387
179511
|
]);
|
|
179388
179512
|
/**
|
|
179389
179513
|
* Answer to `runStatelessStep` — a discriminated union rather than a nullable
|
|
@@ -186845,7 +186969,8 @@ var InferenceDeviceExclusionReasonSchema = _enum([
|
|
|
186845
186969
|
"unavailable",
|
|
186846
186970
|
"cannot-host-camera-root",
|
|
186847
186971
|
"accelerator-preferred",
|
|
186848
|
-
"root-switched-off"
|
|
186972
|
+
"root-switched-off",
|
|
186973
|
+
"no-gpu-device"
|
|
186849
186974
|
]);
|
|
186850
186975
|
var NodeInferenceDeviceSchema = object({
|
|
186851
186976
|
/** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
|
|
@@ -186878,7 +187003,13 @@ var NodeInferenceDeviceSchema = object({
|
|
|
186878
187003
|
enabled: boolean(),
|
|
186879
187004
|
/** Relative balancer weight for the enabled device (default 1). */
|
|
186880
187005
|
weight: number$1(),
|
|
186881
|
-
/**
|
|
187006
|
+
/**
|
|
187007
|
+
* Per-device concurrent-session cap; null = unlimited (multi-device C4). A
|
|
187008
|
+
* limit: a camera no device can take within its cap stays on the node's
|
|
187009
|
+
* default pool — EXCEPT when that default pool is an excluded device
|
|
187010
|
+
* (`defaultPoolExcluded`), where it goes over the cap on the least-loaded
|
|
187011
|
+
* eligible device instead (#610).
|
|
187012
|
+
*/
|
|
186882
187013
|
maxSessions: number$1().nullable(),
|
|
186883
187014
|
/** Object-detection model the executor defaults to for this deviceKey. */
|
|
186884
187015
|
defaultModelId: string(),
|
|
@@ -186928,7 +187059,15 @@ var NodeInferenceDevicesSchema = object({
|
|
|
186928
187059
|
nodeId: string(),
|
|
186929
187060
|
/** False when the node's platform-probe was unreachable (no live device set). */
|
|
186930
187061
|
reachable: boolean(),
|
|
186931
|
-
devices: array(NodeInferenceDeviceSchema).readonly()
|
|
187062
|
+
devices: array(NodeInferenceDeviceSchema).readonly(),
|
|
187063
|
+
/**
|
|
187064
|
+
* The election left NO device and one was excluded because the operator
|
|
187065
|
+
* turned it off or it is not functional (#610): the runner's default pool is
|
|
187066
|
+
* that device, so work with no explicit device (a stateless step, a bench with
|
|
187067
|
+
* no `deviceKey`) is refused rather than run there. Absent = an orchestrator
|
|
187068
|
+
* older than the field, or an unreachable node: nothing is claimed (D315).
|
|
187069
|
+
*/
|
|
187070
|
+
defaultPoolExcluded: boolean().optional()
|
|
186932
187071
|
});
|
|
186933
187072
|
/**
|
|
186934
187073
|
* The CLUSTER switch of one pipeline step (D1065):
|
|
@@ -214898,6 +215037,13 @@ Object.freeze({
|
|
|
214898
215037
|
access: "view",
|
|
214899
215038
|
role: "admin"
|
|
214900
215039
|
},
|
|
215040
|
+
"streamBroker.previewDerivedEncode": {
|
|
215041
|
+
capName: "stream-broker",
|
|
215042
|
+
capScope: "system",
|
|
215043
|
+
addonId: null,
|
|
215044
|
+
access: "view",
|
|
215045
|
+
role: "admin"
|
|
215046
|
+
},
|
|
214901
215047
|
"streamBroker.probeStream": {
|
|
214902
215048
|
capName: "stream-broker",
|
|
214903
215049
|
capScope: "system",
|
|
@@ -219353,6 +219499,11 @@ Object.freeze({
|
|
|
219353
219499
|
form: "single",
|
|
219354
219500
|
optional: false
|
|
219355
219501
|
}],
|
|
219502
|
+
"streamBroker.previewDerivedEncode": [{
|
|
219503
|
+
name: "deviceId",
|
|
219504
|
+
form: "single",
|
|
219505
|
+
optional: false
|
|
219506
|
+
}],
|
|
219356
219507
|
"streamBroker.produceEventMedia": [{
|
|
219357
219508
|
name: "deviceId",
|
|
219358
219509
|
form: "single",
|
|
@@ -229439,8 +229590,8 @@ function wantsEventTrace(debugGeneral, socketFlags) {
|
|
|
229439
229590
|
//#region src/reolink-hub-session.ts
|
|
229440
229591
|
var HUB_DISCOVERY_REFRESH_TIMEOUT_MS = 8e3;
|
|
229441
229592
|
/**
|
|
229442
|
-
* How often the
|
|
229443
|
-
* sleep slices. 60 s: a naturally-waking camera (PIR, schedule) is caught within a minute, and
|
|
229593
|
+
* How often the core re-reads the session's own channels summary to reconcile the adopted
|
|
229594
|
+
* children's sleep slices (the floor of the `device-state-refresh` policy). 60 s: a naturally-waking camera (PIR, schedule) is caught within a minute, and
|
|
229444
229595
|
* the play path has its own faster confirm + post-dial watch, so this only ever carries
|
|
229445
229596
|
* background drift. Never wakes a child — the summary is answered by the hub itself.
|
|
229446
229597
|
*/
|
|
@@ -229481,7 +229632,6 @@ var ReolinkHubSession = class {
|
|
|
229481
229632
|
#connectInFlight = null;
|
|
229482
229633
|
#reconnectAttempts = 0;
|
|
229483
229634
|
#reconnectTimer = null;
|
|
229484
|
-
#reconcileTimer = null;
|
|
229485
229635
|
#shutdown = false;
|
|
229486
229636
|
#online = false;
|
|
229487
229637
|
#snapshot = {
|
|
@@ -229546,14 +229696,11 @@ var ReolinkHubSession = class {
|
|
|
229546
229696
|
port: c.rtspPort
|
|
229547
229697
|
};
|
|
229548
229698
|
}
|
|
229549
|
-
/**
|
|
229699
|
+
/**
|
|
229700
|
+
* Make the first dial. The reconcile after it is the core's: `device-state-refresh` calls
|
|
229701
|
+
* {@link refresh} at {@link HUB_CHILD_SLEEP_RECONCILE_MS} (D1062), the session owns no clock.
|
|
229702
|
+
*/
|
|
229550
229703
|
start() {
|
|
229551
|
-
if (this.#reconcileTimer === null) {
|
|
229552
|
-
this.#reconcileTimer = setInterval(() => {
|
|
229553
|
-
this.refresh().catch(() => {});
|
|
229554
|
-
}, HUB_CHILD_SLEEP_RECONCILE_MS);
|
|
229555
|
-
if (typeof this.#reconcileTimer.unref === "function") this.#reconcileTimer.unref();
|
|
229556
|
-
}
|
|
229557
229704
|
this.getApi().catch((err) => {
|
|
229558
229705
|
this.#logger.warn("Reolink hub initial connect failed — will retry", {
|
|
229559
229706
|
tags: { integrationId: this.integrationId },
|
|
@@ -229586,10 +229733,6 @@ var ReolinkHubSession = class {
|
|
|
229586
229733
|
clearTimeout(this.#reconnectTimer);
|
|
229587
229734
|
this.#reconnectTimer = null;
|
|
229588
229735
|
}
|
|
229589
|
-
if (this.#reconcileTimer !== null) {
|
|
229590
|
-
clearInterval(this.#reconcileTimer);
|
|
229591
|
-
this.#reconcileTimer = null;
|
|
229592
|
-
}
|
|
229593
229736
|
await this.dropApi("hub-shutdown");
|
|
229594
229737
|
}
|
|
229595
229738
|
/**
|
|
@@ -230111,6 +230254,39 @@ async function connectReolinkHub(connection) {
|
|
|
230111
230254
|
return api;
|
|
230112
230255
|
}
|
|
230113
230256
|
//#endregion
|
|
230257
|
+
//#region src/reolink-state-refresh.ts
|
|
230258
|
+
/**
|
|
230259
|
+
* Reolink's side of the core state refresh (D1062) for the cameras behind an NVR / Home Hub.
|
|
230260
|
+
*
|
|
230261
|
+
* The NVR reads its own cameras by itself and pushes their events, so the only scheduled work is
|
|
230262
|
+
* the regular reconcile of the children's sleep state, and it is answered by the NVR session
|
|
230263
|
+
* (`HubSessionHandle.refresh()`): the hub's channel summary and battery table. A refresh NEVER
|
|
230264
|
+
* dials or wakes a child camera. Push level is `partial` (events and awake/sleeping notices
|
|
230265
|
+
* arrive by push; the reconcile catches drift), one schedule per integration (`batch`).
|
|
230266
|
+
*/
|
|
230267
|
+
function hubChildRefreshPolicy(integrationId) {
|
|
230268
|
+
return {
|
|
230269
|
+
integrationId,
|
|
230270
|
+
minIntervalMs: HUB_CHILD_SLEEP_RECONCILE_MS,
|
|
230271
|
+
batch: true,
|
|
230272
|
+
push: "partial"
|
|
230273
|
+
};
|
|
230274
|
+
}
|
|
230275
|
+
/** A standalone camera keeps its own reads and registers nothing. */
|
|
230276
|
+
function registerHubChildStateRefresh(target) {
|
|
230277
|
+
const integrationId = target.integrationId;
|
|
230278
|
+
if (integrationId === null || !target.hubChild) return;
|
|
230279
|
+
target.ctx.registerNativeCap(deviceStateRefreshCapability, {
|
|
230280
|
+
refresh: async () => {
|
|
230281
|
+
const session = target.session();
|
|
230282
|
+
if (session === null) throw new Error(`reolink: no NVR session for integration ${integrationId}`);
|
|
230283
|
+
await session.refresh();
|
|
230284
|
+
return { ok: true };
|
|
230285
|
+
},
|
|
230286
|
+
resubscribe: async () => ({ ok: true })
|
|
230287
|
+
}, { stateRefresh: hubChildRefreshPolicy(integrationId) });
|
|
230288
|
+
}
|
|
230289
|
+
//#endregion
|
|
230114
230290
|
//#region src/hub-child-settings.ts
|
|
230115
230291
|
/**
|
|
230116
230292
|
* A camera adopted under an NVR / Home Hub dials through the integration's session: the address
|
|
@@ -234082,6 +234258,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
234082
234258
|
constructor(ctx) {
|
|
234083
234259
|
super(ctx, reolinkCameraSchema, { type: DeviceType.Camera });
|
|
234084
234260
|
this.registerNativeCapabilities();
|
|
234261
|
+
this.registerNvrStateRefresh();
|
|
234085
234262
|
}
|
|
234086
234263
|
/**
|
|
234087
234264
|
* Resolved Baichuan channel for per-channel cmd_ids. Children
|
|
@@ -235128,6 +235305,20 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
235128
235305
|
async getRawState() {
|
|
235129
235306
|
return buildRawState(this.runtimeState);
|
|
235130
235307
|
}
|
|
235308
|
+
/**
|
|
235309
|
+
* A hub child is kept fresh by its NVR session, never by a dial to the camera (D1062): the
|
|
235310
|
+
* core calls the session's `refresh()` — the hub's own channel summary — once per integration.
|
|
235311
|
+
* A standalone camera keeps its own reads and registers nothing.
|
|
235312
|
+
*/
|
|
235313
|
+
registerNvrStateRefresh() {
|
|
235314
|
+
const integrationId = this.hubIntegrationId();
|
|
235315
|
+
registerHubChildStateRefresh({
|
|
235316
|
+
ctx: this.ctx,
|
|
235317
|
+
integrationId,
|
|
235318
|
+
hubChild: this.isHubChild(),
|
|
235319
|
+
session: () => integrationId === null ? null : reolinkHubSessions.get(integrationId)
|
|
235320
|
+
});
|
|
235321
|
+
}
|
|
235131
235322
|
registerNativeCapabilities() {
|
|
235132
235323
|
this.ctx.registerNativeCap(snapshotCapability, {
|
|
235133
235324
|
getSnapshot: async ({ deviceId, force }) => {
|
package/dist/addon.mjs
CHANGED
|
@@ -106813,7 +106813,7 @@ var ZodIssueCode = {
|
|
|
106813
106813
|
var ZodFirstPartyTypeKind;
|
|
106814
106814
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
106815
106815
|
//#endregion
|
|
106816
|
-
//#region ../types/dist/runtime-capabilities-
|
|
106816
|
+
//#region ../types/dist/runtime-capabilities-B36VcCR6.mjs
|
|
106817
106817
|
/**
|
|
106818
106818
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
106819
106819
|
* window to float samples (D455).
|
|
@@ -111427,14 +111427,104 @@ var SubscribeAudioChunksInputSchema = object({
|
|
|
111427
111427
|
var SubscribeAudioChunksResultSchema = object({
|
|
111428
111428
|
/** Opaque id passed to `pullAudioChunks` / `unsubscribeAudioChunks`. */
|
|
111429
111429
|
subscriptionId: string() });
|
|
111430
|
-
var
|
|
111431
|
-
|
|
111432
|
-
|
|
111433
|
-
|
|
111434
|
-
|
|
111435
|
-
|
|
111436
|
-
|
|
111430
|
+
var BrokerStatusSchema = _enum([
|
|
111431
|
+
"idle",
|
|
111432
|
+
"connecting",
|
|
111433
|
+
"streaming",
|
|
111434
|
+
"error",
|
|
111435
|
+
"stopped"
|
|
111436
|
+
]);
|
|
111437
|
+
/**
|
|
111438
|
+
* The encode a derived stream's feeder was last spawned with — the read-only
|
|
111439
|
+
* "effective encode". Read off the ffmpeg argv that runs, so it cannot drift
|
|
111440
|
+
* from what the operator's profile and the carrier's rules resolved to.
|
|
111441
|
+
*/
|
|
111442
|
+
var DerivedEffectiveEncodeSchema = object({
|
|
111443
|
+
/** `-c:v` of the argv (`libx264`, a hardware encoder, `copy`); null when absent. */
|
|
111444
|
+
encoder: string().nullable(),
|
|
111445
|
+
/** Output frame rate; null when the source cadence passes through unmeasured. */
|
|
111446
|
+
fps: number$1().nullable(),
|
|
111447
|
+
gopFrames: number$1(),
|
|
111448
|
+
/** ABR target (`-b:v`), kbps. */
|
|
111449
|
+
targetKbps: number$1().nullable(),
|
|
111450
|
+
/** Ceiling (`-maxrate`), kbps. */
|
|
111451
|
+
capKbps: number$1().nullable(),
|
|
111452
|
+
bufsizeKbps: number$1().nullable(),
|
|
111453
|
+
/**
|
|
111454
|
+
* `copy` = source audio untouched, `aac` = re-encoded, `profile` = operator's
|
|
111455
|
+
* encode, `none` = the operator dropped the track.
|
|
111456
|
+
*/
|
|
111457
|
+
audio: _enum([
|
|
111458
|
+
"copy",
|
|
111459
|
+
"aac",
|
|
111460
|
+
"profile",
|
|
111461
|
+
"none"
|
|
111462
|
+
])
|
|
111463
|
+
});
|
|
111464
|
+
/**
|
|
111465
|
+
* A derived stream's source: a **profile** slot (follows whatever physical
|
|
111466
|
+
* stream that profile is assigned to) or a **camStream** (pinned to one
|
|
111467
|
+
* physical stream regardless of assignment).
|
|
111468
|
+
*/
|
|
111469
|
+
var DerivedSourceRefSchema = union([object({
|
|
111470
|
+
kind: literal("profile"),
|
|
111471
|
+
profile: _enum([
|
|
111472
|
+
"high",
|
|
111473
|
+
"mid",
|
|
111474
|
+
"low"
|
|
111475
|
+
])
|
|
111476
|
+
}), object({
|
|
111477
|
+
kind: literal("camStream"),
|
|
111478
|
+
camStreamId: string()
|
|
111479
|
+
})]);
|
|
111480
|
+
object({
|
|
111481
|
+
width: number$1().nullable(),
|
|
111482
|
+
height: number$1().nullable(),
|
|
111483
|
+
fps: number$1().nullable(),
|
|
111484
|
+
idrIntervalMs: number$1().nullable(),
|
|
111485
|
+
/** `h264` / `h265` when observed. */
|
|
111486
|
+
videoCodec: _enum(["h264", "h265"]).nullable(),
|
|
111487
|
+
/** Upper-cased SDP name (`AAC`, `PCMU`) when the source has an audio track. */
|
|
111488
|
+
audioCodec: string().nullable()
|
|
111489
|
+
});
|
|
111490
|
+
/**
|
|
111491
|
+
* The full effective encode of a derived-stream profile: the stats the broker
|
|
111492
|
+
* publishes in `getBrokerStats.derivedEncode` plus the resolved geometry, the
|
|
111493
|
+
* flags that say WHY a number differs from the request, and the ffmpeg output
|
|
111494
|
+
* argv. One function (`computeDerivedEncode`) produces it for both the
|
|
111495
|
+
* broker's start path and `previewDerivedEncode`.
|
|
111496
|
+
*/
|
|
111497
|
+
var DerivedEncodePreviewSchema = DerivedEffectiveEncodeSchema.extend({
|
|
111498
|
+
/** Final picture size; `null` when neither the profile nor the source names it. */
|
|
111499
|
+
width: number$1().nullable(),
|
|
111500
|
+
height: number$1().nullable(),
|
|
111501
|
+
/** `h264` / `h265` re-encode, `copy` remux; `null` is never returned (the encoder always resolves). */
|
|
111502
|
+
videoCodec: _enum([
|
|
111503
|
+
"h264",
|
|
111504
|
+
"h265",
|
|
111505
|
+
"copy"
|
|
111437
111506
|
]),
|
|
111507
|
+
requestedFps: number$1().nullable(),
|
|
111508
|
+
/** The requested fps exceeded the source and the source cadence won. */
|
|
111509
|
+
fpsClampedToSource: boolean(),
|
|
111510
|
+
/** Lowest bitrate accepted for this geometry x fps; `null` when unknown. */
|
|
111511
|
+
floorKbps: number$1().nullable(),
|
|
111512
|
+
/** The explicit bitrate was below the floor and was raised to it. */
|
|
111513
|
+
raisedToFloor: boolean(),
|
|
111514
|
+
/** What the profile asked for when it was raised; `null` otherwise. */
|
|
111515
|
+
requestedKbps: number$1().nullable(),
|
|
111516
|
+
/** Seconds between keyframes; `null` when the output cadence is unknown. */
|
|
111517
|
+
keyframeIntervalSec: number$1().nullable(),
|
|
111518
|
+
/** The ffmpeg argv, with the source loopback URL in `-i`. */
|
|
111519
|
+
args: array(string())
|
|
111520
|
+
});
|
|
111521
|
+
/** Result of `previewDerivedEncode`: a plan, or the reason there is none. */
|
|
111522
|
+
var PreviewDerivedEncodeResultSchema = discriminatedUnion("kind", [object({
|
|
111523
|
+
kind: literal("preview"),
|
|
111524
|
+
preview: DerivedEncodePreviewSchema
|
|
111525
|
+
}), object({ kind: literal("no-source") })]);
|
|
111526
|
+
var BrokerStatsSchema = object({
|
|
111527
|
+
status: BrokerStatusSchema,
|
|
111438
111528
|
inputFps: number$1(),
|
|
111439
111529
|
encodedSubscribers: number$1(),
|
|
111440
111530
|
uptimeMs: number$1(),
|
|
@@ -111474,7 +111564,9 @@ var BrokerStatsSchema = object({
|
|
|
111474
111564
|
* alone that the mute is on the packet path and not merely persisted.
|
|
111475
111565
|
*/
|
|
111476
111566
|
audioMuted: boolean().optional(),
|
|
111477
|
-
audioMutedDropped: number$1().optional()
|
|
111567
|
+
audioMutedDropped: number$1().optional(),
|
|
111568
|
+
/** Present for a derived broker once its feeder has spawned at least once. */
|
|
111569
|
+
derivedEncode: DerivedEffectiveEncodeSchema.optional()
|
|
111478
111570
|
});
|
|
111479
111571
|
/**
|
|
111480
111572
|
* Exporter-facing "profile restream" entry. Returned by
|
|
@@ -124002,7 +124094,7 @@ function sleep(ms) {
|
|
|
124002
124094
|
return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
|
|
124003
124095
|
}
|
|
124004
124096
|
//#endregion
|
|
124005
|
-
//#region ../types/dist/implemented-methods-
|
|
124097
|
+
//#region ../types/dist/implemented-methods-BUBqZ2a0.mjs
|
|
124006
124098
|
/**
|
|
124007
124099
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
124008
124100
|
*
|
|
@@ -126627,10 +126719,16 @@ looseObject({
|
|
|
126627
126719
|
TargetSchema.omit({ id: true });
|
|
126628
126720
|
var EncodeProfileSchema = object({
|
|
126629
126721
|
video: object({
|
|
126722
|
+
/**
|
|
126723
|
+
* `h264` / `h265` re-encode into that codec; `source` re-encodes in whatever
|
|
126724
|
+
* codec the source speaks (a resize that keeps the codec); `copy` remuxes
|
|
126725
|
+
* with no encode at all (so no resize either).
|
|
126726
|
+
*/
|
|
126630
126727
|
codec: _enum([
|
|
126631
126728
|
"h264",
|
|
126632
126729
|
"h265",
|
|
126633
|
-
"copy"
|
|
126730
|
+
"copy",
|
|
126731
|
+
"source"
|
|
126634
126732
|
]),
|
|
126635
126733
|
profile: _enum([
|
|
126636
126734
|
"baseline",
|
|
@@ -126682,12 +126780,14 @@ var EncodeProfileSchema = object({
|
|
|
126682
126780
|
singleSlicePerFrame: boolean().optional()
|
|
126683
126781
|
}),
|
|
126684
126782
|
audio: union([literal("passthrough"), object({
|
|
126783
|
+
/** `none` drops the audio track (`-an`); `copy` carries the source's. */
|
|
126685
126784
|
codec: _enum([
|
|
126686
126785
|
"opus",
|
|
126687
126786
|
"aac",
|
|
126688
126787
|
"pcmu",
|
|
126689
126788
|
"pcma",
|
|
126690
|
-
"copy"
|
|
126789
|
+
"copy",
|
|
126790
|
+
"none"
|
|
126691
126791
|
]),
|
|
126692
126792
|
bitrateKbps: number$1().int().positive().optional(),
|
|
126693
126793
|
sampleRateHz: number$1().int().positive().optional(),
|
|
@@ -158033,7 +158133,11 @@ method(object({
|
|
|
158033
158133
|
}).nullable(), {
|
|
158034
158134
|
kind: "mutation",
|
|
158035
158135
|
auth: "admin"
|
|
158036
|
-
}), method(_void(), array(CameraStreamSchema).readonly()), method(_void(), array(ProfileSlotSchema).readonly()), method(object({ brokerId: string() }), BrokerStatsSchema), method(object({
|
|
158136
|
+
}), method(_void(), array(CameraStreamSchema).readonly()), method(_void(), array(ProfileSlotSchema).readonly()), method(object({ brokerId: string() }), BrokerStatsSchema), method(object({
|
|
158137
|
+
deviceId: number$1().int().nonnegative(),
|
|
158138
|
+
profile: EncodeProfileSchema,
|
|
158139
|
+
source: DerivedSourceRefSchema.optional()
|
|
158140
|
+
}), PreviewDerivedEncodeResultSchema), method(object({ brokerId: string() }), object({
|
|
158037
158141
|
probed: boolean(),
|
|
158038
158142
|
summary: string()
|
|
158039
158143
|
}), {
|
|
@@ -166034,15 +166138,28 @@ var DeviceStateRefreshInputSchema = object({
|
|
|
166034
166138
|
var DeviceStateResubscribeInputSchema = object({ deviceId: number$1().int().nonnegative() });
|
|
166035
166139
|
var DeviceStateRefreshResultSchema = object({ ok: literal(true) });
|
|
166036
166140
|
var NOT_OPERATOR_FACING = "the core schedules state refreshes itself; an operator never asks for one";
|
|
166037
|
-
|
|
166038
|
-
|
|
166039
|
-
|
|
166040
|
-
|
|
166041
|
-
|
|
166042
|
-
|
|
166043
|
-
|
|
166044
|
-
|
|
166045
|
-
|
|
166141
|
+
var deviceStateRefreshCapability = {
|
|
166142
|
+
name: "device-state-refresh",
|
|
166143
|
+
scope: "device",
|
|
166144
|
+
deviceNative: true,
|
|
166145
|
+
mode: "singleton",
|
|
166146
|
+
methods: {
|
|
166147
|
+
refresh: method(DeviceStateRefreshInputSchema, DeviceStateRefreshResultSchema, {
|
|
166148
|
+
kind: "mutation",
|
|
166149
|
+
auth: "admin",
|
|
166150
|
+
notOperatorFacing: NOT_OPERATOR_FACING
|
|
166151
|
+
}),
|
|
166152
|
+
resubscribe: method(DeviceStateResubscribeInputSchema, DeviceStateRefreshResultSchema, {
|
|
166153
|
+
kind: "mutation",
|
|
166154
|
+
auth: "admin",
|
|
166155
|
+
notOperatorFacing: NOT_OPERATOR_FACING
|
|
166156
|
+
})
|
|
166157
|
+
},
|
|
166158
|
+
vocabulary: {
|
|
166159
|
+
noun: t("State refresh", "Aggiornamento dello stato"),
|
|
166160
|
+
order: 3247
|
|
166161
|
+
}
|
|
166162
|
+
};
|
|
166046
166163
|
/**
|
|
166047
166164
|
* Generic device-level status snapshot. Auto-registered by `BaseDevice`
|
|
166048
166165
|
* for every device, regardless of provider — the kernel needs a uniform
|
|
@@ -178481,7 +178598,13 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
178481
178598
|
/** Pool deaths inside the current window. */
|
|
178482
178599
|
deaths: number$1(),
|
|
178483
178600
|
/** The last death's message. */
|
|
178484
|
-
lastError: string()
|
|
178601
|
+
lastError: string(),
|
|
178602
|
+
/**
|
|
178603
|
+
* Present when the device is ABSENT rather than dead: the runtime
|
|
178604
|
+
* itself enumerates no such device (`no-gpu-device` — OpenVINO sees
|
|
178605
|
+
* no supported GPU; driver/runtime does not support this iGPU).
|
|
178606
|
+
*/
|
|
178607
|
+
absentReason: _enum(["no-gpu-device"]).optional()
|
|
178485
178608
|
})).readonly() })), method(object({
|
|
178486
178609
|
nodeId: string(),
|
|
178487
178610
|
deviceKey: string()
|
|
@@ -179375,7 +179498,8 @@ var StatelessStepRefusalSchema = _enum([
|
|
|
179375
179498
|
"unknown-step",
|
|
179376
179499
|
"model-not-servable",
|
|
179377
179500
|
"unreadable-frame",
|
|
179378
|
-
"execution-failed"
|
|
179501
|
+
"execution-failed",
|
|
179502
|
+
"no-eligible-device"
|
|
179379
179503
|
]);
|
|
179380
179504
|
/**
|
|
179381
179505
|
* Answer to `runStatelessStep` — a discriminated union rather than a nullable
|
|
@@ -186837,7 +186961,8 @@ var InferenceDeviceExclusionReasonSchema = _enum([
|
|
|
186837
186961
|
"unavailable",
|
|
186838
186962
|
"cannot-host-camera-root",
|
|
186839
186963
|
"accelerator-preferred",
|
|
186840
|
-
"root-switched-off"
|
|
186964
|
+
"root-switched-off",
|
|
186965
|
+
"no-gpu-device"
|
|
186841
186966
|
]);
|
|
186842
186967
|
var NodeInferenceDeviceSchema = object({
|
|
186843
186968
|
/** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
|
|
@@ -186870,7 +186995,13 @@ var NodeInferenceDeviceSchema = object({
|
|
|
186870
186995
|
enabled: boolean(),
|
|
186871
186996
|
/** Relative balancer weight for the enabled device (default 1). */
|
|
186872
186997
|
weight: number$1(),
|
|
186873
|
-
/**
|
|
186998
|
+
/**
|
|
186999
|
+
* Per-device concurrent-session cap; null = unlimited (multi-device C4). A
|
|
187000
|
+
* limit: a camera no device can take within its cap stays on the node's
|
|
187001
|
+
* default pool — EXCEPT when that default pool is an excluded device
|
|
187002
|
+
* (`defaultPoolExcluded`), where it goes over the cap on the least-loaded
|
|
187003
|
+
* eligible device instead (#610).
|
|
187004
|
+
*/
|
|
186874
187005
|
maxSessions: number$1().nullable(),
|
|
186875
187006
|
/** Object-detection model the executor defaults to for this deviceKey. */
|
|
186876
187007
|
defaultModelId: string(),
|
|
@@ -186920,7 +187051,15 @@ var NodeInferenceDevicesSchema = object({
|
|
|
186920
187051
|
nodeId: string(),
|
|
186921
187052
|
/** False when the node's platform-probe was unreachable (no live device set). */
|
|
186922
187053
|
reachable: boolean(),
|
|
186923
|
-
devices: array(NodeInferenceDeviceSchema).readonly()
|
|
187054
|
+
devices: array(NodeInferenceDeviceSchema).readonly(),
|
|
187055
|
+
/**
|
|
187056
|
+
* The election left NO device and one was excluded because the operator
|
|
187057
|
+
* turned it off or it is not functional (#610): the runner's default pool is
|
|
187058
|
+
* that device, so work with no explicit device (a stateless step, a bench with
|
|
187059
|
+
* no `deviceKey`) is refused rather than run there. Absent = an orchestrator
|
|
187060
|
+
* older than the field, or an unreachable node: nothing is claimed (D315).
|
|
187061
|
+
*/
|
|
187062
|
+
defaultPoolExcluded: boolean().optional()
|
|
186924
187063
|
});
|
|
186925
187064
|
/**
|
|
186926
187065
|
* The CLUSTER switch of one pipeline step (D1065):
|
|
@@ -214890,6 +215029,13 @@ Object.freeze({
|
|
|
214890
215029
|
access: "view",
|
|
214891
215030
|
role: "admin"
|
|
214892
215031
|
},
|
|
215032
|
+
"streamBroker.previewDerivedEncode": {
|
|
215033
|
+
capName: "stream-broker",
|
|
215034
|
+
capScope: "system",
|
|
215035
|
+
addonId: null,
|
|
215036
|
+
access: "view",
|
|
215037
|
+
role: "admin"
|
|
215038
|
+
},
|
|
214893
215039
|
"streamBroker.probeStream": {
|
|
214894
215040
|
capName: "stream-broker",
|
|
214895
215041
|
capScope: "system",
|
|
@@ -219345,6 +219491,11 @@ Object.freeze({
|
|
|
219345
219491
|
form: "single",
|
|
219346
219492
|
optional: false
|
|
219347
219493
|
}],
|
|
219494
|
+
"streamBroker.previewDerivedEncode": [{
|
|
219495
|
+
name: "deviceId",
|
|
219496
|
+
form: "single",
|
|
219497
|
+
optional: false
|
|
219498
|
+
}],
|
|
219348
219499
|
"streamBroker.produceEventMedia": [{
|
|
219349
219500
|
name: "deviceId",
|
|
219350
219501
|
form: "single",
|
|
@@ -229431,8 +229582,8 @@ function wantsEventTrace(debugGeneral, socketFlags) {
|
|
|
229431
229582
|
//#region src/reolink-hub-session.ts
|
|
229432
229583
|
var HUB_DISCOVERY_REFRESH_TIMEOUT_MS = 8e3;
|
|
229433
229584
|
/**
|
|
229434
|
-
* How often the
|
|
229435
|
-
* sleep slices. 60 s: a naturally-waking camera (PIR, schedule) is caught within a minute, and
|
|
229585
|
+
* How often the core re-reads the session's own channels summary to reconcile the adopted
|
|
229586
|
+
* children's sleep slices (the floor of the `device-state-refresh` policy). 60 s: a naturally-waking camera (PIR, schedule) is caught within a minute, and
|
|
229436
229587
|
* the play path has its own faster confirm + post-dial watch, so this only ever carries
|
|
229437
229588
|
* background drift. Never wakes a child — the summary is answered by the hub itself.
|
|
229438
229589
|
*/
|
|
@@ -229473,7 +229624,6 @@ var ReolinkHubSession = class {
|
|
|
229473
229624
|
#connectInFlight = null;
|
|
229474
229625
|
#reconnectAttempts = 0;
|
|
229475
229626
|
#reconnectTimer = null;
|
|
229476
|
-
#reconcileTimer = null;
|
|
229477
229627
|
#shutdown = false;
|
|
229478
229628
|
#online = false;
|
|
229479
229629
|
#snapshot = {
|
|
@@ -229538,14 +229688,11 @@ var ReolinkHubSession = class {
|
|
|
229538
229688
|
port: c.rtspPort
|
|
229539
229689
|
};
|
|
229540
229690
|
}
|
|
229541
|
-
/**
|
|
229691
|
+
/**
|
|
229692
|
+
* Make the first dial. The reconcile after it is the core's: `device-state-refresh` calls
|
|
229693
|
+
* {@link refresh} at {@link HUB_CHILD_SLEEP_RECONCILE_MS} (D1062), the session owns no clock.
|
|
229694
|
+
*/
|
|
229542
229695
|
start() {
|
|
229543
|
-
if (this.#reconcileTimer === null) {
|
|
229544
|
-
this.#reconcileTimer = setInterval(() => {
|
|
229545
|
-
this.refresh().catch(() => {});
|
|
229546
|
-
}, HUB_CHILD_SLEEP_RECONCILE_MS);
|
|
229547
|
-
if (typeof this.#reconcileTimer.unref === "function") this.#reconcileTimer.unref();
|
|
229548
|
-
}
|
|
229549
229696
|
this.getApi().catch((err) => {
|
|
229550
229697
|
this.#logger.warn("Reolink hub initial connect failed — will retry", {
|
|
229551
229698
|
tags: { integrationId: this.integrationId },
|
|
@@ -229578,10 +229725,6 @@ var ReolinkHubSession = class {
|
|
|
229578
229725
|
clearTimeout(this.#reconnectTimer);
|
|
229579
229726
|
this.#reconnectTimer = null;
|
|
229580
229727
|
}
|
|
229581
|
-
if (this.#reconcileTimer !== null) {
|
|
229582
|
-
clearInterval(this.#reconcileTimer);
|
|
229583
|
-
this.#reconcileTimer = null;
|
|
229584
|
-
}
|
|
229585
229728
|
await this.dropApi("hub-shutdown");
|
|
229586
229729
|
}
|
|
229587
229730
|
/**
|
|
@@ -230103,6 +230246,39 @@ async function connectReolinkHub(connection) {
|
|
|
230103
230246
|
return api;
|
|
230104
230247
|
}
|
|
230105
230248
|
//#endregion
|
|
230249
|
+
//#region src/reolink-state-refresh.ts
|
|
230250
|
+
/**
|
|
230251
|
+
* Reolink's side of the core state refresh (D1062) for the cameras behind an NVR / Home Hub.
|
|
230252
|
+
*
|
|
230253
|
+
* The NVR reads its own cameras by itself and pushes their events, so the only scheduled work is
|
|
230254
|
+
* the regular reconcile of the children's sleep state, and it is answered by the NVR session
|
|
230255
|
+
* (`HubSessionHandle.refresh()`): the hub's channel summary and battery table. A refresh NEVER
|
|
230256
|
+
* dials or wakes a child camera. Push level is `partial` (events and awake/sleeping notices
|
|
230257
|
+
* arrive by push; the reconcile catches drift), one schedule per integration (`batch`).
|
|
230258
|
+
*/
|
|
230259
|
+
function hubChildRefreshPolicy(integrationId) {
|
|
230260
|
+
return {
|
|
230261
|
+
integrationId,
|
|
230262
|
+
minIntervalMs: HUB_CHILD_SLEEP_RECONCILE_MS,
|
|
230263
|
+
batch: true,
|
|
230264
|
+
push: "partial"
|
|
230265
|
+
};
|
|
230266
|
+
}
|
|
230267
|
+
/** A standalone camera keeps its own reads and registers nothing. */
|
|
230268
|
+
function registerHubChildStateRefresh(target) {
|
|
230269
|
+
const integrationId = target.integrationId;
|
|
230270
|
+
if (integrationId === null || !target.hubChild) return;
|
|
230271
|
+
target.ctx.registerNativeCap(deviceStateRefreshCapability, {
|
|
230272
|
+
refresh: async () => {
|
|
230273
|
+
const session = target.session();
|
|
230274
|
+
if (session === null) throw new Error(`reolink: no NVR session for integration ${integrationId}`);
|
|
230275
|
+
await session.refresh();
|
|
230276
|
+
return { ok: true };
|
|
230277
|
+
},
|
|
230278
|
+
resubscribe: async () => ({ ok: true })
|
|
230279
|
+
}, { stateRefresh: hubChildRefreshPolicy(integrationId) });
|
|
230280
|
+
}
|
|
230281
|
+
//#endregion
|
|
230106
230282
|
//#region src/hub-child-settings.ts
|
|
230107
230283
|
/**
|
|
230108
230284
|
* A camera adopted under an NVR / Home Hub dials through the integration's session: the address
|
|
@@ -234074,6 +234250,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
234074
234250
|
constructor(ctx) {
|
|
234075
234251
|
super(ctx, reolinkCameraSchema, { type: DeviceType.Camera });
|
|
234076
234252
|
this.registerNativeCapabilities();
|
|
234253
|
+
this.registerNvrStateRefresh();
|
|
234077
234254
|
}
|
|
234078
234255
|
/**
|
|
234079
234256
|
* Resolved Baichuan channel for per-channel cmd_ids. Children
|
|
@@ -235120,6 +235297,20 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
235120
235297
|
async getRawState() {
|
|
235121
235298
|
return buildRawState(this.runtimeState);
|
|
235122
235299
|
}
|
|
235300
|
+
/**
|
|
235301
|
+
* A hub child is kept fresh by its NVR session, never by a dial to the camera (D1062): the
|
|
235302
|
+
* core calls the session's `refresh()` — the hub's own channel summary — once per integration.
|
|
235303
|
+
* A standalone camera keeps its own reads and registers nothing.
|
|
235304
|
+
*/
|
|
235305
|
+
registerNvrStateRefresh() {
|
|
235306
|
+
const integrationId = this.hubIntegrationId();
|
|
235307
|
+
registerHubChildStateRefresh({
|
|
235308
|
+
ctx: this.ctx,
|
|
235309
|
+
integrationId,
|
|
235310
|
+
hubChild: this.isHubChild(),
|
|
235311
|
+
session: () => integrationId === null ? null : reolinkHubSessions.get(integrationId)
|
|
235312
|
+
});
|
|
235313
|
+
}
|
|
235123
235314
|
registerNativeCapabilities() {
|
|
235124
235315
|
this.ctx.registerNativeCap(snapshotCapability, {
|
|
235125
235316
|
getSnapshot: async ({ deviceId, force }) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-provider-reolink",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.246",
|
|
4
4
|
"description": "Reolink camera device provider addon for CamStack — native Baichuan protocol",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"werift"
|
|
97
97
|
],
|
|
98
98
|
"requires": {
|
|
99
|
-
"server": ">=1.2.
|
|
99
|
+
"server": ">=1.2.908"
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
102
|
"files": [
|