@camstack/addon-provider-dreame 0.2.97 → 0.2.99
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 +182 -24
- package/dist/addon.mjs +182 -24
- 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(),
|
|
@@ -73388,6 +73480,14 @@ var NativeCropResultSchema = object({
|
|
|
73388
73480
|
* set `encodeJpeg: true`; `bytes` is then absent.
|
|
73389
73481
|
*/
|
|
73390
73482
|
jpeg: string().optional(),
|
|
73483
|
+
/**
|
|
73484
|
+
* The SAME compressed JPEG as `jpeg`, as bytes (D462). Present instead of
|
|
73485
|
+
* `jpeg` when the request set `acceptJpegBytes`; a request that did not gets
|
|
73486
|
+
* `jpeg` exactly as before. MsgPack and the mesh leg both carry binary —
|
|
73487
|
+
* `bytes` above has crossed this boundary as a `Uint8Array` all along — so
|
|
73488
|
+
* base64 was buying nothing but a multi-megabyte string in the relay's heap.
|
|
73489
|
+
*/
|
|
73490
|
+
jpegBytes: _instanceof(Uint8Array).optional(),
|
|
73391
73491
|
width: number().int().positive(),
|
|
73392
73492
|
height: number().int().positive(),
|
|
73393
73493
|
/**
|
|
@@ -73454,7 +73554,14 @@ var ParkTrackFrameResultSchema = discriminatedUnion("parked", [object({
|
|
|
73454
73554
|
})]);
|
|
73455
73555
|
/** A retrieved parcel — the runner's own JPEG, base64 for the wire. */
|
|
73456
73556
|
var ParkedTrackFrameSchema = object({
|
|
73457
|
-
|
|
73557
|
+
/**
|
|
73558
|
+
* Base64 JPEG — the pre-D462 wire. OPTIONAL since D462: a request that set
|
|
73559
|
+
* `acceptJpegBytes` is answered in `jpegBytes` and this is then absent.
|
|
73560
|
+
* Exactly one of the two is present.
|
|
73561
|
+
*/
|
|
73562
|
+
jpeg: string().optional(),
|
|
73563
|
+
/** The same JPEG as bytes, for a caller that declared it reads them (D462). */
|
|
73564
|
+
jpegBytes: _instanceof(Uint8Array).optional(),
|
|
73458
73565
|
width: number().int().positive(),
|
|
73459
73566
|
height: number().int().positive(),
|
|
73460
73567
|
/** The frame instant the parcel shows (the caller's clock, echoed back). */
|
|
@@ -74041,6 +74148,13 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
74041
74148
|
bbox: NativeCropBboxSchema,
|
|
74042
74149
|
maxWidth: number().int().positive().optional(),
|
|
74043
74150
|
/**
|
|
74151
|
+
* The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
|
|
74152
|
+
* back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
|
|
74153
|
+
* wire — never assume consent: a pre-D462 caller parses the field as
|
|
74154
|
+
* base64 and bytes would decode to garbage rather than fail.
|
|
74155
|
+
*/
|
|
74156
|
+
acceptJpegBytes: boolean().optional(),
|
|
74157
|
+
/**
|
|
74044
74158
|
* When `true`, the runner encodes the resolved crop to JPEG ON THE
|
|
74045
74159
|
* OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
|
|
74046
74160
|
* Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
|
|
@@ -74108,7 +74222,14 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
74108
74222
|
}), ParkTrackFrameResultSchema, { kind: "mutation" }), method(object({
|
|
74109
74223
|
deviceId: number(),
|
|
74110
74224
|
trackId: string(),
|
|
74111
|
-
kind: ParkedFrameKindSchema
|
|
74225
|
+
kind: ParkedFrameKindSchema,
|
|
74226
|
+
/**
|
|
74227
|
+
* The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
|
|
74228
|
+
* back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
|
|
74229
|
+
* wire — never assume consent: a pre-D462 caller parses the field as
|
|
74230
|
+
* base64 and bytes would decode to garbage rather than fail.
|
|
74231
|
+
*/
|
|
74232
|
+
acceptJpegBytes: boolean().optional()
|
|
74112
74233
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
74113
74234
|
deviceId: number(),
|
|
74114
74235
|
trackId: string()
|
|
@@ -80531,26 +80652,59 @@ authKey: string().optional() }), object({
|
|
|
80531
80652
|
/** Human-readable error when `ok: false`. */
|
|
80532
80653
|
error: string().optional()
|
|
80533
80654
|
}), { kind: "mutation" });
|
|
80534
|
-
/**
|
|
80535
|
-
* Hardware / firmware motion sensor cap — binary detected state plus
|
|
80536
|
-
* a timestamp of the last observation. Distinct from
|
|
80537
|
-
* `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
|
|
80538
|
-
* `motion` is the lightweight readout from on-camera motion (Reolink
|
|
80539
|
-
* `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
|
|
80540
|
-
*
|
|
80541
|
-
* Native-motion providers also fan out to `detection.camera-native`
|
|
80542
|
-
* with `source: 'onboard'` so cross-cutting system services
|
|
80543
|
-
* (alert-center, advanced-notifier) can subscribe once and receive
|
|
80544
|
-
* motion from every camera.
|
|
80545
|
-
*/
|
|
80546
80655
|
var MotionStatusSchema = object({
|
|
80547
80656
|
detected: boolean(),
|
|
80548
80657
|
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
80549
80658
|
lastDetectedAt: number().nullable(),
|
|
80550
80659
|
/**
|
|
80551
|
-
*
|
|
80552
|
-
*
|
|
80553
|
-
*
|
|
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.
|
|
80554
80708
|
*/
|
|
80555
80709
|
autoClearAfterMs: number().nullable()
|
|
80556
80710
|
});
|
|
@@ -80620,7 +80774,11 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
|
|
|
80620
80774
|
*/
|
|
80621
80775
|
runtimeState: MotionStatusSchema,
|
|
80622
80776
|
/**
|
|
80623
|
-
* 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.)
|
|
80624
80782
|
*
|
|
80625
80783
|
* See `RuntimeStateDurability`. Enforced by
|
|
80626
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(),
|
|
@@ -73385,6 +73477,14 @@ var NativeCropResultSchema = object({
|
|
|
73385
73477
|
* set `encodeJpeg: true`; `bytes` is then absent.
|
|
73386
73478
|
*/
|
|
73387
73479
|
jpeg: string().optional(),
|
|
73480
|
+
/**
|
|
73481
|
+
* The SAME compressed JPEG as `jpeg`, as bytes (D462). Present instead of
|
|
73482
|
+
* `jpeg` when the request set `acceptJpegBytes`; a request that did not gets
|
|
73483
|
+
* `jpeg` exactly as before. MsgPack and the mesh leg both carry binary —
|
|
73484
|
+
* `bytes` above has crossed this boundary as a `Uint8Array` all along — so
|
|
73485
|
+
* base64 was buying nothing but a multi-megabyte string in the relay's heap.
|
|
73486
|
+
*/
|
|
73487
|
+
jpegBytes: _instanceof(Uint8Array).optional(),
|
|
73388
73488
|
width: number().int().positive(),
|
|
73389
73489
|
height: number().int().positive(),
|
|
73390
73490
|
/**
|
|
@@ -73451,7 +73551,14 @@ var ParkTrackFrameResultSchema = discriminatedUnion("parked", [object({
|
|
|
73451
73551
|
})]);
|
|
73452
73552
|
/** A retrieved parcel — the runner's own JPEG, base64 for the wire. */
|
|
73453
73553
|
var ParkedTrackFrameSchema = object({
|
|
73454
|
-
|
|
73554
|
+
/**
|
|
73555
|
+
* Base64 JPEG — the pre-D462 wire. OPTIONAL since D462: a request that set
|
|
73556
|
+
* `acceptJpegBytes` is answered in `jpegBytes` and this is then absent.
|
|
73557
|
+
* Exactly one of the two is present.
|
|
73558
|
+
*/
|
|
73559
|
+
jpeg: string().optional(),
|
|
73560
|
+
/** The same JPEG as bytes, for a caller that declared it reads them (D462). */
|
|
73561
|
+
jpegBytes: _instanceof(Uint8Array).optional(),
|
|
73455
73562
|
width: number().int().positive(),
|
|
73456
73563
|
height: number().int().positive(),
|
|
73457
73564
|
/** The frame instant the parcel shows (the caller's clock, echoed back). */
|
|
@@ -74038,6 +74145,13 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
74038
74145
|
bbox: NativeCropBboxSchema,
|
|
74039
74146
|
maxWidth: number().int().positive().optional(),
|
|
74040
74147
|
/**
|
|
74148
|
+
* The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
|
|
74149
|
+
* back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
|
|
74150
|
+
* wire — never assume consent: a pre-D462 caller parses the field as
|
|
74151
|
+
* base64 and bytes would decode to garbage rather than fail.
|
|
74152
|
+
*/
|
|
74153
|
+
acceptJpegBytes: boolean().optional(),
|
|
74154
|
+
/**
|
|
74041
74155
|
* When `true`, the runner encodes the resolved crop to JPEG ON THE
|
|
74042
74156
|
* OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
|
|
74043
74157
|
* Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
|
|
@@ -74105,7 +74219,14 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
74105
74219
|
}), ParkTrackFrameResultSchema, { kind: "mutation" }), method(object({
|
|
74106
74220
|
deviceId: number(),
|
|
74107
74221
|
trackId: string(),
|
|
74108
|
-
kind: ParkedFrameKindSchema
|
|
74222
|
+
kind: ParkedFrameKindSchema,
|
|
74223
|
+
/**
|
|
74224
|
+
* The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
|
|
74225
|
+
* back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
|
|
74226
|
+
* wire — never assume consent: a pre-D462 caller parses the field as
|
|
74227
|
+
* base64 and bytes would decode to garbage rather than fail.
|
|
74228
|
+
*/
|
|
74229
|
+
acceptJpegBytes: boolean().optional()
|
|
74109
74230
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
74110
74231
|
deviceId: number(),
|
|
74111
74232
|
trackId: string()
|
|
@@ -80528,26 +80649,59 @@ authKey: string().optional() }), object({
|
|
|
80528
80649
|
/** Human-readable error when `ok: false`. */
|
|
80529
80650
|
error: string().optional()
|
|
80530
80651
|
}), { kind: "mutation" });
|
|
80531
|
-
/**
|
|
80532
|
-
* Hardware / firmware motion sensor cap — binary detected state plus
|
|
80533
|
-
* a timestamp of the last observation. Distinct from
|
|
80534
|
-
* `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
|
|
80535
|
-
* `motion` is the lightweight readout from on-camera motion (Reolink
|
|
80536
|
-
* `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
|
|
80537
|
-
*
|
|
80538
|
-
* Native-motion providers also fan out to `detection.camera-native`
|
|
80539
|
-
* with `source: 'onboard'` so cross-cutting system services
|
|
80540
|
-
* (alert-center, advanced-notifier) can subscribe once and receive
|
|
80541
|
-
* motion from every camera.
|
|
80542
|
-
*/
|
|
80543
80652
|
var MotionStatusSchema = object({
|
|
80544
80653
|
detected: boolean(),
|
|
80545
80654
|
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
80546
80655
|
lastDetectedAt: number().nullable(),
|
|
80547
80656
|
/**
|
|
80548
|
-
*
|
|
80549
|
-
*
|
|
80550
|
-
*
|
|
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.
|
|
80551
80705
|
*/
|
|
80552
80706
|
autoClearAfterMs: number().nullable()
|
|
80553
80707
|
});
|
|
@@ -80617,7 +80771,11 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
|
|
|
80617
80771
|
*/
|
|
80618
80772
|
runtimeState: MotionStatusSchema,
|
|
80619
80773
|
/**
|
|
80620
|
-
* 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.)
|
|
80621
80779
|
*
|
|
80622
80780
|
* See `RuntimeStateDurability`. Enforced by
|
|
80623
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.99",
|
|
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",
|