@camstack/addon-provider-dreame 0.2.98 → 0.2.100
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 +151 -22
- package/dist/addon.mjs +151 -22
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -59976,6 +59976,23 @@ function errMsg(err) {
|
|
|
59976
59976
|
if (typeof err === "string") return err;
|
|
59977
59977
|
return String(err);
|
|
59978
59978
|
}
|
|
59979
|
+
new Set([
|
|
59980
|
+
"track",
|
|
59981
|
+
"summary",
|
|
59982
|
+
"face",
|
|
59983
|
+
"identity",
|
|
59984
|
+
"plate",
|
|
59985
|
+
"vehicle",
|
|
59986
|
+
"scene",
|
|
59987
|
+
"motion",
|
|
59988
|
+
"object",
|
|
59989
|
+
"audio"
|
|
59990
|
+
]);
|
|
59991
|
+
new Set([
|
|
59992
|
+
"motion",
|
|
59993
|
+
"object",
|
|
59994
|
+
"audio"
|
|
59995
|
+
]);
|
|
59979
59996
|
var EncodeProfileSchema = object({
|
|
59980
59997
|
video: object({
|
|
59981
59998
|
codec: _enum([
|
|
@@ -65176,8 +65193,17 @@ method(object({
|
|
|
65176
65193
|
}), array(SettingsRecordSchema).readonly()), method(object({
|
|
65177
65194
|
namespace: string().optional(),
|
|
65178
65195
|
collection: string(),
|
|
65179
|
-
record:
|
|
65180
|
-
|
|
65196
|
+
record: object({
|
|
65197
|
+
id: string().optional(),
|
|
65198
|
+
data: record(string(), unknown())
|
|
65199
|
+
})
|
|
65200
|
+
}), object({
|
|
65201
|
+
/**
|
|
65202
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
65203
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
65204
|
+
* primary key — which is the only place an auto key is knowable.
|
|
65205
|
+
*/
|
|
65206
|
+
id: union([string(), number()]) }), { kind: "mutation" }), method(object({
|
|
65181
65207
|
namespace: string().optional(),
|
|
65182
65208
|
collection: string(),
|
|
65183
65209
|
records: array(BulkRecordSchema).readonly()
|
|
@@ -65286,8 +65312,17 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
|
|
|
65286
65312
|
}), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
|
|
65287
65313
|
namespace: string().optional(),
|
|
65288
65314
|
collection: string(),
|
|
65289
|
-
record:
|
|
65290
|
-
|
|
65315
|
+
record: object({
|
|
65316
|
+
id: string().optional(),
|
|
65317
|
+
data: record(string(), unknown())
|
|
65318
|
+
})
|
|
65319
|
+
}), object({
|
|
65320
|
+
/**
|
|
65321
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
65322
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
65323
|
+
* primary key — which is the only place an auto key is knowable.
|
|
65324
|
+
*/
|
|
65325
|
+
id: union([string(), number()]) }), {
|
|
65291
65326
|
kind: "mutation",
|
|
65292
65327
|
auth: "admin"
|
|
65293
65328
|
}), method(object({
|
|
@@ -72212,7 +72247,20 @@ var TrackSchema = object({
|
|
|
72212
72247
|
...TrackRetrainFields
|
|
72213
72248
|
});
|
|
72214
72249
|
var BaseEventFields = {
|
|
72215
|
-
|
|
72250
|
+
/**
|
|
72251
|
+
* A SQLite ROWID, assigned by the database (D474).
|
|
72252
|
+
*
|
|
72253
|
+
* Was a 36-character UUID and cost 263 MB of a 1 117 MB database — paid
|
|
72254
|
+
* TWICE per row, in the row and in the primary-key index, across 2.1 million
|
|
72255
|
+
* motion, audio and object events. An `INTEGER PRIMARY KEY` in SQLite **is**
|
|
72256
|
+
* the rowid: the table itself is that B-tree, so the index stops existing
|
|
72257
|
+
* rather than getting smaller. No shorter string does that.
|
|
72258
|
+
*
|
|
72259
|
+
* Defined once here for all three event kinds, which is why they move
|
|
72260
|
+
* together: a per-table migration would have forked this and
|
|
72261
|
+
* `COMMON_BASE_COLUMNS` and reunited them two stages later.
|
|
72262
|
+
*/
|
|
72263
|
+
id: number().int(),
|
|
72216
72264
|
deviceId: number(),
|
|
72217
72265
|
timestamp: number()
|
|
72218
72266
|
};
|
|
@@ -72231,7 +72279,34 @@ var MotionEventSchema = object({
|
|
|
72231
72279
|
/** Omitted in slim projection. */
|
|
72232
72280
|
frameHeight: number().optional(),
|
|
72233
72281
|
/** Populated by B5 (recording playback URL for this event). */
|
|
72234
|
-
mediaUrl: string().optional()
|
|
72282
|
+
mediaUrl: string().optional(),
|
|
72283
|
+
/**
|
|
72284
|
+
* One row per motion EPISODE, not one per push (D475). `null` while the
|
|
72285
|
+
* episode is still open — a further rising edge extends it in place rather
|
|
72286
|
+
* than inserting a new row. Set once, at close, to `lastOnAt - startedAt`
|
|
72287
|
+
* (the span from the first rising edge to the LAST one, deliberately NOT
|
|
72288
|
+
* `closedAt - startedAt` — the close delay is a quiet CONFIRMATION, not
|
|
72289
|
+
* movement, and folding it in would report `MOTION_CLOSE_AFTER_MS` of
|
|
72290
|
+
* motion for an instantaneous trigger).
|
|
72291
|
+
*
|
|
72292
|
+
* **Absent** (not merely `null`) on a row written before D475 — that means
|
|
72293
|
+
* "closed the old way, before this column existed", never "still open".
|
|
72294
|
+
* Nothing in this codebase may read an absent `durationMs` as an open
|
|
72295
|
+
* episode; only `null` means open.
|
|
72296
|
+
*/
|
|
72297
|
+
durationMs: number().nullable().optional(),
|
|
72298
|
+
/**
|
|
72299
|
+
* Ms offsets from `timestamp` (the episode's own first rising edge, so the
|
|
72300
|
+
* first entry is always `0`) of every genuine off→on transition the
|
|
72301
|
+
* episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
|
|
72302
|
+
* push: a firmware source that keepalives at ~1 Hz for the whole burst
|
|
72303
|
+
* (Reolink, Hikvision) produces exactly one edge; a source that reports an
|
|
72304
|
+
* explicit `false` mid-episode and then resumes before the quiet window
|
|
72305
|
+
* elapses produces another. Stored compactly — see `motion-edge-codec.ts`
|
|
72306
|
+
* — and decoded back to this shape on read. Absent/empty on a legacy row,
|
|
72307
|
+
* which must never be read as "no episode happened here".
|
|
72308
|
+
*/
|
|
72309
|
+
edges: array(number()).readonly().optional()
|
|
72235
72310
|
});
|
|
72236
72311
|
/**
|
|
72237
72312
|
* Which detection SOURCE produced an object event. `pipeline` = the ML
|
|
@@ -72286,6 +72361,23 @@ var ObjectEventSchema = object({
|
|
|
72286
72361
|
* includes it (it is light). Absent on rows written before this field.
|
|
72287
72362
|
*/
|
|
72288
72363
|
frameId: string().optional(),
|
|
72364
|
+
/**
|
|
72365
|
+
* A PRODUCER-chosen key that makes a synthetic event's emission idempotent
|
|
72366
|
+
* (D474).
|
|
72367
|
+
*
|
|
72368
|
+
* Only the package detector writes it, and it exists because the event id
|
|
72369
|
+
* stopped being choosable: the delivery and pick-up rows used to BE their
|
|
72370
|
+
* dedupe key (`pa-pkg-<entryId>-delivered`), which is how "never emit a
|
|
72371
|
+
* second delivery for this entry" survived a restart. An `INTEGER` rowid is
|
|
72372
|
+
* assigned by SQLite, so that key had to move off the primary key rather
|
|
72373
|
+
* than be dropped — a detector that cannot recognise its own row re-delivers
|
|
72374
|
+
* every parcel on every boot.
|
|
72375
|
+
*
|
|
72376
|
+
* Absent on every other object event, and on every row written before this
|
|
72377
|
+
* field. Never a substitute for `id`: it is unique per (producer, occasion),
|
|
72378
|
+
* not per row, and nothing addresses a row by it.
|
|
72379
|
+
*/
|
|
72380
|
+
idempotencyKey: string().optional(),
|
|
72289
72381
|
/** Omitted in slim projection. */
|
|
72290
72382
|
trackId: string().optional(),
|
|
72291
72383
|
className: string(),
|
|
@@ -80560,26 +80652,59 @@ authKey: string().optional() }), object({
|
|
|
80560
80652
|
/** Human-readable error when `ok: false`. */
|
|
80561
80653
|
error: string().optional()
|
|
80562
80654
|
}), { kind: "mutation" });
|
|
80563
|
-
/**
|
|
80564
|
-
* Hardware / firmware motion sensor cap — binary detected state plus
|
|
80565
|
-
* a timestamp of the last observation. Distinct from
|
|
80566
|
-
* `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
|
|
80567
|
-
* `motion` is the lightweight readout from on-camera motion (Reolink
|
|
80568
|
-
* `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
|
|
80569
|
-
*
|
|
80570
|
-
* Native-motion providers also fan out to `detection.camera-native`
|
|
80571
|
-
* with `source: 'onboard'` so cross-cutting system services
|
|
80572
|
-
* (alert-center, advanced-notifier) can subscribe once and receive
|
|
80573
|
-
* motion from every camera.
|
|
80574
|
-
*/
|
|
80575
80655
|
var MotionStatusSchema = object({
|
|
80576
80656
|
detected: boolean(),
|
|
80577
80657
|
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
80578
80658
|
lastDetectedAt: number().nullable(),
|
|
80579
80659
|
/**
|
|
80580
|
-
*
|
|
80581
|
-
*
|
|
80582
|
-
*
|
|
80660
|
+
* `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
|
|
80661
|
+
* `null` while false and on every `Sensor` device (D475) — see that
|
|
80662
|
+
* constant's doc for the one-authority rule.
|
|
80663
|
+
*
|
|
80664
|
+
* ## Reading this field still arms nothing
|
|
80665
|
+
*
|
|
80666
|
+
* It reads like an instruction to the consumer ("revert after N ms if
|
|
80667
|
+
* no fresh push arrives") and it is not one: nothing in this repo reads
|
|
80668
|
+
* the LIVE cap value to drive a timer. `pipeline-analytics`'s motion-episode
|
|
80669
|
+
* close DOES now use the same number — `MOTION_CLOSE_AFTER_MS` — but as an
|
|
80670
|
+
* imported constant, not as a read of `device.state.motion.value`, so this
|
|
80671
|
+
* field stays what it always was: DESCRIPTIVE output, mirroring an answer
|
|
80672
|
+
* computed elsewhere. Building a self-clear timer out of a READ of this
|
|
80673
|
+
* field would add a second falling-edge authority beside whichever one
|
|
80674
|
+
* already owns the device, and two that can disagree are worse than one.
|
|
80675
|
+
* Consumers that need a falling edge SHAPED differently — held open across
|
|
80676
|
+
* a flapping source — debounce on their own side and say so, as
|
|
80677
|
+
* `addon-export-alexa/src/motion-clear-hold.ts` and
|
|
80678
|
+
* `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
|
|
80679
|
+
*
|
|
80680
|
+
* ## Who writes it
|
|
80681
|
+
*
|
|
80682
|
+
* - **Cameras** — the runner's phase machine, `active → watching` on
|
|
80683
|
+
* `cooldown_expired`, which then writes this slice with
|
|
80684
|
+
* `detected: false` (`handlePhaseChanged` in
|
|
80685
|
+
* `pipeline-runner/index.ts`). It produces the FALLING edge, which
|
|
80686
|
+
* matters most for the sources that only ever push a rising one:
|
|
80687
|
+
* Reolink emits `MotionOnMotionChanged { detected: true }` and never
|
|
80688
|
+
* a false.
|
|
80689
|
+
* - **Sensors** (Home Assistant binary sensors, Homematic) — the
|
|
80690
|
+
* provider pushes the false itself, from the upstream system's own
|
|
80691
|
+
* state change. No phase machine is involved.
|
|
80692
|
+
*
|
|
80693
|
+
* ### The phase machine is CANONICAL, not sole — and that is a defect
|
|
80694
|
+
*
|
|
80695
|
+
* An earlier revision of this docblock (mine, 2026-09-12) claimed the
|
|
80696
|
+
* phase machine is the sole writer for a camera. It is not.
|
|
80697
|
+
* `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
|
|
80698
|
+
* `setCapSlice(motionCapability, …)` on their own rising edge, and
|
|
80699
|
+
* Hikvision's comment says why: it read THIS docblock, agreed the
|
|
80700
|
+
* runner is canonical, and wrote anyway to avoid per-tick churn. So
|
|
80701
|
+
* two authorities can disagree about one slice, which this repo
|
|
80702
|
+
* forbids, and the doc said otherwise — which is worse than saying
|
|
80703
|
+
* nothing, because it reads as verification.
|
|
80704
|
+
*
|
|
80705
|
+
* This predates D475 and is not fixed there: the fix touches every
|
|
80706
|
+
* camera provider. Recorded in D475's Consequences. Do not restore the
|
|
80707
|
+
* "sole writer" wording without also removing the other writers.
|
|
80583
80708
|
*/
|
|
80584
80709
|
autoClearAfterMs: number().nullable()
|
|
80585
80710
|
});
|
|
@@ -80649,7 +80774,11 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
|
|
|
80649
80774
|
*/
|
|
80650
80775
|
runtimeState: MotionStatusSchema,
|
|
80651
80776
|
/**
|
|
80652
|
-
* Runtime-state durability: **session** —
|
|
80777
|
+
* Runtime-state durability: **session** — every writer of this slice
|
|
80778
|
+
* writes only on an EDGE, so a restored `detected: true` would stay
|
|
80779
|
+
* frozen until the next one instead of being corrected. The next edge
|
|
80780
|
+
* re-publishes the real state. (On who the writers are, and why there
|
|
80781
|
+
* is more than one, see `autoClearAfterMs` above.)
|
|
80653
80782
|
*
|
|
80654
80783
|
* See `RuntimeStateDurability`. Enforced by
|
|
80655
80784
|
* `scripts/check-runtime-state-durability.ts`.
|
package/dist/addon.mjs
CHANGED
|
@@ -59973,6 +59973,23 @@ function errMsg(err) {
|
|
|
59973
59973
|
if (typeof err === "string") return err;
|
|
59974
59974
|
return String(err);
|
|
59975
59975
|
}
|
|
59976
|
+
new Set([
|
|
59977
|
+
"track",
|
|
59978
|
+
"summary",
|
|
59979
|
+
"face",
|
|
59980
|
+
"identity",
|
|
59981
|
+
"plate",
|
|
59982
|
+
"vehicle",
|
|
59983
|
+
"scene",
|
|
59984
|
+
"motion",
|
|
59985
|
+
"object",
|
|
59986
|
+
"audio"
|
|
59987
|
+
]);
|
|
59988
|
+
new Set([
|
|
59989
|
+
"motion",
|
|
59990
|
+
"object",
|
|
59991
|
+
"audio"
|
|
59992
|
+
]);
|
|
59976
59993
|
var EncodeProfileSchema = object({
|
|
59977
59994
|
video: object({
|
|
59978
59995
|
codec: _enum([
|
|
@@ -65173,8 +65190,17 @@ method(object({
|
|
|
65173
65190
|
}), array(SettingsRecordSchema).readonly()), method(object({
|
|
65174
65191
|
namespace: string().optional(),
|
|
65175
65192
|
collection: string(),
|
|
65176
|
-
record:
|
|
65177
|
-
|
|
65193
|
+
record: object({
|
|
65194
|
+
id: string().optional(),
|
|
65195
|
+
data: record(string(), unknown())
|
|
65196
|
+
})
|
|
65197
|
+
}), object({
|
|
65198
|
+
/**
|
|
65199
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
65200
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
65201
|
+
* primary key — which is the only place an auto key is knowable.
|
|
65202
|
+
*/
|
|
65203
|
+
id: union([string(), number()]) }), { kind: "mutation" }), method(object({
|
|
65178
65204
|
namespace: string().optional(),
|
|
65179
65205
|
collection: string(),
|
|
65180
65206
|
records: array(BulkRecordSchema).readonly()
|
|
@@ -65283,8 +65309,17 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
|
|
|
65283
65309
|
}), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
|
|
65284
65310
|
namespace: string().optional(),
|
|
65285
65311
|
collection: string(),
|
|
65286
|
-
record:
|
|
65287
|
-
|
|
65312
|
+
record: object({
|
|
65313
|
+
id: string().optional(),
|
|
65314
|
+
data: record(string(), unknown())
|
|
65315
|
+
})
|
|
65316
|
+
}), object({
|
|
65317
|
+
/**
|
|
65318
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
65319
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
65320
|
+
* primary key — which is the only place an auto key is knowable.
|
|
65321
|
+
*/
|
|
65322
|
+
id: union([string(), number()]) }), {
|
|
65288
65323
|
kind: "mutation",
|
|
65289
65324
|
auth: "admin"
|
|
65290
65325
|
}), method(object({
|
|
@@ -72209,7 +72244,20 @@ var TrackSchema = object({
|
|
|
72209
72244
|
...TrackRetrainFields
|
|
72210
72245
|
});
|
|
72211
72246
|
var BaseEventFields = {
|
|
72212
|
-
|
|
72247
|
+
/**
|
|
72248
|
+
* A SQLite ROWID, assigned by the database (D474).
|
|
72249
|
+
*
|
|
72250
|
+
* Was a 36-character UUID and cost 263 MB of a 1 117 MB database — paid
|
|
72251
|
+
* TWICE per row, in the row and in the primary-key index, across 2.1 million
|
|
72252
|
+
* motion, audio and object events. An `INTEGER PRIMARY KEY` in SQLite **is**
|
|
72253
|
+
* the rowid: the table itself is that B-tree, so the index stops existing
|
|
72254
|
+
* rather than getting smaller. No shorter string does that.
|
|
72255
|
+
*
|
|
72256
|
+
* Defined once here for all three event kinds, which is why they move
|
|
72257
|
+
* together: a per-table migration would have forked this and
|
|
72258
|
+
* `COMMON_BASE_COLUMNS` and reunited them two stages later.
|
|
72259
|
+
*/
|
|
72260
|
+
id: number().int(),
|
|
72213
72261
|
deviceId: number(),
|
|
72214
72262
|
timestamp: number()
|
|
72215
72263
|
};
|
|
@@ -72228,7 +72276,34 @@ var MotionEventSchema = object({
|
|
|
72228
72276
|
/** Omitted in slim projection. */
|
|
72229
72277
|
frameHeight: number().optional(),
|
|
72230
72278
|
/** Populated by B5 (recording playback URL for this event). */
|
|
72231
|
-
mediaUrl: string().optional()
|
|
72279
|
+
mediaUrl: string().optional(),
|
|
72280
|
+
/**
|
|
72281
|
+
* One row per motion EPISODE, not one per push (D475). `null` while the
|
|
72282
|
+
* episode is still open — a further rising edge extends it in place rather
|
|
72283
|
+
* than inserting a new row. Set once, at close, to `lastOnAt - startedAt`
|
|
72284
|
+
* (the span from the first rising edge to the LAST one, deliberately NOT
|
|
72285
|
+
* `closedAt - startedAt` — the close delay is a quiet CONFIRMATION, not
|
|
72286
|
+
* movement, and folding it in would report `MOTION_CLOSE_AFTER_MS` of
|
|
72287
|
+
* motion for an instantaneous trigger).
|
|
72288
|
+
*
|
|
72289
|
+
* **Absent** (not merely `null`) on a row written before D475 — that means
|
|
72290
|
+
* "closed the old way, before this column existed", never "still open".
|
|
72291
|
+
* Nothing in this codebase may read an absent `durationMs` as an open
|
|
72292
|
+
* episode; only `null` means open.
|
|
72293
|
+
*/
|
|
72294
|
+
durationMs: number().nullable().optional(),
|
|
72295
|
+
/**
|
|
72296
|
+
* Ms offsets from `timestamp` (the episode's own first rising edge, so the
|
|
72297
|
+
* first entry is always `0`) of every genuine off→on transition the
|
|
72298
|
+
* episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
|
|
72299
|
+
* push: a firmware source that keepalives at ~1 Hz for the whole burst
|
|
72300
|
+
* (Reolink, Hikvision) produces exactly one edge; a source that reports an
|
|
72301
|
+
* explicit `false` mid-episode and then resumes before the quiet window
|
|
72302
|
+
* elapses produces another. Stored compactly — see `motion-edge-codec.ts`
|
|
72303
|
+
* — and decoded back to this shape on read. Absent/empty on a legacy row,
|
|
72304
|
+
* which must never be read as "no episode happened here".
|
|
72305
|
+
*/
|
|
72306
|
+
edges: array(number()).readonly().optional()
|
|
72232
72307
|
});
|
|
72233
72308
|
/**
|
|
72234
72309
|
* Which detection SOURCE produced an object event. `pipeline` = the ML
|
|
@@ -72283,6 +72358,23 @@ var ObjectEventSchema = object({
|
|
|
72283
72358
|
* includes it (it is light). Absent on rows written before this field.
|
|
72284
72359
|
*/
|
|
72285
72360
|
frameId: string().optional(),
|
|
72361
|
+
/**
|
|
72362
|
+
* A PRODUCER-chosen key that makes a synthetic event's emission idempotent
|
|
72363
|
+
* (D474).
|
|
72364
|
+
*
|
|
72365
|
+
* Only the package detector writes it, and it exists because the event id
|
|
72366
|
+
* stopped being choosable: the delivery and pick-up rows used to BE their
|
|
72367
|
+
* dedupe key (`pa-pkg-<entryId>-delivered`), which is how "never emit a
|
|
72368
|
+
* second delivery for this entry" survived a restart. An `INTEGER` rowid is
|
|
72369
|
+
* assigned by SQLite, so that key had to move off the primary key rather
|
|
72370
|
+
* than be dropped — a detector that cannot recognise its own row re-delivers
|
|
72371
|
+
* every parcel on every boot.
|
|
72372
|
+
*
|
|
72373
|
+
* Absent on every other object event, and on every row written before this
|
|
72374
|
+
* field. Never a substitute for `id`: it is unique per (producer, occasion),
|
|
72375
|
+
* not per row, and nothing addresses a row by it.
|
|
72376
|
+
*/
|
|
72377
|
+
idempotencyKey: string().optional(),
|
|
72286
72378
|
/** Omitted in slim projection. */
|
|
72287
72379
|
trackId: string().optional(),
|
|
72288
72380
|
className: string(),
|
|
@@ -80557,26 +80649,59 @@ authKey: string().optional() }), object({
|
|
|
80557
80649
|
/** Human-readable error when `ok: false`. */
|
|
80558
80650
|
error: string().optional()
|
|
80559
80651
|
}), { kind: "mutation" });
|
|
80560
|
-
/**
|
|
80561
|
-
* Hardware / firmware motion sensor cap — binary detected state plus
|
|
80562
|
-
* a timestamp of the last observation. Distinct from
|
|
80563
|
-
* `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
|
|
80564
|
-
* `motion` is the lightweight readout from on-camera motion (Reolink
|
|
80565
|
-
* `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
|
|
80566
|
-
*
|
|
80567
|
-
* Native-motion providers also fan out to `detection.camera-native`
|
|
80568
|
-
* with `source: 'onboard'` so cross-cutting system services
|
|
80569
|
-
* (alert-center, advanced-notifier) can subscribe once and receive
|
|
80570
|
-
* motion from every camera.
|
|
80571
|
-
*/
|
|
80572
80652
|
var MotionStatusSchema = object({
|
|
80573
80653
|
detected: boolean(),
|
|
80574
80654
|
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
80575
80655
|
lastDetectedAt: number().nullable(),
|
|
80576
80656
|
/**
|
|
80577
|
-
*
|
|
80578
|
-
*
|
|
80579
|
-
*
|
|
80657
|
+
* `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
|
|
80658
|
+
* `null` while false and on every `Sensor` device (D475) — see that
|
|
80659
|
+
* constant's doc for the one-authority rule.
|
|
80660
|
+
*
|
|
80661
|
+
* ## Reading this field still arms nothing
|
|
80662
|
+
*
|
|
80663
|
+
* It reads like an instruction to the consumer ("revert after N ms if
|
|
80664
|
+
* no fresh push arrives") and it is not one: nothing in this repo reads
|
|
80665
|
+
* the LIVE cap value to drive a timer. `pipeline-analytics`'s motion-episode
|
|
80666
|
+
* close DOES now use the same number — `MOTION_CLOSE_AFTER_MS` — but as an
|
|
80667
|
+
* imported constant, not as a read of `device.state.motion.value`, so this
|
|
80668
|
+
* field stays what it always was: DESCRIPTIVE output, mirroring an answer
|
|
80669
|
+
* computed elsewhere. Building a self-clear timer out of a READ of this
|
|
80670
|
+
* field would add a second falling-edge authority beside whichever one
|
|
80671
|
+
* already owns the device, and two that can disagree are worse than one.
|
|
80672
|
+
* Consumers that need a falling edge SHAPED differently — held open across
|
|
80673
|
+
* a flapping source — debounce on their own side and say so, as
|
|
80674
|
+
* `addon-export-alexa/src/motion-clear-hold.ts` and
|
|
80675
|
+
* `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
|
|
80676
|
+
*
|
|
80677
|
+
* ## Who writes it
|
|
80678
|
+
*
|
|
80679
|
+
* - **Cameras** — the runner's phase machine, `active → watching` on
|
|
80680
|
+
* `cooldown_expired`, which then writes this slice with
|
|
80681
|
+
* `detected: false` (`handlePhaseChanged` in
|
|
80682
|
+
* `pipeline-runner/index.ts`). It produces the FALLING edge, which
|
|
80683
|
+
* matters most for the sources that only ever push a rising one:
|
|
80684
|
+
* Reolink emits `MotionOnMotionChanged { detected: true }` and never
|
|
80685
|
+
* a false.
|
|
80686
|
+
* - **Sensors** (Home Assistant binary sensors, Homematic) — the
|
|
80687
|
+
* provider pushes the false itself, from the upstream system's own
|
|
80688
|
+
* state change. No phase machine is involved.
|
|
80689
|
+
*
|
|
80690
|
+
* ### The phase machine is CANONICAL, not sole — and that is a defect
|
|
80691
|
+
*
|
|
80692
|
+
* An earlier revision of this docblock (mine, 2026-09-12) claimed the
|
|
80693
|
+
* phase machine is the sole writer for a camera. It is not.
|
|
80694
|
+
* `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
|
|
80695
|
+
* `setCapSlice(motionCapability, …)` on their own rising edge, and
|
|
80696
|
+
* Hikvision's comment says why: it read THIS docblock, agreed the
|
|
80697
|
+
* runner is canonical, and wrote anyway to avoid per-tick churn. So
|
|
80698
|
+
* two authorities can disagree about one slice, which this repo
|
|
80699
|
+
* forbids, and the doc said otherwise — which is worse than saying
|
|
80700
|
+
* nothing, because it reads as verification.
|
|
80701
|
+
*
|
|
80702
|
+
* This predates D475 and is not fixed there: the fix touches every
|
|
80703
|
+
* camera provider. Recorded in D475's Consequences. Do not restore the
|
|
80704
|
+
* "sole writer" wording without also removing the other writers.
|
|
80580
80705
|
*/
|
|
80581
80706
|
autoClearAfterMs: number().nullable()
|
|
80582
80707
|
});
|
|
@@ -80646,7 +80771,11 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
|
|
|
80646
80771
|
*/
|
|
80647
80772
|
runtimeState: MotionStatusSchema,
|
|
80648
80773
|
/**
|
|
80649
|
-
* Runtime-state durability: **session** —
|
|
80774
|
+
* Runtime-state durability: **session** — every writer of this slice
|
|
80775
|
+
* writes only on an EDGE, so a restored `detected: true` would stay
|
|
80776
|
+
* frozen until the next one instead of being corrected. The next edge
|
|
80777
|
+
* re-publishes the real state. (On who the writers are, and why there
|
|
80778
|
+
* is more than one, see `autoClearAfterMs` above.)
|
|
80650
80779
|
*
|
|
80651
80780
|
* See `RuntimeStateDurability`. Enforced by
|
|
80652
80781
|
* `scripts/check-runtime-state-durability.ts`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-provider-dreame",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.100",
|
|
4
4
|
"description": "Dreame robot-vacuum / lawn-mower device-provider addon for CamStack — wraps the @apocaliss92/nodedreame Dreamehome cloud client",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|