@camstack/addon-provider-wyze 0.2.121 → 0.2.123
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 +336 -206
- package/dist/addon.mjs +336 -206
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { getCACertificates, setDefaultCACertificates } from "node:tls";
|
|
|
10
10
|
//#region \0rolldown/runtime.js
|
|
11
11
|
var __require$1 = /* @__PURE__ */ createRequire(import.meta.url);
|
|
12
12
|
//#endregion
|
|
13
|
-
//#region ../types/dist/event-category-
|
|
13
|
+
//#region ../types/dist/event-category-BGmz_oxW.mjs
|
|
14
14
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
15
15
|
EventCategory["SystemBoot"] = "system.boot";
|
|
16
16
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -543,6 +543,15 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
543
543
|
*/
|
|
544
544
|
EventCategory["PipelineAudioInferenceResult"] = "pipeline.audio-inference-result";
|
|
545
545
|
EventCategory["DetectionPhaseTransition"] = "detection.phase-transition";
|
|
546
|
+
/**
|
|
547
|
+
* A camera provider's RAW onboard motion push (D673): the `MotionOnMotionChanged`
|
|
548
|
+
* data shape without `triggeredBy`, built by `providerMotionEvent`. Its one
|
|
549
|
+
* consumer is the orchestrator's camera-sensors bridge, which re-emits the
|
|
550
|
+
* camera's EFFECTIVE onboard motion as `MotionOnMotionChanged` (a pass-through
|
|
551
|
+
* for a camera with no attached sensor). Providers must not emit
|
|
552
|
+
* `MotionOnMotionChanged` themselves; `scripts/check-onboard-motion-emitters.ts`
|
|
553
|
+
* keeps it so (camera-grid is a named, deferred exception).
|
|
554
|
+
*/
|
|
546
555
|
EventCategory["ProviderMotion"] = "provider.motion";
|
|
547
556
|
EventCategory["ProviderDetection"] = "provider.detection";
|
|
548
557
|
EventCategory["EnrichmentEmbeddingStored"] = "enrichment.embedding.stored";
|
|
@@ -5381,7 +5390,7 @@ var ZodIssueCode = {
|
|
|
5381
5390
|
var ZodFirstPartyTypeKind;
|
|
5382
5391
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5383
5392
|
//#endregion
|
|
5384
|
-
//#region ../types/dist/sleep-
|
|
5393
|
+
//#region ../types/dist/sleep-CDCONfkt.mjs
|
|
5385
5394
|
/**
|
|
5386
5395
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5387
5396
|
* window to float samples (D455).
|
|
@@ -7424,7 +7433,7 @@ function errMsg(err) {
|
|
|
7424
7433
|
return String(err);
|
|
7425
7434
|
}
|
|
7426
7435
|
//#endregion
|
|
7427
|
-
//#region ../types/dist/composition-
|
|
7436
|
+
//#region ../types/dist/composition-43aqsZQj.mjs
|
|
7428
7437
|
/**
|
|
7429
7438
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
7430
7439
|
*
|
|
@@ -7481,13 +7490,12 @@ portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac
|
|
|
7481
7490
|
* LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
|
|
7482
7491
|
* valutatore puro del suo FRONTE.
|
|
7483
7492
|
*
|
|
7484
|
-
*
|
|
7485
|
-
*
|
|
7486
|
-
*
|
|
7487
|
-
*
|
|
7488
|
-
*
|
|
7489
|
-
* fa suonare il campanello ma non registra" — è esattamente D62.
|
|
7490
|
-
* SPOSTA qui e il doorbell la ri-esporta.
|
|
7493
|
+
* UNA tabella per tutti quelli che chiedono "questo device è ALTO?": il
|
|
7494
|
+
* trigger `RecordingTriggers.sensorDeviceIds` del recorder, i marker dei
|
|
7495
|
+
* sensori della post-analysis, il bridge camera-sensors dell'orchestratore e
|
|
7496
|
+
* le sorgenti di un campanello composto (`doorbellFeatureSources`, D671).
|
|
7497
|
+
* Una seconda copia divergerebbe alla prima cap aggiunta, e il sintomo — "il
|
|
7498
|
+
* sensore fa suonare il campanello ma non registra" — è esattamente D62.
|
|
7491
7499
|
*
|
|
7492
7500
|
* ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
|
|
7493
7501
|
* due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
|
|
@@ -7513,8 +7521,6 @@ var SOURCE_CAP_ACTIVE_FIELD = {
|
|
|
7513
7521
|
vibration: "detected",
|
|
7514
7522
|
tamper: "tampered"
|
|
7515
7523
|
};
|
|
7516
|
-
/** Cap names whose presence in a device's bindings qualify it as a source. */
|
|
7517
|
-
var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
|
|
7518
7524
|
/**
|
|
7519
7525
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
7520
7526
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
@@ -9244,7 +9250,7 @@ var RecordingTriggersSchema = object({
|
|
|
9244
9250
|
*
|
|
9245
9251
|
* Cosa vuol dire "alto" dipende dal TIPO di device e non è deciso qui:
|
|
9246
9252
|
* `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) è LA tabella,
|
|
9247
|
-
* la stessa
|
|
9253
|
+
* la stessa del campanello composto (D671). Ed è il FRONTE, non
|
|
9248
9254
|
* il livello: un contatto trovato già aperto al riavvio del runner non fa
|
|
9249
9255
|
* registrare.
|
|
9250
9256
|
*/
|
|
@@ -14758,7 +14764,17 @@ var SiteZoneSchema = object({
|
|
|
14758
14764
|
var ProviderStatusSchema = object({
|
|
14759
14765
|
connected: boolean(),
|
|
14760
14766
|
deviceCount: number(),
|
|
14761
|
-
error: string().optional()
|
|
14767
|
+
error: string().optional(),
|
|
14768
|
+
/**
|
|
14769
|
+
* `'orchestrator'`: this provider writes NO camera's `motion` runtime slice
|
|
14770
|
+
* — the orchestrator is its only writer (D696). Set by `BaseDeviceProvider`,
|
|
14771
|
+
* which every provider bundles, so only a provider BUILT from D696-amended
|
|
14772
|
+
* code says it. ABSENT means an older provider that may still write it (raw
|
|
14773
|
+
* VMD writes, a boot seed), and the orchestrator's provider gate keeps that
|
|
14774
|
+
* provider's cameras unwritten (`camera-sensors/motion-slice-provider-gate.ts`)
|
|
14775
|
+
* — the provider twin of the runner's `getLocalLoad().motionSliceWriter`.
|
|
14776
|
+
*/
|
|
14777
|
+
motionSliceWriter: literal("orchestrator").optional()
|
|
14762
14778
|
});
|
|
14763
14779
|
object({
|
|
14764
14780
|
externalId: string(),
|
|
@@ -15637,109 +15653,10 @@ method(object({
|
|
|
15637
15653
|
deviceIds: array(number()).readonly(),
|
|
15638
15654
|
caps: array(string()).readonly().optional()
|
|
15639
15655
|
}), record(string(), record(string(), unknown().nullable())));
|
|
15640
|
-
|
|
15641
|
-
|
|
15642
|
-
* name (same pattern as `snapshot`):
|
|
15643
|
-
*
|
|
15644
|
-
* - **Native** providers: registered per-device by device-driver
|
|
15645
|
-
* addons via `ctx.registerNativeCap` — either on a
|
|
15646
|
-
* `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
|
|
15647
|
-
* or directly on the camera (Reolink registers at camera level).
|
|
15648
|
-
* Emits an `onPressed` event every time the firmware pushes a
|
|
15649
|
-
* ring; status tracks the last press and a pressCount since start
|
|
15650
|
-
* (diagnostic).
|
|
15651
|
-
*
|
|
15652
|
-
* - **Wrapper** provider: the `virtual-doorbell` system builtin
|
|
15653
|
-
* (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
|
|
15654
|
-
* device (contact / switch / event-emitter …) into a doorbell for
|
|
15655
|
-
* a camera. `defaultActive: false` — the operator explicitly binds
|
|
15656
|
-
* it per camera in the device-bindings UI, then picks the source
|
|
15657
|
-
* device + trigger in the per-device settings.
|
|
15658
|
-
*
|
|
15659
|
-
* The DeviceEventPropagator re-emits `onPressed` on the camera parent
|
|
15660
|
-
* — subscribers listening at the camera level receive ring events
|
|
15661
|
-
* with `via[]` populated. No code on the parent needed.
|
|
15662
|
-
*/
|
|
15663
|
-
var DoorbellStatusSchema = object({
|
|
15664
|
-
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
15665
|
-
lastPressedAt: number().nullable(),
|
|
15666
|
-
/** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
|
|
15667
|
-
pressCountSinceStart: number()
|
|
15668
|
-
});
|
|
15669
|
-
var DoorbellPressEventSchema = object({
|
|
15670
|
-
deviceId: number(),
|
|
15671
|
-
timestamp: number()
|
|
15672
|
-
});
|
|
15673
|
-
/**
|
|
15674
|
-
* The `doorbell-source` extension slot's editable value (D648): the camera's
|
|
15675
|
-
* virtual-doorbell trigger devices, exactly what the wrapper's
|
|
15676
|
-
* `doorbellSources` persists (as `{ deviceId }` records).
|
|
15677
|
-
*/
|
|
15678
|
-
var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
|
|
15679
|
-
/**
|
|
15680
|
-
* The `doorbell-source` slot — which devices ring this camera's VIRTUAL
|
|
15681
|
-
* doorbell, owned by the `virtual-doorbell` wrapper over its
|
|
15682
|
-
* `doorbellSources` store (D648). A source rings when one of its
|
|
15683
|
-
* `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
|
|
15684
|
-
* different authority (`deviceManager.setWrapperActive`, D62) — the slot
|
|
15685
|
-
* reports it, it never writes it.
|
|
15686
|
-
*/
|
|
15687
|
-
var DOORBELL_SOURCE_SLOT = {
|
|
15688
|
-
id: "doorbell-source",
|
|
15689
|
-
label: "Doorbell trigger devices",
|
|
15690
|
-
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.",
|
|
15691
|
-
shape: "association",
|
|
15692
|
-
hostDeviceTypes: [DeviceType.Camera],
|
|
15693
|
-
sourceCaps: SOURCE_CAPS,
|
|
15694
|
-
cardinality: "many",
|
|
15695
|
-
value: DoorbellSourceSlotValueSchema
|
|
15696
|
-
};
|
|
15697
|
-
var doorbellCapability = {
|
|
15698
|
-
name: "doorbell",
|
|
15699
|
-
scope: "device",
|
|
15700
|
-
deviceNative: true,
|
|
15701
|
-
mode: "singleton",
|
|
15702
|
-
kind: "wrapper",
|
|
15703
|
-
defaultActive: false,
|
|
15704
|
-
deviceTypes: [DeviceType.Button, DeviceType.Camera],
|
|
15705
|
-
extensionSlots: [DOORBELL_SOURCE_SLOT],
|
|
15706
|
-
methods: {},
|
|
15707
|
-
events: {
|
|
15708
|
-
/**
|
|
15709
|
-
* Fires once per physical press. Reolink delivers via Baichuan
|
|
15710
|
-
* push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
|
|
15711
|
-
* release/duration — it's a pulse.
|
|
15712
|
-
*/
|
|
15713
|
-
onPressed: {
|
|
15714
|
-
data: DoorbellPressEventSchema,
|
|
15715
|
-
fromState: {
|
|
15716
|
-
field: "lastPressedAt",
|
|
15717
|
-
on: "advance"
|
|
15718
|
-
}
|
|
15719
|
-
} },
|
|
15720
|
-
status: {
|
|
15721
|
-
schema: DoorbellStatusSchema,
|
|
15722
|
-
kind: "push"
|
|
15723
|
-
},
|
|
15724
|
-
/**
|
|
15725
|
-
* Runtime-state slice — last press timestamp + lifetime press count.
|
|
15726
|
-
* Mirrored by the kernel and readable via
|
|
15727
|
-
* `device.state.doorbell.value`. UIs can show "last ring 5m ago"
|
|
15728
|
-
* without subscribing.
|
|
15729
|
-
*/
|
|
15730
|
-
runtimeState: DoorbellStatusSchema,
|
|
15731
|
-
/**
|
|
15732
|
-
* 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.
|
|
15733
|
-
*
|
|
15734
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
15735
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
15736
|
-
*/
|
|
15737
|
-
durability: "restored"
|
|
15738
|
-
};
|
|
15739
|
-
var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
|
|
15740
|
-
DeviceType.Camera, DeviceType.Camera;
|
|
15656
|
+
var ExtensionSlotIdSchema = _enum(["linked-devices"]);
|
|
15657
|
+
DeviceType.Camera;
|
|
15741
15658
|
/** A slot's editable value, discriminated on `slot`. */
|
|
15742
|
-
var ExtensionSlotValueSchema = discriminatedUnion("slot", [
|
|
15659
|
+
var ExtensionSlotValueSchema = discriminatedUnion("slot", [LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
|
|
15743
15660
|
DeviceType.Camera;
|
|
15744
15661
|
var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
|
|
15745
15662
|
state: literal("unreachable"),
|
|
@@ -15776,10 +15693,11 @@ var ExtensionSlotSourceSchema = object({
|
|
|
15776
15693
|
});
|
|
15777
15694
|
/**
|
|
15778
15695
|
* A DIFFERENT authority that gates whether the slot's sources do anything —
|
|
15779
|
-
* reported read-only, named, never written through this contract (D62).
|
|
15780
|
-
*
|
|
15781
|
-
*
|
|
15782
|
-
* `unknown` means the gate could
|
|
15696
|
+
* reported read-only, named, never written through this contract (D62) — e.g.
|
|
15697
|
+
* a slot whose sources act only while a wrapper is bound to the host, a
|
|
15698
|
+
* binding that belongs to `deviceManager.setWrapperActive`. No slot reports
|
|
15699
|
+
* one today (`linked-devices` answers `null`). `unknown` means the gate could
|
|
15700
|
+
* not be read; it is not "inactive" (D315).
|
|
15783
15701
|
*/
|
|
15784
15702
|
var ExtensionSlotActivationSchema = object({
|
|
15785
15703
|
state: _enum([
|
|
@@ -15795,7 +15713,7 @@ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
|
|
|
15795
15713
|
/** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
|
|
15796
15714
|
slotRef: string(),
|
|
15797
15715
|
slot: ExtensionSlotIdSchema,
|
|
15798
|
-
/** Names the store written (D62), e.g. `
|
|
15716
|
+
/** Names the store written (D62), e.g. `device-manager:_linkedDeviceIds`. */
|
|
15799
15717
|
authority: string(),
|
|
15800
15718
|
activation: ExtensionSlotActivationSchema.nullable(),
|
|
15801
15719
|
value: ExtensionSlotValueSchema,
|
|
@@ -20318,6 +20236,29 @@ object({
|
|
|
20318
20236
|
firstAt: number(),
|
|
20319
20237
|
lastAt: number()
|
|
20320
20238
|
});
|
|
20239
|
+
var NC_ALARM_TRIGGERED_MAX_SEC = 3600;
|
|
20240
|
+
var NcAlarmDelaySecSchema = number().int().min(0).max(600);
|
|
20241
|
+
var NcAlarmTriggeredSecSchema = number().int().min(0).max(NC_ALARM_TRIGGERED_MAX_SEC);
|
|
20242
|
+
var uniqueModes = (entries) => new Set(entries.map((e) => e.mode)).size === entries.length;
|
|
20243
|
+
var NcAlarmModeDelaysListSchema = array(object({
|
|
20244
|
+
mode: AlarmArmModeSchema,
|
|
20245
|
+
exitDelaySec: NcAlarmDelaySecSchema.optional(),
|
|
20246
|
+
entryDelaySec: NcAlarmDelaySecSchema.optional(),
|
|
20247
|
+
triggeredDurationSec: NcAlarmTriggeredSecSchema.optional()
|
|
20248
|
+
})).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
|
|
20249
|
+
var NcAlarmModeDelaysEditListSchema = array(object({
|
|
20250
|
+
mode: AlarmArmModeSchema,
|
|
20251
|
+
exitDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
|
|
20252
|
+
entryDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
|
|
20253
|
+
triggeredDurationSec: NcAlarmTriggeredSecSchema.nullable().optional()
|
|
20254
|
+
})).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
|
|
20255
|
+
/** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
|
|
20256
|
+
var NcAlarmNonBlockingEditSchema = object({
|
|
20257
|
+
mode: AlarmArmModeSchema,
|
|
20258
|
+
deviceId: number().int().positive(),
|
|
20259
|
+
/** true = on the list (may be open, does not block); false = off the list (blocks). */
|
|
20260
|
+
nonBlocking: boolean()
|
|
20261
|
+
});
|
|
20321
20262
|
/**
|
|
20322
20263
|
* The per-mode lists, at most one per mode. Two lists for one mode have no
|
|
20323
20264
|
* meaning a reader could agree on (union? the last one?), so they are refused
|
|
@@ -20326,10 +20267,10 @@ object({
|
|
|
20326
20267
|
var NcAlarmNonBlockingListSchema = array(object({
|
|
20327
20268
|
mode: AlarmArmModeSchema,
|
|
20328
20269
|
deviceIds: array(number().int()).max(200)
|
|
20329
|
-
})).max(8).refine(
|
|
20270
|
+
})).max(8).refine(uniqueModes, { message: "nonBlocking: at most one list per arm mode" });
|
|
20330
20271
|
/**
|
|
20331
|
-
* The three durations
|
|
20332
|
-
* transitions, and which openings each mode tolerates.
|
|
20272
|
+
* The three durations — global, and per mode since D697 — the panel's state
|
|
20273
|
+
* machine runs on, who hears about its transitions, and which openings each mode tolerates.
|
|
20333
20274
|
*
|
|
20334
20275
|
* They live on the NOTIFICATION-RULES cap, not on `alarm-panel`, on purpose:
|
|
20335
20276
|
* `alarm-panel` is `deviceNative` and its other provider mirrors somebody
|
|
@@ -20339,15 +20280,15 @@ var NcAlarmNonBlockingListSchema = array(object({
|
|
|
20339
20280
|
*/
|
|
20340
20281
|
var NcAlarmSettingsSchema = object({
|
|
20341
20282
|
/** Grace period between arming and the mode taking effect. 0 = immediate. */
|
|
20342
|
-
exitDelaySec:
|
|
20283
|
+
exitDelaySec: NcAlarmDelaySecSchema,
|
|
20343
20284
|
/** Grace period between a trigger and the alarm firing. 0 = immediate. */
|
|
20344
|
-
entryDelaySec:
|
|
20285
|
+
entryDelaySec: NcAlarmDelaySecSchema,
|
|
20345
20286
|
/**
|
|
20346
20287
|
* How long `triggered` lasts before the panel re-arms itself.
|
|
20347
20288
|
* **0 = until an operator disarms it** — the behaviour before this field
|
|
20348
20289
|
* existed, and therefore what an untouched install keeps doing.
|
|
20349
20290
|
*/
|
|
20350
|
-
triggeredDurationSec:
|
|
20291
|
+
triggeredDurationSec: NcAlarmTriggeredSecSchema,
|
|
20351
20292
|
/**
|
|
20352
20293
|
* Deprecated by D630 — every transition is announced. Parsed, never read;
|
|
20353
20294
|
* remove after one release. Optional so an older admin's patch (which still
|
|
@@ -20370,17 +20311,30 @@ var NcAlarmSettingsSchema = object({
|
|
|
20370
20311
|
* per mode is meaningful. Defaulted to `[]` so a blob stored before D630
|
|
20371
20312
|
* parses as "every opening blocks" — the behaviour it was written under.
|
|
20372
20313
|
*/
|
|
20373
|
-
nonBlocking: NcAlarmNonBlockingListSchema.default([])
|
|
20314
|
+
nonBlocking: NcAlarmNonBlockingListSchema.default([]),
|
|
20315
|
+
/**
|
|
20316
|
+
* Per arm mode, the delays that mode OVERRIDES (D697). A mode with no entry, or an entry
|
|
20317
|
+
* without a field, uses the global value above — so `[]`, the default, is exactly the
|
|
20318
|
+
* behaviour of a blob stored before this field existed. Read through `resolveModeDelays`.
|
|
20319
|
+
*/
|
|
20320
|
+
modeDelays: NcAlarmModeDelaysListSchema.default([])
|
|
20374
20321
|
});
|
|
20375
20322
|
/**
|
|
20376
20323
|
* Every field optional — a tab edits one control at a time.
|
|
20377
20324
|
*
|
|
20378
|
-
* `nonBlocking`
|
|
20379
|
-
* remove an inner `.default()`, so a patch that never
|
|
20380
|
-
* parse to `
|
|
20381
|
-
* (the same trap {@link NcRulePatchSchema} documents).
|
|
20325
|
+
* `nonBlocking` and `modeDelays` are re-declared WITHOUT their defaults:
|
|
20326
|
+
* `.partial()` does not remove an inner `.default()`, so a patch that never
|
|
20327
|
+
* named the field would parse to `[]` and wipe every mode's list on an
|
|
20328
|
+
* unrelated edit (the same trap {@link NcRulePatchSchema} documents). Here
|
|
20329
|
+
* `modeDelays` means EDITS, not the stored overrides.
|
|
20382
20330
|
*/
|
|
20383
|
-
var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({
|
|
20331
|
+
var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({
|
|
20332
|
+
nonBlocking: NcAlarmNonBlockingListSchema,
|
|
20333
|
+
/** Per-mode, per-field edits — NOT the whole list (see NcAlarmModeDelaysEditSchema). */
|
|
20334
|
+
modeDelays: NcAlarmModeDelaysEditListSchema,
|
|
20335
|
+
/** ONE membership change; the panel applies it to the list it holds at its turn. */
|
|
20336
|
+
nonBlockingEdit: NcAlarmNonBlockingEditSchema
|
|
20337
|
+
}).partial().refine((p) => p.nonBlocking === void 0 || p.nonBlockingEdit === void 0, { message: "nonBlocking and nonBlockingEdit are exclusive — send the whole lists or one edit" });
|
|
20384
20338
|
/**
|
|
20385
20339
|
* What one arm mode actually arms, DERIVED from the enabled rules gated on it.
|
|
20386
20340
|
* Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
|
|
@@ -20480,6 +20434,28 @@ var NcAlarmConfigSchema = object({
|
|
|
20480
20434
|
*/
|
|
20481
20435
|
live: NcAlarmLiveSchema.optional()
|
|
20482
20436
|
});
|
|
20437
|
+
var NcAlarmSensorReadingSchema = _enum([
|
|
20438
|
+
"open",
|
|
20439
|
+
"closed",
|
|
20440
|
+
"unknown",
|
|
20441
|
+
"not-opening"
|
|
20442
|
+
]);
|
|
20443
|
+
/** One device's state as the alarm reads it — the classifier the arm check uses. */
|
|
20444
|
+
var NcAlarmSensorStateSchema = object({
|
|
20445
|
+
deviceId: number().int().positive(),
|
|
20446
|
+
reading: NcAlarmSensorReadingSchema,
|
|
20447
|
+
/** The word as read (`open`, `closed`, `unlocked`, `stopped`, …); null when unknown / not an opening. */
|
|
20448
|
+
state: string().nullable(),
|
|
20449
|
+
/** Why `unknown`: the read failed, or the slice holds no word its cap defines (a placeholder included). */
|
|
20450
|
+
unknownWhy: _enum(["read-failed", "unknown-word"]).nullable(),
|
|
20451
|
+
/** The device manager's liveness as the centre mirrors it; null = not known. */
|
|
20452
|
+
online: boolean().nullable()
|
|
20453
|
+
});
|
|
20454
|
+
var NcAlarmSensorsInputSchema = object({ deviceIds: array(number().int().positive()).max(500) });
|
|
20455
|
+
var NcAlarmSensorsSchema = object({
|
|
20456
|
+
sensors: array(NcAlarmSensorStateSchema),
|
|
20457
|
+
readAt: number().int().nonnegative()
|
|
20458
|
+
});
|
|
20483
20459
|
/**
|
|
20484
20460
|
* ONE rule's demand on ONE camera's clip ring.
|
|
20485
20461
|
*
|
|
@@ -20570,7 +20546,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
20570
20546
|
}), method(object({}), NcAlarmConfigSchema, { auth: "admin" }), method(object({ patch: NcAlarmSettingsPatchSchema }), NcAlarmConfigSchema, {
|
|
20571
20547
|
kind: "mutation",
|
|
20572
20548
|
auth: "admin"
|
|
20573
|
-
});
|
|
20549
|
+
}), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
|
|
20574
20550
|
/**
|
|
20575
20551
|
* Zod schemas for persisted record types.
|
|
20576
20552
|
*
|
|
@@ -20917,12 +20893,26 @@ var CameraSensorRefSchema = object({
|
|
|
20917
20893
|
function cameraSensorRefKey(ref) {
|
|
20918
20894
|
return `${ref.addonId}/${ref.stableId}`;
|
|
20919
20895
|
}
|
|
20920
|
-
/**
|
|
20921
|
-
|
|
20922
|
-
|
|
20923
|
-
|
|
20924
|
-
|
|
20925
|
-
|
|
20896
|
+
/**
|
|
20897
|
+
* A sensor's mode (D673). `in-addition`: its motion is the camera's motion too.
|
|
20898
|
+
* `replace`: its motion is the camera's, and while one is READY the camera's
|
|
20899
|
+
* own motion no longer counts on its own. `confirm`: while one is READY the
|
|
20900
|
+
* camera's own motion counts only while a confirm sensor is active — with or
|
|
20901
|
+
* without a replace sensor (spec C2, the controller's ruling on Q1).
|
|
20902
|
+
*/
|
|
20903
|
+
var CameraSensorModeSchema = _enum([
|
|
20904
|
+
"in-addition",
|
|
20905
|
+
"confirm",
|
|
20906
|
+
"replace"
|
|
20907
|
+
]);
|
|
20908
|
+
/** A stored sensor with no mode — every CS-1 row — is in addition. */
|
|
20909
|
+
var DEFAULT_CAMERA_SENSOR_MODE = "in-addition";
|
|
20910
|
+
/**
|
|
20911
|
+
* A camera's attached sensors. A CS-1 row carried an envelope
|
|
20912
|
+
* `mode: 'in-addition'`: `z.object` drops it on parse, and the PARSED value is
|
|
20913
|
+
* what the write stores (D672 rule 3), so it is never written again.
|
|
20914
|
+
*/
|
|
20915
|
+
var CameraSensorsConfigSchema = object({ sensors: array(CameraSensorRefSchema.extend({ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE) })).min(1).max(8) }).superRefine((value, ctx) => {
|
|
20926
20916
|
const seen = /* @__PURE__ */ new Set();
|
|
20927
20917
|
value.sensors.forEach((ref, index) => {
|
|
20928
20918
|
const key = cameraSensorRefKey(ref);
|
|
@@ -20934,39 +20924,41 @@ var CameraSensorsConfigSchema = object({
|
|
|
20934
20924
|
seen.add(key);
|
|
20935
20925
|
});
|
|
20936
20926
|
});
|
|
20937
|
-
|
|
20927
|
+
/** Every attachment names its mode; an older orchestrator that does not is in addition. */
|
|
20928
|
+
var AttachmentFields = {
|
|
20938
20929
|
addonId: string(),
|
|
20939
|
-
stableId: string()
|
|
20930
|
+
stableId: string(),
|
|
20931
|
+
mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE)
|
|
20940
20932
|
};
|
|
20941
20933
|
var CameraSensorAttachmentSchema = discriminatedUnion("state", [
|
|
20942
20934
|
object({
|
|
20943
|
-
...
|
|
20935
|
+
...AttachmentFields,
|
|
20944
20936
|
state: literal("ready"),
|
|
20945
20937
|
deviceId: number(),
|
|
20946
20938
|
name: string(),
|
|
20947
20939
|
caps: array(string()).readonly()
|
|
20948
20940
|
}),
|
|
20949
20941
|
object({
|
|
20950
|
-
...
|
|
20942
|
+
...AttachmentFields,
|
|
20951
20943
|
state: literal("offline"),
|
|
20952
20944
|
deviceId: number(),
|
|
20953
20945
|
name: string(),
|
|
20954
20946
|
reason: _enum(["offline", "disabled"])
|
|
20955
20947
|
}),
|
|
20956
20948
|
object({
|
|
20957
|
-
...
|
|
20949
|
+
...AttachmentFields,
|
|
20958
20950
|
state: literal("missing"),
|
|
20959
20951
|
reason: string()
|
|
20960
20952
|
}),
|
|
20961
20953
|
object({
|
|
20962
|
-
...
|
|
20954
|
+
...AttachmentFields,
|
|
20963
20955
|
state: literal("unsupported"),
|
|
20964
20956
|
deviceId: number(),
|
|
20965
20957
|
name: string(),
|
|
20966
20958
|
reason: string()
|
|
20967
20959
|
}),
|
|
20968
20960
|
object({
|
|
20969
|
-
...
|
|
20961
|
+
...AttachmentFields,
|
|
20970
20962
|
state: literal("unreadable"),
|
|
20971
20963
|
reason: string()
|
|
20972
20964
|
})
|
|
@@ -20979,17 +20971,49 @@ var CameraSensorAttachmentSchema = discriminatedUnion("state", [
|
|
|
20979
20971
|
* say.
|
|
20980
20972
|
*/
|
|
20981
20973
|
var CameraSensorsNotForwardedSchema = _enum(["onboard-not-listed", "no-active-detection"]);
|
|
20974
|
+
/** Whether the camera's OWN motion counts on its own (D673 C2), from its READY sensors (C3). */
|
|
20975
|
+
var CameraOwnMotionSchema = _enum([
|
|
20976
|
+
"always",
|
|
20977
|
+
"when-confirmed",
|
|
20978
|
+
"never"
|
|
20979
|
+
]);
|
|
20980
|
+
/** Confirm / Replace cannot suppress this camera's motion: its provider still emits it directly (D673 C13). */
|
|
20981
|
+
var CameraSensorsNotEnforcedSchema = _enum(["provider-not-split"]);
|
|
20982
|
+
/**
|
|
20983
|
+
* The camera's OWN onboard motion (D696): the raw input the bridge combines,
|
|
20984
|
+
* never the effective value. The camera's `motion` slice is the effective one,
|
|
20985
|
+
* so a view of the camera's own row reads this.
|
|
20986
|
+
* - `atMs`: when the bridge received the camera's last own edge.
|
|
20987
|
+
* - `detected`: evaluated WHEN THE STATUS IS ASKED — the last edge said `true`
|
|
20988
|
+
* AND it is younger than the window the bridge counts the camera's own motion
|
|
20989
|
+
* for (`motionCooldownMs`, floored at two sustain ticks). A camera that never
|
|
20990
|
+
* sends a clear (heartbeats only) therefore reads `false` once no push came
|
|
20991
|
+
* within the window; a status read is a snapshot, so a live view re-asks.
|
|
20992
|
+
* Absent = this orchestrator has not received the camera's own motion since it
|
|
20993
|
+
* started (unknown, never "quiet"), or an orchestrator older than D696.
|
|
20994
|
+
*/
|
|
20995
|
+
var CameraRawLevelSchema = object({
|
|
20996
|
+
detected: boolean(),
|
|
20997
|
+
atMs: number()
|
|
20998
|
+
});
|
|
20982
20999
|
var CameraSensorsStatusSchema = discriminatedUnion("state", [
|
|
20983
|
-
object({
|
|
21000
|
+
object({
|
|
21001
|
+
state: literal("not-configured"),
|
|
21002
|
+
cameraLevel: CameraRawLevelSchema.optional()
|
|
21003
|
+
}),
|
|
20984
21004
|
object({
|
|
20985
21005
|
state: literal("unreadable"),
|
|
20986
|
-
reason: string()
|
|
21006
|
+
reason: string(),
|
|
21007
|
+
cameraLevel: CameraRawLevelSchema.optional()
|
|
20987
21008
|
}),
|
|
20988
21009
|
object({
|
|
20989
21010
|
state: literal("configured"),
|
|
20990
|
-
|
|
21011
|
+
cameraLevel: CameraRawLevelSchema.optional(),
|
|
20991
21012
|
sensors: array(CameraSensorAttachmentSchema).readonly(),
|
|
20992
|
-
|
|
21013
|
+
/** Absent = an orchestrator older than CS-2: it does not say (D315). */
|
|
21014
|
+
cameraMotion: CameraOwnMotionSchema.optional(),
|
|
21015
|
+
notForwarded: CameraSensorsNotForwardedSchema.optional(),
|
|
21016
|
+
notEnforced: CameraSensorsNotEnforcedSchema.optional()
|
|
20993
21017
|
})
|
|
20994
21018
|
]);
|
|
20995
21019
|
Object.freeze({
|
|
@@ -24220,8 +24244,10 @@ var RunnerCameraConfigSchema = object({
|
|
|
24220
24244
|
* - `analyzer`: ML/frame-diff motion detection (motion-wasm or other
|
|
24221
24245
|
* analyzer providers) running on decoded frames in this runner.
|
|
24222
24246
|
* - `onboard`: camera-native motion pushes (Reolink Baichuan, ONVIF
|
|
24223
|
-
* analytics). The provider emits ProviderMotion
|
|
24224
|
-
*
|
|
24247
|
+
* analytics). The provider emits its raw push as `ProviderMotion`
|
|
24248
|
+
* (D673); the orchestrator's camera-sensors bridge re-emits the camera's
|
|
24249
|
+
* effective motion as `MotionOnMotionChanged`, which is what reaches
|
|
24250
|
+
* `reportMotion`.
|
|
24225
24251
|
*/
|
|
24226
24252
|
motionSources: MotionSourcesSchema.default(["analyzer"]),
|
|
24227
24253
|
/**
|
|
@@ -24398,7 +24424,15 @@ var RunnerLocalLoadSchema = object({
|
|
|
24398
24424
|
hasGpu: boolean(),
|
|
24399
24425
|
inferenceBackend: string().optional(),
|
|
24400
24426
|
cpuCores: number().optional()
|
|
24401
|
-
})
|
|
24427
|
+
}),
|
|
24428
|
+
/**
|
|
24429
|
+
* Who writes a camera's `motion` runtime slice (D696). `'orchestrator'`: this
|
|
24430
|
+
* runner never writes it. ABSENT = a runner older than D696, which still
|
|
24431
|
+
* writes the slice from its phase machine; the orchestrator does not write
|
|
24432
|
+
* while any runner node is absent-or-unanswered, so one slice never has two
|
|
24433
|
+
* writers.
|
|
24434
|
+
*/
|
|
24435
|
+
motionSliceWriter: literal("orchestrator").optional()
|
|
24402
24436
|
});
|
|
24403
24437
|
/**
|
|
24404
24438
|
* Aggregate runtime metrics for the runner's whole local pool. Mirrors the
|
|
@@ -30031,6 +30065,70 @@ onStatusChanged: { data: object({
|
|
|
30031
30065
|
* whether persisting is worth a SQLite commit. */
|
|
30032
30066
|
volatileStateFields: ["lastChangedAt"]
|
|
30033
30067
|
};
|
|
30068
|
+
var DoorbellStatusSchema = object({
|
|
30069
|
+
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
30070
|
+
lastPressedAt: number().nullable(),
|
|
30071
|
+
/** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
|
|
30072
|
+
pressCountSinceStart: number()
|
|
30073
|
+
});
|
|
30074
|
+
var DoorbellPressEventSchema = object({
|
|
30075
|
+
deviceId: number(),
|
|
30076
|
+
timestamp: number()
|
|
30077
|
+
});
|
|
30078
|
+
/**
|
|
30079
|
+
* Doorbell button cap. Two kinds of provider serve it, and to every consumer
|
|
30080
|
+
* they are the same cap:
|
|
30081
|
+
*
|
|
30082
|
+
* - **Native** providers, registered per device by a driver addon through
|
|
30083
|
+
* `ctx.registerNativeCap` — a `DeviceType.Button` accessory with
|
|
30084
|
+
* `role: DeviceRole.Doorbell`, or the camera itself (Reolink registers at
|
|
30085
|
+
* camera level). They emit `onPressed` on every firmware ring.
|
|
30086
|
+
* - **A composed doorbell** (D670, D671): a camera's customization gives it
|
|
30087
|
+
* the cap, its `lastPressedAt` rising from the sources the operator
|
|
30088
|
+
* assigned in Customize → Doorbell, and the composer emits `onPressed`
|
|
30089
|
+
* from that field's advance (`fromState`).
|
|
30090
|
+
*
|
|
30091
|
+
* The DeviceEventPropagator re-emits `onPressed` on the camera parent.
|
|
30092
|
+
*/
|
|
30093
|
+
var doorbellCapability = {
|
|
30094
|
+
name: "doorbell",
|
|
30095
|
+
scope: "device",
|
|
30096
|
+
deviceNative: true,
|
|
30097
|
+
mode: "singleton",
|
|
30098
|
+
deviceTypes: [DeviceType.Button, DeviceType.Camera],
|
|
30099
|
+
methods: {},
|
|
30100
|
+
events: {
|
|
30101
|
+
/**
|
|
30102
|
+
* Fires once per physical press. Reolink delivers via Baichuan
|
|
30103
|
+
* push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
|
|
30104
|
+
* release/duration — it's a pulse.
|
|
30105
|
+
*/
|
|
30106
|
+
onPressed: {
|
|
30107
|
+
data: DoorbellPressEventSchema,
|
|
30108
|
+
fromState: {
|
|
30109
|
+
field: "lastPressedAt",
|
|
30110
|
+
on: "advance"
|
|
30111
|
+
}
|
|
30112
|
+
} },
|
|
30113
|
+
status: {
|
|
30114
|
+
schema: DoorbellStatusSchema,
|
|
30115
|
+
kind: "push"
|
|
30116
|
+
},
|
|
30117
|
+
/**
|
|
30118
|
+
* Runtime-state slice — last press timestamp + lifetime press count.
|
|
30119
|
+
* Mirrored by the kernel and readable via
|
|
30120
|
+
* `device.state.doorbell.value`. UIs can show "last ring 5m ago"
|
|
30121
|
+
* without subscribing.
|
|
30122
|
+
*/
|
|
30123
|
+
runtimeState: DoorbellStatusSchema,
|
|
30124
|
+
/**
|
|
30125
|
+
* 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.
|
|
30126
|
+
*
|
|
30127
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
30128
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
30129
|
+
*/
|
|
30130
|
+
durability: "restored"
|
|
30131
|
+
};
|
|
30034
30132
|
/**
|
|
30035
30133
|
* Enum-state sensor — a string value picked from a finite option set.
|
|
30036
30134
|
* Drives HA `sensor` entries with `state_class: enum` (HVAC action
|
|
@@ -32175,9 +32273,9 @@ var MotionStatusSchema = object({
|
|
|
32175
32273
|
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
32176
32274
|
lastDetectedAt: number().nullable(),
|
|
32177
32275
|
/**
|
|
32178
|
-
* `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device
|
|
32179
|
-
* `null` while false and on every `Sensor`
|
|
32180
|
-
* constant's doc for the one-authority rule.
|
|
32276
|
+
* `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device (the
|
|
32277
|
+
* orchestrator writes it, D696), `null` while false and on every `Sensor`
|
|
32278
|
+
* device (D475) — see that constant's doc for the one-authority rule.
|
|
32181
32279
|
*
|
|
32182
32280
|
* ## Reading this field still arms nothing
|
|
32183
32281
|
*
|
|
@@ -32195,34 +32293,31 @@ var MotionStatusSchema = object({
|
|
|
32195
32293
|
* `addon-export-alexa/src/motion-clear-hold.ts` and
|
|
32196
32294
|
* `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
|
|
32197
32295
|
*
|
|
32198
|
-
* ## Who writes it
|
|
32199
|
-
*
|
|
32200
|
-
* - **Cameras** — the
|
|
32201
|
-
*
|
|
32202
|
-
* `
|
|
32203
|
-
* `
|
|
32204
|
-
*
|
|
32205
|
-
*
|
|
32206
|
-
* a
|
|
32207
|
-
*
|
|
32208
|
-
*
|
|
32209
|
-
*
|
|
32210
|
-
*
|
|
32211
|
-
*
|
|
32212
|
-
*
|
|
32213
|
-
*
|
|
32214
|
-
*
|
|
32215
|
-
*
|
|
32216
|
-
* `
|
|
32217
|
-
*
|
|
32218
|
-
*
|
|
32219
|
-
*
|
|
32220
|
-
*
|
|
32221
|
-
*
|
|
32222
|
-
*
|
|
32223
|
-
* This predates D475 and is not fixed there: the fix touches every
|
|
32224
|
-
* camera provider. Recorded in D475's Consequences. Do not restore the
|
|
32225
|
-
* "sole writer" wording without also removing the other writers.
|
|
32296
|
+
* ## Who writes it (D696)
|
|
32297
|
+
*
|
|
32298
|
+
* - **Cameras** — the orchestrator, and nothing else. It writes the camera's
|
|
32299
|
+
* EFFECTIVE motion (`addon-pipeline-orchestrator`
|
|
32300
|
+
* `camera-sensors/motion-slice.ts`), alongside the effective
|
|
32301
|
+
* `MotionOnMotionChanged` it emits or receives: the camera-sensors bridge
|
|
32302
|
+
* for a split camera, an unsplit emitter's direct event, the analyzer and
|
|
32303
|
+
* device activity, as the camera's `motionSources` counts them. A source
|
|
32304
|
+
* that never sends a clear falls one window after its last `true`.
|
|
32305
|
+
* `lastDetectedAt` moves only on an effective rise. No camera provider
|
|
32306
|
+
* writes this slice (not even a boot seed), and neither does the runner's
|
|
32307
|
+
* phase machine: its phase is "a session is attached" for every on-motion
|
|
32308
|
+
* session, not motion, and it now has its own `DetectionPhaseTransition`.
|
|
32309
|
+
* A provider's `isDetected` answers from the hub's slice.
|
|
32310
|
+
* - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
|
|
32311
|
+
* imports) — the provider pushes both edges itself, from the upstream
|
|
32312
|
+
* system's own state change. That is the sensor's own fact.
|
|
32313
|
+
*
|
|
32314
|
+
* `scripts/check-onboard-motion-emitters.ts` refuses any other writer of a
|
|
32315
|
+
* `motion` slice; each sensor writer is a named exemption.
|
|
32316
|
+
*
|
|
32317
|
+
* This replaces the D475 §4 rule ("the phase machine is the sole writer").
|
|
32318
|
+
* That rule was never true: Hikvision and Amcrest wrote the slice raw beside
|
|
32319
|
+
* it, every provider seeded it at boot, and every session left it
|
|
32320
|
+
* `detected: true` after its detach.
|
|
32226
32321
|
*/
|
|
32227
32322
|
autoClearAfterMs: number().nullable()
|
|
32228
32323
|
});
|
|
@@ -32294,11 +32389,12 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
|
|
|
32294
32389
|
*/
|
|
32295
32390
|
runtimeState: MotionStatusSchema,
|
|
32296
32391
|
/**
|
|
32297
|
-
* Runtime-state durability: **session** —
|
|
32392
|
+
* Runtime-state durability: **session** — the writer of this slice
|
|
32298
32393
|
* writes only on an EDGE, so a restored `detected: true` would stay
|
|
32299
32394
|
* frozen until the next one instead of being corrected. The next edge
|
|
32300
|
-
* re-publishes the real state
|
|
32301
|
-
*
|
|
32395
|
+
* re-publishes the real state, and the orchestrator re-publishes every
|
|
32396
|
+
* camera when it starts writing (D696; on who writes it, see
|
|
32397
|
+
* `autoClearAfterMs` above).
|
|
32302
32398
|
*
|
|
32303
32399
|
* See `RuntimeStateDurability`. Enforced by
|
|
32304
32400
|
* `scripts/check-runtime-state-durability.ts`.
|
|
@@ -34681,8 +34777,7 @@ var ptzAutotrackCapability = {
|
|
|
34681
34777
|
deviceNative: true,
|
|
34682
34778
|
mode: "singleton",
|
|
34683
34779
|
/**
|
|
34684
|
-
* Two kinds of provider behind one name, the same shape `snapshot`
|
|
34685
|
-
* `doorbell` use:
|
|
34780
|
+
* Two kinds of provider behind one name, the same shape `snapshot` uses:
|
|
34686
34781
|
*
|
|
34687
34782
|
* - **Native**: the camera's own firmware autotrack, registered per device by
|
|
34688
34783
|
* the driver when the probe says it exists (Reolink: yes; Hikvision:
|
|
@@ -34690,7 +34785,7 @@ var ptzAutotrackCapability = {
|
|
|
34690
34785
|
* - **Wrapper**: the emulated implementation (`@camstack/system`'s `autotrack` builtin),
|
|
34691
34786
|
* which follows a subject with `ptz.move` pulses driven by the detection
|
|
34692
34787
|
* pipeline. `defaultActive: false` — the operator binds it per camera in
|
|
34693
|
-
* the bindings UI
|
|
34788
|
+
* the bindings UI.
|
|
34694
34789
|
*
|
|
34695
34790
|
* The binding chooses WHICH implementation answers; `setEnabled` stays the
|
|
34696
34791
|
* one switch for the function either way. A camera never has both driving its
|
|
@@ -39788,13 +39883,14 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
39788
39883
|
async getStatus() {
|
|
39789
39884
|
const all = await this.ctx.kernel.devices?.getAll() ?? [];
|
|
39790
39885
|
const summary = this.restoreFailureSummary();
|
|
39791
|
-
|
|
39886
|
+
const base = {
|
|
39792
39887
|
connected: true,
|
|
39793
|
-
deviceCount: all.length
|
|
39888
|
+
deviceCount: all.length,
|
|
39889
|
+
motionSliceWriter: "orchestrator"
|
|
39794
39890
|
};
|
|
39891
|
+
if (summary === null) return base;
|
|
39795
39892
|
return {
|
|
39796
|
-
|
|
39797
|
-
deviceCount: all.length,
|
|
39893
|
+
...base,
|
|
39798
39894
|
error: summary
|
|
39799
39895
|
};
|
|
39800
39896
|
}
|
|
@@ -45230,6 +45326,12 @@ Object.freeze({
|
|
|
45230
45326
|
addonId: null,
|
|
45231
45327
|
access: "view"
|
|
45232
45328
|
},
|
|
45329
|
+
"notificationRules.getAlarmSensors": {
|
|
45330
|
+
capName: "notification-rules",
|
|
45331
|
+
capScope: "system",
|
|
45332
|
+
addonId: null,
|
|
45333
|
+
access: "view"
|
|
45334
|
+
},
|
|
45233
45335
|
"notificationRules.getClipRetentionAsks": {
|
|
45234
45336
|
capName: "notification-rules",
|
|
45235
45337
|
capScope: "system",
|
|
@@ -49713,6 +49815,11 @@ Object.freeze({
|
|
|
49713
49815
|
form: "single",
|
|
49714
49816
|
optional: false
|
|
49715
49817
|
}],
|
|
49818
|
+
"notificationRules.getAlarmSensors": [{
|
|
49819
|
+
name: "deviceIds",
|
|
49820
|
+
form: "array",
|
|
49821
|
+
optional: false
|
|
49822
|
+
}],
|
|
49716
49823
|
"notificationRules.setDeviceMuted": [{
|
|
49717
49824
|
name: "deviceId",
|
|
49718
49825
|
form: "single",
|
|
@@ -51648,6 +51755,25 @@ TimelapseRuleInputSchema.extend({
|
|
|
51648
51755
|
createdAt: number(),
|
|
51649
51756
|
updatedAt: number()
|
|
51650
51757
|
});
|
|
51758
|
+
async function readHubMotionDetected(deviceState, deviceId) {
|
|
51759
|
+
let slice;
|
|
51760
|
+
try {
|
|
51761
|
+
slice = await deviceState.getCapSlice.query({
|
|
51762
|
+
deviceId,
|
|
51763
|
+
capName: "motion"
|
|
51764
|
+
});
|
|
51765
|
+
} catch (err) {
|
|
51766
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
51767
|
+
throw new Error(`motion state of device ${deviceId} is unreadable: ${reason}`, { cause: err });
|
|
51768
|
+
}
|
|
51769
|
+
const detected = slice?.["detected"];
|
|
51770
|
+
if (typeof detected !== "boolean") throw new Error(`motion state of device ${deviceId} is not published yet (unknown)`);
|
|
51771
|
+
return detected;
|
|
51772
|
+
}
|
|
51773
|
+
MotionOnMotionChangedDataSchema.omit({ triggeredBy: true });
|
|
51774
|
+
function providerMotionEvent(source, data) {
|
|
51775
|
+
return createEvent(EventCategory.ProviderMotion, source, data);
|
|
51776
|
+
}
|
|
51651
51777
|
object({
|
|
51652
51778
|
/**
|
|
51653
51779
|
* Fraction of the box's own size added on EACH side before cutting.
|
|
@@ -56116,16 +56242,18 @@ var WyzeCamera = class extends BaseDevice {
|
|
|
56116
56242
|
return null;
|
|
56117
56243
|
}
|
|
56118
56244
|
}
|
|
56245
|
+
/**
|
|
56246
|
+
* The native `motion` cap. This provider writes NO `motion` slice (D696): the
|
|
56247
|
+
* orchestrator is its only writer, with the EFFECTIVE motion, on the hub.
|
|
56248
|
+
* `isDetected` answers from the HUB's slice; an unreadable hub, or a slice
|
|
56249
|
+
* nobody has published yet, fails the call — never `false` for unknown
|
|
56250
|
+
* (D49, D393).
|
|
56251
|
+
*/
|
|
56119
56252
|
registerMotionProvider() {
|
|
56120
56253
|
this.ctx.registerNativeCap(motionCapability, { isDetected: async ({ deviceId }) => {
|
|
56121
|
-
if (deviceId !== this.id)
|
|
56122
|
-
return this.
|
|
56254
|
+
if (deviceId !== this.id) throw new Error(`WyzeCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
|
|
56255
|
+
return readHubMotionDetected(this.ctx.api.deviceState, this.id);
|
|
56123
56256
|
} });
|
|
56124
|
-
this.setCapSlice(motionCapability, {
|
|
56125
|
-
detected: false,
|
|
56126
|
-
lastDetectedAt: null,
|
|
56127
|
-
autoClearAfterMs: null
|
|
56128
|
-
});
|
|
56129
56257
|
}
|
|
56130
56258
|
/**
|
|
56131
56259
|
* Start the configured motion source. `cloud` polls the Wyze events API
|
|
@@ -56169,12 +56297,14 @@ var WyzeCamera = class extends BaseDevice {
|
|
|
56169
56297
|
}
|
|
56170
56298
|
}
|
|
56171
56299
|
/**
|
|
56172
|
-
* Emit
|
|
56173
|
-
*
|
|
56174
|
-
*
|
|
56300
|
+
* Emit the camera's RAW motion push as `ProviderMotion`
|
|
56301
|
+
* (`source: 'onboard'`, D673). The orchestrator's camera-sensors bridge
|
|
56302
|
+
* re-emits it as the effective `MotionOnMotionChanged`, and the
|
|
56303
|
+
* orchestrator is the only writer of the camera's `motion` runtime-state
|
|
56304
|
+
* slice (D696) — symmetric with the Reolink onboard-motion path.
|
|
56175
56305
|
*/
|
|
56176
56306
|
emitMotion(timestamp) {
|
|
56177
|
-
this.ctx.eventBus.emit(
|
|
56307
|
+
this.ctx.eventBus.emit(providerMotionEvent({
|
|
56178
56308
|
type: "device",
|
|
56179
56309
|
id: this.id,
|
|
56180
56310
|
addonId: WYZE_ADDON_ID,
|