@camstack/addon-import-alexa 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 +151 -24
- package/dist/addon.mjs +151 -24
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -7342,8 +7342,23 @@ function errMsg(err) {
|
|
|
7342
7342
|
if (typeof err === "string") return err;
|
|
7343
7343
|
return String(err);
|
|
7344
7344
|
}
|
|
7345
|
-
|
|
7346
|
-
|
|
7345
|
+
new Set([
|
|
7346
|
+
"track",
|
|
7347
|
+
"summary",
|
|
7348
|
+
"face",
|
|
7349
|
+
"identity",
|
|
7350
|
+
"plate",
|
|
7351
|
+
"vehicle",
|
|
7352
|
+
"scene",
|
|
7353
|
+
"motion",
|
|
7354
|
+
"object",
|
|
7355
|
+
"audio"
|
|
7356
|
+
]);
|
|
7357
|
+
new Set([
|
|
7358
|
+
"motion",
|
|
7359
|
+
"object",
|
|
7360
|
+
"audio"
|
|
7361
|
+
]);
|
|
7347
7362
|
/**
|
|
7348
7363
|
* Build an `IAddonRouteProvider` from a list of routes. Implements
|
|
7349
7364
|
* both the operator-facing `getRoutes` (returning route descriptors
|
|
@@ -12729,8 +12744,17 @@ method(object({
|
|
|
12729
12744
|
}), array(SettingsRecordSchema).readonly()), method(object({
|
|
12730
12745
|
namespace: string().optional(),
|
|
12731
12746
|
collection: string(),
|
|
12732
|
-
record:
|
|
12733
|
-
|
|
12747
|
+
record: object({
|
|
12748
|
+
id: string().optional(),
|
|
12749
|
+
data: record(string(), unknown())
|
|
12750
|
+
})
|
|
12751
|
+
}), object({
|
|
12752
|
+
/**
|
|
12753
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
12754
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
12755
|
+
* primary key — which is the only place an auto key is knowable.
|
|
12756
|
+
*/
|
|
12757
|
+
id: union([string(), number()]) }), { kind: "mutation" }), method(object({
|
|
12734
12758
|
namespace: string().optional(),
|
|
12735
12759
|
collection: string(),
|
|
12736
12760
|
records: array(BulkRecordSchema).readonly()
|
|
@@ -12839,8 +12863,17 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
|
|
|
12839
12863
|
}), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
|
|
12840
12864
|
namespace: string().optional(),
|
|
12841
12865
|
collection: string(),
|
|
12842
|
-
record:
|
|
12843
|
-
|
|
12866
|
+
record: object({
|
|
12867
|
+
id: string().optional(),
|
|
12868
|
+
data: record(string(), unknown())
|
|
12869
|
+
})
|
|
12870
|
+
}), object({
|
|
12871
|
+
/**
|
|
12872
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
12873
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
12874
|
+
* primary key — which is the only place an auto key is knowable.
|
|
12875
|
+
*/
|
|
12876
|
+
id: union([string(), number()]) }), {
|
|
12844
12877
|
kind: "mutation",
|
|
12845
12878
|
auth: "admin"
|
|
12846
12879
|
}), method(object({
|
|
@@ -19765,7 +19798,20 @@ var TrackSchema = object({
|
|
|
19765
19798
|
...TrackRetrainFields
|
|
19766
19799
|
});
|
|
19767
19800
|
var BaseEventFields = {
|
|
19768
|
-
|
|
19801
|
+
/**
|
|
19802
|
+
* A SQLite ROWID, assigned by the database (D474).
|
|
19803
|
+
*
|
|
19804
|
+
* Was a 36-character UUID and cost 263 MB of a 1 117 MB database — paid
|
|
19805
|
+
* TWICE per row, in the row and in the primary-key index, across 2.1 million
|
|
19806
|
+
* motion, audio and object events. An `INTEGER PRIMARY KEY` in SQLite **is**
|
|
19807
|
+
* the rowid: the table itself is that B-tree, so the index stops existing
|
|
19808
|
+
* rather than getting smaller. No shorter string does that.
|
|
19809
|
+
*
|
|
19810
|
+
* Defined once here for all three event kinds, which is why they move
|
|
19811
|
+
* together: a per-table migration would have forked this and
|
|
19812
|
+
* `COMMON_BASE_COLUMNS` and reunited them two stages later.
|
|
19813
|
+
*/
|
|
19814
|
+
id: number().int(),
|
|
19769
19815
|
deviceId: number(),
|
|
19770
19816
|
timestamp: number()
|
|
19771
19817
|
};
|
|
@@ -19784,7 +19830,34 @@ var MotionEventSchema = object({
|
|
|
19784
19830
|
/** Omitted in slim projection. */
|
|
19785
19831
|
frameHeight: number().optional(),
|
|
19786
19832
|
/** Populated by B5 (recording playback URL for this event). */
|
|
19787
|
-
mediaUrl: string().optional()
|
|
19833
|
+
mediaUrl: string().optional(),
|
|
19834
|
+
/**
|
|
19835
|
+
* One row per motion EPISODE, not one per push (D475). `null` while the
|
|
19836
|
+
* episode is still open — a further rising edge extends it in place rather
|
|
19837
|
+
* than inserting a new row. Set once, at close, to `lastOnAt - startedAt`
|
|
19838
|
+
* (the span from the first rising edge to the LAST one, deliberately NOT
|
|
19839
|
+
* `closedAt - startedAt` — the close delay is a quiet CONFIRMATION, not
|
|
19840
|
+
* movement, and folding it in would report `MOTION_CLOSE_AFTER_MS` of
|
|
19841
|
+
* motion for an instantaneous trigger).
|
|
19842
|
+
*
|
|
19843
|
+
* **Absent** (not merely `null`) on a row written before D475 — that means
|
|
19844
|
+
* "closed the old way, before this column existed", never "still open".
|
|
19845
|
+
* Nothing in this codebase may read an absent `durationMs` as an open
|
|
19846
|
+
* episode; only `null` means open.
|
|
19847
|
+
*/
|
|
19848
|
+
durationMs: number().nullable().optional(),
|
|
19849
|
+
/**
|
|
19850
|
+
* Ms offsets from `timestamp` (the episode's own first rising edge, so the
|
|
19851
|
+
* first entry is always `0`) of every genuine off→on transition the
|
|
19852
|
+
* episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
|
|
19853
|
+
* push: a firmware source that keepalives at ~1 Hz for the whole burst
|
|
19854
|
+
* (Reolink, Hikvision) produces exactly one edge; a source that reports an
|
|
19855
|
+
* explicit `false` mid-episode and then resumes before the quiet window
|
|
19856
|
+
* elapses produces another. Stored compactly — see `motion-edge-codec.ts`
|
|
19857
|
+
* — and decoded back to this shape on read. Absent/empty on a legacy row,
|
|
19858
|
+
* which must never be read as "no episode happened here".
|
|
19859
|
+
*/
|
|
19860
|
+
edges: array(number()).readonly().optional()
|
|
19788
19861
|
});
|
|
19789
19862
|
/**
|
|
19790
19863
|
* Which detection SOURCE produced an object event. `pipeline` = the ML
|
|
@@ -19839,6 +19912,23 @@ var ObjectEventSchema = object({
|
|
|
19839
19912
|
* includes it (it is light). Absent on rows written before this field.
|
|
19840
19913
|
*/
|
|
19841
19914
|
frameId: string().optional(),
|
|
19915
|
+
/**
|
|
19916
|
+
* A PRODUCER-chosen key that makes a synthetic event's emission idempotent
|
|
19917
|
+
* (D474).
|
|
19918
|
+
*
|
|
19919
|
+
* Only the package detector writes it, and it exists because the event id
|
|
19920
|
+
* stopped being choosable: the delivery and pick-up rows used to BE their
|
|
19921
|
+
* dedupe key (`pa-pkg-<entryId>-delivered`), which is how "never emit a
|
|
19922
|
+
* second delivery for this entry" survived a restart. An `INTEGER` rowid is
|
|
19923
|
+
* assigned by SQLite, so that key had to move off the primary key rather
|
|
19924
|
+
* than be dropped — a detector that cannot recognise its own row re-delivers
|
|
19925
|
+
* every parcel on every boot.
|
|
19926
|
+
*
|
|
19927
|
+
* Absent on every other object event, and on every row written before this
|
|
19928
|
+
* field. Never a substitute for `id`: it is unique per (producer, occasion),
|
|
19929
|
+
* not per row, and nothing addresses a row by it.
|
|
19930
|
+
*/
|
|
19931
|
+
idempotencyKey: string().optional(),
|
|
19842
19932
|
/** Omitted in slim projection. */
|
|
19843
19933
|
trackId: string().optional(),
|
|
19844
19934
|
className: string(),
|
|
@@ -28105,26 +28195,59 @@ authKey: string().optional() }), object({
|
|
|
28105
28195
|
/** Human-readable error when `ok: false`. */
|
|
28106
28196
|
error: string().optional()
|
|
28107
28197
|
}), { kind: "mutation" });
|
|
28108
|
-
/**
|
|
28109
|
-
* Hardware / firmware motion sensor cap — binary detected state plus
|
|
28110
|
-
* a timestamp of the last observation. Distinct from
|
|
28111
|
-
* `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
|
|
28112
|
-
* `motion` is the lightweight readout from on-camera motion (Reolink
|
|
28113
|
-
* `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
|
|
28114
|
-
*
|
|
28115
|
-
* Native-motion providers also fan out to `detection.camera-native`
|
|
28116
|
-
* with `source: 'onboard'` so cross-cutting system services
|
|
28117
|
-
* (alert-center, advanced-notifier) can subscribe once and receive
|
|
28118
|
-
* motion from every camera.
|
|
28119
|
-
*/
|
|
28120
28198
|
var MotionStatusSchema = object({
|
|
28121
28199
|
detected: boolean(),
|
|
28122
28200
|
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
28123
28201
|
lastDetectedAt: number().nullable(),
|
|
28124
28202
|
/**
|
|
28125
|
-
*
|
|
28126
|
-
*
|
|
28127
|
-
*
|
|
28203
|
+
* `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
|
|
28204
|
+
* `null` while false and on every `Sensor` device (D475) — see that
|
|
28205
|
+
* constant's doc for the one-authority rule.
|
|
28206
|
+
*
|
|
28207
|
+
* ## Reading this field still arms nothing
|
|
28208
|
+
*
|
|
28209
|
+
* It reads like an instruction to the consumer ("revert after N ms if
|
|
28210
|
+
* no fresh push arrives") and it is not one: nothing in this repo reads
|
|
28211
|
+
* the LIVE cap value to drive a timer. `pipeline-analytics`'s motion-episode
|
|
28212
|
+
* close DOES now use the same number — `MOTION_CLOSE_AFTER_MS` — but as an
|
|
28213
|
+
* imported constant, not as a read of `device.state.motion.value`, so this
|
|
28214
|
+
* field stays what it always was: DESCRIPTIVE output, mirroring an answer
|
|
28215
|
+
* computed elsewhere. Building a self-clear timer out of a READ of this
|
|
28216
|
+
* field would add a second falling-edge authority beside whichever one
|
|
28217
|
+
* already owns the device, and two that can disagree are worse than one.
|
|
28218
|
+
* Consumers that need a falling edge SHAPED differently — held open across
|
|
28219
|
+
* a flapping source — debounce on their own side and say so, as
|
|
28220
|
+
* `addon-export-alexa/src/motion-clear-hold.ts` and
|
|
28221
|
+
* `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
|
|
28222
|
+
*
|
|
28223
|
+
* ## Who writes it
|
|
28224
|
+
*
|
|
28225
|
+
* - **Cameras** — the runner's phase machine, `active → watching` on
|
|
28226
|
+
* `cooldown_expired`, which then writes this slice with
|
|
28227
|
+
* `detected: false` (`handlePhaseChanged` in
|
|
28228
|
+
* `pipeline-runner/index.ts`). It produces the FALLING edge, which
|
|
28229
|
+
* matters most for the sources that only ever push a rising one:
|
|
28230
|
+
* Reolink emits `MotionOnMotionChanged { detected: true }` and never
|
|
28231
|
+
* a false.
|
|
28232
|
+
* - **Sensors** (Home Assistant binary sensors, Homematic) — the
|
|
28233
|
+
* provider pushes the false itself, from the upstream system's own
|
|
28234
|
+
* state change. No phase machine is involved.
|
|
28235
|
+
*
|
|
28236
|
+
* ### The phase machine is CANONICAL, not sole — and that is a defect
|
|
28237
|
+
*
|
|
28238
|
+
* An earlier revision of this docblock (mine, 2026-09-12) claimed the
|
|
28239
|
+
* phase machine is the sole writer for a camera. It is not.
|
|
28240
|
+
* `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
|
|
28241
|
+
* `setCapSlice(motionCapability, …)` on their own rising edge, and
|
|
28242
|
+
* Hikvision's comment says why: it read THIS docblock, agreed the
|
|
28243
|
+
* runner is canonical, and wrote anyway to avoid per-tick churn. So
|
|
28244
|
+
* two authorities can disagree about one slice, which this repo
|
|
28245
|
+
* forbids, and the doc said otherwise — which is worse than saying
|
|
28246
|
+
* nothing, because it reads as verification.
|
|
28247
|
+
*
|
|
28248
|
+
* This predates D475 and is not fixed there: the fix touches every
|
|
28249
|
+
* camera provider. Recorded in D475's Consequences. Do not restore the
|
|
28250
|
+
* "sole writer" wording without also removing the other writers.
|
|
28128
28251
|
*/
|
|
28129
28252
|
autoClearAfterMs: number().nullable()
|
|
28130
28253
|
});
|
|
@@ -28194,7 +28317,11 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
|
|
|
28194
28317
|
*/
|
|
28195
28318
|
runtimeState: MotionStatusSchema,
|
|
28196
28319
|
/**
|
|
28197
|
-
* Runtime-state durability: **session** —
|
|
28320
|
+
* Runtime-state durability: **session** — every writer of this slice
|
|
28321
|
+
* writes only on an EDGE, so a restored `detected: true` would stay
|
|
28322
|
+
* frozen until the next one instead of being corrected. The next edge
|
|
28323
|
+
* re-publishes the real state. (On who the writers are, and why there
|
|
28324
|
+
* is more than one, see `autoClearAfterMs` above.)
|
|
28198
28325
|
*
|
|
28199
28326
|
* See `RuntimeStateDurability`. Enforced by
|
|
28200
28327
|
* `scripts/check-runtime-state-durability.ts`.
|
package/dist/addon.mjs
CHANGED
|
@@ -7342,8 +7342,23 @@ function errMsg(err) {
|
|
|
7342
7342
|
if (typeof err === "string") return err;
|
|
7343
7343
|
return String(err);
|
|
7344
7344
|
}
|
|
7345
|
-
|
|
7346
|
-
|
|
7345
|
+
new Set([
|
|
7346
|
+
"track",
|
|
7347
|
+
"summary",
|
|
7348
|
+
"face",
|
|
7349
|
+
"identity",
|
|
7350
|
+
"plate",
|
|
7351
|
+
"vehicle",
|
|
7352
|
+
"scene",
|
|
7353
|
+
"motion",
|
|
7354
|
+
"object",
|
|
7355
|
+
"audio"
|
|
7356
|
+
]);
|
|
7357
|
+
new Set([
|
|
7358
|
+
"motion",
|
|
7359
|
+
"object",
|
|
7360
|
+
"audio"
|
|
7361
|
+
]);
|
|
7347
7362
|
/**
|
|
7348
7363
|
* Build an `IAddonRouteProvider` from a list of routes. Implements
|
|
7349
7364
|
* both the operator-facing `getRoutes` (returning route descriptors
|
|
@@ -12729,8 +12744,17 @@ method(object({
|
|
|
12729
12744
|
}), array(SettingsRecordSchema).readonly()), method(object({
|
|
12730
12745
|
namespace: string().optional(),
|
|
12731
12746
|
collection: string(),
|
|
12732
|
-
record:
|
|
12733
|
-
|
|
12747
|
+
record: object({
|
|
12748
|
+
id: string().optional(),
|
|
12749
|
+
data: record(string(), unknown())
|
|
12750
|
+
})
|
|
12751
|
+
}), object({
|
|
12752
|
+
/**
|
|
12753
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
12754
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
12755
|
+
* primary key — which is the only place an auto key is knowable.
|
|
12756
|
+
*/
|
|
12757
|
+
id: union([string(), number()]) }), { kind: "mutation" }), method(object({
|
|
12734
12758
|
namespace: string().optional(),
|
|
12735
12759
|
collection: string(),
|
|
12736
12760
|
records: array(BulkRecordSchema).readonly()
|
|
@@ -12839,8 +12863,17 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
|
|
|
12839
12863
|
}), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
|
|
12840
12864
|
namespace: string().optional(),
|
|
12841
12865
|
collection: string(),
|
|
12842
|
-
record:
|
|
12843
|
-
|
|
12866
|
+
record: object({
|
|
12867
|
+
id: string().optional(),
|
|
12868
|
+
data: record(string(), unknown())
|
|
12869
|
+
})
|
|
12870
|
+
}), object({
|
|
12871
|
+
/**
|
|
12872
|
+
* The id the row ACTUALLY got (D473): the one supplied, the UUID minted
|
|
12873
|
+
* for an absent one, or the ROWID SQLite assigned on an `INTEGER`
|
|
12874
|
+
* primary key — which is the only place an auto key is knowable.
|
|
12875
|
+
*/
|
|
12876
|
+
id: union([string(), number()]) }), {
|
|
12844
12877
|
kind: "mutation",
|
|
12845
12878
|
auth: "admin"
|
|
12846
12879
|
}), method(object({
|
|
@@ -19765,7 +19798,20 @@ var TrackSchema = object({
|
|
|
19765
19798
|
...TrackRetrainFields
|
|
19766
19799
|
});
|
|
19767
19800
|
var BaseEventFields = {
|
|
19768
|
-
|
|
19801
|
+
/**
|
|
19802
|
+
* A SQLite ROWID, assigned by the database (D474).
|
|
19803
|
+
*
|
|
19804
|
+
* Was a 36-character UUID and cost 263 MB of a 1 117 MB database — paid
|
|
19805
|
+
* TWICE per row, in the row and in the primary-key index, across 2.1 million
|
|
19806
|
+
* motion, audio and object events. An `INTEGER PRIMARY KEY` in SQLite **is**
|
|
19807
|
+
* the rowid: the table itself is that B-tree, so the index stops existing
|
|
19808
|
+
* rather than getting smaller. No shorter string does that.
|
|
19809
|
+
*
|
|
19810
|
+
* Defined once here for all three event kinds, which is why they move
|
|
19811
|
+
* together: a per-table migration would have forked this and
|
|
19812
|
+
* `COMMON_BASE_COLUMNS` and reunited them two stages later.
|
|
19813
|
+
*/
|
|
19814
|
+
id: number().int(),
|
|
19769
19815
|
deviceId: number(),
|
|
19770
19816
|
timestamp: number()
|
|
19771
19817
|
};
|
|
@@ -19784,7 +19830,34 @@ var MotionEventSchema = object({
|
|
|
19784
19830
|
/** Omitted in slim projection. */
|
|
19785
19831
|
frameHeight: number().optional(),
|
|
19786
19832
|
/** Populated by B5 (recording playback URL for this event). */
|
|
19787
|
-
mediaUrl: string().optional()
|
|
19833
|
+
mediaUrl: string().optional(),
|
|
19834
|
+
/**
|
|
19835
|
+
* One row per motion EPISODE, not one per push (D475). `null` while the
|
|
19836
|
+
* episode is still open — a further rising edge extends it in place rather
|
|
19837
|
+
* than inserting a new row. Set once, at close, to `lastOnAt - startedAt`
|
|
19838
|
+
* (the span from the first rising edge to the LAST one, deliberately NOT
|
|
19839
|
+
* `closedAt - startedAt` — the close delay is a quiet CONFIRMATION, not
|
|
19840
|
+
* movement, and folding it in would report `MOTION_CLOSE_AFTER_MS` of
|
|
19841
|
+
* motion for an instantaneous trigger).
|
|
19842
|
+
*
|
|
19843
|
+
* **Absent** (not merely `null`) on a row written before D475 — that means
|
|
19844
|
+
* "closed the old way, before this column existed", never "still open".
|
|
19845
|
+
* Nothing in this codebase may read an absent `durationMs` as an open
|
|
19846
|
+
* episode; only `null` means open.
|
|
19847
|
+
*/
|
|
19848
|
+
durationMs: number().nullable().optional(),
|
|
19849
|
+
/**
|
|
19850
|
+
* Ms offsets from `timestamp` (the episode's own first rising edge, so the
|
|
19851
|
+
* first entry is always `0`) of every genuine off→on transition the
|
|
19852
|
+
* episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
|
|
19853
|
+
* push: a firmware source that keepalives at ~1 Hz for the whole burst
|
|
19854
|
+
* (Reolink, Hikvision) produces exactly one edge; a source that reports an
|
|
19855
|
+
* explicit `false` mid-episode and then resumes before the quiet window
|
|
19856
|
+
* elapses produces another. Stored compactly — see `motion-edge-codec.ts`
|
|
19857
|
+
* — and decoded back to this shape on read. Absent/empty on a legacy row,
|
|
19858
|
+
* which must never be read as "no episode happened here".
|
|
19859
|
+
*/
|
|
19860
|
+
edges: array(number()).readonly().optional()
|
|
19788
19861
|
});
|
|
19789
19862
|
/**
|
|
19790
19863
|
* Which detection SOURCE produced an object event. `pipeline` = the ML
|
|
@@ -19839,6 +19912,23 @@ var ObjectEventSchema = object({
|
|
|
19839
19912
|
* includes it (it is light). Absent on rows written before this field.
|
|
19840
19913
|
*/
|
|
19841
19914
|
frameId: string().optional(),
|
|
19915
|
+
/**
|
|
19916
|
+
* A PRODUCER-chosen key that makes a synthetic event's emission idempotent
|
|
19917
|
+
* (D474).
|
|
19918
|
+
*
|
|
19919
|
+
* Only the package detector writes it, and it exists because the event id
|
|
19920
|
+
* stopped being choosable: the delivery and pick-up rows used to BE their
|
|
19921
|
+
* dedupe key (`pa-pkg-<entryId>-delivered`), which is how "never emit a
|
|
19922
|
+
* second delivery for this entry" survived a restart. An `INTEGER` rowid is
|
|
19923
|
+
* assigned by SQLite, so that key had to move off the primary key rather
|
|
19924
|
+
* than be dropped — a detector that cannot recognise its own row re-delivers
|
|
19925
|
+
* every parcel on every boot.
|
|
19926
|
+
*
|
|
19927
|
+
* Absent on every other object event, and on every row written before this
|
|
19928
|
+
* field. Never a substitute for `id`: it is unique per (producer, occasion),
|
|
19929
|
+
* not per row, and nothing addresses a row by it.
|
|
19930
|
+
*/
|
|
19931
|
+
idempotencyKey: string().optional(),
|
|
19842
19932
|
/** Omitted in slim projection. */
|
|
19843
19933
|
trackId: string().optional(),
|
|
19844
19934
|
className: string(),
|
|
@@ -28105,26 +28195,59 @@ authKey: string().optional() }), object({
|
|
|
28105
28195
|
/** Human-readable error when `ok: false`. */
|
|
28106
28196
|
error: string().optional()
|
|
28107
28197
|
}), { kind: "mutation" });
|
|
28108
|
-
/**
|
|
28109
|
-
* Hardware / firmware motion sensor cap — binary detected state plus
|
|
28110
|
-
* a timestamp of the last observation. Distinct from
|
|
28111
|
-
* `motion-detection.cap.ts` which owns the LOCAL ML motion pipeline;
|
|
28112
|
-
* `motion` is the lightweight readout from on-camera motion (Reolink
|
|
28113
|
-
* `GetMdState`, Baichuan push `type: motion`, ONVIF analytics).
|
|
28114
|
-
*
|
|
28115
|
-
* Native-motion providers also fan out to `detection.camera-native`
|
|
28116
|
-
* with `source: 'onboard'` so cross-cutting system services
|
|
28117
|
-
* (alert-center, advanced-notifier) can subscribe once and receive
|
|
28118
|
-
* motion from every camera.
|
|
28119
|
-
*/
|
|
28120
28198
|
var MotionStatusSchema = object({
|
|
28121
28199
|
detected: boolean(),
|
|
28122
28200
|
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
28123
28201
|
lastDetectedAt: number().nullable(),
|
|
28124
28202
|
/**
|
|
28125
|
-
*
|
|
28126
|
-
*
|
|
28127
|
-
*
|
|
28203
|
+
* `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device,
|
|
28204
|
+
* `null` while false and on every `Sensor` device (D475) — see that
|
|
28205
|
+
* constant's doc for the one-authority rule.
|
|
28206
|
+
*
|
|
28207
|
+
* ## Reading this field still arms nothing
|
|
28208
|
+
*
|
|
28209
|
+
* It reads like an instruction to the consumer ("revert after N ms if
|
|
28210
|
+
* no fresh push arrives") and it is not one: nothing in this repo reads
|
|
28211
|
+
* the LIVE cap value to drive a timer. `pipeline-analytics`'s motion-episode
|
|
28212
|
+
* close DOES now use the same number — `MOTION_CLOSE_AFTER_MS` — but as an
|
|
28213
|
+
* imported constant, not as a read of `device.state.motion.value`, so this
|
|
28214
|
+
* field stays what it always was: DESCRIPTIVE output, mirroring an answer
|
|
28215
|
+
* computed elsewhere. Building a self-clear timer out of a READ of this
|
|
28216
|
+
* field would add a second falling-edge authority beside whichever one
|
|
28217
|
+
* already owns the device, and two that can disagree are worse than one.
|
|
28218
|
+
* Consumers that need a falling edge SHAPED differently — held open across
|
|
28219
|
+
* a flapping source — debounce on their own side and say so, as
|
|
28220
|
+
* `addon-export-alexa/src/motion-clear-hold.ts` and
|
|
28221
|
+
* `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
|
|
28222
|
+
*
|
|
28223
|
+
* ## Who writes it
|
|
28224
|
+
*
|
|
28225
|
+
* - **Cameras** — the runner's phase machine, `active → watching` on
|
|
28226
|
+
* `cooldown_expired`, which then writes this slice with
|
|
28227
|
+
* `detected: false` (`handlePhaseChanged` in
|
|
28228
|
+
* `pipeline-runner/index.ts`). It produces the FALLING edge, which
|
|
28229
|
+
* matters most for the sources that only ever push a rising one:
|
|
28230
|
+
* Reolink emits `MotionOnMotionChanged { detected: true }` and never
|
|
28231
|
+
* a false.
|
|
28232
|
+
* - **Sensors** (Home Assistant binary sensors, Homematic) — the
|
|
28233
|
+
* provider pushes the false itself, from the upstream system's own
|
|
28234
|
+
* state change. No phase machine is involved.
|
|
28235
|
+
*
|
|
28236
|
+
* ### The phase machine is CANONICAL, not sole — and that is a defect
|
|
28237
|
+
*
|
|
28238
|
+
* An earlier revision of this docblock (mine, 2026-09-12) claimed the
|
|
28239
|
+
* phase machine is the sole writer for a camera. It is not.
|
|
28240
|
+
* `hikvision-camera.ts:3464` and `amcrest-camera.ts:445` both call
|
|
28241
|
+
* `setCapSlice(motionCapability, …)` on their own rising edge, and
|
|
28242
|
+
* Hikvision's comment says why: it read THIS docblock, agreed the
|
|
28243
|
+
* runner is canonical, and wrote anyway to avoid per-tick churn. So
|
|
28244
|
+
* two authorities can disagree about one slice, which this repo
|
|
28245
|
+
* forbids, and the doc said otherwise — which is worse than saying
|
|
28246
|
+
* nothing, because it reads as verification.
|
|
28247
|
+
*
|
|
28248
|
+
* This predates D475 and is not fixed there: the fix touches every
|
|
28249
|
+
* camera provider. Recorded in D475's Consequences. Do not restore the
|
|
28250
|
+
* "sole writer" wording without also removing the other writers.
|
|
28128
28251
|
*/
|
|
28129
28252
|
autoClearAfterMs: number().nullable()
|
|
28130
28253
|
});
|
|
@@ -28194,7 +28317,11 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
|
|
|
28194
28317
|
*/
|
|
28195
28318
|
runtimeState: MotionStatusSchema,
|
|
28196
28319
|
/**
|
|
28197
|
-
* Runtime-state durability: **session** —
|
|
28320
|
+
* Runtime-state durability: **session** — every writer of this slice
|
|
28321
|
+
* writes only on an EDGE, so a restored `detected: true` would stay
|
|
28322
|
+
* frozen until the next one instead of being corrected. The next edge
|
|
28323
|
+
* re-publishes the real state. (On who the writers are, and why there
|
|
28324
|
+
* is more than one, see `autoClearAfterMs` above.)
|
|
28198
28325
|
*
|
|
28199
28326
|
* See `RuntimeStateDurability`. Enforced by
|
|
28200
28327
|
* `scripts/check-runtime-state-durability.ts`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-import-alexa",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.98",
|
|
4
4
|
"description": "Alexa device-import provider for CamStack — imports the smart-home devices in a user's Alexa account via the unofficial alexa-remote2 cookie/token client (the inverse of the Alexa exporter)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|