@camstack/addon-provider-reolink 1.2.166 → 1.2.167
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/addon.js +248 -194
- package/dist/addon.mjs +248 -194
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -32,7 +32,7 @@ let node_os = require("node:os");
|
|
|
32
32
|
node_os = require_chunk.__toESM(node_os);
|
|
33
33
|
let node_fs = require("node:fs");
|
|
34
34
|
node_fs = require_chunk.__toESM(node_fs, 1);
|
|
35
|
-
//#region ../types/dist/event-category-
|
|
35
|
+
//#region ../types/dist/event-category-BGmz_oxW.mjs
|
|
36
36
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
37
37
|
EventCategory["SystemBoot"] = "system.boot";
|
|
38
38
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -565,6 +565,15 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
565
565
|
*/
|
|
566
566
|
EventCategory["PipelineAudioInferenceResult"] = "pipeline.audio-inference-result";
|
|
567
567
|
EventCategory["DetectionPhaseTransition"] = "detection.phase-transition";
|
|
568
|
+
/**
|
|
569
|
+
* A camera provider's RAW onboard motion push (D673): the `MotionOnMotionChanged`
|
|
570
|
+
* data shape without `triggeredBy`, built by `providerMotionEvent`. Its one
|
|
571
|
+
* consumer is the orchestrator's camera-sensors bridge, which re-emits the
|
|
572
|
+
* camera's EFFECTIVE onboard motion as `MotionOnMotionChanged` (a pass-through
|
|
573
|
+
* for a camera with no attached sensor). Providers must not emit
|
|
574
|
+
* `MotionOnMotionChanged` themselves; `scripts/check-onboard-motion-emitters.ts`
|
|
575
|
+
* keeps it so (camera-grid is a named, deferred exception).
|
|
576
|
+
*/
|
|
568
577
|
EventCategory["ProviderMotion"] = "provider.motion";
|
|
569
578
|
EventCategory["ProviderDetection"] = "provider.detection";
|
|
570
579
|
EventCategory["EnrichmentEmbeddingStored"] = "enrichment.embedding.stored";
|
|
@@ -5403,7 +5412,7 @@ var ZodIssueCode = {
|
|
|
5403
5412
|
var ZodFirstPartyTypeKind;
|
|
5404
5413
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5405
5414
|
//#endregion
|
|
5406
|
-
//#region ../types/dist/sleep-
|
|
5415
|
+
//#region ../types/dist/sleep-CDCONfkt.mjs
|
|
5407
5416
|
/**
|
|
5408
5417
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5409
5418
|
* window to float samples (D455).
|
|
@@ -7494,7 +7503,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
7494
7503
|
return DeviceRole;
|
|
7495
7504
|
}({});
|
|
7496
7505
|
//#endregion
|
|
7497
|
-
//#region ../types/dist/composition-
|
|
7506
|
+
//#region ../types/dist/composition-43aqsZQj.mjs
|
|
7498
7507
|
/**
|
|
7499
7508
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
7500
7509
|
*
|
|
@@ -7551,13 +7560,12 @@ portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac
|
|
|
7551
7560
|
* LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
|
|
7552
7561
|
* valutatore puro del suo FRONTE.
|
|
7553
7562
|
*
|
|
7554
|
-
*
|
|
7555
|
-
*
|
|
7556
|
-
*
|
|
7557
|
-
*
|
|
7558
|
-
*
|
|
7559
|
-
* fa suonare il campanello ma non registra" — è esattamente D62.
|
|
7560
|
-
* SPOSTA qui e il doorbell la ri-esporta.
|
|
7563
|
+
* UNA tabella per tutti quelli che chiedono "questo device è ALTO?": il
|
|
7564
|
+
* trigger `RecordingTriggers.sensorDeviceIds` del recorder, i marker dei
|
|
7565
|
+
* sensori della post-analysis, il bridge camera-sensors dell'orchestratore e
|
|
7566
|
+
* le sorgenti di un campanello composto (`doorbellFeatureSources`, D671).
|
|
7567
|
+
* Una seconda copia divergerebbe alla prima cap aggiunta, e il sintomo — "il
|
|
7568
|
+
* sensore fa suonare il campanello ma non registra" — è esattamente D62.
|
|
7561
7569
|
*
|
|
7562
7570
|
* ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
|
|
7563
7571
|
* due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
|
|
@@ -7583,8 +7591,6 @@ var SOURCE_CAP_ACTIVE_FIELD = {
|
|
|
7583
7591
|
vibration: "detected",
|
|
7584
7592
|
tamper: "tampered"
|
|
7585
7593
|
};
|
|
7586
|
-
/** Cap names whose presence in a device's bindings qualify it as a source. */
|
|
7587
|
-
var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
|
|
7588
7594
|
/**
|
|
7589
7595
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
7590
7596
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
@@ -9314,7 +9320,7 @@ var RecordingTriggersSchema = object({
|
|
|
9314
9320
|
*
|
|
9315
9321
|
* Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
|
|
9316
9322
|
* `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
|
|
9317
|
-
* la stessa
|
|
9323
|
+
* la stessa del campanello composto (D671). Ed è il FRONTE, non
|
|
9318
9324
|
* il livello: un contatto trovato già aperto al riavvio del runner non fa
|
|
9319
9325
|
* registrare.
|
|
9320
9326
|
*/
|
|
@@ -16335,109 +16341,10 @@ method(object({
|
|
|
16335
16341
|
deviceIds: array(number()).readonly(),
|
|
16336
16342
|
caps: array(string()).readonly().optional()
|
|
16337
16343
|
}), record(string(), record(string(), unknown().nullable())));
|
|
16338
|
-
|
|
16339
|
-
|
|
16340
|
-
* name (same pattern as `snapshot`):
|
|
16341
|
-
*
|
|
16342
|
-
* - **Native** providers: registered per-device by device-driver
|
|
16343
|
-
* addons via `ctx.registerNativeCap` — either on a
|
|
16344
|
-
* `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
|
|
16345
|
-
* or directly on the camera (Reolink registers at camera level).
|
|
16346
|
-
* Emits an `onPressed` event every time the firmware pushes a
|
|
16347
|
-
* ring; status tracks the last press and a pressCount since start
|
|
16348
|
-
* (diagnostic).
|
|
16349
|
-
*
|
|
16350
|
-
* - **Wrapper** provider: the `virtual-doorbell` system builtin
|
|
16351
|
-
* (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
|
|
16352
|
-
* device (contact / switch / event-emitter …) into a doorbell for
|
|
16353
|
-
* a camera. `defaultActive: false` — the operator explicitly binds
|
|
16354
|
-
* it per camera in the device-bindings UI, then picks the source
|
|
16355
|
-
* device + trigger in the per-device settings.
|
|
16356
|
-
*
|
|
16357
|
-
* The DeviceEventPropagator re-emits `onPressed` on the camera parent
|
|
16358
|
-
* — subscribers listening at the camera level receive ring events
|
|
16359
|
-
* with `via[]` populated. No code on the parent needed.
|
|
16360
|
-
*/
|
|
16361
|
-
var DoorbellStatusSchema = object({
|
|
16362
|
-
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
16363
|
-
lastPressedAt: number().nullable(),
|
|
16364
|
-
/** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
|
|
16365
|
-
pressCountSinceStart: number()
|
|
16366
|
-
});
|
|
16367
|
-
var DoorbellPressEventSchema = object({
|
|
16368
|
-
deviceId: number(),
|
|
16369
|
-
timestamp: number()
|
|
16370
|
-
});
|
|
16371
|
-
/**
|
|
16372
|
-
* The `doorbell-source` extension slot's editable value (D648): the camera's
|
|
16373
|
-
* virtual-doorbell trigger devices, exactly what the wrapper's
|
|
16374
|
-
* `doorbellSources` persists (as `{ deviceId }` records).
|
|
16375
|
-
*/
|
|
16376
|
-
var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
|
|
16377
|
-
/**
|
|
16378
|
-
* The `doorbell-source` slot — which devices ring this camera's VIRTUAL
|
|
16379
|
-
* doorbell, owned by the `virtual-doorbell` wrapper over its
|
|
16380
|
-
* `doorbellSources` store (D648). A source rings when one of its
|
|
16381
|
-
* `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
|
|
16382
|
-
* different authority (`deviceManager.setWrapperActive`, D62) — the slot
|
|
16383
|
-
* reports it, it never writes it.
|
|
16384
|
-
*/
|
|
16385
|
-
var DOORBELL_SOURCE_SLOT = {
|
|
16386
|
-
id: "doorbell-source",
|
|
16387
|
-
label: "Doorbell trigger devices",
|
|
16388
|
-
description: "Any of these becoming active rings this camera's virtual doorbell: a binary sensor when it goes active, a switch when it turns on.",
|
|
16389
|
-
shape: "association",
|
|
16390
|
-
hostDeviceTypes: [DeviceType.Camera],
|
|
16391
|
-
sourceCaps: SOURCE_CAPS,
|
|
16392
|
-
cardinality: "many",
|
|
16393
|
-
value: DoorbellSourceSlotValueSchema
|
|
16394
|
-
};
|
|
16395
|
-
var doorbellCapability = {
|
|
16396
|
-
name: "doorbell",
|
|
16397
|
-
scope: "device",
|
|
16398
|
-
deviceNative: true,
|
|
16399
|
-
mode: "singleton",
|
|
16400
|
-
kind: "wrapper",
|
|
16401
|
-
defaultActive: false,
|
|
16402
|
-
deviceTypes: [DeviceType.Button, DeviceType.Camera],
|
|
16403
|
-
extensionSlots: [DOORBELL_SOURCE_SLOT],
|
|
16404
|
-
methods: {},
|
|
16405
|
-
events: {
|
|
16406
|
-
/**
|
|
16407
|
-
* Fires once per physical press. Reolink delivers via Baichuan
|
|
16408
|
-
* push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
|
|
16409
|
-
* release/duration — it's a pulse.
|
|
16410
|
-
*/
|
|
16411
|
-
onPressed: {
|
|
16412
|
-
data: DoorbellPressEventSchema,
|
|
16413
|
-
fromState: {
|
|
16414
|
-
field: "lastPressedAt",
|
|
16415
|
-
on: "advance"
|
|
16416
|
-
}
|
|
16417
|
-
} },
|
|
16418
|
-
status: {
|
|
16419
|
-
schema: DoorbellStatusSchema,
|
|
16420
|
-
kind: "push"
|
|
16421
|
-
},
|
|
16422
|
-
/**
|
|
16423
|
-
* Runtime-state slice — last press timestamp + lifetime press count.
|
|
16424
|
-
* Mirrored by the kernel and readable via
|
|
16425
|
-
* `device.state.doorbell.value`. UIs can show "last ring 5m ago"
|
|
16426
|
-
* without subscribing.
|
|
16427
|
-
*/
|
|
16428
|
-
runtimeState: DoorbellStatusSchema,
|
|
16429
|
-
/**
|
|
16430
|
-
* Runtime-state durability: **restored** — a monotonic accumulator: the slice IS the record. `lastPressedAt` is content here, not a clock, so it is deliberately NOT volatile.
|
|
16431
|
-
*
|
|
16432
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
16433
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
16434
|
-
*/
|
|
16435
|
-
durability: "restored"
|
|
16436
|
-
};
|
|
16437
|
-
var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
|
|
16438
|
-
DeviceType.Camera, DeviceType.Camera;
|
|
16344
|
+
var ExtensionSlotIdSchema = _enum(["linked-devices"]);
|
|
16345
|
+
DeviceType.Camera;
|
|
16439
16346
|
/** A slot's editable value, discriminated on `slot`. */
|
|
16440
|
-
var ExtensionSlotValueSchema = discriminatedUnion("slot", [
|
|
16347
|
+
var ExtensionSlotValueSchema = discriminatedUnion("slot", [LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
|
|
16441
16348
|
DeviceType.Camera;
|
|
16442
16349
|
var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
|
|
16443
16350
|
state: literal("unreachable"),
|
|
@@ -16474,10 +16381,11 @@ var ExtensionSlotSourceSchema = object({
|
|
|
16474
16381
|
});
|
|
16475
16382
|
/**
|
|
16476
16383
|
* A DIFFERENT authority that gates whether the slot's sources do anything —
|
|
16477
|
-
* reported read-only, named, never written through this contract (D62).
|
|
16478
|
-
*
|
|
16479
|
-
*
|
|
16480
|
-
* `unknown` means the gate could
|
|
16384
|
+
* reported read-only, named, never written through this contract (D62) — e.g.
|
|
16385
|
+
* a slot whose sources act only while a wrapper is bound to the host, a
|
|
16386
|
+
* binding that belongs to `deviceManager.setWrapperActive`. No slot reports
|
|
16387
|
+
* one today (`linked-devices` answers `null`). `unknown` means the gate could
|
|
16388
|
+
* not be read; it is not "inactive" (D315).
|
|
16481
16389
|
*/
|
|
16482
16390
|
var ExtensionSlotActivationSchema = object({
|
|
16483
16391
|
state: _enum([
|
|
@@ -16493,7 +16401,7 @@ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
|
|
|
16493
16401
|
/** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
|
|
16494
16402
|
slotRef: string(),
|
|
16495
16403
|
slot: ExtensionSlotIdSchema,
|
|
16496
|
-
/** Names the store written (D62), e.g. `
|
|
16404
|
+
/** Names the store written (D62), e.g. `device-manager:_linkedDeviceIds`. */
|
|
16497
16405
|
authority: string(),
|
|
16498
16406
|
activation: ExtensionSlotActivationSchema.nullable(),
|
|
16499
16407
|
value: ExtensionSlotValueSchema,
|
|
@@ -21655,12 +21563,26 @@ var CameraSensorRefSchema = object({
|
|
|
21655
21563
|
function cameraSensorRefKey(ref) {
|
|
21656
21564
|
return `${ref.addonId}/${ref.stableId}`;
|
|
21657
21565
|
}
|
|
21658
|
-
/**
|
|
21659
|
-
|
|
21660
|
-
|
|
21661
|
-
|
|
21662
|
-
|
|
21663
|
-
|
|
21566
|
+
/**
|
|
21567
|
+
* A sensor's mode (D673). `in-addition`: its motion is the camera's motion too.
|
|
21568
|
+
* `replace`: its motion is the camera's, and while one is READY the camera's
|
|
21569
|
+
* own motion no longer counts on its own. `confirm`: while one is READY the
|
|
21570
|
+
* camera's own motion counts only while a confirm sensor is active — with or
|
|
21571
|
+
* without a replace sensor (spec C2, the controller's ruling on Q1).
|
|
21572
|
+
*/
|
|
21573
|
+
var CameraSensorModeSchema = _enum([
|
|
21574
|
+
"in-addition",
|
|
21575
|
+
"confirm",
|
|
21576
|
+
"replace"
|
|
21577
|
+
]);
|
|
21578
|
+
/** A stored sensor with no mode — every CS-1 row — is in addition. */
|
|
21579
|
+
var DEFAULT_CAMERA_SENSOR_MODE = "in-addition";
|
|
21580
|
+
/**
|
|
21581
|
+
* A camera's attached sensors. A CS-1 row carried an envelope
|
|
21582
|
+
* `mode: 'in-addition'`: `z.object` drops it on parse, and the PARSED value is
|
|
21583
|
+
* what the write stores (D672 rule 3), so it is never written again.
|
|
21584
|
+
*/
|
|
21585
|
+
var CameraSensorsConfigSchema = object({ sensors: array(CameraSensorRefSchema.extend({ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE) })).min(1).max(8) }).superRefine((value, ctx) => {
|
|
21664
21586
|
const seen = /* @__PURE__ */ new Set();
|
|
21665
21587
|
value.sensors.forEach((ref, index) => {
|
|
21666
21588
|
const key = cameraSensorRefKey(ref);
|
|
@@ -21672,39 +21594,41 @@ var CameraSensorsConfigSchema = object({
|
|
|
21672
21594
|
seen.add(key);
|
|
21673
21595
|
});
|
|
21674
21596
|
});
|
|
21675
|
-
|
|
21597
|
+
/** Every attachment names its mode; an older orchestrator that does not is in addition. */
|
|
21598
|
+
var AttachmentFields = {
|
|
21676
21599
|
addonId: string(),
|
|
21677
|
-
stableId: string()
|
|
21600
|
+
stableId: string(),
|
|
21601
|
+
mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE)
|
|
21678
21602
|
};
|
|
21679
21603
|
var CameraSensorAttachmentSchema = discriminatedUnion("state", [
|
|
21680
21604
|
object({
|
|
21681
|
-
...
|
|
21605
|
+
...AttachmentFields,
|
|
21682
21606
|
state: literal("ready"),
|
|
21683
21607
|
deviceId: number(),
|
|
21684
21608
|
name: string(),
|
|
21685
21609
|
caps: array(string()).readonly()
|
|
21686
21610
|
}),
|
|
21687
21611
|
object({
|
|
21688
|
-
...
|
|
21612
|
+
...AttachmentFields,
|
|
21689
21613
|
state: literal("offline"),
|
|
21690
21614
|
deviceId: number(),
|
|
21691
21615
|
name: string(),
|
|
21692
21616
|
reason: _enum(["offline", "disabled"])
|
|
21693
21617
|
}),
|
|
21694
21618
|
object({
|
|
21695
|
-
...
|
|
21619
|
+
...AttachmentFields,
|
|
21696
21620
|
state: literal("missing"),
|
|
21697
21621
|
reason: string()
|
|
21698
21622
|
}),
|
|
21699
21623
|
object({
|
|
21700
|
-
...
|
|
21624
|
+
...AttachmentFields,
|
|
21701
21625
|
state: literal("unsupported"),
|
|
21702
21626
|
deviceId: number(),
|
|
21703
21627
|
name: string(),
|
|
21704
21628
|
reason: string()
|
|
21705
21629
|
}),
|
|
21706
21630
|
object({
|
|
21707
|
-
...
|
|
21631
|
+
...AttachmentFields,
|
|
21708
21632
|
state: literal("unreadable"),
|
|
21709
21633
|
reason: string()
|
|
21710
21634
|
})
|
|
@@ -21717,17 +21641,49 @@ var CameraSensorAttachmentSchema = discriminatedUnion("state", [
|
|
|
21717
21641
|
* say.
|
|
21718
21642
|
*/
|
|
21719
21643
|
var CameraSensorsNotForwardedSchema = _enum(["onboard-not-listed", "no-active-detection"]);
|
|
21644
|
+
/** Whether the camera's OWN motion counts on its own (D673 C2), from its READY sensors (C3). */
|
|
21645
|
+
var CameraOwnMotionSchema = _enum([
|
|
21646
|
+
"always",
|
|
21647
|
+
"when-confirmed",
|
|
21648
|
+
"never"
|
|
21649
|
+
]);
|
|
21650
|
+
/** Confirm / Replace cannot suppress this camera's motion: its provider still emits it directly (D673 C13). */
|
|
21651
|
+
var CameraSensorsNotEnforcedSchema = _enum(["provider-not-split"]);
|
|
21652
|
+
/**
|
|
21653
|
+
* The camera's OWN onboard motion (D696): the raw input the bridge combines,
|
|
21654
|
+
* never the effective value. The camera's `motion` slice is the effective one,
|
|
21655
|
+
* so a view of the camera's own row reads this.
|
|
21656
|
+
* - `atMs`: when the bridge received the camera's last own edge.
|
|
21657
|
+
* - `detected`: evaluated WHEN THE STATUS IS ASKED — the last edge said `true`
|
|
21658
|
+
* AND it is younger than the window the bridge counts the camera's own motion
|
|
21659
|
+
* for (`motionCooldownMs`, floored at two sustain ticks). A camera that never
|
|
21660
|
+
* sends a clear (heartbeats only) therefore reads `false` once no push came
|
|
21661
|
+
* within the window; a status read is a snapshot, so a live view re-asks.
|
|
21662
|
+
* Absent = this orchestrator has not received the camera's own motion since it
|
|
21663
|
+
* started (unknown, never "quiet"), or an orchestrator older than D696.
|
|
21664
|
+
*/
|
|
21665
|
+
var CameraRawLevelSchema = object({
|
|
21666
|
+
detected: boolean(),
|
|
21667
|
+
atMs: number()
|
|
21668
|
+
});
|
|
21720
21669
|
var CameraSensorsStatusSchema = discriminatedUnion("state", [
|
|
21721
|
-
object({
|
|
21670
|
+
object({
|
|
21671
|
+
state: literal("not-configured"),
|
|
21672
|
+
cameraLevel: CameraRawLevelSchema.optional()
|
|
21673
|
+
}),
|
|
21722
21674
|
object({
|
|
21723
21675
|
state: literal("unreadable"),
|
|
21724
|
-
reason: string()
|
|
21676
|
+
reason: string(),
|
|
21677
|
+
cameraLevel: CameraRawLevelSchema.optional()
|
|
21725
21678
|
}),
|
|
21726
21679
|
object({
|
|
21727
21680
|
state: literal("configured"),
|
|
21728
|
-
|
|
21681
|
+
cameraLevel: CameraRawLevelSchema.optional(),
|
|
21729
21682
|
sensors: array(CameraSensorAttachmentSchema).readonly(),
|
|
21730
|
-
|
|
21683
|
+
/** Absent = an orchestrator older than CS-2: it does not say (D315). */
|
|
21684
|
+
cameraMotion: CameraOwnMotionSchema.optional(),
|
|
21685
|
+
notForwarded: CameraSensorsNotForwardedSchema.optional(),
|
|
21686
|
+
notEnforced: CameraSensorsNotEnforcedSchema.optional()
|
|
21731
21687
|
})
|
|
21732
21688
|
]);
|
|
21733
21689
|
Object.freeze({
|
|
@@ -24958,8 +24914,10 @@ var RunnerCameraConfigSchema = object({
|
|
|
24958
24914
|
* - `analyzer`: ML/frame-diff motion detection (motion-wasm or other
|
|
24959
24915
|
* analyzer providers) running on decoded frames in this runner.
|
|
24960
24916
|
* - `onboard`: camera-native motion pushes (Reolink Baichuan, ONVIF
|
|
24961
|
-
* analytics). The provider emits ProviderMotion
|
|
24962
|
-
*
|
|
24917
|
+
* analytics). The provider emits its raw push as `ProviderMotion`
|
|
24918
|
+
* (D673); the orchestrator's camera-sensors bridge re-emits the camera's
|
|
24919
|
+
* effective motion as `MotionOnMotionChanged`, which is what reaches
|
|
24920
|
+
* `reportMotion`.
|
|
24963
24921
|
*/
|
|
24964
24922
|
motionSources: MotionSourcesSchema.default(["analyzer"]),
|
|
24965
24923
|
/**
|
|
@@ -25136,7 +25094,15 @@ var RunnerLocalLoadSchema = object({
|
|
|
25136
25094
|
hasGpu: boolean(),
|
|
25137
25095
|
inferenceBackend: string().optional(),
|
|
25138
25096
|
cpuCores: number().optional()
|
|
25139
|
-
})
|
|
25097
|
+
}),
|
|
25098
|
+
/**
|
|
25099
|
+
* Who writes a camera's `motion` runtime slice (D696). `'orchestrator'`: this
|
|
25100
|
+
* runner never writes it. ABSENT = a runner older than D696, which still
|
|
25101
|
+
* writes the slice from its phase machine; the orchestrator does not write
|
|
25102
|
+
* while any runner node is absent-or-unanswered, so one slice never has two
|
|
25103
|
+
* writers.
|
|
25104
|
+
*/
|
|
25105
|
+
motionSliceWriter: literal("orchestrator").optional()
|
|
25140
25106
|
});
|
|
25141
25107
|
/**
|
|
25142
25108
|
* Aggregate runtime metrics for the runner's whole local pool. Mirrors the
|
|
@@ -31179,6 +31145,70 @@ onStatusChanged: { data: object({
|
|
|
31179
31145
|
* whether persisting is worth a SQLite commit. */
|
|
31180
31146
|
volatileStateFields: ["lastChangedAt"]
|
|
31181
31147
|
};
|
|
31148
|
+
var DoorbellStatusSchema = object({
|
|
31149
|
+
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
31150
|
+
lastPressedAt: number().nullable(),
|
|
31151
|
+
/** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
|
|
31152
|
+
pressCountSinceStart: number()
|
|
31153
|
+
});
|
|
31154
|
+
var DoorbellPressEventSchema = object({
|
|
31155
|
+
deviceId: number(),
|
|
31156
|
+
timestamp: number()
|
|
31157
|
+
});
|
|
31158
|
+
/**
|
|
31159
|
+
* Doorbell button cap. Two kinds of provider serve it, and to every consumer
|
|
31160
|
+
* they are the same cap:
|
|
31161
|
+
*
|
|
31162
|
+
* - **Native** providers, registered per device by a driver addon through
|
|
31163
|
+
* `ctx.registerNativeCap` — a `DeviceType.Button` accessory with
|
|
31164
|
+
* `role: DeviceRole.Doorbell`, or the camera itself (Reolink registers at
|
|
31165
|
+
* camera level). They emit `onPressed` on every firmware ring.
|
|
31166
|
+
* - **A composed doorbell** (D670, D671): a camera's customization gives it
|
|
31167
|
+
* the cap, its `lastPressedAt` rising from the sources the operator
|
|
31168
|
+
* assigned in Customize → Doorbell, and the composer emits `onPressed`
|
|
31169
|
+
* from that field's advance (`fromState`).
|
|
31170
|
+
*
|
|
31171
|
+
* The DeviceEventPropagator re-emits `onPressed` on the camera parent.
|
|
31172
|
+
*/
|
|
31173
|
+
var doorbellCapability = {
|
|
31174
|
+
name: "doorbell",
|
|
31175
|
+
scope: "device",
|
|
31176
|
+
deviceNative: true,
|
|
31177
|
+
mode: "singleton",
|
|
31178
|
+
deviceTypes: [DeviceType.Button, DeviceType.Camera],
|
|
31179
|
+
methods: {},
|
|
31180
|
+
events: {
|
|
31181
|
+
/**
|
|
31182
|
+
* Fires once per physical press. Reolink delivers via Baichuan
|
|
31183
|
+
* push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
|
|
31184
|
+
* release/duration — it's a pulse.
|
|
31185
|
+
*/
|
|
31186
|
+
onPressed: {
|
|
31187
|
+
data: DoorbellPressEventSchema,
|
|
31188
|
+
fromState: {
|
|
31189
|
+
field: "lastPressedAt",
|
|
31190
|
+
on: "advance"
|
|
31191
|
+
}
|
|
31192
|
+
} },
|
|
31193
|
+
status: {
|
|
31194
|
+
schema: DoorbellStatusSchema,
|
|
31195
|
+
kind: "push"
|
|
31196
|
+
},
|
|
31197
|
+
/**
|
|
31198
|
+
* Runtime-state slice — last press timestamp + lifetime press count.
|
|
31199
|
+
* Mirrored by the kernel and readable via
|
|
31200
|
+
* `device.state.doorbell.value`. UIs can show "last ring 5m ago"
|
|
31201
|
+
* without subscribing.
|
|
31202
|
+
*/
|
|
31203
|
+
runtimeState: DoorbellStatusSchema,
|
|
31204
|
+
/**
|
|
31205
|
+
* Runtime-state durability: **restored** — a monotonic accumulator: the slice IS the record. `lastPressedAt` is content here, not a clock, so it is deliberately NOT volatile.
|
|
31206
|
+
*
|
|
31207
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
31208
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
31209
|
+
*/
|
|
31210
|
+
durability: "restored"
|
|
31211
|
+
};
|
|
31182
31212
|
/**
|
|
31183
31213
|
* Enum-state sensor — a string value picked from a finite option set.
|
|
31184
31214
|
* Drives HA `sensor` entries with `state_class: enum` (HVAC action
|
|
@@ -33323,9 +33353,9 @@ var MotionStatusSchema = object({
|
|
|
33323
33353
|
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
33324
33354
|
lastDetectedAt: number().nullable(),
|
|
33325
33355
|
/**
|
|
33326
|
-
* `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device
|
|
33327
|
-
* `null` while false and on every `Sensor`
|
|
33328
|
-
* constant's doc for the one-authority rule.
|
|
33356
|
+
* `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device (the
|
|
33357
|
+
* orchestrator writes it, D696), `null` while false and on every `Sensor`
|
|
33358
|
+
* device (D475) — see that constant's doc for the one-authority rule.
|
|
33329
33359
|
*
|
|
33330
33360
|
* ## Reading this field still arms nothing
|
|
33331
33361
|
*
|
|
@@ -33343,34 +33373,31 @@ var MotionStatusSchema = object({
|
|
|
33343
33373
|
* `addon-export-alexa/src/motion-clear-hold.ts` and
|
|
33344
33374
|
* `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
|
|
33345
33375
|
*
|
|
33346
|
-
* ## Who writes it
|
|
33347
|
-
*
|
|
33348
|
-
* - **Cameras** — the
|
|
33349
|
-
*
|
|
33350
|
-
* `
|
|
33351
|
-
* `
|
|
33352
|
-
*
|
|
33353
|
-
*
|
|
33354
|
-
* a
|
|
33355
|
-
*
|
|
33356
|
-
*
|
|
33357
|
-
*
|
|
33358
|
-
*
|
|
33359
|
-
*
|
|
33360
|
-
*
|
|
33361
|
-
*
|
|
33362
|
-
*
|
|
33363
|
-
*
|
|
33364
|
-
* `
|
|
33365
|
-
*
|
|
33366
|
-
*
|
|
33367
|
-
*
|
|
33368
|
-
*
|
|
33369
|
-
*
|
|
33370
|
-
*
|
|
33371
|
-
* This predates D475 and is not fixed there: the fix touches every
|
|
33372
|
-
* camera provider. Recorded in D475's Consequences. Do not restore the
|
|
33373
|
-
* "sole writer" wording without also removing the other writers.
|
|
33376
|
+
* ## Who writes it (D696)
|
|
33377
|
+
*
|
|
33378
|
+
* - **Cameras** — the orchestrator, and nothing else. It writes the camera's
|
|
33379
|
+
* EFFECTIVE motion (`addon-pipeline-orchestrator`
|
|
33380
|
+
* `camera-sensors/motion-slice.ts`), alongside the effective
|
|
33381
|
+
* `MotionOnMotionChanged` it emits or receives: the camera-sensors bridge
|
|
33382
|
+
* for a split camera, an unsplit emitter's direct event, the analyzer and
|
|
33383
|
+
* device activity, as the camera's `motionSources` counts them. A source
|
|
33384
|
+
* that never sends a clear falls one window after its last `true`.
|
|
33385
|
+
* `lastDetectedAt` moves only on an effective rise. No camera provider
|
|
33386
|
+
* writes this slice (not even a boot seed), and neither does the runner's
|
|
33387
|
+
* phase machine: its phase is "a session is attached" for every on-motion
|
|
33388
|
+
* session, not motion, and it now has its own `DetectionPhaseTransition`.
|
|
33389
|
+
* A provider's `isDetected` answers from the hub's slice.
|
|
33390
|
+
* - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
|
|
33391
|
+
* imports) — the provider pushes both edges itself, from the upstream
|
|
33392
|
+
* system's own state change. That is the sensor's own fact.
|
|
33393
|
+
*
|
|
33394
|
+
* `scripts/check-onboard-motion-emitters.ts` refuses any other writer of a
|
|
33395
|
+
* `motion` slice; each sensor writer is a named exemption.
|
|
33396
|
+
*
|
|
33397
|
+
* This replaces the D475 §4 rule ("the phase machine is the sole writer").
|
|
33398
|
+
* That rule was never true: Hikvision and Amcrest wrote the slice raw beside
|
|
33399
|
+
* it, every provider seeded it at boot, and every session left it
|
|
33400
|
+
* `detected: true` after its detach.
|
|
33374
33401
|
*/
|
|
33375
33402
|
autoClearAfterMs: number().nullable()
|
|
33376
33403
|
});
|
|
@@ -33442,11 +33469,12 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
|
|
|
33442
33469
|
*/
|
|
33443
33470
|
runtimeState: MotionStatusSchema,
|
|
33444
33471
|
/**
|
|
33445
|
-
* Runtime-state durability: **session** —
|
|
33472
|
+
* Runtime-state durability: **session** — the writer of this slice
|
|
33446
33473
|
* writes only on an EDGE, so a restored `detected: true` would stay
|
|
33447
33474
|
* frozen until the next one instead of being corrected. The next edge
|
|
33448
|
-
* re-publishes the real state
|
|
33449
|
-
*
|
|
33475
|
+
* re-publishes the real state, and the orchestrator re-publishes every
|
|
33476
|
+
* camera when it starts writing (D696; on who writes it, see
|
|
33477
|
+
* `autoClearAfterMs` above).
|
|
33450
33478
|
*
|
|
33451
33479
|
* See `RuntimeStateDurability`. Enforced by
|
|
33452
33480
|
* `scripts/check-runtime-state-durability.ts`.
|
|
@@ -35961,8 +35989,7 @@ var ptzAutotrackCapability = {
|
|
|
35961
35989
|
deviceNative: true,
|
|
35962
35990
|
mode: "singleton",
|
|
35963
35991
|
/**
|
|
35964
|
-
* Two kinds of provider behind one name, the same shape `snapshot`
|
|
35965
|
-
* `doorbell` use:
|
|
35992
|
+
* Two kinds of provider behind one name, the same shape `snapshot` uses:
|
|
35966
35993
|
*
|
|
35967
35994
|
* - **Native**: the camera's own firmware autotrack, registered per device by
|
|
35968
35995
|
* the driver when the probe says it exists (Reolink: yes; Hikvision:
|
|
@@ -35970,7 +35997,7 @@ var ptzAutotrackCapability = {
|
|
|
35970
35997
|
* - **Wrapper**: the emulated implementation (`@camstack/system`'s `autotrack` builtin),
|
|
35971
35998
|
* which follows a subject with `ptz.move` pulses driven by the detection
|
|
35972
35999
|
* pipeline. `defaultActive: false` — the operator binds it per camera in
|
|
35973
|
-
* the bindings UI
|
|
36000
|
+
* the bindings UI.
|
|
35974
36001
|
*
|
|
35975
36002
|
* The binding chooses WHICH implementation answers; `setEnabled` stays the
|
|
35976
36003
|
* one switch for the function either way. A camera never has both driving its
|
|
@@ -53498,6 +53525,25 @@ TimelapseRuleInputSchema.extend({
|
|
|
53498
53525
|
createdAt: number(),
|
|
53499
53526
|
updatedAt: number()
|
|
53500
53527
|
});
|
|
53528
|
+
async function readHubMotionDetected(deviceState, deviceId) {
|
|
53529
|
+
let slice;
|
|
53530
|
+
try {
|
|
53531
|
+
slice = await deviceState.getCapSlice.query({
|
|
53532
|
+
deviceId,
|
|
53533
|
+
capName: "motion"
|
|
53534
|
+
});
|
|
53535
|
+
} catch (err) {
|
|
53536
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
53537
|
+
throw new Error(`motion state of device ${deviceId} is unreadable: ${reason}`, { cause: err });
|
|
53538
|
+
}
|
|
53539
|
+
const detected = slice?.["detected"];
|
|
53540
|
+
if (typeof detected !== "boolean") throw new Error(`motion state of device ${deviceId} is not published yet (unknown)`);
|
|
53541
|
+
return detected;
|
|
53542
|
+
}
|
|
53543
|
+
MotionOnMotionChangedDataSchema.omit({ triggeredBy: true });
|
|
53544
|
+
function providerMotionEvent(source, data) {
|
|
53545
|
+
return createEvent(EventCategory.ProviderMotion, source, data);
|
|
53546
|
+
}
|
|
53501
53547
|
object({
|
|
53502
53548
|
/**
|
|
53503
53549
|
* Fraction of the box's own size added on EACH side before cutting.
|
|
@@ -165053,6 +165099,22 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
165053
165099
|
* writers are {@link refreshNetworkLinkFromApi}. Seeded unknown so the
|
|
165054
165100
|
* restored slice (if any) stays valid and a fresh device draws no link.
|
|
165055
165101
|
*/
|
|
165102
|
+
/**
|
|
165103
|
+
* The native `motion` cap. This provider writes NO `motion` slice (D696):
|
|
165104
|
+
* `handleSimpleEvent` emits its raw push as `ProviderMotion` (`source:
|
|
165105
|
+
* 'onboard'`, D673), the orchestrator's camera-sensors bridge turns it into
|
|
165106
|
+
* the effective `MotionOnMotionChanged`, and the orchestrator is the slice's
|
|
165107
|
+
* only writer, with that effective value, on the hub. `isDetected`
|
|
165108
|
+
* therefore answers from the HUB's slice; an unreadable hub, or a slice
|
|
165109
|
+
* nobody has published since the hub started, fails the call. It never
|
|
165110
|
+
* answers `false` for "unknown" (D49, D393).
|
|
165111
|
+
*/
|
|
165112
|
+
registerMotionCap() {
|
|
165113
|
+
this.ctx.registerNativeCap(motionCapability, { isDetected: async ({ deviceId }) => {
|
|
165114
|
+
if (deviceId !== this.id) throw new Error(`ReolinkCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
|
|
165115
|
+
return readHubMotionDetected(this.ctx.api.deviceState, this.id);
|
|
165116
|
+
} });
|
|
165117
|
+
}
|
|
165056
165118
|
registerNetworkLink() {
|
|
165057
165119
|
this.ctx.registerNativeCap(networkLinkCapability, { getStatus: async ({ deviceId }) => {
|
|
165058
165120
|
if (deviceId !== this.id) throw new Error(`ReolinkCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
|
|
@@ -165781,15 +165843,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
165781
165843
|
};
|
|
165782
165844
|
} });
|
|
165783
165845
|
this.registerNetworkLink();
|
|
165784
|
-
this.
|
|
165785
|
-
if (deviceId !== this.id) throw new Error(`ReolinkCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
|
|
165786
|
-
return this.state.motion.detected ?? false;
|
|
165787
|
-
} });
|
|
165788
|
-
this.setCapSlice(motionCapability, {
|
|
165789
|
-
detected: false,
|
|
165790
|
-
lastDetectedAt: null,
|
|
165791
|
-
autoClearAfterMs: null
|
|
165792
|
-
});
|
|
165846
|
+
this.registerMotionCap();
|
|
165793
165847
|
this.registerDoorbellIfSupported();
|
|
165794
165848
|
this.registerPtzIfSupported();
|
|
165795
165849
|
this.registerPtzAutotrackIfSupported();
|
|
@@ -171788,11 +171842,11 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
171788
171842
|
* axes, each driven exclusively by their own firmware push events.
|
|
171789
171843
|
*
|
|
171790
171844
|
* - 'motion' + AI types (people, vehicle, animal, face, package):
|
|
171791
|
-
* emit `EventCategory.
|
|
171792
|
-
*
|
|
171793
|
-
*
|
|
171794
|
-
*
|
|
171795
|
-
*
|
|
171845
|
+
* emit the RAW push as `EventCategory.ProviderMotion`
|
|
171846
|
+
* (`source: 'onboard'`, D673). The orchestrator's camera-sensors bridge
|
|
171847
|
+
* re-emits it as the effective `MotionOnMotionChanged`, and the
|
|
171848
|
+
* orchestrator is the only writer of the camera's `motion` runtime-state
|
|
171849
|
+
* slice (D696; no slice write here). AI subtype also lands on
|
|
171796
171850
|
* `EventCategory.DetectionCameraNative`.
|
|
171797
171851
|
* - 'awake' / 'sleeping': emit DeviceAwake / DeviceSleeping. Battery
|
|
171798
171852
|
* power-state only — does NOT touch online state.
|
|
@@ -171845,7 +171899,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
171845
171899
|
} });
|
|
171846
171900
|
if (event.type === "motion") {
|
|
171847
171901
|
const now = Date.now();
|
|
171848
|
-
this.ctx.eventBus.emit(
|
|
171902
|
+
this.ctx.eventBus.emit(providerMotionEvent(eventSource, {
|
|
171849
171903
|
deviceId: this.id,
|
|
171850
171904
|
detected: true,
|
|
171851
171905
|
timestamp: now,
|
|
@@ -171873,7 +171927,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
171873
171927
|
}]
|
|
171874
171928
|
}));
|
|
171875
171929
|
} else this.noteNativeDetectionSuppressed(aiClass);
|
|
171876
|
-
this.ctx.eventBus.emit(
|
|
171930
|
+
this.ctx.eventBus.emit(providerMotionEvent(eventSource, {
|
|
171877
171931
|
deviceId: this.id,
|
|
171878
171932
|
detected: true,
|
|
171879
171933
|
timestamp: now,
|
|
@@ -173722,7 +173776,7 @@ var AutodetectCache = class {
|
|
|
173722
173776
|
* silently dropped.
|
|
173723
173777
|
*
|
|
173724
173778
|
* Returns a LIST rather than a single type because of `doorbell`. The
|
|
173725
|
-
* camera's `handleSimpleEvent` emits `
|
|
173779
|
+
* camera's `handleSimpleEvent` emits `ProviderMotion` for `motion`
|
|
173726
173780
|
* and for every AI class, but the `doorbell` branch emits ONLY
|
|
173727
173781
|
* `DoorbellOnPressed` and returns. An email is the sole signal a sleeping
|
|
173728
173782
|
* battery camera can send, so a doorbell-classified email mapped to
|