@camstack/addon-provider-tuya 0.2.96 → 0.2.98
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
|
@@ -8123,6 +8123,23 @@ function errMsg(err) {
|
|
|
8123
8123
|
if (typeof err === "string") return err;
|
|
8124
8124
|
return String(err);
|
|
8125
8125
|
}
|
|
8126
|
+
new Set([
|
|
8127
|
+
"track",
|
|
8128
|
+
"summary",
|
|
8129
|
+
"face",
|
|
8130
|
+
"identity",
|
|
8131
|
+
"plate",
|
|
8132
|
+
"vehicle",
|
|
8133
|
+
"scene",
|
|
8134
|
+
"motion",
|
|
8135
|
+
"object",
|
|
8136
|
+
"audio"
|
|
8137
|
+
]);
|
|
8138
|
+
new Set([
|
|
8139
|
+
"motion",
|
|
8140
|
+
"object",
|
|
8141
|
+
"audio"
|
|
8142
|
+
]);
|
|
8126
8143
|
var EncodeProfileSchema = object({
|
|
8127
8144
|
video: object({
|
|
8128
8145
|
codec: _enum([
|
|
@@ -13323,8 +13340,17 @@ method(object({
|
|
|
13323
13340
|
}), array(SettingsRecordSchema).readonly()), method(object({
|
|
13324
13341
|
namespace: string().optional(),
|
|
13325
13342
|
collection: string(),
|
|
13326
|
-
record:
|
|
13327
|
-
|
|
13343
|
+
record: object({
|
|
13344
|
+
id: string().optional(),
|
|
13345
|
+
data: record(string(), unknown())
|
|
13346
|
+
})
|
|
13347
|
+
}), object({
|
|
13348
|
+
/**
|
|
13349
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
13350
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
13351
|
+
* primary key — which is the only place an auto key is knowable.
|
|
13352
|
+
*/
|
|
13353
|
+
id: union([string(), number()]) }), { kind: "mutation" }), method(object({
|
|
13328
13354
|
namespace: string().optional(),
|
|
13329
13355
|
collection: string(),
|
|
13330
13356
|
records: array(BulkRecordSchema).readonly()
|
|
@@ -13433,8 +13459,17 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
|
|
|
13433
13459
|
}), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
|
|
13434
13460
|
namespace: string().optional(),
|
|
13435
13461
|
collection: string(),
|
|
13436
|
-
record:
|
|
13437
|
-
|
|
13462
|
+
record: object({
|
|
13463
|
+
id: string().optional(),
|
|
13464
|
+
data: record(string(), unknown())
|
|
13465
|
+
})
|
|
13466
|
+
}), object({
|
|
13467
|
+
/**
|
|
13468
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
13469
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
13470
|
+
* primary key — which is the only place an auto key is knowable.
|
|
13471
|
+
*/
|
|
13472
|
+
id: union([string(), number()]) }), {
|
|
13438
13473
|
kind: "mutation",
|
|
13439
13474
|
auth: "admin"
|
|
13440
13475
|
}), method(object({
|
|
@@ -20359,7 +20394,20 @@ var TrackSchema = object({
|
|
|
20359
20394
|
...TrackRetrainFields
|
|
20360
20395
|
});
|
|
20361
20396
|
var BaseEventFields = {
|
|
20362
|
-
|
|
20397
|
+
/**
|
|
20398
|
+
* A SQLite ROWID, assigned by the database (D474).
|
|
20399
|
+
*
|
|
20400
|
+
* Was a 36-character UUID and cost 263 MB of a 1 117 MB database — paid
|
|
20401
|
+
* TWICE per row, in the row and in the primary-key index, across 2.1 million
|
|
20402
|
+
* motion, audio and object events. An `INTEGER PRIMARY KEY` in SQLite **is**
|
|
20403
|
+
* the rowid: the table itself is that B-tree, so the index stops existing
|
|
20404
|
+
* rather than getting smaller. No shorter string does that.
|
|
20405
|
+
*
|
|
20406
|
+
* Defined once here for all three event kinds, which is why they move
|
|
20407
|
+
* together: a per-table migration would have forked this and
|
|
20408
|
+
* `COMMON_BASE_COLUMNS` and reunited them two stages later.
|
|
20409
|
+
*/
|
|
20410
|
+
id: number().int(),
|
|
20363
20411
|
deviceId: number(),
|
|
20364
20412
|
timestamp: number()
|
|
20365
20413
|
};
|
|
@@ -20378,7 +20426,34 @@ var MotionEventSchema = object({
|
|
|
20378
20426
|
/** Omitted in slim projection. */
|
|
20379
20427
|
frameHeight: number().optional(),
|
|
20380
20428
|
/** Populated by B5 (recording playback URL for this event). */
|
|
20381
|
-
mediaUrl: string().optional()
|
|
20429
|
+
mediaUrl: string().optional(),
|
|
20430
|
+
/**
|
|
20431
|
+
* One row per motion EPISODE, not one per push (D475). `null` while the
|
|
20432
|
+
* episode is still open — a further rising edge extends it in place rather
|
|
20433
|
+
* than inserting a new row. Set once, at close, to `lastOnAt - startedAt`
|
|
20434
|
+
* (the span from the first rising edge to the LAST one, deliberately NOT
|
|
20435
|
+
* `closedAt - startedAt` — the close delay is a quiet CONFIRMATION, not
|
|
20436
|
+
* movement, and folding it in would report `MOTION_CLOSE_AFTER_MS` of
|
|
20437
|
+
* motion for an instantaneous trigger).
|
|
20438
|
+
*
|
|
20439
|
+
* **Absent** (not merely `null`) on a row written before D475 — that means
|
|
20440
|
+
* "closed the old way, before this column existed", never "still open".
|
|
20441
|
+
* Nothing in this codebase may read an absent `durationMs` as an open
|
|
20442
|
+
* episode; only `null` means open.
|
|
20443
|
+
*/
|
|
20444
|
+
durationMs: number().nullable().optional(),
|
|
20445
|
+
/**
|
|
20446
|
+
* Ms offsets from `timestamp` (the episode's own first rising edge, so the
|
|
20447
|
+
* first entry is always `0`) of every genuine off→on transition the
|
|
20448
|
+
* episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
|
|
20449
|
+
* push: a firmware source that keepalives at ~1 Hz for the whole burst
|
|
20450
|
+
* (Reolink, Hikvision) produces exactly one edge; a source that reports an
|
|
20451
|
+
* explicit `false` mid-episode and then resumes before the quiet window
|
|
20452
|
+
* elapses produces another. Stored compactly — see `motion-edge-codec.ts`
|
|
20453
|
+
* — and decoded back to this shape on read. Absent/empty on a legacy row,
|
|
20454
|
+
* which must never be read as "no episode happened here".
|
|
20455
|
+
*/
|
|
20456
|
+
edges: array(number()).readonly().optional()
|
|
20382
20457
|
});
|
|
20383
20458
|
/**
|
|
20384
20459
|
* Which detection SOURCE produced an object event. `pipeline` = the ML
|
|
@@ -20433,6 +20508,23 @@ var ObjectEventSchema = object({
|
|
|
20433
20508
|
* includes it (it is light). Absent on rows written before this field.
|
|
20434
20509
|
*/
|
|
20435
20510
|
frameId: string().optional(),
|
|
20511
|
+
/**
|
|
20512
|
+
* A PRODUCER-chosen key that makes a synthetic event's emission idempotent
|
|
20513
|
+
* (D474).
|
|
20514
|
+
*
|
|
20515
|
+
* Only the package detector writes it, and it exists because the event id
|
|
20516
|
+
* stopped being choosable: the delivery and pick-up rows used to BE their
|
|
20517
|
+
* dedupe key (`pa-pkg-<entryId>-delivered`), which is how "never emit a
|
|
20518
|
+
* second delivery for this entry" survived a restart. An `INTEGER` rowid is
|
|
20519
|
+
* assigned by SQLite, so that key had to move off the primary key rather
|
|
20520
|
+
* than be dropped — a detector that cannot recognise its own row re-delivers
|
|
20521
|
+
* every parcel on every boot.
|
|
20522
|
+
*
|
|
20523
|
+
* Absent on every other object event, and on every row written before this
|
|
20524
|
+
* field. Never a substitute for `id`: it is unique per (producer, occasion),
|
|
20525
|
+
* not per row, and nothing addresses a row by it.
|
|
20526
|
+
*/
|
|
20527
|
+
idempotencyKey: string().optional(),
|
|
20436
20528
|
/** Omitted in slim projection. */
|
|
20437
20529
|
trackId: string().optional(),
|
|
20438
20530
|
className: string(),
|
|
@@ -21535,6 +21627,14 @@ var NativeCropResultSchema = object({
|
|
|
21535
21627
|
* set `encodeJpeg: true`; `bytes` is then absent.
|
|
21536
21628
|
*/
|
|
21537
21629
|
jpeg: string().optional(),
|
|
21630
|
+
/**
|
|
21631
|
+
* The SAME compressed JPEG as `jpeg`, as bytes (D462). Present instead of
|
|
21632
|
+
* `jpeg` when the request set `acceptJpegBytes`; a request that did not gets
|
|
21633
|
+
* `jpeg` exactly as before. MsgPack and the mesh leg both carry binary —
|
|
21634
|
+
* `bytes` above has crossed this boundary as a `Uint8Array` all along — so
|
|
21635
|
+
* base64 was buying nothing but a multi-megabyte string in the relay's heap.
|
|
21636
|
+
*/
|
|
21637
|
+
jpegBytes: _instanceof(Uint8Array).optional(),
|
|
21538
21638
|
width: number().int().positive(),
|
|
21539
21639
|
height: number().int().positive(),
|
|
21540
21640
|
/**
|
|
@@ -21601,7 +21701,14 @@ var ParkTrackFrameResultSchema = discriminatedUnion("parked", [object({
|
|
|
21601
21701
|
})]);
|
|
21602
21702
|
/** A retrieved parcel — the runner's own JPEG, base64 for the wire. */
|
|
21603
21703
|
var ParkedTrackFrameSchema = object({
|
|
21604
|
-
|
|
21704
|
+
/**
|
|
21705
|
+
* Base64 JPEG — the pre-D462 wire. OPTIONAL since D462: a request that set
|
|
21706
|
+
* `acceptJpegBytes` is answered in `jpegBytes` and this is then absent.
|
|
21707
|
+
* Exactly one of the two is present.
|
|
21708
|
+
*/
|
|
21709
|
+
jpeg: string().optional(),
|
|
21710
|
+
/** The same JPEG as bytes, for a caller that declared it reads them (D462). */
|
|
21711
|
+
jpegBytes: _instanceof(Uint8Array).optional(),
|
|
21605
21712
|
width: number().int().positive(),
|
|
21606
21713
|
height: number().int().positive(),
|
|
21607
21714
|
/** The frame instant the parcel shows (the caller's clock, echoed back). */
|
|
@@ -22188,6 +22295,13 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
22188
22295
|
bbox: NativeCropBboxSchema,
|
|
22189
22296
|
maxWidth: number().int().positive().optional(),
|
|
22190
22297
|
/**
|
|
22298
|
+
* The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
|
|
22299
|
+
* back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
|
|
22300
|
+
* wire — never assume consent: a pre-D462 caller parses the field as
|
|
22301
|
+
* base64 and bytes would decode to garbage rather than fail.
|
|
22302
|
+
*/
|
|
22303
|
+
acceptJpegBytes: boolean().optional(),
|
|
22304
|
+
/**
|
|
22191
22305
|
* When `true`, the runner encodes the resolved crop to JPEG ON THE
|
|
22192
22306
|
* OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
|
|
22193
22307
|
* Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
|
|
@@ -22255,7 +22369,14 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
22255
22369
|
}), ParkTrackFrameResultSchema, { kind: "mutation" }), method(object({
|
|
22256
22370
|
deviceId: number(),
|
|
22257
22371
|
trackId: string(),
|
|
22258
|
-
kind: ParkedFrameKindSchema
|
|
22372
|
+
kind: ParkedFrameKindSchema,
|
|
22373
|
+
/**
|
|
22374
|
+
* The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
|
|
22375
|
+
* back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
|
|
22376
|
+
* wire — never assume consent: a pre-D462 caller parses the field as
|
|
22377
|
+
* base64 and bytes would decode to garbage rather than fail.
|
|
22378
|
+
*/
|
|
22379
|
+
acceptJpegBytes: boolean().optional()
|
|
22259
22380
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
22260
22381
|
deviceId: number(),
|
|
22261
22382
|
trackId: string()
|
|
@@ -28661,26 +28782,59 @@ authKey: string().optional() }), object({
|
|
|
28661
28782
|
/** Human-readable error when `ok: false`. */
|
|
28662
28783
|
error: string().optional()
|
|
28663
28784
|
}), { kind: "mutation" });
|
|
28664
|
-
/**
|
|
28665
|
-
* Hardware / firmware motion sensor cap — binary detected state plus
|
|
28666
|
-
* a timestamp of the last observation. Distinct from
|
|
28667
|
-
* `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
|
|
28668
|
-
* `motion` is the lightweight readout from on-camera motion (Reolink
|
|
28669
|
-
* `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
|
|
28670
|
-
*
|
|
28671
|
-
* Native-motion providers also fan out to `detection.camera-native`
|
|
28672
|
-
* with `source: 'onboard'` so cross-cutting system services
|
|
28673
|
-
* (alert-center, advanced-notifier) can subscribe once and receive
|
|
28674
|
-
* motion from every camera.
|
|
28675
|
-
*/
|
|
28676
28785
|
var MotionStatusSchema = object({
|
|
28677
28786
|
detected: boolean(),
|
|
28678
28787
|
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
28679
28788
|
lastDetectedAt: number().nullable(),
|
|
28680
28789
|
/**
|
|
28681
|
-
*
|
|
28682
|
-
*
|
|
28683
|
-
*
|
|
28790
|
+
* `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
|
|
28791
|
+
* `null` while false and on every `Sensor` device (D475) — see that
|
|
28792
|
+
* constant's doc for the one-authority rule.
|
|
28793
|
+
*
|
|
28794
|
+
* ## Reading this field still arms nothing
|
|
28795
|
+
*
|
|
28796
|
+
* It reads like an instruction to the consumer ("revert after N ms if
|
|
28797
|
+
* no fresh push arrives") and it is not one: nothing in this repo reads
|
|
28798
|
+
* the LIVE cap value to drive a timer. `pipeline-analytics`'s motion-episode
|
|
28799
|
+
* close DOES now use the same number — `MOTION_CLOSE_AFTER_MS` — but as an
|
|
28800
|
+
* imported constant, not as a read of `device.state.motion.value`, so this
|
|
28801
|
+
* field stays what it always was: DESCRIPTIVE output, mirroring an answer
|
|
28802
|
+
* computed elsewhere. Building a self-clear timer out of a READ of this
|
|
28803
|
+
* field would add a second falling-edge authority beside whichever one
|
|
28804
|
+
* already owns the device, and two that can disagree are worse than one.
|
|
28805
|
+
* Consumers that need a falling edge SHAPED differently — held open across
|
|
28806
|
+
* a flapping source — debounce on their own side and say so, as
|
|
28807
|
+
* `addon-export-alexa/src/motion-clear-hold.ts` and
|
|
28808
|
+
* `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
|
|
28809
|
+
*
|
|
28810
|
+
* ## Who writes it
|
|
28811
|
+
*
|
|
28812
|
+
* - **Cameras** — the runner's phase machine, `active → watching` on
|
|
28813
|
+
* `cooldown_expired`, which then writes this slice with
|
|
28814
|
+
* `detected: false` (`handlePhaseChanged` in
|
|
28815
|
+
* `pipeline-runner/index.ts`). It produces the FALLING edge, which
|
|
28816
|
+
* matters most for the sources that only ever push a rising one:
|
|
28817
|
+
* Reolink emits `MotionOnMotionChanged { detected: true }` and never
|
|
28818
|
+
* a false.
|
|
28819
|
+
* - **Sensors** (Home Assistant binary sensors, Homematic) — the
|
|
28820
|
+
* provider pushes the false itself, from the upstream system's own
|
|
28821
|
+
* state change. No phase machine is involved.
|
|
28822
|
+
*
|
|
28823
|
+
* ### The phase machine is CANONICAL, not sole — and that is a defect
|
|
28824
|
+
*
|
|
28825
|
+
* An earlier revision of this docblock (mine, 2026-09-12) claimed the
|
|
28826
|
+
* phase machine is the sole writer for a camera. It is not.
|
|
28827
|
+
* `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
|
|
28828
|
+
* `setCapSlice(motionCapability, …)` on their own rising edge, and
|
|
28829
|
+
* Hikvision's comment says why: it read THIS docblock, agreed the
|
|
28830
|
+
* runner is canonical, and wrote anyway to avoid per-tick churn. So
|
|
28831
|
+
* two authorities can disagree about one slice, which this repo
|
|
28832
|
+
* forbids, and the doc said otherwise — which is worse than saying
|
|
28833
|
+
* nothing, because it reads as verification.
|
|
28834
|
+
*
|
|
28835
|
+
* This predates D475 and is not fixed there: the fix touches every
|
|
28836
|
+
* camera provider. Recorded in D475's Consequences. Do not restore the
|
|
28837
|
+
* "sole writer" wording without also removing the other writers.
|
|
28684
28838
|
*/
|
|
28685
28839
|
autoClearAfterMs: number().nullable()
|
|
28686
28840
|
});
|
|
@@ -28750,7 +28904,11 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
|
|
|
28750
28904
|
*/
|
|
28751
28905
|
runtimeState: MotionStatusSchema,
|
|
28752
28906
|
/**
|
|
28753
|
-
* Runtime-state durability: **session** —
|
|
28907
|
+
* Runtime-state durability: **session** — every writer of this slice
|
|
28908
|
+
* writes only on an EDGE, so a restored `detected: true` would stay
|
|
28909
|
+
* frozen until the next one instead of being corrected. The next edge
|
|
28910
|
+
* re-publishes the real state. (On who the writers are, and why there
|
|
28911
|
+
* is more than one, see `autoClearAfterMs` above.)
|
|
28754
28912
|
*
|
|
28755
28913
|
* See `RuntimeStateDurability`. Enforced by
|
|
28756
28914
|
* `scripts/check-runtime-state-durability.ts`.
|
package/dist/addon.mjs
CHANGED
|
@@ -8122,6 +8122,23 @@ function errMsg(err) {
|
|
|
8122
8122
|
if (typeof err === "string") return err;
|
|
8123
8123
|
return String(err);
|
|
8124
8124
|
}
|
|
8125
|
+
new Set([
|
|
8126
|
+
"track",
|
|
8127
|
+
"summary",
|
|
8128
|
+
"face",
|
|
8129
|
+
"identity",
|
|
8130
|
+
"plate",
|
|
8131
|
+
"vehicle",
|
|
8132
|
+
"scene",
|
|
8133
|
+
"motion",
|
|
8134
|
+
"object",
|
|
8135
|
+
"audio"
|
|
8136
|
+
]);
|
|
8137
|
+
new Set([
|
|
8138
|
+
"motion",
|
|
8139
|
+
"object",
|
|
8140
|
+
"audio"
|
|
8141
|
+
]);
|
|
8125
8142
|
var EncodeProfileSchema = object({
|
|
8126
8143
|
video: object({
|
|
8127
8144
|
codec: _enum([
|
|
@@ -13322,8 +13339,17 @@ method(object({
|
|
|
13322
13339
|
}), array(SettingsRecordSchema).readonly()), method(object({
|
|
13323
13340
|
namespace: string().optional(),
|
|
13324
13341
|
collection: string(),
|
|
13325
|
-
record:
|
|
13326
|
-
|
|
13342
|
+
record: object({
|
|
13343
|
+
id: string().optional(),
|
|
13344
|
+
data: record(string(), unknown())
|
|
13345
|
+
})
|
|
13346
|
+
}), object({
|
|
13347
|
+
/**
|
|
13348
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
13349
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
13350
|
+
* primary key — which is the only place an auto key is knowable.
|
|
13351
|
+
*/
|
|
13352
|
+
id: union([string(), number()]) }), { kind: "mutation" }), method(object({
|
|
13327
13353
|
namespace: string().optional(),
|
|
13328
13354
|
collection: string(),
|
|
13329
13355
|
records: array(BulkRecordSchema).readonly()
|
|
@@ -13432,8 +13458,17 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
|
|
|
13432
13458
|
}), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
|
|
13433
13459
|
namespace: string().optional(),
|
|
13434
13460
|
collection: string(),
|
|
13435
|
-
record:
|
|
13436
|
-
|
|
13461
|
+
record: object({
|
|
13462
|
+
id: string().optional(),
|
|
13463
|
+
data: record(string(), unknown())
|
|
13464
|
+
})
|
|
13465
|
+
}), object({
|
|
13466
|
+
/**
|
|
13467
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
13468
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
13469
|
+
* primary key — which is the only place an auto key is knowable.
|
|
13470
|
+
*/
|
|
13471
|
+
id: union([string(), number()]) }), {
|
|
13437
13472
|
kind: "mutation",
|
|
13438
13473
|
auth: "admin"
|
|
13439
13474
|
}), method(object({
|
|
@@ -20358,7 +20393,20 @@ var TrackSchema = object({
|
|
|
20358
20393
|
...TrackRetrainFields
|
|
20359
20394
|
});
|
|
20360
20395
|
var BaseEventFields = {
|
|
20361
|
-
|
|
20396
|
+
/**
|
|
20397
|
+
* A SQLite ROWID, assigned by the database (D474).
|
|
20398
|
+
*
|
|
20399
|
+
* Was a 36-character UUID and cost 263 MB of a 1 117 MB database — paid
|
|
20400
|
+
* TWICE per row, in the row and in the primary-key index, across 2.1 million
|
|
20401
|
+
* motion, audio and object events. An `INTEGER PRIMARY KEY` in SQLite **is**
|
|
20402
|
+
* the rowid: the table itself is that B-tree, so the index stops existing
|
|
20403
|
+
* rather than getting smaller. No shorter string does that.
|
|
20404
|
+
*
|
|
20405
|
+
* Defined once here for all three event kinds, which is why they move
|
|
20406
|
+
* together: a per-table migration would have forked this and
|
|
20407
|
+
* `COMMON_BASE_COLUMNS` and reunited them two stages later.
|
|
20408
|
+
*/
|
|
20409
|
+
id: number().int(),
|
|
20362
20410
|
deviceId: number(),
|
|
20363
20411
|
timestamp: number()
|
|
20364
20412
|
};
|
|
@@ -20377,7 +20425,34 @@ var MotionEventSchema = object({
|
|
|
20377
20425
|
/** Omitted in slim projection. */
|
|
20378
20426
|
frameHeight: number().optional(),
|
|
20379
20427
|
/** Populated by B5 (recording playback URL for this event). */
|
|
20380
|
-
mediaUrl: string().optional()
|
|
20428
|
+
mediaUrl: string().optional(),
|
|
20429
|
+
/**
|
|
20430
|
+
* One row per motion EPISODE, not one per push (D475). `null` while the
|
|
20431
|
+
* episode is still open — a further rising edge extends it in place rather
|
|
20432
|
+
* than inserting a new row. Set once, at close, to `lastOnAt - startedAt`
|
|
20433
|
+
* (the span from the first rising edge to the LAST one, deliberately NOT
|
|
20434
|
+
* `closedAt - startedAt` — the close delay is a quiet CONFIRMATION, not
|
|
20435
|
+
* movement, and folding it in would report `MOTION_CLOSE_AFTER_MS` of
|
|
20436
|
+
* motion for an instantaneous trigger).
|
|
20437
|
+
*
|
|
20438
|
+
* **Absent** (not merely `null`) on a row written before D475 — that means
|
|
20439
|
+
* "closed the old way, before this column existed", never "still open".
|
|
20440
|
+
* Nothing in this codebase may read an absent `durationMs` as an open
|
|
20441
|
+
* episode; only `null` means open.
|
|
20442
|
+
*/
|
|
20443
|
+
durationMs: number().nullable().optional(),
|
|
20444
|
+
/**
|
|
20445
|
+
* Ms offsets from `timestamp` (the episode's own first rising edge, so the
|
|
20446
|
+
* first entry is always `0`) of every genuine off→on transition the
|
|
20447
|
+
* episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
|
|
20448
|
+
* push: a firmware source that keepalives at ~1 Hz for the whole burst
|
|
20449
|
+
* (Reolink, Hikvision) produces exactly one edge; a source that reports an
|
|
20450
|
+
* explicit `false` mid-episode and then resumes before the quiet window
|
|
20451
|
+
* elapses produces another. Stored compactly — see `motion-edge-codec.ts`
|
|
20452
|
+
* — and decoded back to this shape on read. Absent/empty on a legacy row,
|
|
20453
|
+
* which must never be read as "no episode happened here".
|
|
20454
|
+
*/
|
|
20455
|
+
edges: array(number()).readonly().optional()
|
|
20381
20456
|
});
|
|
20382
20457
|
/**
|
|
20383
20458
|
* Which detection SOURCE produced an object event. `pipeline` = the ML
|
|
@@ -20432,6 +20507,23 @@ var ObjectEventSchema = object({
|
|
|
20432
20507
|
* includes it (it is light). Absent on rows written before this field.
|
|
20433
20508
|
*/
|
|
20434
20509
|
frameId: string().optional(),
|
|
20510
|
+
/**
|
|
20511
|
+
* A PRODUCER-chosen key that makes a synthetic event's emission idempotent
|
|
20512
|
+
* (D474).
|
|
20513
|
+
*
|
|
20514
|
+
* Only the package detector writes it, and it exists because the event id
|
|
20515
|
+
* stopped being choosable: the delivery and pick-up rows used to BE their
|
|
20516
|
+
* dedupe key (`pa-pkg-<entryId>-delivered`), which is how "never emit a
|
|
20517
|
+
* second delivery for this entry" survived a restart. An `INTEGER` rowid is
|
|
20518
|
+
* assigned by SQLite, so that key had to move off the primary key rather
|
|
20519
|
+
* than be dropped — a detector that cannot recognise its own row re-delivers
|
|
20520
|
+
* every parcel on every boot.
|
|
20521
|
+
*
|
|
20522
|
+
* Absent on every other object event, and on every row written before this
|
|
20523
|
+
* field. Never a substitute for `id`: it is unique per (producer, occasion),
|
|
20524
|
+
* not per row, and nothing addresses a row by it.
|
|
20525
|
+
*/
|
|
20526
|
+
idempotencyKey: string().optional(),
|
|
20435
20527
|
/** Omitted in slim projection. */
|
|
20436
20528
|
trackId: string().optional(),
|
|
20437
20529
|
className: string(),
|
|
@@ -21534,6 +21626,14 @@ var NativeCropResultSchema = object({
|
|
|
21534
21626
|
* set `encodeJpeg: true`; `bytes` is then absent.
|
|
21535
21627
|
*/
|
|
21536
21628
|
jpeg: string().optional(),
|
|
21629
|
+
/**
|
|
21630
|
+
* The SAME compressed JPEG as `jpeg`, as bytes (D462). Present instead of
|
|
21631
|
+
* `jpeg` when the request set `acceptJpegBytes`; a request that did not gets
|
|
21632
|
+
* `jpeg` exactly as before. MsgPack and the mesh leg both carry binary —
|
|
21633
|
+
* `bytes` above has crossed this boundary as a `Uint8Array` all along — so
|
|
21634
|
+
* base64 was buying nothing but a multi-megabyte string in the relay's heap.
|
|
21635
|
+
*/
|
|
21636
|
+
jpegBytes: _instanceof(Uint8Array).optional(),
|
|
21537
21637
|
width: number().int().positive(),
|
|
21538
21638
|
height: number().int().positive(),
|
|
21539
21639
|
/**
|
|
@@ -21600,7 +21700,14 @@ var ParkTrackFrameResultSchema = discriminatedUnion("parked", [object({
|
|
|
21600
21700
|
})]);
|
|
21601
21701
|
/** A retrieved parcel — the runner's own JPEG, base64 for the wire. */
|
|
21602
21702
|
var ParkedTrackFrameSchema = object({
|
|
21603
|
-
|
|
21703
|
+
/**
|
|
21704
|
+
* Base64 JPEG — the pre-D462 wire. OPTIONAL since D462: a request that set
|
|
21705
|
+
* `acceptJpegBytes` is answered in `jpegBytes` and this is then absent.
|
|
21706
|
+
* Exactly one of the two is present.
|
|
21707
|
+
*/
|
|
21708
|
+
jpeg: string().optional(),
|
|
21709
|
+
/** The same JPEG as bytes, for a caller that declared it reads them (D462). */
|
|
21710
|
+
jpegBytes: _instanceof(Uint8Array).optional(),
|
|
21604
21711
|
width: number().int().positive(),
|
|
21605
21712
|
height: number().int().positive(),
|
|
21606
21713
|
/** The frame instant the parcel shows (the caller's clock, echoed back). */
|
|
@@ -22187,6 +22294,13 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
22187
22294
|
bbox: NativeCropBboxSchema,
|
|
22188
22295
|
maxWidth: number().int().positive().optional(),
|
|
22189
22296
|
/**
|
|
22297
|
+
* The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
|
|
22298
|
+
* back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
|
|
22299
|
+
* wire — never assume consent: a pre-D462 caller parses the field as
|
|
22300
|
+
* base64 and bytes would decode to garbage rather than fail.
|
|
22301
|
+
*/
|
|
22302
|
+
acceptJpegBytes: boolean().optional(),
|
|
22303
|
+
/**
|
|
22190
22304
|
* When `true`, the runner encodes the resolved crop to JPEG ON THE
|
|
22191
22305
|
* OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
|
|
22192
22306
|
* Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
|
|
@@ -22254,7 +22368,14 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
22254
22368
|
}), ParkTrackFrameResultSchema, { kind: "mutation" }), method(object({
|
|
22255
22369
|
deviceId: number(),
|
|
22256
22370
|
trackId: string(),
|
|
22257
|
-
kind: ParkedFrameKindSchema
|
|
22371
|
+
kind: ParkedFrameKindSchema,
|
|
22372
|
+
/**
|
|
22373
|
+
* The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
|
|
22374
|
+
* back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
|
|
22375
|
+
* wire — never assume consent: a pre-D462 caller parses the field as
|
|
22376
|
+
* base64 and bytes would decode to garbage rather than fail.
|
|
22377
|
+
*/
|
|
22378
|
+
acceptJpegBytes: boolean().optional()
|
|
22258
22379
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
22259
22380
|
deviceId: number(),
|
|
22260
22381
|
trackId: string()
|
|
@@ -28660,26 +28781,59 @@ authKey: string().optional() }), object({
|
|
|
28660
28781
|
/** Human-readable error when `ok: false`. */
|
|
28661
28782
|
error: string().optional()
|
|
28662
28783
|
}), { kind: "mutation" });
|
|
28663
|
-
/**
|
|
28664
|
-
* Hardware / firmware motion sensor cap — binary detected state plus
|
|
28665
|
-
* a timestamp of the last observation. Distinct from
|
|
28666
|
-
* `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
|
|
28667
|
-
* `motion` is the lightweight readout from on-camera motion (Reolink
|
|
28668
|
-
* `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
|
|
28669
|
-
*
|
|
28670
|
-
* Native-motion providers also fan out to `detection.camera-native`
|
|
28671
|
-
* with `source: 'onboard'` so cross-cutting system services
|
|
28672
|
-
* (alert-center, advanced-notifier) can subscribe once and receive
|
|
28673
|
-
* motion from every camera.
|
|
28674
|
-
*/
|
|
28675
28784
|
var MotionStatusSchema = object({
|
|
28676
28785
|
detected: boolean(),
|
|
28677
28786
|
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
28678
28787
|
lastDetectedAt: number().nullable(),
|
|
28679
28788
|
/**
|
|
28680
|
-
*
|
|
28681
|
-
*
|
|
28682
|
-
*
|
|
28789
|
+
* `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
|
|
28790
|
+
* `null` while false and on every `Sensor` device (D475) — see that
|
|
28791
|
+
* constant's doc for the one-authority rule.
|
|
28792
|
+
*
|
|
28793
|
+
* ## Reading this field still arms nothing
|
|
28794
|
+
*
|
|
28795
|
+
* It reads like an instruction to the consumer ("revert after N ms if
|
|
28796
|
+
* no fresh push arrives") and it is not one: nothing in this repo reads
|
|
28797
|
+
* the LIVE cap value to drive a timer. `pipeline-analytics`'s motion-episode
|
|
28798
|
+
* close DOES now use the same number — `MOTION_CLOSE_AFTER_MS` — but as an
|
|
28799
|
+
* imported constant, not as a read of `device.state.motion.value`, so this
|
|
28800
|
+
* field stays what it always was: DESCRIPTIVE output, mirroring an answer
|
|
28801
|
+
* computed elsewhere. Building a self-clear timer out of a READ of this
|
|
28802
|
+
* field would add a second falling-edge authority beside whichever one
|
|
28803
|
+
* already owns the device, and two that can disagree are worse than one.
|
|
28804
|
+
* Consumers that need a falling edge SHAPED differently — held open across
|
|
28805
|
+
* a flapping source — debounce on their own side and say so, as
|
|
28806
|
+
* `addon-export-alexa/src/motion-clear-hold.ts` and
|
|
28807
|
+
* `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
|
|
28808
|
+
*
|
|
28809
|
+
* ## Who writes it
|
|
28810
|
+
*
|
|
28811
|
+
* - **Cameras** — the runner's phase machine, `active → watching` on
|
|
28812
|
+
* `cooldown_expired`, which then writes this slice with
|
|
28813
|
+
* `detected: false` (`handlePhaseChanged` in
|
|
28814
|
+
* `pipeline-runner/index.ts`). It produces the FALLING edge, which
|
|
28815
|
+
* matters most for the sources that only ever push a rising one:
|
|
28816
|
+
* Reolink emits `MotionOnMotionChanged { detected: true }` and never
|
|
28817
|
+
* a false.
|
|
28818
|
+
* - **Sensors** (Home Assistant binary sensors, Homematic) — the
|
|
28819
|
+
* provider pushes the false itself, from the upstream system's own
|
|
28820
|
+
* state change. No phase machine is involved.
|
|
28821
|
+
*
|
|
28822
|
+
* ### The phase machine is CANONICAL, not sole — and that is a defect
|
|
28823
|
+
*
|
|
28824
|
+
* An earlier revision of this docblock (mine, 2026-09-12) claimed the
|
|
28825
|
+
* phase machine is the sole writer for a camera. It is not.
|
|
28826
|
+
* `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
|
|
28827
|
+
* `setCapSlice(motionCapability, …)` on their own rising edge, and
|
|
28828
|
+
* Hikvision's comment says why: it read THIS docblock, agreed the
|
|
28829
|
+
* runner is canonical, and wrote anyway to avoid per-tick churn. So
|
|
28830
|
+
* two authorities can disagree about one slice, which this repo
|
|
28831
|
+
* forbids, and the doc said otherwise — which is worse than saying
|
|
28832
|
+
* nothing, because it reads as verification.
|
|
28833
|
+
*
|
|
28834
|
+
* This predates D475 and is not fixed there: the fix touches every
|
|
28835
|
+
* camera provider. Recorded in D475's Consequences. Do not restore the
|
|
28836
|
+
* "sole writer" wording without also removing the other writers.
|
|
28683
28837
|
*/
|
|
28684
28838
|
autoClearAfterMs: number().nullable()
|
|
28685
28839
|
});
|
|
@@ -28749,7 +28903,11 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
|
|
|
28749
28903
|
*/
|
|
28750
28904
|
runtimeState: MotionStatusSchema,
|
|
28751
28905
|
/**
|
|
28752
|
-
* Runtime-state durability: **session** —
|
|
28906
|
+
* Runtime-state durability: **session** — every writer of this slice
|
|
28907
|
+
* writes only on an EDGE, so a restored `detected: true` would stay
|
|
28908
|
+
* frozen until the next one instead of being corrected. The next edge
|
|
28909
|
+
* re-publishes the real state. (On who the writers are, and why there
|
|
28910
|
+
* is more than one, see `autoClearAfterMs` above.)
|
|
28753
28911
|
*
|
|
28754
28912
|
* See `RuntimeStateDurability`. Enforced by
|
|
28755
28913
|
* `scripts/check-runtime-state-durability.ts`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-provider-tuya",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.98",
|
|
4
4
|
"description": "Tuya / Smart Life device-provider addon for CamStack — account-onboarded (Tuya IoT cloud fetch of device localKeys) + LOCAL DP control via the @apocaliss92/nodetuya encrypted-LAN client, exposing switch / water-heater-family kettle entities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|