@camstack/addon-provider-tuya 0.2.72 → 0.2.74
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 +169 -1
- package/dist/addon.mjs +169 -1
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -7265,6 +7265,21 @@ var CameraStreamSchema = object({
|
|
|
7265
7265
|
*/
|
|
7266
7266
|
autoEligible: boolean().optional(),
|
|
7267
7267
|
/**
|
|
7268
|
+
* The profile slot the PUBLISHER says this stream is: `low` for a stream
|
|
7269
|
+
* whose only sensible role is the low-bandwidth one, `high` for a main
|
|
7270
|
+
* stream. Consulted by the broker's automatic ranking
|
|
7271
|
+
* (`rankInitialAssignment`) BEFORE the pixel-count heuristic, and only there:
|
|
7272
|
+
* an operator's manual assignment still wins, and an absent hint is the
|
|
7273
|
+
* pixel-ranked default every camera had before this field existed.
|
|
7274
|
+
*
|
|
7275
|
+
* Why it exists: a camera with ONE stream ranked to `mid` — the slot no
|
|
7276
|
+
* storage class is written for on its own (`recordings` is high|mid,
|
|
7277
|
+
* `recordingsLow` is low) and the one profile scrub does not read. The robot
|
|
7278
|
+
* camera's single 720p relay is a `low` in every respect except the slot the
|
|
7279
|
+
* heuristic put it in.
|
|
7280
|
+
*/
|
|
7281
|
+
profileHint: CamProfileSchema.optional(),
|
|
7282
|
+
/**
|
|
7268
7283
|
* Transport-specific opaque metadata. The broker passes it through to
|
|
7269
7284
|
* the source reader without inspecting it. Currently used by
|
|
7270
7285
|
* `pull-rfc4571` streams to carry the upstream SDP (so the reader can
|
|
@@ -8714,7 +8729,22 @@ var RecordingTriggersSchema = object({
|
|
|
8714
8729
|
* il livello: un contatto trovato già aperto al riavvio del runner non fa
|
|
8715
8730
|
* registrare.
|
|
8716
8731
|
*/
|
|
8717
|
-
sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
|
|
8732
|
+
sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional(),
|
|
8733
|
+
/**
|
|
8734
|
+
* La camera registra per tutta la durata del SEGNALE che lei stessa
|
|
8735
|
+
* pubblica — la cap `recording-signal` (`active: true` mentre il device è in
|
|
8736
|
+
* funzione: un robot che pulisce). È un LIVELLO, non un fronte: la finestra
|
|
8737
|
+
* resta aperta finché il segnale è alto e si chiude `postBufferSec` dopo la
|
|
8738
|
+
* caduta, così una pulizia di quaranta minuti è UNA clip.
|
|
8739
|
+
*
|
|
8740
|
+
* Non nomina un device: il segnale è della camera stessa, tenuto fresco dal
|
|
8741
|
+
* suo provider (D224); il recorder lo ascolta su `DeviceStateChanged` e lo
|
|
8742
|
+
* riconcilia leggendo la slice via RPC, con un tetto oltre il quale un
|
|
8743
|
+
* segnale mai abbassato (un evento perso) non può tenere aperta una
|
|
8744
|
+
* registrazione (D11). Vedi `recorder/addon/band-decision.ts`
|
|
8745
|
+
* (`holdTrigger` / `releaseTrigger`).
|
|
8746
|
+
*/
|
|
8747
|
+
deviceSignal: boolean().optional()
|
|
8718
8748
|
});
|
|
8719
8749
|
/**
|
|
8720
8750
|
* Mode of a single recording band — the recorder per-band vocabulary.
|
|
@@ -12178,6 +12208,8 @@ method(object({
|
|
|
12178
12208
|
label: string().optional(),
|
|
12179
12209
|
deviceFeatures: array(string()).optional(),
|
|
12180
12210
|
autoEligible: boolean().optional(),
|
|
12211
|
+
/** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
|
|
12212
|
+
profileHint: CamProfileSchema.optional(),
|
|
12181
12213
|
metadata: record(string(), unknown()).optional(),
|
|
12182
12214
|
/** Required when kind === 'derived' — the source camStreamId the
|
|
12183
12215
|
* derived broker reads its encoded plane from.
|
|
@@ -30728,6 +30760,77 @@ method(object({
|
|
|
30728
30760
|
auth: "protected"
|
|
30729
30761
|
});
|
|
30730
30762
|
/**
|
|
30763
|
+
* A camera's own "record me NOW" LEVEL — a signal the device raises while
|
|
30764
|
+
* something it knows about is happening (a robot vacuum cleaning, a machine
|
|
30765
|
+
* running, a gate open) and lowers when it stops.
|
|
30766
|
+
*
|
|
30767
|
+
* It is a level, not an edge. The sensor triggers the recorder already listens
|
|
30768
|
+
* to (`SOURCE_CAP_ACTIVE_FIELD`) fire on a rising edge and record for a fixed
|
|
30769
|
+
* post-buffer; a cleaning lasts forty minutes, and forty minutes of "this is
|
|
30770
|
+
* still happening" cannot be expressed as an edge plus a post-buffer without
|
|
30771
|
+
* either re-triggering on a timer (polling — D224 forbids the consumer keeping
|
|
30772
|
+
* the fact fresh) or picking a post-buffer long enough to cover every job,
|
|
30773
|
+
* which records the dock for that long after every short one. So the recorder
|
|
30774
|
+
* reads the LEVEL: it records for as long as `active` is true, plus the band's
|
|
30775
|
+
* own post-buffer once it falls.
|
|
30776
|
+
*
|
|
30777
|
+
* Who owns the fact: the PROVIDER of the device, which already reads the state
|
|
30778
|
+
* the signal is derived from (the vacuum's lifecycle state, for Dreame). It
|
|
30779
|
+
* writes this slice on every change; consumers subscribe to the kernel's
|
|
30780
|
+
* `DeviceStateChanged` for it and read it back through
|
|
30781
|
+
* `deviceState.getCapSlice` to reconcile — never a second copy, never a poll
|
|
30782
|
+
* against the device (D224, D8/D11).
|
|
30783
|
+
*
|
|
30784
|
+
* Deliberately NOT a `binary` sensor on the camera: a binary sensor is exported
|
|
30785
|
+
* to Home Assistant, HomeKit and the sensor picker as a thing an operator can
|
|
30786
|
+
* bind, and "the camera wants to record" is not a room sensor. It is a fact
|
|
30787
|
+
* about the camera, on the camera.
|
|
30788
|
+
*/
|
|
30789
|
+
var RecordingSignalStatusSchema = object({
|
|
30790
|
+
/** True while the device asks to be recorded. */
|
|
30791
|
+
active: boolean(),
|
|
30792
|
+
/**
|
|
30793
|
+
* Why, in the provider's own vocabulary (a vacuum's `cleaning` / `docked`,
|
|
30794
|
+
* …). Free text for the log line and the UI badge; the recorder never
|
|
30795
|
+
* branches on it.
|
|
30796
|
+
*/
|
|
30797
|
+
reason: string(),
|
|
30798
|
+
/** Ms epoch of the last `active` transition. 0 if never observed. */
|
|
30799
|
+
lastChangedAt: number()
|
|
30800
|
+
});
|
|
30801
|
+
/** The runtime-state slice: the status plus the clock every slice carries. */
|
|
30802
|
+
var RecordingSignalRuntimeStateSchema = RecordingSignalStatusSchema.extend({ lastFetchedAt: number() });
|
|
30803
|
+
var recordingSignalCapability = {
|
|
30804
|
+
name: "recording-signal",
|
|
30805
|
+
scope: "device",
|
|
30806
|
+
deviceNative: true,
|
|
30807
|
+
mode: "singleton",
|
|
30808
|
+
deviceTypes: [DeviceType.Camera],
|
|
30809
|
+
methods: {
|
|
30810
|
+
/** The current level, straight from the slice the provider keeps fresh. */
|
|
30811
|
+
getStatus: method(object({ deviceId: number() }), RecordingSignalStatusSchema) },
|
|
30812
|
+
status: {
|
|
30813
|
+
schema: RecordingSignalStatusSchema,
|
|
30814
|
+
kind: "push",
|
|
30815
|
+
empty: {
|
|
30816
|
+
active: false,
|
|
30817
|
+
reason: "unknown",
|
|
30818
|
+
lastChangedAt: 0
|
|
30819
|
+
}
|
|
30820
|
+
},
|
|
30821
|
+
runtimeState: RecordingSignalRuntimeStateSchema,
|
|
30822
|
+
/**
|
|
30823
|
+
* Runtime-state durability: **session** — a restored `active: true` from
|
|
30824
|
+
* before a restart is exactly the stale level the recorder's reconcile bound
|
|
30825
|
+
* exists to end, and the provider re-derives the true level on activation
|
|
30826
|
+
* anyway. Nothing is lost by forgetting it; a lie is avoided.
|
|
30827
|
+
*
|
|
30828
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
30829
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
30830
|
+
*/
|
|
30831
|
+
durability: "session"
|
|
30832
|
+
};
|
|
30833
|
+
/**
|
|
30731
30834
|
* scene-monitor — device-scoped reference-region state cap. An operator marks
|
|
30732
30835
|
* a rect ROI on a camera frame and names one or more states; the engine
|
|
30733
30836
|
* (pipeline-analytics, designated post-processing node) reports which state is
|
|
@@ -31225,6 +31328,8 @@ var CamStreamDescriptorSchema = object({
|
|
|
31225
31328
|
deviceFeatures: array(string()).optional(),
|
|
31226
31329
|
/** Eligible for automatic profile assignment. Absent = `true`. */
|
|
31227
31330
|
autoEligible: boolean().optional(),
|
|
31331
|
+
/** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
|
|
31332
|
+
profileHint: CamProfileSchema.optional(),
|
|
31228
31333
|
/** Transport-specific opaque metadata (e.g. rfc4571 SDP). */
|
|
31229
31334
|
metadata: record(string(), unknown()).optional()
|
|
31230
31335
|
});
|
|
@@ -33364,6 +33469,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
33364
33469
|
pressureSensor: pressureSensorCapability,
|
|
33365
33470
|
privacyMask: privacyMaskCapability,
|
|
33366
33471
|
ptzAutotrack: ptzAutotrackCapability,
|
|
33472
|
+
recordingSignal: recordingSignalCapability,
|
|
33367
33473
|
sceneMonitor: sceneMonitorCapability,
|
|
33368
33474
|
scriptRunner: scriptRunnerCapability,
|
|
33369
33475
|
smoke: smokeCapability,
|
|
@@ -34207,6 +34313,53 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
34207
34313
|
const ids = [...this._permanentRestoreFailures.keys()].join(", ");
|
|
34208
34314
|
return `${this._permanentRestoreFailures.size} device(s) permanently failed restore (deviceIds: ${ids}) — restart the ${this.providerName} provider to retry`;
|
|
34209
34315
|
}
|
|
34316
|
+
/**
|
|
34317
|
+
* A top-level persisted row with NO configuration is a leftover, not a
|
|
34318
|
+
* device — quarantine it instead of dialling it.
|
|
34319
|
+
*
|
|
34320
|
+
* Device 614 was deleted, resurrected as a config-less shell by a write
|
|
34321
|
+
* already in flight (D376), and then dialled at every single boot: eight
|
|
34322
|
+
* `Failed to restore device — bounded retry scheduled` lines in one day,
|
|
34323
|
+
* each one the same Zod refusal on `host` and `password`. The bound was
|
|
34324
|
+
* real, but it is a bound PER PROCESS, and the runner restarts — so nothing
|
|
34325
|
+
* about the row ever stopped costing attempts and log lines.
|
|
34326
|
+
*
|
|
34327
|
+
* No retry can add a configuration that is not there. The row is reported
|
|
34328
|
+
* once, with its `deviceId`, and set aside.
|
|
34329
|
+
*
|
|
34330
|
+
* Top-level only: an accessory child legitimately carries an empty blob (it
|
|
34331
|
+
* lives off its parent), and a hub-adopted child with an emptied blob is
|
|
34332
|
+
* repaired by `healSavedConfig` from its parent instead. Providers that
|
|
34333
|
+
* genuinely create configuration-free top-level devices turn this off.
|
|
34334
|
+
*/
|
|
34335
|
+
quarantineConfiglessTopLevelRestores = true;
|
|
34336
|
+
isUnrestorableShell(saved) {
|
|
34337
|
+
if (!this.quarantineConfiglessTopLevelRestores) return false;
|
|
34338
|
+
if (saved.parentDeviceId !== null) return false;
|
|
34339
|
+
const config = saved.config;
|
|
34340
|
+
if (config === void 0) return false;
|
|
34341
|
+
return Object.keys(config).length === 0;
|
|
34342
|
+
}
|
|
34343
|
+
quarantineShell(saved) {
|
|
34344
|
+
this._permanentRestoreFailures.set(saved.id, {
|
|
34345
|
+
deviceId: saved.id,
|
|
34346
|
+
stableId: saved.stableId,
|
|
34347
|
+
type: saved.type,
|
|
34348
|
+
attempts: 0,
|
|
34349
|
+
lastError: "persisted row has no configuration",
|
|
34350
|
+
failedAt: Date.now()
|
|
34351
|
+
});
|
|
34352
|
+
this.ctx.logger.error("Persisted device row has NO configuration — quarantined: not restored, not retried. Remove it (deviceManager.removeDevice) or re-add the device.", {
|
|
34353
|
+
tags: {
|
|
34354
|
+
deviceId: saved.id,
|
|
34355
|
+
stableId: saved.stableId
|
|
34356
|
+
},
|
|
34357
|
+
meta: {
|
|
34358
|
+
type: saved.type,
|
|
34359
|
+
provider: this.providerName
|
|
34360
|
+
}
|
|
34361
|
+
});
|
|
34362
|
+
}
|
|
34210
34363
|
cancelRestoreRetries() {
|
|
34211
34364
|
this._restoreRetryScheduler?.cancel();
|
|
34212
34365
|
this._restoreRetryScheduler = null;
|
|
@@ -34391,6 +34544,10 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
34391
34544
|
});
|
|
34392
34545
|
return;
|
|
34393
34546
|
}
|
|
34547
|
+
if (this.isUnrestorableShell(saved)) {
|
|
34548
|
+
this.quarantineShell(saved);
|
|
34549
|
+
return;
|
|
34550
|
+
}
|
|
34394
34551
|
try {
|
|
34395
34552
|
await attemptRestore(saved);
|
|
34396
34553
|
} catch (err) {
|
|
@@ -39111,6 +39268,12 @@ Object.freeze({
|
|
|
39111
39268
|
addonId: null,
|
|
39112
39269
|
access: "view"
|
|
39113
39270
|
},
|
|
39271
|
+
"recordingSignal.getStatus": {
|
|
39272
|
+
capName: "recording-signal",
|
|
39273
|
+
capScope: "device",
|
|
39274
|
+
addonId: null,
|
|
39275
|
+
access: "view"
|
|
39276
|
+
},
|
|
39114
39277
|
"sceneMonitor.captureReference": {
|
|
39115
39278
|
capName: "scene-monitor",
|
|
39116
39279
|
capScope: "device",
|
|
@@ -42103,6 +42266,11 @@ Object.freeze({
|
|
|
42103
42266
|
form: "single",
|
|
42104
42267
|
optional: true
|
|
42105
42268
|
}],
|
|
42269
|
+
"recordingSignal.getStatus": [{
|
|
42270
|
+
name: "deviceId",
|
|
42271
|
+
form: "single",
|
|
42272
|
+
optional: false
|
|
42273
|
+
}],
|
|
42106
42274
|
"sceneMonitor.captureReference": [{
|
|
42107
42275
|
name: "deviceId",
|
|
42108
42276
|
form: "single",
|
package/dist/addon.mjs
CHANGED
|
@@ -7264,6 +7264,21 @@ var CameraStreamSchema = object({
|
|
|
7264
7264
|
*/
|
|
7265
7265
|
autoEligible: boolean().optional(),
|
|
7266
7266
|
/**
|
|
7267
|
+
* The profile slot the PUBLISHER says this stream is: `low` for a stream
|
|
7268
|
+
* whose only sensible role is the low-bandwidth one, `high` for a main
|
|
7269
|
+
* stream. Consulted by the broker's automatic ranking
|
|
7270
|
+
* (`rankInitialAssignment`) BEFORE the pixel-count heuristic, and only there:
|
|
7271
|
+
* an operator's manual assignment still wins, and an absent hint is the
|
|
7272
|
+
* pixel-ranked default every camera had before this field existed.
|
|
7273
|
+
*
|
|
7274
|
+
* Why it exists: a camera with ONE stream ranked to `mid` — the slot no
|
|
7275
|
+
* storage class is written for on its own (`recordings` is high|mid,
|
|
7276
|
+
* `recordingsLow` is low) and the one profile scrub does not read. The robot
|
|
7277
|
+
* camera's single 720p relay is a `low` in every respect except the slot the
|
|
7278
|
+
* heuristic put it in.
|
|
7279
|
+
*/
|
|
7280
|
+
profileHint: CamProfileSchema.optional(),
|
|
7281
|
+
/**
|
|
7267
7282
|
* Transport-specific opaque metadata. The broker passes it through to
|
|
7268
7283
|
* the source reader without inspecting it. Currently used by
|
|
7269
7284
|
* `pull-rfc4571` streams to carry the upstream SDP (so the reader can
|
|
@@ -8713,7 +8728,22 @@ var RecordingTriggersSchema = object({
|
|
|
8713
8728
|
* il livello: un contatto trovato già aperto al riavvio del runner non fa
|
|
8714
8729
|
* registrare.
|
|
8715
8730
|
*/
|
|
8716
|
-
sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
|
|
8731
|
+
sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional(),
|
|
8732
|
+
/**
|
|
8733
|
+
* La camera registra per tutta la durata del SEGNALE che lei stessa
|
|
8734
|
+
* pubblica — la cap `recording-signal` (`active: true` mentre il device è in
|
|
8735
|
+
* funzione: un robot che pulisce). È un LIVELLO, non un fronte: la finestra
|
|
8736
|
+
* resta aperta finché il segnale è alto e si chiude `postBufferSec` dopo la
|
|
8737
|
+
* caduta, così una pulizia di quaranta minuti è UNA clip.
|
|
8738
|
+
*
|
|
8739
|
+
* Non nomina un device: il segnale è della camera stessa, tenuto fresco dal
|
|
8740
|
+
* suo provider (D224); il recorder lo ascolta su `DeviceStateChanged` e lo
|
|
8741
|
+
* riconcilia leggendo la slice via RPC, con un tetto oltre il quale un
|
|
8742
|
+
* segnale mai abbassato (un evento perso) non può tenere aperta una
|
|
8743
|
+
* registrazione (D11). Vedi `recorder/addon/band-decision.ts`
|
|
8744
|
+
* (`holdTrigger` / `releaseTrigger`).
|
|
8745
|
+
*/
|
|
8746
|
+
deviceSignal: boolean().optional()
|
|
8717
8747
|
});
|
|
8718
8748
|
/**
|
|
8719
8749
|
* Mode of a single recording band — the recorder per-band vocabulary.
|
|
@@ -12177,6 +12207,8 @@ method(object({
|
|
|
12177
12207
|
label: string().optional(),
|
|
12178
12208
|
deviceFeatures: array(string()).optional(),
|
|
12179
12209
|
autoEligible: boolean().optional(),
|
|
12210
|
+
/** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
|
|
12211
|
+
profileHint: CamProfileSchema.optional(),
|
|
12180
12212
|
metadata: record(string(), unknown()).optional(),
|
|
12181
12213
|
/** Required when kind === 'derived' — the source camStreamId the
|
|
12182
12214
|
* derived broker reads its encoded plane from.
|
|
@@ -30727,6 +30759,77 @@ method(object({
|
|
|
30727
30759
|
auth: "protected"
|
|
30728
30760
|
});
|
|
30729
30761
|
/**
|
|
30762
|
+
* A camera's own "record me NOW" LEVEL — a signal the device raises while
|
|
30763
|
+
* something it knows about is happening (a robot vacuum cleaning, a machine
|
|
30764
|
+
* running, a gate open) and lowers when it stops.
|
|
30765
|
+
*
|
|
30766
|
+
* It is a level, not an edge. The sensor triggers the recorder already listens
|
|
30767
|
+
* to (`SOURCE_CAP_ACTIVE_FIELD`) fire on a rising edge and record for a fixed
|
|
30768
|
+
* post-buffer; a cleaning lasts forty minutes, and forty minutes of "this is
|
|
30769
|
+
* still happening" cannot be expressed as an edge plus a post-buffer without
|
|
30770
|
+
* either re-triggering on a timer (polling — D224 forbids the consumer keeping
|
|
30771
|
+
* the fact fresh) or picking a post-buffer long enough to cover every job,
|
|
30772
|
+
* which records the dock for that long after every short one. So the recorder
|
|
30773
|
+
* reads the LEVEL: it records for as long as `active` is true, plus the band's
|
|
30774
|
+
* own post-buffer once it falls.
|
|
30775
|
+
*
|
|
30776
|
+
* Who owns the fact: the PROVIDER of the device, which already reads the state
|
|
30777
|
+
* the signal is derived from (the vacuum's lifecycle state, for Dreame). It
|
|
30778
|
+
* writes this slice on every change; consumers subscribe to the kernel's
|
|
30779
|
+
* `DeviceStateChanged` for it and read it back through
|
|
30780
|
+
* `deviceState.getCapSlice` to reconcile — never a second copy, never a poll
|
|
30781
|
+
* against the device (D224, D8/D11).
|
|
30782
|
+
*
|
|
30783
|
+
* Deliberately NOT a `binary` sensor on the camera: a binary sensor is exported
|
|
30784
|
+
* to Home Assistant, HomeKit and the sensor picker as a thing an operator can
|
|
30785
|
+
* bind, and "the camera wants to record" is not a room sensor. It is a fact
|
|
30786
|
+
* about the camera, on the camera.
|
|
30787
|
+
*/
|
|
30788
|
+
var RecordingSignalStatusSchema = object({
|
|
30789
|
+
/** True while the device asks to be recorded. */
|
|
30790
|
+
active: boolean(),
|
|
30791
|
+
/**
|
|
30792
|
+
* Why, in the provider's own vocabulary (a vacuum's `cleaning` / `docked`,
|
|
30793
|
+
* …). Free text for the log line and the UI badge; the recorder never
|
|
30794
|
+
* branches on it.
|
|
30795
|
+
*/
|
|
30796
|
+
reason: string(),
|
|
30797
|
+
/** Ms epoch of the last `active` transition. 0 if never observed. */
|
|
30798
|
+
lastChangedAt: number()
|
|
30799
|
+
});
|
|
30800
|
+
/** The runtime-state slice: the status plus the clock every slice carries. */
|
|
30801
|
+
var RecordingSignalRuntimeStateSchema = RecordingSignalStatusSchema.extend({ lastFetchedAt: number() });
|
|
30802
|
+
var recordingSignalCapability = {
|
|
30803
|
+
name: "recording-signal",
|
|
30804
|
+
scope: "device",
|
|
30805
|
+
deviceNative: true,
|
|
30806
|
+
mode: "singleton",
|
|
30807
|
+
deviceTypes: [DeviceType.Camera],
|
|
30808
|
+
methods: {
|
|
30809
|
+
/** The current level, straight from the slice the provider keeps fresh. */
|
|
30810
|
+
getStatus: method(object({ deviceId: number() }), RecordingSignalStatusSchema) },
|
|
30811
|
+
status: {
|
|
30812
|
+
schema: RecordingSignalStatusSchema,
|
|
30813
|
+
kind: "push",
|
|
30814
|
+
empty: {
|
|
30815
|
+
active: false,
|
|
30816
|
+
reason: "unknown",
|
|
30817
|
+
lastChangedAt: 0
|
|
30818
|
+
}
|
|
30819
|
+
},
|
|
30820
|
+
runtimeState: RecordingSignalRuntimeStateSchema,
|
|
30821
|
+
/**
|
|
30822
|
+
* Runtime-state durability: **session** — a restored `active: true` from
|
|
30823
|
+
* before a restart is exactly the stale level the recorder's reconcile bound
|
|
30824
|
+
* exists to end, and the provider re-derives the true level on activation
|
|
30825
|
+
* anyway. Nothing is lost by forgetting it; a lie is avoided.
|
|
30826
|
+
*
|
|
30827
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
30828
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
30829
|
+
*/
|
|
30830
|
+
durability: "session"
|
|
30831
|
+
};
|
|
30832
|
+
/**
|
|
30730
30833
|
* scene-monitor — device-scoped reference-region state cap. An operator marks
|
|
30731
30834
|
* a rect ROI on a camera frame and names one or more states; the engine
|
|
30732
30835
|
* (pipeline-analytics, designated post-processing node) reports which state is
|
|
@@ -31224,6 +31327,8 @@ var CamStreamDescriptorSchema = object({
|
|
|
31224
31327
|
deviceFeatures: array(string()).optional(),
|
|
31225
31328
|
/** Eligible for automatic profile assignment. Absent = `true`. */
|
|
31226
31329
|
autoEligible: boolean().optional(),
|
|
31330
|
+
/** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
|
|
31331
|
+
profileHint: CamProfileSchema.optional(),
|
|
31227
31332
|
/** Transport-specific opaque metadata (e.g. rfc4571 SDP). */
|
|
31228
31333
|
metadata: record(string(), unknown()).optional()
|
|
31229
31334
|
});
|
|
@@ -33363,6 +33468,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
33363
33468
|
pressureSensor: pressureSensorCapability,
|
|
33364
33469
|
privacyMask: privacyMaskCapability,
|
|
33365
33470
|
ptzAutotrack: ptzAutotrackCapability,
|
|
33471
|
+
recordingSignal: recordingSignalCapability,
|
|
33366
33472
|
sceneMonitor: sceneMonitorCapability,
|
|
33367
33473
|
scriptRunner: scriptRunnerCapability,
|
|
33368
33474
|
smoke: smokeCapability,
|
|
@@ -34206,6 +34312,53 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
34206
34312
|
const ids = [...this._permanentRestoreFailures.keys()].join(", ");
|
|
34207
34313
|
return `${this._permanentRestoreFailures.size} device(s) permanently failed restore (deviceIds: ${ids}) — restart the ${this.providerName} provider to retry`;
|
|
34208
34314
|
}
|
|
34315
|
+
/**
|
|
34316
|
+
* A top-level persisted row with NO configuration is a leftover, not a
|
|
34317
|
+
* device — quarantine it instead of dialling it.
|
|
34318
|
+
*
|
|
34319
|
+
* Device 614 was deleted, resurrected as a config-less shell by a write
|
|
34320
|
+
* already in flight (D376), and then dialled at every single boot: eight
|
|
34321
|
+
* `Failed to restore device — bounded retry scheduled` lines in one day,
|
|
34322
|
+
* each one the same Zod refusal on `host` and `password`. The bound was
|
|
34323
|
+
* real, but it is a bound PER PROCESS, and the runner restarts — so nothing
|
|
34324
|
+
* about the row ever stopped costing attempts and log lines.
|
|
34325
|
+
*
|
|
34326
|
+
* No retry can add a configuration that is not there. The row is reported
|
|
34327
|
+
* once, with its `deviceId`, and set aside.
|
|
34328
|
+
*
|
|
34329
|
+
* Top-level only: an accessory child legitimately carries an empty blob (it
|
|
34330
|
+
* lives off its parent), and a hub-adopted child with an emptied blob is
|
|
34331
|
+
* repaired by `healSavedConfig` from its parent instead. Providers that
|
|
34332
|
+
* genuinely create configuration-free top-level devices turn this off.
|
|
34333
|
+
*/
|
|
34334
|
+
quarantineConfiglessTopLevelRestores = true;
|
|
34335
|
+
isUnrestorableShell(saved) {
|
|
34336
|
+
if (!this.quarantineConfiglessTopLevelRestores) return false;
|
|
34337
|
+
if (saved.parentDeviceId !== null) return false;
|
|
34338
|
+
const config = saved.config;
|
|
34339
|
+
if (config === void 0) return false;
|
|
34340
|
+
return Object.keys(config).length === 0;
|
|
34341
|
+
}
|
|
34342
|
+
quarantineShell(saved) {
|
|
34343
|
+
this._permanentRestoreFailures.set(saved.id, {
|
|
34344
|
+
deviceId: saved.id,
|
|
34345
|
+
stableId: saved.stableId,
|
|
34346
|
+
type: saved.type,
|
|
34347
|
+
attempts: 0,
|
|
34348
|
+
lastError: "persisted row has no configuration",
|
|
34349
|
+
failedAt: Date.now()
|
|
34350
|
+
});
|
|
34351
|
+
this.ctx.logger.error("Persisted device row has NO configuration — quarantined: not restored, not retried. Remove it (deviceManager.removeDevice) or re-add the device.", {
|
|
34352
|
+
tags: {
|
|
34353
|
+
deviceId: saved.id,
|
|
34354
|
+
stableId: saved.stableId
|
|
34355
|
+
},
|
|
34356
|
+
meta: {
|
|
34357
|
+
type: saved.type,
|
|
34358
|
+
provider: this.providerName
|
|
34359
|
+
}
|
|
34360
|
+
});
|
|
34361
|
+
}
|
|
34209
34362
|
cancelRestoreRetries() {
|
|
34210
34363
|
this._restoreRetryScheduler?.cancel();
|
|
34211
34364
|
this._restoreRetryScheduler = null;
|
|
@@ -34390,6 +34543,10 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
34390
34543
|
});
|
|
34391
34544
|
return;
|
|
34392
34545
|
}
|
|
34546
|
+
if (this.isUnrestorableShell(saved)) {
|
|
34547
|
+
this.quarantineShell(saved);
|
|
34548
|
+
return;
|
|
34549
|
+
}
|
|
34393
34550
|
try {
|
|
34394
34551
|
await attemptRestore(saved);
|
|
34395
34552
|
} catch (err) {
|
|
@@ -39110,6 +39267,12 @@ Object.freeze({
|
|
|
39110
39267
|
addonId: null,
|
|
39111
39268
|
access: "view"
|
|
39112
39269
|
},
|
|
39270
|
+
"recordingSignal.getStatus": {
|
|
39271
|
+
capName: "recording-signal",
|
|
39272
|
+
capScope: "device",
|
|
39273
|
+
addonId: null,
|
|
39274
|
+
access: "view"
|
|
39275
|
+
},
|
|
39113
39276
|
"sceneMonitor.captureReference": {
|
|
39114
39277
|
capName: "scene-monitor",
|
|
39115
39278
|
capScope: "device",
|
|
@@ -42102,6 +42265,11 @@ Object.freeze({
|
|
|
42102
42265
|
form: "single",
|
|
42103
42266
|
optional: true
|
|
42104
42267
|
}],
|
|
42268
|
+
"recordingSignal.getStatus": [{
|
|
42269
|
+
name: "deviceId",
|
|
42270
|
+
form: "single",
|
|
42271
|
+
optional: false
|
|
42272
|
+
}],
|
|
42105
42273
|
"sceneMonitor.captureReference": [{
|
|
42106
42274
|
name: "deviceId",
|
|
42107
42275
|
form: "single",
|
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.74",
|
|
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",
|