@camstack/addon-provider-reolink 1.2.166 → 1.2.168

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.
Files changed (3) hide show
  1. package/dist/addon.js +346 -212
  2. package/dist/addon.mjs +346 -212
  3. 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-C5xZWqz6.mjs
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-gU6hqv4_.mjs
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-Dq42XWp0.mjs
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
- * Viveva dentro il builtin virtual-doorbell
7555
- * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
7556
- * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
7557
- * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
7558
- * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
7559
- * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
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 che il virtual-doorbell usa dal 2026-08-05. Ed è il FRONTE, non
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
  */
@@ -15456,7 +15462,17 @@ var SiteZoneSchema = object({
15456
15462
  var ProviderStatusSchema = object({
15457
15463
  connected: boolean(),
15458
15464
  deviceCount: number(),
15459
- error: string().optional()
15465
+ error: string().optional(),
15466
+ /**
15467
+ * `'orchestrator'`: this provider writes NO camera's `motion` runtime slice
15468
+ * — the orchestrator is its only writer (D696). Set by `BaseDeviceProvider`,
15469
+ * which every provider bundles, so only a provider BUILT from D696-amended
15470
+ * code says it. ABSENT means an older provider that may still write it (raw
15471
+ * VMD writes, a boot seed), and the orchestrator's provider gate keeps that
15472
+ * provider's cameras unwritten (`camera-sensors/motion-slice-provider-gate.ts`)
15473
+ * — the provider twin of the runner's `getLocalLoad().motionSliceWriter`.
15474
+ */
15475
+ motionSliceWriter: literal("orchestrator").optional()
15460
15476
  });
15461
15477
  object({
15462
15478
  externalId: string(),
@@ -16335,109 +16351,10 @@ method(object({
16335
16351
  deviceIds: array(number()).readonly(),
16336
16352
  caps: array(string()).readonly().optional()
16337
16353
  }), record(string(), record(string(), unknown().nullable())));
16338
- /**
16339
- * Doorbell button cap. Two kinds of providers coexist behind this cap
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;
16354
+ var ExtensionSlotIdSchema = _enum(["linked-devices"]);
16355
+ DeviceType.Camera;
16439
16356
  /** A slot's editable value, discriminated on `slot`. */
16440
- var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
16357
+ var ExtensionSlotValueSchema = discriminatedUnion("slot", [LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
16441
16358
  DeviceType.Camera;
16442
16359
  var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
16443
16360
  state: literal("unreachable"),
@@ -16474,10 +16391,11 @@ var ExtensionSlotSourceSchema = object({
16474
16391
  });
16475
16392
  /**
16476
16393
  * A DIFFERENT authority that gates whether the slot's sources do anything —
16477
- * reported read-only, named, never written through this contract (D62). The
16478
- * virtual doorbell's sources ring only while the wrapper is bound to the
16479
- * camera, and that binding belongs to `deviceManager.setWrapperActive`.
16480
- * `unknown` means the gate could not be read; it is not "inactive" (D315).
16394
+ * reported read-only, named, never written through this contract (D62) — e.g.
16395
+ * a slot whose sources act only while a wrapper is bound to the host, a
16396
+ * binding that belongs to `deviceManager.setWrapperActive`. No slot reports
16397
+ * one today (`linked-devices` answers `null`). `unknown` means the gate could
16398
+ * not be read; it is not "inactive" (D315).
16481
16399
  */
16482
16400
  var ExtensionSlotActivationSchema = object({
16483
16401
  state: _enum([
@@ -16493,7 +16411,7 @@ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
16493
16411
  /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
16494
16412
  slotRef: string(),
16495
16413
  slot: ExtensionSlotIdSchema,
16496
- /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
16414
+ /** Names the store written (D62), e.g. `device-manager:_linkedDeviceIds`. */
16497
16415
  authority: string(),
16498
16416
  activation: ExtensionSlotActivationSchema.nullable(),
16499
16417
  value: ExtensionSlotValueSchema,
@@ -21056,6 +20974,29 @@ object({
21056
20974
  firstAt: number(),
21057
20975
  lastAt: number()
21058
20976
  });
20977
+ var NC_ALARM_TRIGGERED_MAX_SEC = 3600;
20978
+ var NcAlarmDelaySecSchema = number().int().min(0).max(600);
20979
+ var NcAlarmTriggeredSecSchema = number().int().min(0).max(NC_ALARM_TRIGGERED_MAX_SEC);
20980
+ var uniqueModes = (entries) => new Set(entries.map((e) => e.mode)).size === entries.length;
20981
+ var NcAlarmModeDelaysListSchema = array(object({
20982
+ mode: AlarmArmModeSchema,
20983
+ exitDelaySec: NcAlarmDelaySecSchema.optional(),
20984
+ entryDelaySec: NcAlarmDelaySecSchema.optional(),
20985
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.optional()
20986
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
20987
+ var NcAlarmModeDelaysEditListSchema = array(object({
20988
+ mode: AlarmArmModeSchema,
20989
+ exitDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
20990
+ entryDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
20991
+ triggeredDurationSec: NcAlarmTriggeredSecSchema.nullable().optional()
20992
+ })).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
20993
+ /** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
20994
+ var NcAlarmNonBlockingEditSchema = object({
20995
+ mode: AlarmArmModeSchema,
20996
+ deviceId: number().int().positive(),
20997
+ /** true = on the list (may be open, does not block); false = off the list (blocks). */
20998
+ nonBlocking: boolean()
20999
+ });
21059
21000
  /**
21060
21001
  * The per-mode lists, at most one per mode. Two lists for one mode have no
21061
21002
  * meaning a reader could agree on (union? the last one?), so they are refused
@@ -21064,10 +21005,10 @@ object({
21064
21005
  var NcAlarmNonBlockingListSchema = array(object({
21065
21006
  mode: AlarmArmModeSchema,
21066
21007
  deviceIds: array(number().int()).max(200)
21067
- })).max(8).refine((lists) => new Set(lists.map((l) => l.mode)).size === lists.length, { message: "nonBlocking: at most one list per arm mode" });
21008
+ })).max(8).refine(uniqueModes, { message: "nonBlocking: at most one list per arm mode" });
21068
21009
  /**
21069
- * The three durations the panel's state machine runs on, who hears about its
21070
- * transitions, and which openings each mode tolerates.
21010
+ * The three durations — global, and per mode since D697 — the panel's state
21011
+ * machine runs on, who hears about its transitions, and which openings each mode tolerates.
21071
21012
  *
21072
21013
  * They live on the NOTIFICATION-RULES cap, not on `alarm-panel`, on purpose:
21073
21014
  * `alarm-panel` is `deviceNative` and its other provider mirrors somebody
@@ -21077,15 +21018,15 @@ var NcAlarmNonBlockingListSchema = array(object({
21077
21018
  */
21078
21019
  var NcAlarmSettingsSchema = object({
21079
21020
  /** Grace period between arming and the mode taking effect. 0 = immediate. */
21080
- exitDelaySec: number().int().min(0).max(600),
21021
+ exitDelaySec: NcAlarmDelaySecSchema,
21081
21022
  /** Grace period between a trigger and the alarm firing. 0 = immediate. */
21082
- entryDelaySec: number().int().min(0).max(600),
21023
+ entryDelaySec: NcAlarmDelaySecSchema,
21083
21024
  /**
21084
21025
  * How long `triggered` lasts before the panel re-arms itself.
21085
21026
  * **0 = until an operator disarms it** — the behaviour before this field
21086
21027
  * existed, and therefore what an untouched install keeps doing.
21087
21028
  */
21088
- triggeredDurationSec: number().int().min(0).max(3600),
21029
+ triggeredDurationSec: NcAlarmTriggeredSecSchema,
21089
21030
  /**
21090
21031
  * Deprecated by D630 — every transition is announced. Parsed, never read;
21091
21032
  * remove after one release. Optional so an older admin's patch (which still
@@ -21108,17 +21049,30 @@ var NcAlarmSettingsSchema = object({
21108
21049
  * per mode is meaningful. Defaulted to `[]` so a blob stored before D630
21109
21050
  * parses as "every opening blocks" — the behaviour it was written under.
21110
21051
  */
21111
- nonBlocking: NcAlarmNonBlockingListSchema.default([])
21052
+ nonBlocking: NcAlarmNonBlockingListSchema.default([]),
21053
+ /**
21054
+ * Per arm mode, the delays that mode OVERRIDES (D697). A mode with no entry, or an entry
21055
+ * without a field, uses the global value above — so `[]`, the default, is exactly the
21056
+ * behaviour of a blob stored before this field existed. Read through `resolveModeDelays`.
21057
+ */
21058
+ modeDelays: NcAlarmModeDelaysListSchema.default([])
21112
21059
  });
21113
21060
  /**
21114
21061
  * Every field optional — a tab edits one control at a time.
21115
21062
  *
21116
- * `nonBlocking` is re-declared WITHOUT its default: `.partial()` does not
21117
- * remove an inner `.default()`, so a patch that never named the field would
21118
- * parse to `nonBlocking: []` and wipe every mode's list on an unrelated edit
21119
- * (the same trap {@link NcRulePatchSchema} documents).
21063
+ * `nonBlocking` and `modeDelays` are re-declared WITHOUT their defaults:
21064
+ * `.partial()` does not remove an inner `.default()`, so a patch that never
21065
+ * named the field would parse to `[]` and wipe every mode's list on an
21066
+ * unrelated edit (the same trap {@link NcRulePatchSchema} documents). Here
21067
+ * `modeDelays` means EDITS, not the stored overrides.
21120
21068
  */
21121
- var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({ nonBlocking: NcAlarmNonBlockingListSchema }).partial();
21069
+ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({
21070
+ nonBlocking: NcAlarmNonBlockingListSchema,
21071
+ /** Per-mode, per-field edits — NOT the whole list (see NcAlarmModeDelaysEditSchema). */
21072
+ modeDelays: NcAlarmModeDelaysEditListSchema,
21073
+ /** ONE membership change; the panel applies it to the list it holds at its turn. */
21074
+ nonBlockingEdit: NcAlarmNonBlockingEditSchema
21075
+ }).partial().refine((p) => p.nonBlocking === void 0 || p.nonBlockingEdit === void 0, { message: "nonBlocking and nonBlockingEdit are exclusive — send the whole lists or one edit" });
21122
21076
  /**
21123
21077
  * What one arm mode actually arms, DERIVED from the enabled rules gated on it.
21124
21078
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
@@ -21218,6 +21172,28 @@ var NcAlarmConfigSchema = object({
21218
21172
  */
21219
21173
  live: NcAlarmLiveSchema.optional()
21220
21174
  });
21175
+ var NcAlarmSensorReadingSchema = _enum([
21176
+ "open",
21177
+ "closed",
21178
+ "unknown",
21179
+ "not-opening"
21180
+ ]);
21181
+ /** One device's state as the alarm reads it — the classifier the arm check uses. */
21182
+ var NcAlarmSensorStateSchema = object({
21183
+ deviceId: number().int().positive(),
21184
+ reading: NcAlarmSensorReadingSchema,
21185
+ /** The word as read (`open`, `closed`, `unlocked`, `stopped`, …); null when unknown / not an opening. */
21186
+ state: string().nullable(),
21187
+ /** Why `unknown`: the read failed, or the slice holds no word its cap defines (a placeholder included). */
21188
+ unknownWhy: _enum(["read-failed", "unknown-word"]).nullable(),
21189
+ /** The device manager's liveness as the centre mirrors it; null = not known. */
21190
+ online: boolean().nullable()
21191
+ });
21192
+ var NcAlarmSensorsInputSchema = object({ deviceIds: array(number().int().positive()).max(500) });
21193
+ var NcAlarmSensorsSchema = object({
21194
+ sensors: array(NcAlarmSensorStateSchema),
21195
+ readAt: number().int().nonnegative()
21196
+ });
21221
21197
  /**
21222
21198
  * ONE rule's demand on ONE camera's clip ring.
21223
21199
  *
@@ -21308,7 +21284,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
21308
21284
  }), method(object({}), NcAlarmConfigSchema, { auth: "admin" }), method(object({ patch: NcAlarmSettingsPatchSchema }), NcAlarmConfigSchema, {
21309
21285
  kind: "mutation",
21310
21286
  auth: "admin"
21311
- });
21287
+ }), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
21312
21288
  /**
21313
21289
  * Zod schemas for persisted record types.
21314
21290
  *
@@ -21655,12 +21631,26 @@ var CameraSensorRefSchema = object({
21655
21631
  function cameraSensorRefKey(ref) {
21656
21632
  return `${ref.addonId}/${ref.stableId}`;
21657
21633
  }
21658
- /** CS-1 accepts exactly one mode; CS-2 (D673) widens it to confirm / replace. */
21659
- var CameraSensorsModeSchema = _enum(["in-addition"]);
21660
- var CameraSensorsConfigSchema = object({
21661
- mode: CameraSensorsModeSchema,
21662
- sensors: array(CameraSensorRefSchema).min(1).max(8)
21663
- }).superRefine((value, ctx) => {
21634
+ /**
21635
+ * A sensor's mode (D673). `in-addition`: its motion is the camera's motion too.
21636
+ * `replace`: its motion is the camera's, and while one is READY the camera's
21637
+ * own motion no longer counts on its own. `confirm`: while one is READY the
21638
+ * camera's own motion counts only while a confirm sensor is active — with or
21639
+ * without a replace sensor (spec C2, the controller's ruling on Q1).
21640
+ */
21641
+ var CameraSensorModeSchema = _enum([
21642
+ "in-addition",
21643
+ "confirm",
21644
+ "replace"
21645
+ ]);
21646
+ /** A stored sensor with no mode — every CS-1 row — is in addition. */
21647
+ var DEFAULT_CAMERA_SENSOR_MODE = "in-addition";
21648
+ /**
21649
+ * A camera's attached sensors. A CS-1 row carried an envelope
21650
+ * `mode: 'in-addition'`: `z.object` drops it on parse, and the PARSED value is
21651
+ * what the write stores (D672 rule 3), so it is never written again.
21652
+ */
21653
+ var CameraSensorsConfigSchema = object({ sensors: array(CameraSensorRefSchema.extend({ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE) })).min(1).max(8) }).superRefine((value, ctx) => {
21664
21654
  const seen = /* @__PURE__ */ new Set();
21665
21655
  value.sensors.forEach((ref, index) => {
21666
21656
  const key = cameraSensorRefKey(ref);
@@ -21672,39 +21662,41 @@ var CameraSensorsConfigSchema = object({
21672
21662
  seen.add(key);
21673
21663
  });
21674
21664
  });
21675
- var RefFields = {
21665
+ /** Every attachment names its mode; an older orchestrator that does not is in addition. */
21666
+ var AttachmentFields = {
21676
21667
  addonId: string(),
21677
- stableId: string()
21668
+ stableId: string(),
21669
+ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE)
21678
21670
  };
21679
21671
  var CameraSensorAttachmentSchema = discriminatedUnion("state", [
21680
21672
  object({
21681
- ...RefFields,
21673
+ ...AttachmentFields,
21682
21674
  state: literal("ready"),
21683
21675
  deviceId: number(),
21684
21676
  name: string(),
21685
21677
  caps: array(string()).readonly()
21686
21678
  }),
21687
21679
  object({
21688
- ...RefFields,
21680
+ ...AttachmentFields,
21689
21681
  state: literal("offline"),
21690
21682
  deviceId: number(),
21691
21683
  name: string(),
21692
21684
  reason: _enum(["offline", "disabled"])
21693
21685
  }),
21694
21686
  object({
21695
- ...RefFields,
21687
+ ...AttachmentFields,
21696
21688
  state: literal("missing"),
21697
21689
  reason: string()
21698
21690
  }),
21699
21691
  object({
21700
- ...RefFields,
21692
+ ...AttachmentFields,
21701
21693
  state: literal("unsupported"),
21702
21694
  deviceId: number(),
21703
21695
  name: string(),
21704
21696
  reason: string()
21705
21697
  }),
21706
21698
  object({
21707
- ...RefFields,
21699
+ ...AttachmentFields,
21708
21700
  state: literal("unreadable"),
21709
21701
  reason: string()
21710
21702
  })
@@ -21717,17 +21709,49 @@ var CameraSensorAttachmentSchema = discriminatedUnion("state", [
21717
21709
  * say.
21718
21710
  */
21719
21711
  var CameraSensorsNotForwardedSchema = _enum(["onboard-not-listed", "no-active-detection"]);
21712
+ /** Whether the camera's OWN motion counts on its own (D673 C2), from its READY sensors (C3). */
21713
+ var CameraOwnMotionSchema = _enum([
21714
+ "always",
21715
+ "when-confirmed",
21716
+ "never"
21717
+ ]);
21718
+ /** Confirm / Replace cannot suppress this camera's motion: its provider still emits it directly (D673 C13). */
21719
+ var CameraSensorsNotEnforcedSchema = _enum(["provider-not-split"]);
21720
+ /**
21721
+ * The camera's OWN onboard motion (D696): the raw input the bridge combines,
21722
+ * never the effective value. The camera's `motion` slice is the effective one,
21723
+ * so a view of the camera's own row reads this.
21724
+ * - `atMs`: when the bridge received the camera's last own edge.
21725
+ * - `detected`: evaluated WHEN THE STATUS IS ASKED — the last edge said `true`
21726
+ * AND it is younger than the window the bridge counts the camera's own motion
21727
+ * for (`motionCooldownMs`, floored at two sustain ticks). A camera that never
21728
+ * sends a clear (heartbeats only) therefore reads `false` once no push came
21729
+ * within the window; a status read is a snapshot, so a live view re-asks.
21730
+ * Absent = this orchestrator has not received the camera's own motion since it
21731
+ * started (unknown, never "quiet"), or an orchestrator older than D696.
21732
+ */
21733
+ var CameraRawLevelSchema = object({
21734
+ detected: boolean(),
21735
+ atMs: number()
21736
+ });
21720
21737
  var CameraSensorsStatusSchema = discriminatedUnion("state", [
21721
- object({ state: literal("not-configured") }),
21738
+ object({
21739
+ state: literal("not-configured"),
21740
+ cameraLevel: CameraRawLevelSchema.optional()
21741
+ }),
21722
21742
  object({
21723
21743
  state: literal("unreadable"),
21724
- reason: string()
21744
+ reason: string(),
21745
+ cameraLevel: CameraRawLevelSchema.optional()
21725
21746
  }),
21726
21747
  object({
21727
21748
  state: literal("configured"),
21728
- mode: CameraSensorsModeSchema,
21749
+ cameraLevel: CameraRawLevelSchema.optional(),
21729
21750
  sensors: array(CameraSensorAttachmentSchema).readonly(),
21730
- notForwarded: CameraSensorsNotForwardedSchema.optional()
21751
+ /** Absent = an orchestrator older than CS-2: it does not say (D315). */
21752
+ cameraMotion: CameraOwnMotionSchema.optional(),
21753
+ notForwarded: CameraSensorsNotForwardedSchema.optional(),
21754
+ notEnforced: CameraSensorsNotEnforcedSchema.optional()
21731
21755
  })
21732
21756
  ]);
21733
21757
  Object.freeze({
@@ -24958,8 +24982,10 @@ var RunnerCameraConfigSchema = object({
24958
24982
  * - `analyzer`: ML/frame-diff motion detection (motion-wasm or other
24959
24983
  * analyzer providers) running on decoded frames in this runner.
24960
24984
  * - `onboard`: camera-native motion pushes (Reolink Baichuan, ONVIF
24961
- * analytics). The provider emits ProviderMotion
24962
- * events; the orchestrator forwards to `reportMotion`.
24985
+ * analytics). The provider emits its raw push as `ProviderMotion`
24986
+ * (D673); the orchestrator's camera-sensors bridge re-emits the camera's
24987
+ * effective motion as `MotionOnMotionChanged`, which is what reaches
24988
+ * `reportMotion`.
24963
24989
  */
24964
24990
  motionSources: MotionSourcesSchema.default(["analyzer"]),
24965
24991
  /**
@@ -25136,7 +25162,15 @@ var RunnerLocalLoadSchema = object({
25136
25162
  hasGpu: boolean(),
25137
25163
  inferenceBackend: string().optional(),
25138
25164
  cpuCores: number().optional()
25139
- })
25165
+ }),
25166
+ /**
25167
+ * Who writes a camera's `motion` runtime slice (D696). `'orchestrator'`: this
25168
+ * runner never writes it. ABSENT = a runner older than D696, which still
25169
+ * writes the slice from its phase machine; the orchestrator does not write
25170
+ * while any runner node is absent-or-unanswered, so one slice never has two
25171
+ * writers.
25172
+ */
25173
+ motionSliceWriter: literal("orchestrator").optional()
25140
25174
  });
25141
25175
  /**
25142
25176
  * Aggregate runtime metrics for the runner's whole local pool. Mirrors the
@@ -31179,6 +31213,70 @@ onStatusChanged: { data: object({
31179
31213
  * whether persisting is worth a SQLite commit. */
31180
31214
  volatileStateFields: ["lastChangedAt"]
31181
31215
  };
31216
+ var DoorbellStatusSchema = object({
31217
+ /** Ms epoch of the last press. null = never observed since this provider started. */
31218
+ lastPressedAt: number().nullable(),
31219
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
31220
+ pressCountSinceStart: number()
31221
+ });
31222
+ var DoorbellPressEventSchema = object({
31223
+ deviceId: number(),
31224
+ timestamp: number()
31225
+ });
31226
+ /**
31227
+ * Doorbell button cap. Two kinds of provider serve it, and to every consumer
31228
+ * they are the same cap:
31229
+ *
31230
+ * - **Native** providers, registered per device by a driver addon through
31231
+ * `ctx.registerNativeCap` — a `DeviceType.Button` accessory with
31232
+ * `role: DeviceRole.Doorbell`, or the camera itself (Reolink registers at
31233
+ * camera level). They emit `onPressed` on every firmware ring.
31234
+ * - **A composed doorbell** (D670, D671): a camera's customization gives it
31235
+ * the cap, its `lastPressedAt` rising from the sources the operator
31236
+ * assigned in Customize → Doorbell, and the composer emits `onPressed`
31237
+ * from that field's advance (`fromState`).
31238
+ *
31239
+ * The DeviceEventPropagator re-emits `onPressed` on the camera parent.
31240
+ */
31241
+ var doorbellCapability = {
31242
+ name: "doorbell",
31243
+ scope: "device",
31244
+ deviceNative: true,
31245
+ mode: "singleton",
31246
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
31247
+ methods: {},
31248
+ events: {
31249
+ /**
31250
+ * Fires once per physical press. Reolink delivers via Baichuan
31251
+ * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
31252
+ * release/duration — it's a pulse.
31253
+ */
31254
+ onPressed: {
31255
+ data: DoorbellPressEventSchema,
31256
+ fromState: {
31257
+ field: "lastPressedAt",
31258
+ on: "advance"
31259
+ }
31260
+ } },
31261
+ status: {
31262
+ schema: DoorbellStatusSchema,
31263
+ kind: "push"
31264
+ },
31265
+ /**
31266
+ * Runtime-state slice — last press timestamp + lifetime press count.
31267
+ * Mirrored by the kernel and readable via
31268
+ * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
31269
+ * without subscribing.
31270
+ */
31271
+ runtimeState: DoorbellStatusSchema,
31272
+ /**
31273
+ * 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.
31274
+ *
31275
+ * See `RuntimeStateDurability`. Enforced by
31276
+ * `scripts/check-runtime-state-durability.ts`.
31277
+ */
31278
+ durability: "restored"
31279
+ };
31182
31280
  /**
31183
31281
  * Enum-state sensor — a string value picked from a finite option set.
31184
31282
  * Drives HA `sensor` entries with `state_class: enum` (HVAC action
@@ -33323,9 +33421,9 @@ var MotionStatusSchema = object({
33323
33421
  /** Ms epoch of the last detected-true observation. Null if never detected. */
33324
33422
  lastDetectedAt: number().nullable(),
33325
33423
  /**
33326
- * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
33327
- * `null` while false and on every `Sensor` device (D475) — see that
33328
- * constant's doc for the one-authority rule.
33424
+ * `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device (the
33425
+ * orchestrator writes it, D696), `null` while false and on every `Sensor`
33426
+ * device (D475) — see that constant's doc for the one-authority rule.
33329
33427
  *
33330
33428
  * ## Reading this field still arms nothing
33331
33429
  *
@@ -33343,34 +33441,31 @@ var MotionStatusSchema = object({
33343
33441
  * `addon-export-alexa/src/motion-clear-hold.ts` and
33344
33442
  * `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
33345
33443
  *
33346
- * ## Who writes it
33347
- *
33348
- * - **Cameras** — the runner's phase machine, `active → watching` on
33349
- * `cooldown_expired`, which then writes this slice with
33350
- * `detected: false` (`handlePhaseChanged` in
33351
- * `pipeline-runner/index.ts`). It produces the FALLING edge, which
33352
- * matters most for the sources that only ever push a rising one:
33353
- * Reolink emits `MotionOnMotionChanged { detected: true }` and never
33354
- * a false.
33355
- * - **Sensors** (Home Assistant binary sensors, Homematic) — the
33356
- * provider pushes the false itself, from the upstream system's own
33357
- * state change. No phase machine is involved.
33358
- *
33359
- * ### The phase machine is CANONICAL, not sole — and that is a defect
33360
- *
33361
- * An earlier revision of this docblock (mine, 2026-09-12) claimed the
33362
- * phase machine is the sole writer for a camera. It is not.
33363
- * `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
33364
- * `setCapSlice(motionCapability, …)` on their own rising edge, and
33365
- * Hikvision's comment says why: it read THIS docblock, agreed the
33366
- * runner is canonical, and wrote anyway to avoid per-tick churn. So
33367
- * two authorities can disagree about one slice, which this repo
33368
- * forbids, and the doc said otherwise — which is worse than saying
33369
- * nothing, because it reads as verification.
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.
33444
+ * ## Who writes it (D696)
33445
+ *
33446
+ * - **Cameras** — the orchestrator, and nothing else. It writes the camera's
33447
+ * EFFECTIVE motion (`addon-pipeline-orchestrator`
33448
+ * `camera-sensors/motion-slice.ts`), alongside the effective
33449
+ * `MotionOnMotionChanged` it emits or receives: the camera-sensors bridge
33450
+ * for a split camera, an unsplit emitter's direct event, the analyzer and
33451
+ * device activity, as the camera's `motionSources` counts them. A source
33452
+ * that never sends a clear falls one window after its last `true`.
33453
+ * `lastDetectedAt` moves only on an effective rise. No camera provider
33454
+ * writes this slice (not even a boot seed), and neither does the runner's
33455
+ * phase machine: its phase is "a session is attached" for every on-motion
33456
+ * session, not motion, and it now has its own `DetectionPhaseTransition`.
33457
+ * A provider's `isDetected` answers from the hub's slice.
33458
+ * - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
33459
+ * imports) — the provider pushes both edges itself, from the upstream
33460
+ * system's own state change. That is the sensor's own fact.
33461
+ *
33462
+ * `scripts/check-onboard-motion-emitters.ts` refuses any other writer of a
33463
+ * `motion` slice; each sensor writer is a named exemption.
33464
+ *
33465
+ * This replaces the D475 §4 rule ("the phase machine is the sole writer").
33466
+ * That rule was never true: Hikvision and Amcrest wrote the slice raw beside
33467
+ * it, every provider seeded it at boot, and every session left it
33468
+ * `detected: true` after its detach.
33374
33469
  */
33375
33470
  autoClearAfterMs: number().nullable()
33376
33471
  });
@@ -33442,11 +33537,12 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
33442
33537
  */
33443
33538
  runtimeState: MotionStatusSchema,
33444
33539
  /**
33445
- * Runtime-state durability: **session** — every writer of this slice
33540
+ * Runtime-state durability: **session** — the writer of this slice
33446
33541
  * writes only on an EDGE, so a restored `detected: true` would stay
33447
33542
  * frozen until the next one instead of being corrected. The next edge
33448
- * re-publishes the real state. (On who the writers are, and why there
33449
- * is more than one, see `autoClearAfterMs` above.)
33543
+ * re-publishes the real state, and the orchestrator re-publishes every
33544
+ * camera when it starts writing (D696; on who writes it, see
33545
+ * `autoClearAfterMs` above).
33450
33546
  *
33451
33547
  * See `RuntimeStateDurability`. Enforced by
33452
33548
  * `scripts/check-runtime-state-durability.ts`.
@@ -35961,8 +36057,7 @@ var ptzAutotrackCapability = {
35961
36057
  deviceNative: true,
35962
36058
  mode: "singleton",
35963
36059
  /**
35964
- * Two kinds of provider behind one name, the same shape `snapshot` and
35965
- * `doorbell` use:
36060
+ * Two kinds of provider behind one name, the same shape `snapshot` uses:
35966
36061
  *
35967
36062
  * - **Native**: the camera's own firmware autotrack, registered per device by
35968
36063
  * the driver when the probe says it exists (Reolink: yes; Hikvision:
@@ -35970,7 +36065,7 @@ var ptzAutotrackCapability = {
35970
36065
  * - **Wrapper**: the emulated implementation (`@camstack/system`'s `autotrack` builtin),
35971
36066
  * which follows a subject with `ptz.move` pulses driven by the detection
35972
36067
  * pipeline. `defaultActive: false` — the operator binds it per camera in
35973
- * the bindings UI, exactly as `virtual-doorbell` is bound.
36068
+ * the bindings UI.
35974
36069
  *
35975
36070
  * The binding chooses WHICH implementation answers; `setEnabled` stays the
35976
36071
  * one switch for the function either way. A camera never has both driving its
@@ -41475,13 +41570,14 @@ var BaseDeviceProvider = class extends BaseAddon {
41475
41570
  async getStatus() {
41476
41571
  const all = await this.ctx.kernel.devices?.getAll() ?? [];
41477
41572
  const summary = this.restoreFailureSummary();
41478
- if (summary === null) return {
41573
+ const base = {
41479
41574
  connected: true,
41480
- deviceCount: all.length
41575
+ deviceCount: all.length,
41576
+ motionSliceWriter: "orchestrator"
41481
41577
  };
41578
+ if (summary === null) return base;
41482
41579
  return {
41483
- connected: true,
41484
- deviceCount: all.length,
41580
+ ...base,
41485
41581
  error: summary
41486
41582
  };
41487
41583
  }
@@ -47080,6 +47176,12 @@ Object.freeze({
47080
47176
  addonId: null,
47081
47177
  access: "view"
47082
47178
  },
47179
+ "notificationRules.getAlarmSensors": {
47180
+ capName: "notification-rules",
47181
+ capScope: "system",
47182
+ addonId: null,
47183
+ access: "view"
47184
+ },
47083
47185
  "notificationRules.getClipRetentionAsks": {
47084
47186
  capName: "notification-rules",
47085
47187
  capScope: "system",
@@ -51563,6 +51665,11 @@ Object.freeze({
51563
51665
  form: "single",
51564
51666
  optional: false
51565
51667
  }],
51668
+ "notificationRules.getAlarmSensors": [{
51669
+ name: "deviceIds",
51670
+ form: "array",
51671
+ optional: false
51672
+ }],
51566
51673
  "notificationRules.setDeviceMuted": [{
51567
51674
  name: "deviceId",
51568
51675
  form: "single",
@@ -53498,6 +53605,25 @@ TimelapseRuleInputSchema.extend({
53498
53605
  createdAt: number(),
53499
53606
  updatedAt: number()
53500
53607
  });
53608
+ async function readHubMotionDetected(deviceState, deviceId) {
53609
+ let slice;
53610
+ try {
53611
+ slice = await deviceState.getCapSlice.query({
53612
+ deviceId,
53613
+ capName: "motion"
53614
+ });
53615
+ } catch (err) {
53616
+ const reason = err instanceof Error ? err.message : String(err);
53617
+ throw new Error(`motion state of device ${deviceId} is unreadable: ${reason}`, { cause: err });
53618
+ }
53619
+ const detected = slice?.["detected"];
53620
+ if (typeof detected !== "boolean") throw new Error(`motion state of device ${deviceId} is not published yet (unknown)`);
53621
+ return detected;
53622
+ }
53623
+ MotionOnMotionChangedDataSchema.omit({ triggeredBy: true });
53624
+ function providerMotionEvent(source, data) {
53625
+ return createEvent(EventCategory.ProviderMotion, source, data);
53626
+ }
53501
53627
  object({
53502
53628
  /**
53503
53629
  * Fraction of the box's own size added on EACH side before cutting.
@@ -165053,6 +165179,22 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
165053
165179
  * writers are {@link refreshNetworkLinkFromApi}. Seeded unknown so the
165054
165180
  * restored slice (if any) stays valid and a fresh device draws no link.
165055
165181
  */
165182
+ /**
165183
+ * The native `motion` cap. This provider writes NO `motion` slice (D696):
165184
+ * `handleSimpleEvent` emits its raw push as `ProviderMotion` (`source:
165185
+ * 'onboard'`, D673), the orchestrator's camera-sensors bridge turns it into
165186
+ * the effective `MotionOnMotionChanged`, and the orchestrator is the slice's
165187
+ * only writer, with that effective value, on the hub. `isDetected`
165188
+ * therefore answers from the HUB's slice; an unreadable hub, or a slice
165189
+ * nobody has published since the hub started, fails the call. It never
165190
+ * answers `false` for "unknown" (D49, D393).
165191
+ */
165192
+ registerMotionCap() {
165193
+ this.ctx.registerNativeCap(motionCapability, { isDetected: async ({ deviceId }) => {
165194
+ if (deviceId !== this.id) throw new Error(`ReolinkCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
165195
+ return readHubMotionDetected(this.ctx.api.deviceState, this.id);
165196
+ } });
165197
+ }
165056
165198
  registerNetworkLink() {
165057
165199
  this.ctx.registerNativeCap(networkLinkCapability, { getStatus: async ({ deviceId }) => {
165058
165200
  if (deviceId !== this.id) throw new Error(`ReolinkCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
@@ -165781,15 +165923,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
165781
165923
  };
165782
165924
  } });
165783
165925
  this.registerNetworkLink();
165784
- this.ctx.registerNativeCap(motionCapability, { isDetected: async ({ deviceId }) => {
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
- });
165926
+ this.registerMotionCap();
165793
165927
  this.registerDoorbellIfSupported();
165794
165928
  this.registerPtzIfSupported();
165795
165929
  this.registerPtzAutotrackIfSupported();
@@ -171788,11 +171922,11 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
171788
171922
  * axes, each driven exclusively by their own firmware push events.
171789
171923
  *
171790
171924
  * - 'motion' + AI types (people, vehicle, animal, face, package):
171791
- * emit `EventCategory.MotionOnMotionChanged` (`source: 'onboard'`)
171792
- * so the runner's phase machine reacts via `reportMotion`. The
171793
- * runner is the sole writer of the `motion` runtime-state slice
171794
- * (no direct slice writes here — keeps onboard symmetric with the
171795
- * analyzer path). AI subtype also lands on
171925
+ * emit the RAW push as `EventCategory.ProviderMotion`
171926
+ * (`source: 'onboard'`, D673). The orchestrator's camera-sensors bridge
171927
+ * re-emits it as the effective `MotionOnMotionChanged`, and the
171928
+ * orchestrator is the only writer of the camera's `motion` runtime-state
171929
+ * slice (D696; no slice write here). AI subtype also lands on
171796
171930
  * `EventCategory.DetectionCameraNative`.
171797
171931
  * - 'awake' / 'sleeping': emit DeviceAwake / DeviceSleeping. Battery
171798
171932
  * power-state only — does NOT touch online state.
@@ -171845,7 +171979,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
171845
171979
  } });
171846
171980
  if (event.type === "motion") {
171847
171981
  const now = Date.now();
171848
- this.ctx.eventBus.emit(createEvent(EventCategory.MotionOnMotionChanged, eventSource, {
171982
+ this.ctx.eventBus.emit(providerMotionEvent(eventSource, {
171849
171983
  deviceId: this.id,
171850
171984
  detected: true,
171851
171985
  timestamp: now,
@@ -171873,7 +172007,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
171873
172007
  }]
171874
172008
  }));
171875
172009
  } else this.noteNativeDetectionSuppressed(aiClass);
171876
- this.ctx.eventBus.emit(createEvent(EventCategory.MotionOnMotionChanged, eventSource, {
172010
+ this.ctx.eventBus.emit(providerMotionEvent(eventSource, {
171877
172011
  deviceId: this.id,
171878
172012
  detected: true,
171879
172013
  timestamp: now,
@@ -173722,7 +173856,7 @@ var AutodetectCache = class {
173722
173856
  * silently dropped.
173723
173857
  *
173724
173858
  * Returns a LIST rather than a single type because of `doorbell`. The
173725
- * camera's `handleSimpleEvent` emits `MotionOnMotionChanged` for `motion`
173859
+ * camera's `handleSimpleEvent` emits `ProviderMotion` for `motion`
173726
173860
  * and for every AI class, but the `doorbell` branch emits ONLY
173727
173861
  * `DoorbellOnPressed` and returns. An email is the sole signal a sleeping
173728
173862
  * battery camera can send, so a doorbell-classified email mapped to