@camstack/addon-provider-homeassistant 1.2.88 → 1.2.90
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 +1 -1
- package/dist/addon.mjs +1 -1
- package/dist/{dist-CrOwnDRr.mjs → dist-DKXax7Rq.mjs} +169 -1
- package/dist/{dist-BBVEH2jM.js → dist-DfCgRCeO.js} +169 -1
- package/dist/ha-export/ha-export.addon.js +1 -1
- package/dist/ha-export/ha-export.addon.mjs +1 -1
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_dist = require("./dist-
|
|
2
|
+
const require_dist = require("./dist-DfCgRCeO.js");
|
|
3
3
|
let node_crypto = require("node:crypto");
|
|
4
4
|
let node_zlib = require("node:zlib");
|
|
5
5
|
//#region src/ha-device-source.ts
|
package/dist/addon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as presenceCapability, A as controlCapability, At as EventCategory, B as humiditySensorCapability, C as buildAddonRouteProvider, Ct as number, D as colorCapability, Dt as union, E as climateControlCapability, Et as string, F as eventEmitterCapability, G as motionCapability, H as lawnMowerControlCapability, I as fanControlCapability, J as notifierCapability, K as normalizeUnit, L as floodCapability, M as deviceAdoptionCapability, O as connectivityCapability, Ot as unknown, P as enumSensorCapability, Q as prepareNotification, R as gasCapability, S as brokerCapability, St as literal, T as carbonMonoxideCapability, Tt as record, U as lockControlCapability, V as imageCapability, W as mediaPlayerCapability, Y as numericSensorCapability, Z as powerMeterCapability, _ as automationControlCapability, _t as createEvent, at as temperatureSensorCapability, b as binaryCapability, bt as array, ct as valveCapability, d as TargetSchema, dt as weatherCapability, et as pressureSensorCapability, f as accessoriesCapability, ft as errMsg, g as ambientLightSensorCapability, gt as DeviceType, h as alarmPanelCapability, ht as DeviceRole, it as tamperCapability, j as coverCapability, k as contactCapability, kt as url, lt as vibrationCapability, m as airQualitySensorCapability, mt as DeviceFeature, n as BaseDevice, nt as smokeCapability, ot as updateCapability, p as addonRoutesCapability, q as notificationOutputCapability, r as BaseDeviceProvider, rt as switchCapability, s as EnumSensorDateTimeFormatSchema, st as vacuumControlCapability, tt as scriptRunnerCapability, ut as waterHeaterCapability, v as batteryCapability, w as buttonCapability, wt as object, x as brightnessCapability, xt as discriminatedUnion, y as bestLocationMatch, yt as _enum, z as humidifierCapability } from "./dist-
|
|
1
|
+
import { $ as presenceCapability, A as controlCapability, At as EventCategory, B as humiditySensorCapability, C as buildAddonRouteProvider, Ct as number, D as colorCapability, Dt as union, E as climateControlCapability, Et as string, F as eventEmitterCapability, G as motionCapability, H as lawnMowerControlCapability, I as fanControlCapability, J as notifierCapability, K as normalizeUnit, L as floodCapability, M as deviceAdoptionCapability, O as connectivityCapability, Ot as unknown, P as enumSensorCapability, Q as prepareNotification, R as gasCapability, S as brokerCapability, St as literal, T as carbonMonoxideCapability, Tt as record, U as lockControlCapability, V as imageCapability, W as mediaPlayerCapability, Y as numericSensorCapability, Z as powerMeterCapability, _ as automationControlCapability, _t as createEvent, at as temperatureSensorCapability, b as binaryCapability, bt as array, ct as valveCapability, d as TargetSchema, dt as weatherCapability, et as pressureSensorCapability, f as accessoriesCapability, ft as errMsg, g as ambientLightSensorCapability, gt as DeviceType, h as alarmPanelCapability, ht as DeviceRole, it as tamperCapability, j as coverCapability, k as contactCapability, kt as url, lt as vibrationCapability, m as airQualitySensorCapability, mt as DeviceFeature, n as BaseDevice, nt as smokeCapability, ot as updateCapability, p as addonRoutesCapability, q as notificationOutputCapability, r as BaseDeviceProvider, rt as switchCapability, s as EnumSensorDateTimeFormatSchema, st as vacuumControlCapability, tt as scriptRunnerCapability, ut as waterHeaterCapability, v as batteryCapability, w as buttonCapability, wt as object, x as brightnessCapability, xt as discriminatedUnion, y as bestLocationMatch, yt as _enum, z as humidifierCapability } from "./dist-DKXax7Rq.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { brotliCompressSync, deflateSync, gzipSync } from "node:zlib";
|
|
4
4
|
//#region src/ha-device-source.ts
|
|
@@ -6444,6 +6444,21 @@ var CameraStreamSchema = object({
|
|
|
6444
6444
|
*/
|
|
6445
6445
|
autoEligible: boolean().optional(),
|
|
6446
6446
|
/**
|
|
6447
|
+
* The profile slot the PUBLISHER says this stream is: `low` for a stream
|
|
6448
|
+
* whose only sensible role is the low-bandwidth one, `high` for a main
|
|
6449
|
+
* stream. Consulted by the broker's automatic ranking
|
|
6450
|
+
* (`rankInitialAssignment`) BEFORE the pixel-count heuristic, and only there:
|
|
6451
|
+
* an operator's manual assignment still wins, and an absent hint is the
|
|
6452
|
+
* pixel-ranked default every camera had before this field existed.
|
|
6453
|
+
*
|
|
6454
|
+
* Why it exists: a camera with ONE stream ranked to `mid` — the slot no
|
|
6455
|
+
* storage class is written for on its own (`recordings` is high|mid,
|
|
6456
|
+
* `recordingsLow` is low) and the one profile scrub does not read. The robot
|
|
6457
|
+
* camera's single 720p relay is a `low` in every respect except the slot the
|
|
6458
|
+
* heuristic put it in.
|
|
6459
|
+
*/
|
|
6460
|
+
profileHint: CamProfileSchema.optional(),
|
|
6461
|
+
/**
|
|
6447
6462
|
* Transport-specific opaque metadata. The broker passes it through to
|
|
6448
6463
|
* the source reader without inspecting it. Currently used by
|
|
6449
6464
|
* `pull-rfc4571` streams to carry the upstream SDP (so the reader can
|
|
@@ -8097,7 +8112,22 @@ var RecordingTriggersSchema = object({
|
|
|
8097
8112
|
* il livello: un contatto trovato già aperto al riavvio del runner non fa
|
|
8098
8113
|
* registrare.
|
|
8099
8114
|
*/
|
|
8100
|
-
sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
|
|
8115
|
+
sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional(),
|
|
8116
|
+
/**
|
|
8117
|
+
* La camera registra per tutta la durata del SEGNALE che lei stessa
|
|
8118
|
+
* pubblica — la cap `recording-signal` (`active: true` mentre il device è in
|
|
8119
|
+
* funzione: un robot che pulisce). È un LIVELLO, non un fronte: la finestra
|
|
8120
|
+
* resta aperta finché il segnale è alto e si chiude `postBufferSec` dopo la
|
|
8121
|
+
* caduta, così una pulizia di quaranta minuti è UNA clip.
|
|
8122
|
+
*
|
|
8123
|
+
* Non nomina un device: il segnale è della camera stessa, tenuto fresco dal
|
|
8124
|
+
* suo provider (D224); il recorder lo ascolta su `DeviceStateChanged` e lo
|
|
8125
|
+
* riconcilia leggendo la slice via RPC, con un tetto oltre il quale un
|
|
8126
|
+
* segnale mai abbassato (un evento perso) non può tenere aperta una
|
|
8127
|
+
* registrazione (D11). Vedi `recorder/addon/band-decision.ts`
|
|
8128
|
+
* (`holdTrigger` / `releaseTrigger`).
|
|
8129
|
+
*/
|
|
8130
|
+
deviceSignal: boolean().optional()
|
|
8101
8131
|
});
|
|
8102
8132
|
/**
|
|
8103
8133
|
* Mode of a single recording band — the recorder per-band vocabulary.
|
|
@@ -11629,6 +11659,8 @@ method(object({
|
|
|
11629
11659
|
label: string().optional(),
|
|
11630
11660
|
deviceFeatures: array(string()).optional(),
|
|
11631
11661
|
autoEligible: boolean().optional(),
|
|
11662
|
+
/** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
|
|
11663
|
+
profileHint: CamProfileSchema.optional(),
|
|
11632
11664
|
metadata: record(string(), unknown()).optional(),
|
|
11633
11665
|
/** Required when kind === 'derived' — the source camStreamId the
|
|
11634
11666
|
* derived broker reads its encoded plane from.
|
|
@@ -30360,6 +30392,77 @@ method(object({
|
|
|
30360
30392
|
auth: "protected"
|
|
30361
30393
|
});
|
|
30362
30394
|
/**
|
|
30395
|
+
* A camera's own "record me NOW" LEVEL — a signal the device raises while
|
|
30396
|
+
* something it knows about is happening (a robot vacuum cleaning, a machine
|
|
30397
|
+
* running, a gate open) and lowers when it stops.
|
|
30398
|
+
*
|
|
30399
|
+
* It is a level, not an edge. The sensor triggers the recorder already listens
|
|
30400
|
+
* to (`SOURCE_CAP_ACTIVE_FIELD`) fire on a rising edge and record for a fixed
|
|
30401
|
+
* post-buffer; a cleaning lasts forty minutes, and forty minutes of "this is
|
|
30402
|
+
* still happening" cannot be expressed as an edge plus a post-buffer without
|
|
30403
|
+
* either re-triggering on a timer (polling — D224 forbids the consumer keeping
|
|
30404
|
+
* the fact fresh) or picking a post-buffer long enough to cover every job,
|
|
30405
|
+
* which records the dock for that long after every short one. So the recorder
|
|
30406
|
+
* reads the LEVEL: it records for as long as `active` is true, plus the band's
|
|
30407
|
+
* own post-buffer once it falls.
|
|
30408
|
+
*
|
|
30409
|
+
* Who owns the fact: the PROVIDER of the device, which already reads the state
|
|
30410
|
+
* the signal is derived from (the vacuum's lifecycle state, for Dreame). It
|
|
30411
|
+
* writes this slice on every change; consumers subscribe to the kernel's
|
|
30412
|
+
* `DeviceStateChanged` for it and read it back through
|
|
30413
|
+
* `deviceState.getCapSlice` to reconcile — never a second copy, never a poll
|
|
30414
|
+
* against the device (D224, D8/D11).
|
|
30415
|
+
*
|
|
30416
|
+
* Deliberately NOT a `binary` sensor on the camera: a binary sensor is exported
|
|
30417
|
+
* to Home Assistant, HomeKit and the sensor picker as a thing an operator can
|
|
30418
|
+
* bind, and "the camera wants to record" is not a room sensor. It is a fact
|
|
30419
|
+
* about the camera, on the camera.
|
|
30420
|
+
*/
|
|
30421
|
+
var RecordingSignalStatusSchema = object({
|
|
30422
|
+
/** True while the device asks to be recorded. */
|
|
30423
|
+
active: boolean(),
|
|
30424
|
+
/**
|
|
30425
|
+
* Why, in the provider's own vocabulary (a vacuum's `cleaning` / `docked`,
|
|
30426
|
+
* …). Free text for the log line and the UI badge; the recorder never
|
|
30427
|
+
* branches on it.
|
|
30428
|
+
*/
|
|
30429
|
+
reason: string(),
|
|
30430
|
+
/** Ms epoch of the last `active` transition. 0 if never observed. */
|
|
30431
|
+
lastChangedAt: number()
|
|
30432
|
+
});
|
|
30433
|
+
/** The runtime-state slice: the status plus the clock every slice carries. */
|
|
30434
|
+
var RecordingSignalRuntimeStateSchema = RecordingSignalStatusSchema.extend({ lastFetchedAt: number() });
|
|
30435
|
+
var recordingSignalCapability = {
|
|
30436
|
+
name: "recording-signal",
|
|
30437
|
+
scope: "device",
|
|
30438
|
+
deviceNative: true,
|
|
30439
|
+
mode: "singleton",
|
|
30440
|
+
deviceTypes: [DeviceType.Camera],
|
|
30441
|
+
methods: {
|
|
30442
|
+
/** The current level, straight from the slice the provider keeps fresh. */
|
|
30443
|
+
getStatus: method(object({ deviceId: number() }), RecordingSignalStatusSchema) },
|
|
30444
|
+
status: {
|
|
30445
|
+
schema: RecordingSignalStatusSchema,
|
|
30446
|
+
kind: "push",
|
|
30447
|
+
empty: {
|
|
30448
|
+
active: false,
|
|
30449
|
+
reason: "unknown",
|
|
30450
|
+
lastChangedAt: 0
|
|
30451
|
+
}
|
|
30452
|
+
},
|
|
30453
|
+
runtimeState: RecordingSignalRuntimeStateSchema,
|
|
30454
|
+
/**
|
|
30455
|
+
* Runtime-state durability: **session** — a restored `active: true` from
|
|
30456
|
+
* before a restart is exactly the stale level the recorder's reconcile bound
|
|
30457
|
+
* exists to end, and the provider re-derives the true level on activation
|
|
30458
|
+
* anyway. Nothing is lost by forgetting it; a lie is avoided.
|
|
30459
|
+
*
|
|
30460
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
30461
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
30462
|
+
*/
|
|
30463
|
+
durability: "session"
|
|
30464
|
+
};
|
|
30465
|
+
/**
|
|
30363
30466
|
* scene-monitor — device-scoped reference-region state cap. An operator marks
|
|
30364
30467
|
* a rect ROI on a camera frame and names one or more states; the engine
|
|
30365
30468
|
* (pipeline-analytics, designated post-processing node) reports which state is
|
|
@@ -30857,6 +30960,8 @@ var CamStreamDescriptorSchema = object({
|
|
|
30857
30960
|
deviceFeatures: array(string()).optional(),
|
|
30858
30961
|
/** Eligible for automatic profile assignment. Absent = `true`. */
|
|
30859
30962
|
autoEligible: boolean().optional(),
|
|
30963
|
+
/** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
|
|
30964
|
+
profileHint: CamProfileSchema.optional(),
|
|
30860
30965
|
/** Transport-specific opaque metadata (e.g. rfc4571 SDP). */
|
|
30861
30966
|
metadata: record(string(), unknown()).optional()
|
|
30862
30967
|
});
|
|
@@ -32996,6 +33101,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
32996
33101
|
pressureSensor: pressureSensorCapability,
|
|
32997
33102
|
privacyMask: privacyMaskCapability,
|
|
32998
33103
|
ptzAutotrack: ptzAutotrackCapability,
|
|
33104
|
+
recordingSignal: recordingSignalCapability,
|
|
32999
33105
|
sceneMonitor: sceneMonitorCapability,
|
|
33000
33106
|
scriptRunner: scriptRunnerCapability,
|
|
33001
33107
|
smoke: smokeCapability,
|
|
@@ -33839,6 +33945,53 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
33839
33945
|
const ids = [...this._permanentRestoreFailures.keys()].join(", ");
|
|
33840
33946
|
return `${this._permanentRestoreFailures.size} device(s) permanently failed restore (deviceIds: ${ids}) — restart the ${this.providerName} provider to retry`;
|
|
33841
33947
|
}
|
|
33948
|
+
/**
|
|
33949
|
+
* A top-level persisted row with NO configuration is a leftover, not a
|
|
33950
|
+
* device — quarantine it instead of dialling it.
|
|
33951
|
+
*
|
|
33952
|
+
* Device 614 was deleted, resurrected as a config-less shell by a write
|
|
33953
|
+
* already in flight (D376), and then dialled at every single boot: eight
|
|
33954
|
+
* `Failed to restore device — bounded retry scheduled` lines in one day,
|
|
33955
|
+
* each one the same Zod refusal on `host` and `password`. The bound was
|
|
33956
|
+
* real, but it is a bound PER PROCESS, and the runner restarts — so nothing
|
|
33957
|
+
* about the row ever stopped costing attempts and log lines.
|
|
33958
|
+
*
|
|
33959
|
+
* No retry can add a configuration that is not there. The row is reported
|
|
33960
|
+
* once, with its `deviceId`, and set aside.
|
|
33961
|
+
*
|
|
33962
|
+
* Top-level only: an accessory child legitimately carries an empty blob (it
|
|
33963
|
+
* lives off its parent), and a hub-adopted child with an emptied blob is
|
|
33964
|
+
* repaired by `healSavedConfig` from its parent instead. Providers that
|
|
33965
|
+
* genuinely create configuration-free top-level devices turn this off.
|
|
33966
|
+
*/
|
|
33967
|
+
quarantineConfiglessTopLevelRestores = true;
|
|
33968
|
+
isUnrestorableShell(saved) {
|
|
33969
|
+
if (!this.quarantineConfiglessTopLevelRestores) return false;
|
|
33970
|
+
if (saved.parentDeviceId !== null) return false;
|
|
33971
|
+
const config = saved.config;
|
|
33972
|
+
if (config === void 0) return false;
|
|
33973
|
+
return Object.keys(config).length === 0;
|
|
33974
|
+
}
|
|
33975
|
+
quarantineShell(saved) {
|
|
33976
|
+
this._permanentRestoreFailures.set(saved.id, {
|
|
33977
|
+
deviceId: saved.id,
|
|
33978
|
+
stableId: saved.stableId,
|
|
33979
|
+
type: saved.type,
|
|
33980
|
+
attempts: 0,
|
|
33981
|
+
lastError: "persisted row has no configuration",
|
|
33982
|
+
failedAt: Date.now()
|
|
33983
|
+
});
|
|
33984
|
+
this.ctx.logger.error("Persisted device row has NO configuration — quarantined: not restored, not retried. Remove it (deviceManager.removeDevice) or re-add the device.", {
|
|
33985
|
+
tags: {
|
|
33986
|
+
deviceId: saved.id,
|
|
33987
|
+
stableId: saved.stableId
|
|
33988
|
+
},
|
|
33989
|
+
meta: {
|
|
33990
|
+
type: saved.type,
|
|
33991
|
+
provider: this.providerName
|
|
33992
|
+
}
|
|
33993
|
+
});
|
|
33994
|
+
}
|
|
33842
33995
|
cancelRestoreRetries() {
|
|
33843
33996
|
this._restoreRetryScheduler?.cancel();
|
|
33844
33997
|
this._restoreRetryScheduler = null;
|
|
@@ -34023,6 +34176,10 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
34023
34176
|
});
|
|
34024
34177
|
return;
|
|
34025
34178
|
}
|
|
34179
|
+
if (this.isUnrestorableShell(saved)) {
|
|
34180
|
+
this.quarantineShell(saved);
|
|
34181
|
+
return;
|
|
34182
|
+
}
|
|
34026
34183
|
try {
|
|
34027
34184
|
await attemptRestore(saved);
|
|
34028
34185
|
} catch (err) {
|
|
@@ -38743,6 +38900,12 @@ Object.freeze({
|
|
|
38743
38900
|
addonId: null,
|
|
38744
38901
|
access: "view"
|
|
38745
38902
|
},
|
|
38903
|
+
"recordingSignal.getStatus": {
|
|
38904
|
+
capName: "recording-signal",
|
|
38905
|
+
capScope: "device",
|
|
38906
|
+
addonId: null,
|
|
38907
|
+
access: "view"
|
|
38908
|
+
},
|
|
38746
38909
|
"sceneMonitor.captureReference": {
|
|
38747
38910
|
capName: "scene-monitor",
|
|
38748
38911
|
capScope: "device",
|
|
@@ -41735,6 +41898,11 @@ Object.freeze({
|
|
|
41735
41898
|
form: "single",
|
|
41736
41899
|
optional: true
|
|
41737
41900
|
}],
|
|
41901
|
+
"recordingSignal.getStatus": [{
|
|
41902
|
+
name: "deviceId",
|
|
41903
|
+
form: "single",
|
|
41904
|
+
optional: false
|
|
41905
|
+
}],
|
|
41738
41906
|
"sceneMonitor.captureReference": [{
|
|
41739
41907
|
name: "deviceId",
|
|
41740
41908
|
form: "single",
|
|
@@ -6444,6 +6444,21 @@ var CameraStreamSchema = object({
|
|
|
6444
6444
|
*/
|
|
6445
6445
|
autoEligible: boolean().optional(),
|
|
6446
6446
|
/**
|
|
6447
|
+
* The profile slot the PUBLISHER says this stream is: `low` for a stream
|
|
6448
|
+
* whose only sensible role is the low-bandwidth one, `high` for a main
|
|
6449
|
+
* stream. Consulted by the broker's automatic ranking
|
|
6450
|
+
* (`rankInitialAssignment`) BEFORE the pixel-count heuristic, and only there:
|
|
6451
|
+
* an operator's manual assignment still wins, and an absent hint is the
|
|
6452
|
+
* pixel-ranked default every camera had before this field existed.
|
|
6453
|
+
*
|
|
6454
|
+
* Why it exists: a camera with ONE stream ranked to `mid` — the slot no
|
|
6455
|
+
* storage class is written for on its own (`recordings` is high|mid,
|
|
6456
|
+
* `recordingsLow` is low) and the one profile scrub does not read. The robot
|
|
6457
|
+
* camera's single 720p relay is a `low` in every respect except the slot the
|
|
6458
|
+
* heuristic put it in.
|
|
6459
|
+
*/
|
|
6460
|
+
profileHint: CamProfileSchema.optional(),
|
|
6461
|
+
/**
|
|
6447
6462
|
* Transport-specific opaque metadata. The broker passes it through to
|
|
6448
6463
|
* the source reader without inspecting it. Currently used by
|
|
6449
6464
|
* `pull-rfc4571` streams to carry the upstream SDP (so the reader can
|
|
@@ -8097,7 +8112,22 @@ var RecordingTriggersSchema = object({
|
|
|
8097
8112
|
* il livello: un contatto trovato già aperto al riavvio del runner non fa
|
|
8098
8113
|
* registrare.
|
|
8099
8114
|
*/
|
|
8100
|
-
sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
|
|
8115
|
+
sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional(),
|
|
8116
|
+
/**
|
|
8117
|
+
* La camera registra per tutta la durata del SEGNALE che lei stessa
|
|
8118
|
+
* pubblica — la cap `recording-signal` (`active: true` mentre il device è in
|
|
8119
|
+
* funzione: un robot che pulisce). È un LIVELLO, non un fronte: la finestra
|
|
8120
|
+
* resta aperta finché il segnale è alto e si chiude `postBufferSec` dopo la
|
|
8121
|
+
* caduta, così una pulizia di quaranta minuti è UNA clip.
|
|
8122
|
+
*
|
|
8123
|
+
* Non nomina un device: il segnale è della camera stessa, tenuto fresco dal
|
|
8124
|
+
* suo provider (D224); il recorder lo ascolta su `DeviceStateChanged` e lo
|
|
8125
|
+
* riconcilia leggendo la slice via RPC, con un tetto oltre il quale un
|
|
8126
|
+
* segnale mai abbassato (un evento perso) non può tenere aperta una
|
|
8127
|
+
* registrazione (D11). Vedi `recorder/addon/band-decision.ts`
|
|
8128
|
+
* (`holdTrigger` / `releaseTrigger`).
|
|
8129
|
+
*/
|
|
8130
|
+
deviceSignal: boolean().optional()
|
|
8101
8131
|
});
|
|
8102
8132
|
/**
|
|
8103
8133
|
* Mode of a single recording band — the recorder per-band vocabulary.
|
|
@@ -11629,6 +11659,8 @@ method(object({
|
|
|
11629
11659
|
label: string().optional(),
|
|
11630
11660
|
deviceFeatures: array(string()).optional(),
|
|
11631
11661
|
autoEligible: boolean().optional(),
|
|
11662
|
+
/** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
|
|
11663
|
+
profileHint: CamProfileSchema.optional(),
|
|
11632
11664
|
metadata: record(string(), unknown()).optional(),
|
|
11633
11665
|
/** Required when kind === 'derived' — the source camStreamId the
|
|
11634
11666
|
* derived broker reads its encoded plane from.
|
|
@@ -30360,6 +30392,77 @@ method(object({
|
|
|
30360
30392
|
auth: "protected"
|
|
30361
30393
|
});
|
|
30362
30394
|
/**
|
|
30395
|
+
* A camera's own "record me NOW" LEVEL — a signal the device raises while
|
|
30396
|
+
* something it knows about is happening (a robot vacuum cleaning, a machine
|
|
30397
|
+
* running, a gate open) and lowers when it stops.
|
|
30398
|
+
*
|
|
30399
|
+
* It is a level, not an edge. The sensor triggers the recorder already listens
|
|
30400
|
+
* to (`SOURCE_CAP_ACTIVE_FIELD`) fire on a rising edge and record for a fixed
|
|
30401
|
+
* post-buffer; a cleaning lasts forty minutes, and forty minutes of "this is
|
|
30402
|
+
* still happening" cannot be expressed as an edge plus a post-buffer without
|
|
30403
|
+
* either re-triggering on a timer (polling — D224 forbids the consumer keeping
|
|
30404
|
+
* the fact fresh) or picking a post-buffer long enough to cover every job,
|
|
30405
|
+
* which records the dock for that long after every short one. So the recorder
|
|
30406
|
+
* reads the LEVEL: it records for as long as `active` is true, plus the band's
|
|
30407
|
+
* own post-buffer once it falls.
|
|
30408
|
+
*
|
|
30409
|
+
* Who owns the fact: the PROVIDER of the device, which already reads the state
|
|
30410
|
+
* the signal is derived from (the vacuum's lifecycle state, for Dreame). It
|
|
30411
|
+
* writes this slice on every change; consumers subscribe to the kernel's
|
|
30412
|
+
* `DeviceStateChanged` for it and read it back through
|
|
30413
|
+
* `deviceState.getCapSlice` to reconcile — never a second copy, never a poll
|
|
30414
|
+
* against the device (D224, D8/D11).
|
|
30415
|
+
*
|
|
30416
|
+
* Deliberately NOT a `binary` sensor on the camera: a binary sensor is exported
|
|
30417
|
+
* to Home Assistant, HomeKit and the sensor picker as a thing an operator can
|
|
30418
|
+
* bind, and "the camera wants to record" is not a room sensor. It is a fact
|
|
30419
|
+
* about the camera, on the camera.
|
|
30420
|
+
*/
|
|
30421
|
+
var RecordingSignalStatusSchema = object({
|
|
30422
|
+
/** True while the device asks to be recorded. */
|
|
30423
|
+
active: boolean(),
|
|
30424
|
+
/**
|
|
30425
|
+
* Why, in the provider's own vocabulary (a vacuum's `cleaning` / `docked`,
|
|
30426
|
+
* …). Free text for the log line and the UI badge; the recorder never
|
|
30427
|
+
* branches on it.
|
|
30428
|
+
*/
|
|
30429
|
+
reason: string(),
|
|
30430
|
+
/** Ms epoch of the last `active` transition. 0 if never observed. */
|
|
30431
|
+
lastChangedAt: number()
|
|
30432
|
+
});
|
|
30433
|
+
/** The runtime-state slice: the status plus the clock every slice carries. */
|
|
30434
|
+
var RecordingSignalRuntimeStateSchema = RecordingSignalStatusSchema.extend({ lastFetchedAt: number() });
|
|
30435
|
+
var recordingSignalCapability = {
|
|
30436
|
+
name: "recording-signal",
|
|
30437
|
+
scope: "device",
|
|
30438
|
+
deviceNative: true,
|
|
30439
|
+
mode: "singleton",
|
|
30440
|
+
deviceTypes: [DeviceType.Camera],
|
|
30441
|
+
methods: {
|
|
30442
|
+
/** The current level, straight from the slice the provider keeps fresh. */
|
|
30443
|
+
getStatus: method(object({ deviceId: number() }), RecordingSignalStatusSchema) },
|
|
30444
|
+
status: {
|
|
30445
|
+
schema: RecordingSignalStatusSchema,
|
|
30446
|
+
kind: "push",
|
|
30447
|
+
empty: {
|
|
30448
|
+
active: false,
|
|
30449
|
+
reason: "unknown",
|
|
30450
|
+
lastChangedAt: 0
|
|
30451
|
+
}
|
|
30452
|
+
},
|
|
30453
|
+
runtimeState: RecordingSignalRuntimeStateSchema,
|
|
30454
|
+
/**
|
|
30455
|
+
* Runtime-state durability: **session** — a restored `active: true` from
|
|
30456
|
+
* before a restart is exactly the stale level the recorder's reconcile bound
|
|
30457
|
+
* exists to end, and the provider re-derives the true level on activation
|
|
30458
|
+
* anyway. Nothing is lost by forgetting it; a lie is avoided.
|
|
30459
|
+
*
|
|
30460
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
30461
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
30462
|
+
*/
|
|
30463
|
+
durability: "session"
|
|
30464
|
+
};
|
|
30465
|
+
/**
|
|
30363
30466
|
* scene-monitor — device-scoped reference-region state cap. An operator marks
|
|
30364
30467
|
* a rect ROI on a camera frame and names one or more states; the engine
|
|
30365
30468
|
* (pipeline-analytics, designated post-processing node) reports which state is
|
|
@@ -30857,6 +30960,8 @@ var CamStreamDescriptorSchema = object({
|
|
|
30857
30960
|
deviceFeatures: array(string()).optional(),
|
|
30858
30961
|
/** Eligible for automatic profile assignment. Absent = `true`. */
|
|
30859
30962
|
autoEligible: boolean().optional(),
|
|
30963
|
+
/** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
|
|
30964
|
+
profileHint: CamProfileSchema.optional(),
|
|
30860
30965
|
/** Transport-specific opaque metadata (e.g. rfc4571 SDP). */
|
|
30861
30966
|
metadata: record(string(), unknown()).optional()
|
|
30862
30967
|
});
|
|
@@ -32996,6 +33101,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
32996
33101
|
pressureSensor: pressureSensorCapability,
|
|
32997
33102
|
privacyMask: privacyMaskCapability,
|
|
32998
33103
|
ptzAutotrack: ptzAutotrackCapability,
|
|
33104
|
+
recordingSignal: recordingSignalCapability,
|
|
32999
33105
|
sceneMonitor: sceneMonitorCapability,
|
|
33000
33106
|
scriptRunner: scriptRunnerCapability,
|
|
33001
33107
|
smoke: smokeCapability,
|
|
@@ -33839,6 +33945,53 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
33839
33945
|
const ids = [...this._permanentRestoreFailures.keys()].join(", ");
|
|
33840
33946
|
return `${this._permanentRestoreFailures.size} device(s) permanently failed restore (deviceIds: ${ids}) — restart the ${this.providerName} provider to retry`;
|
|
33841
33947
|
}
|
|
33948
|
+
/**
|
|
33949
|
+
* A top-level persisted row with NO configuration is a leftover, not a
|
|
33950
|
+
* device — quarantine it instead of dialling it.
|
|
33951
|
+
*
|
|
33952
|
+
* Device 614 was deleted, resurrected as a config-less shell by a write
|
|
33953
|
+
* already in flight (D376), and then dialled at every single boot: eight
|
|
33954
|
+
* `Failed to restore device — bounded retry scheduled` lines in one day,
|
|
33955
|
+
* each one the same Zod refusal on `host` and `password`. The bound was
|
|
33956
|
+
* real, but it is a bound PER PROCESS, and the runner restarts — so nothing
|
|
33957
|
+
* about the row ever stopped costing attempts and log lines.
|
|
33958
|
+
*
|
|
33959
|
+
* No retry can add a configuration that is not there. The row is reported
|
|
33960
|
+
* once, with its `deviceId`, and set aside.
|
|
33961
|
+
*
|
|
33962
|
+
* Top-level only: an accessory child legitimately carries an empty blob (it
|
|
33963
|
+
* lives off its parent), and a hub-adopted child with an emptied blob is
|
|
33964
|
+
* repaired by `healSavedConfig` from its parent instead. Providers that
|
|
33965
|
+
* genuinely create configuration-free top-level devices turn this off.
|
|
33966
|
+
*/
|
|
33967
|
+
quarantineConfiglessTopLevelRestores = true;
|
|
33968
|
+
isUnrestorableShell(saved) {
|
|
33969
|
+
if (!this.quarantineConfiglessTopLevelRestores) return false;
|
|
33970
|
+
if (saved.parentDeviceId !== null) return false;
|
|
33971
|
+
const config = saved.config;
|
|
33972
|
+
if (config === void 0) return false;
|
|
33973
|
+
return Object.keys(config).length === 0;
|
|
33974
|
+
}
|
|
33975
|
+
quarantineShell(saved) {
|
|
33976
|
+
this._permanentRestoreFailures.set(saved.id, {
|
|
33977
|
+
deviceId: saved.id,
|
|
33978
|
+
stableId: saved.stableId,
|
|
33979
|
+
type: saved.type,
|
|
33980
|
+
attempts: 0,
|
|
33981
|
+
lastError: "persisted row has no configuration",
|
|
33982
|
+
failedAt: Date.now()
|
|
33983
|
+
});
|
|
33984
|
+
this.ctx.logger.error("Persisted device row has NO configuration — quarantined: not restored, not retried. Remove it (deviceManager.removeDevice) or re-add the device.", {
|
|
33985
|
+
tags: {
|
|
33986
|
+
deviceId: saved.id,
|
|
33987
|
+
stableId: saved.stableId
|
|
33988
|
+
},
|
|
33989
|
+
meta: {
|
|
33990
|
+
type: saved.type,
|
|
33991
|
+
provider: this.providerName
|
|
33992
|
+
}
|
|
33993
|
+
});
|
|
33994
|
+
}
|
|
33842
33995
|
cancelRestoreRetries() {
|
|
33843
33996
|
this._restoreRetryScheduler?.cancel();
|
|
33844
33997
|
this._restoreRetryScheduler = null;
|
|
@@ -34023,6 +34176,10 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
34023
34176
|
});
|
|
34024
34177
|
return;
|
|
34025
34178
|
}
|
|
34179
|
+
if (this.isUnrestorableShell(saved)) {
|
|
34180
|
+
this.quarantineShell(saved);
|
|
34181
|
+
return;
|
|
34182
|
+
}
|
|
34026
34183
|
try {
|
|
34027
34184
|
await attemptRestore(saved);
|
|
34028
34185
|
} catch (err) {
|
|
@@ -38743,6 +38900,12 @@ Object.freeze({
|
|
|
38743
38900
|
addonId: null,
|
|
38744
38901
|
access: "view"
|
|
38745
38902
|
},
|
|
38903
|
+
"recordingSignal.getStatus": {
|
|
38904
|
+
capName: "recording-signal",
|
|
38905
|
+
capScope: "device",
|
|
38906
|
+
addonId: null,
|
|
38907
|
+
access: "view"
|
|
38908
|
+
},
|
|
38746
38909
|
"sceneMonitor.captureReference": {
|
|
38747
38910
|
capName: "scene-monitor",
|
|
38748
38911
|
capScope: "device",
|
|
@@ -41735,6 +41898,11 @@ Object.freeze({
|
|
|
41735
41898
|
form: "single",
|
|
41736
41899
|
optional: true
|
|
41737
41900
|
}],
|
|
41901
|
+
"recordingSignal.getStatus": [{
|
|
41902
|
+
name: "deviceId",
|
|
41903
|
+
form: "single",
|
|
41904
|
+
optional: false
|
|
41905
|
+
}],
|
|
41738
41906
|
"sceneMonitor.captureReference": [{
|
|
41739
41907
|
name: "deviceId",
|
|
41740
41908
|
form: "single",
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
//#endregion
|
|
6
|
-
const require_dist = require("../dist-
|
|
6
|
+
const require_dist = require("../dist-DfCgRCeO.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
//#region src/ha-export/topics.ts
|
|
9
9
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as EventCategory, C as buildAddonRouteProvider, Et as string, N as deviceExportCapability, X as oauthIntegrationCapability, a as COCO_TO_MACRO, c as FanDirectionSchema, i as CAMERA_SWITCH_ORDER, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, pt as BaseAddon, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema, vt as nodePin } from "../dist-
|
|
1
|
+
import { At as EventCategory, C as buildAddonRouteProvider, Et as string, N as deviceExportCapability, X as oauthIntegrationCapability, a as COCO_TO_MACRO, c as FanDirectionSchema, i as CAMERA_SWITCH_ORDER, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, pt as BaseAddon, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema, vt as nodePin } from "../dist-DKXax7Rq.mjs";
|
|
2
2
|
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
3
3
|
//#region src/ha-export/topics.ts
|
|
4
4
|
/**
|