@camstack/addon-provider-reolink 1.2.258 → 1.2.260
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/CHANGELOG.md +17 -0
- package/README.md +10 -0
- package/dist/addon.js +436 -111
- package/dist/addon.mjs +436 -111
- package/i18n/en.json +4 -0
- package/i18n/it.json +4 -0
- package/package.json +3 -3
package/dist/addon.js
CHANGED
|
@@ -29165,7 +29165,7 @@ var require_lz4 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
29165
29165
|
};
|
|
29166
29166
|
}));
|
|
29167
29167
|
//#endregion
|
|
29168
|
-
//#region node_modules/@apocaliss92/nodelink-js/dist/chunk-
|
|
29168
|
+
//#region node_modules/@apocaliss92/nodelink-js/dist/chunk-2XVZ5ZZL.js
|
|
29169
29169
|
var import_fxp = require_fxp();
|
|
29170
29170
|
var import_lz4 = /* @__PURE__ */ require_chunk.__toESM(require_lz4(), 1);
|
|
29171
29171
|
function bcHeaderLen(messageClass, buf, bodyLen) {
|
|
@@ -37540,7 +37540,7 @@ function computeDeviceCapabilities(params) {
|
|
|
37540
37540
|
const hasZoomFromAbilities = ptzExplicitlyDisabledBySupportItem ? false : abilitiesHasAny(flat, /zoom|zoomFocus|StartZoomFocus/i);
|
|
37541
37541
|
const hasPresetsFromAbilities = abilitiesHasAny(flat, /preset/i);
|
|
37542
37542
|
const hasPirFromAbilities = abilitiesHasAny(flat, /(^|_)pir/i) || abilitiesHasAny(flat, /rfAlarm/i) || abilitiesHasAny(flat, /mdWithPir/i);
|
|
37543
|
-
const hasPirFromSupport = supportItem ? isTruthyNumberLike(supportItem.rfCfg) || isTruthyNumberLike(supportItem.newRfCfg) || isTruthyNumberLike(supportItem.rfVersion)
|
|
37543
|
+
const hasPirFromSupport = supportItem ? isTruthyNumberLike(supportItem.rfCfg) || isTruthyNumberLike(supportItem.newRfCfg) || isTruthyNumberLike(supportItem.rfVersion) : false;
|
|
37544
37544
|
const hasAutotrackingFromSupport = supportItem ? isTruthyNumberLike(supportItem.autoPt) || isTruthyNumberLike(supportItem.smartAI) : false;
|
|
37545
37545
|
const hasAutotrackingFromAbilities = abilitiesHasAny(flat, /smartTrack/i);
|
|
37546
37546
|
const hasBattery = hasBatteryFromSupport || hasBatteryFromAbilities;
|
|
@@ -105928,9 +105928,9 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
105928
105928
|
*/
|
|
105929
105929
|
EventCategory["DeviceStateChanged"] = "device.state-changed";
|
|
105930
105930
|
/**
|
|
105931
|
-
* A device COMMAND (a vocabulary action, D920/D983)
|
|
105932
|
-
*
|
|
105933
|
-
* failed. Never a device's own change. Payload: `DeviceCommandSettledEvent`
|
|
105931
|
+
* A device COMMAND (a vocabulary action, D920/D983) completed, as the hub's
|
|
105932
|
+
* command audit saw it (D1022, D1084): the call returned (`ok`) or threw
|
|
105933
|
+
* (`failed`). Never a device's own change, and never proof the device obeyed. Payload: `DeviceCommandSettledEvent`
|
|
105934
105934
|
* (`{deviceId, action, outcome, actor, at}`, no arguments). It feeds
|
|
105935
105935
|
* the Notification Center `device-command` kind. Telemetry (D8): losing one
|
|
105936
105936
|
* costs a notification, never state; the audit row is the record.
|
|
@@ -109029,6 +109029,15 @@ var BaseAddon = class {
|
|
|
109029
109029
|
/** The instance kinds whose switch move this process already ran (or tried), by record kind name. */
|
|
109030
109030
|
switchMoved = /* @__PURE__ */ new Set();
|
|
109031
109031
|
lastDeclared = [];
|
|
109032
|
+
/**
|
|
109033
|
+
* Every switch migration this process added to a declaration so far, by id. The engine replaces
|
|
109034
|
+
* an owner's catalogue on each declare, so a later one (a late kind) carries them all: dropping
|
|
109035
|
+
* an earlier id would read its applied ledger row as a newer database.
|
|
109036
|
+
*/
|
|
109037
|
+
switchDeclared = /* @__PURE__ */ new Map();
|
|
109038
|
+
/** The seq each kind's move got, fixed at its first declare so its id and seq never change. */
|
|
109039
|
+
switchSeqs = /* @__PURE__ */ new Map();
|
|
109040
|
+
moveInDeclared = false;
|
|
109032
109041
|
registrySwitchBound() {
|
|
109033
109042
|
const api = this.ctx.migrationApi;
|
|
109034
109043
|
const spec = this.registrySwitchSpec;
|
|
@@ -109039,7 +109048,7 @@ var BaseAddon = class {
|
|
|
109039
109048
|
return [];
|
|
109040
109049
|
}
|
|
109041
109050
|
const date = "2026-11-06";
|
|
109042
|
-
const moveIn = spec === null ? [] : migrationSet([registrySwitchToBodyMigration({
|
|
109051
|
+
const moveIn = spec === null || this.moveInDeclared ? [] : migrationSet([registrySwitchToBodyMigration({
|
|
109043
109052
|
addonId: this.ctx.id,
|
|
109044
109053
|
date,
|
|
109045
109054
|
seq: 1e3,
|
|
@@ -109049,12 +109058,15 @@ var BaseAddon = class {
|
|
|
109049
109058
|
records: switchRecordsOverMigrationApi(a),
|
|
109050
109059
|
kind: spec.kind
|
|
109051
109060
|
})).bind(api);
|
|
109052
|
-
|
|
109061
|
+
if (spec !== null) this.moveInDeclared = true;
|
|
109062
|
+
const moveBack = kinds.flatMap(({ kind }) => {
|
|
109053
109063
|
this.switchMoved.add(kind.name);
|
|
109064
|
+
const seq = 1001 + this.switchSeqs.size;
|
|
109065
|
+
this.switchSeqs.set(kind.name, seq);
|
|
109054
109066
|
return migrationSet([bodySwitchToRegistryMigration({
|
|
109055
109067
|
addonId: this.ctx.id,
|
|
109056
109068
|
date: "2026-11-19",
|
|
109057
|
-
seq
|
|
109069
|
+
seq,
|
|
109058
109070
|
kindName: kind.name,
|
|
109059
109071
|
...spec === null ? {} : { followsDate: date }
|
|
109060
109072
|
})], (a) => bodySwitchPortsOver({
|
|
@@ -109092,7 +109104,8 @@ var BaseAddon = class {
|
|
|
109092
109104
|
async runBound(declared, options) {
|
|
109093
109105
|
this.lastDeclared = declared;
|
|
109094
109106
|
const added = this.registrySwitchBound();
|
|
109095
|
-
const
|
|
109107
|
+
for (const m of added) this.switchDeclared.set(m.meta.id, m);
|
|
109108
|
+
const migrations = [...declared, ...[...this.switchDeclared.values()].filter((m) => !declared.some((d) => d.meta.id === m.meta.id))];
|
|
109096
109109
|
const widened = options?.only === void 0 || added.length === 0 ? options : {
|
|
109097
109110
|
...options,
|
|
109098
109111
|
only: [...new Set([...options.only, ...added.map((m) => m.meta.id)])]
|
|
@@ -110262,6 +110275,7 @@ function method(input, output, options) {
|
|
|
110262
110275
|
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
110263
110276
|
...options?.actions !== void 0 ? { actions: options.actions } : {},
|
|
110264
110277
|
...options?.notOperatorFacing !== void 0 ? { notOperatorFacing: options.notOperatorFacing } : {},
|
|
110278
|
+
...options?.description !== void 0 ? { description: options.description } : {},
|
|
110265
110279
|
timeoutMs: options?.timeoutMs
|
|
110266
110280
|
};
|
|
110267
110281
|
}
|
|
@@ -111877,6 +111891,11 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
|
111877
111891
|
* water, cooling, solar), its system modes and its power. One main read-only
|
|
111878
111892
|
* `heat-pump-status` cap carries all of it; `heat-pump-control` sets it (D1026). */
|
|
111879
111893
|
DeviceType["HeatPump"] = "heat-pump";
|
|
111894
|
+
/** A road vehicle reached through its maker's connected-car account: odometer, range,
|
|
111895
|
+
* openings, tyre warnings and the 12 V battery in one read-only `vehicle` cap; where it
|
|
111896
|
+
* is in `location`; fuel, fluids and service in `consumables`. Its lock and its cabin
|
|
111897
|
+
* climate are accessory children (`lock-vehicle`, `climate-vehicle`). */
|
|
111898
|
+
DeviceType["Vehicle"] = "vehicle";
|
|
111880
111899
|
/** A home energy installation (any vendor): solar, grid, house, a metered heat pump
|
|
111881
111900
|
* and the storage as branches of one bus. One read-only `energy-system` cap carries
|
|
111882
111901
|
* every value; the storage is a field of it, never the `battery` cap (#513, #522). */
|
|
@@ -112119,6 +112138,14 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
112119
112138
|
/** One heating/cooling circuit of a heat pump: a water loop with comfort /
|
|
112120
112139
|
* eco setpoints and a heat/cool mode, no room sensor. */
|
|
112121
112140
|
DeviceRole["ClimateHeatPumpCircuit"] = "climate-heat-pump-circuit";
|
|
112141
|
+
/** A car's cabin: pre-conditioning (start / stop, target temperature) through the
|
|
112142
|
+
* maker's connected-car account. An accessory child of a vehicle. */
|
|
112143
|
+
DeviceRole["ClimateVehicle"] = "climate-vehicle";
|
|
112144
|
+
/** A car's central locking, an accessory child of a vehicle. Slow, cloud-held
|
|
112145
|
+
* commands; exports decide by `isVehicleLock`. */
|
|
112146
|
+
DeviceRole["LockVehicle"] = "lock-vehicle";
|
|
112147
|
+
/** A television: power, volume, channel, source and apps. */
|
|
112148
|
+
DeviceRole["MediaPlayerTv"] = "media-player-tv";
|
|
112122
112149
|
/** Generic motion / occupancy / moving event source. Distinct from
|
|
112123
112150
|
* the camera accessory PirSensor role: that one is a camera child;
|
|
112124
112151
|
* this is a standalone HA / 3rd-party motion sensor. */
|
|
@@ -112693,7 +112720,9 @@ var brightnessCapability = {
|
|
|
112693
112720
|
deviceNative: true,
|
|
112694
112721
|
mode: "singleton",
|
|
112695
112722
|
deviceTypes: [DeviceType.Light],
|
|
112696
|
-
methods: {
|
|
112723
|
+
methods: {
|
|
112724
|
+
/** Set the light's brightness level from 0 to 100. */
|
|
112725
|
+
setBrightness: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
112697
112726
|
deviceId: /* @__PURE__ */ number().int().nonnegative(),
|
|
112698
112727
|
level: /* @__PURE__ */ number().min(0).max(100)
|
|
112699
112728
|
}), /* @__PURE__ */ _void(), {
|
|
@@ -112889,7 +112918,9 @@ var dayNightCapability = {
|
|
|
112889
112918
|
tab: "image"
|
|
112890
112919
|
} },
|
|
112891
112920
|
methods: {
|
|
112921
|
+
/** The camera's day/night modes and current settings. */
|
|
112892
112922
|
getOptions: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), DayNightOptionsSchema),
|
|
112923
|
+
/** Change the camera's day/night mode, sensitivity or switch delay. */
|
|
112893
112924
|
setSettings: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
112894
112925
|
deviceId: /* @__PURE__ */ number(),
|
|
112895
112926
|
settings: DayNightSettingsPatchSchema
|
|
@@ -113254,21 +113285,28 @@ var deviceAdoptionCapability = {
|
|
|
113254
113285
|
kind: "poll"
|
|
113255
113286
|
},
|
|
113256
113287
|
methods: {
|
|
113288
|
+
/** The filters an integration offers to narrow its discovered candidates. */
|
|
113257
113289
|
listCandidateFilters: /* @__PURE__ */ method(/* @__PURE__ */ object({ integrationId: /* @__PURE__ */ string() }), /* @__PURE__ */ object({ filters: /* @__PURE__ */ array(AdoptionFilterSchema) }), { auth: "admin" }),
|
|
113290
|
+
/** List the devices an integration has discovered and that can be adopted. */
|
|
113258
113291
|
listCandidates: /* @__PURE__ */ method(ListCandidatesInputSchema, ListCandidatesOutputSchema, { auth: "admin" }),
|
|
113292
|
+
/** Fetch one discovered candidate; null when unknown. */
|
|
113259
113293
|
getCandidate: /* @__PURE__ */ method(GetCandidateInputSchema, /* @__PURE__ */ DiscoveredChildDeviceSchema.nullable(), { auth: "admin" }),
|
|
113294
|
+
/** Rescan an integration for new candidates and report the adoption status. */
|
|
113260
113295
|
refresh: /* @__PURE__ */ method(/* @__PURE__ */ object({ integrationId: /* @__PURE__ */ string() }), AdoptionStatusSchema, {
|
|
113261
113296
|
kind: "mutation",
|
|
113262
113297
|
auth: "admin"
|
|
113263
113298
|
}),
|
|
113299
|
+
/** Adopt a discovered candidate as a device. */
|
|
113264
113300
|
adopt: /* @__PURE__ */ method(AdoptInputSchema, AdoptResultSchema, {
|
|
113265
113301
|
kind: "mutation",
|
|
113266
113302
|
auth: "admin"
|
|
113267
113303
|
}),
|
|
113304
|
+
/** Release an adopted device back to the candidate list. */
|
|
113268
113305
|
release: /* @__PURE__ */ method(ReleaseInputSchema, /* @__PURE__ */ _void(), {
|
|
113269
113306
|
kind: "mutation",
|
|
113270
113307
|
auth: "admin"
|
|
113271
113308
|
}),
|
|
113309
|
+
/** Re-read an adopted device from the integration and reconcile it. */
|
|
113272
113310
|
resync: /* @__PURE__ */ method(ResyncInputSchema, ResyncResultSchema, {
|
|
113273
113311
|
kind: "mutation",
|
|
113274
113312
|
auth: "admin"
|
|
@@ -113632,9 +113670,13 @@ var deviceProviderCapability = {
|
|
|
113632
113670
|
scope: "system",
|
|
113633
113671
|
mode: "collection",
|
|
113634
113672
|
methods: {
|
|
113673
|
+
/** Start the provider so it begins serving its devices. */
|
|
113635
113674
|
start: /* @__PURE__ */ method(/* @__PURE__ */ _void(), /* @__PURE__ */ _void(), { kind: "mutation" }),
|
|
113675
|
+
/** Stop the provider. */
|
|
113636
113676
|
stop: /* @__PURE__ */ method(/* @__PURE__ */ _void(), /* @__PURE__ */ _void(), { kind: "mutation" }),
|
|
113677
|
+
/** The provider's current status. */
|
|
113637
113678
|
getStatus: /* @__PURE__ */ method(/* @__PURE__ */ _void(), ProviderStatusSchema),
|
|
113679
|
+
/** List the devices the provider serves. */
|
|
113638
113680
|
getDevices: /* @__PURE__ */ method(/* @__PURE__ */ _void(), /* @__PURE__ */ array(/* @__PURE__ */ object({
|
|
113639
113681
|
id: /* @__PURE__ */ string(),
|
|
113640
113682
|
name: /* @__PURE__ */ string(),
|
|
@@ -113669,6 +113711,7 @@ var deviceProviderCapability = {
|
|
|
113669
113711
|
kind: "mutation",
|
|
113670
113712
|
timeoutMs: 3 * 6e4
|
|
113671
113713
|
}),
|
|
113714
|
+
/** Whether the provider can discover devices on the network. */
|
|
113672
113715
|
supportsDiscovery: /* @__PURE__ */ method(/* @__PURE__ */ object({}), /* @__PURE__ */ boolean()),
|
|
113673
113716
|
/**
|
|
113674
113717
|
* Run a network scan. `params` carries optional provider-specific scan
|
|
@@ -113714,6 +113757,7 @@ var deviceProviderCapability = {
|
|
|
113714
113757
|
getManualCreationType: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
113715
113758
|
/** The integration asked about; a provider whose integrations differ answers per one. */
|
|
113716
113759
|
integrationId: /* @__PURE__ */ string().optional() }), /* @__PURE__ */ object({ deviceType: /* @__PURE__ */ _enum(DeviceType).nullable() })),
|
|
113760
|
+
/** Adopt a discovered candidate as a device, optionally into an integration instance. */
|
|
113717
113761
|
adoptDiscoveredDevice: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
113718
113762
|
candidate: DiscoveryCandidateSchema,
|
|
113719
113763
|
/** The integration the operator adopts into; a provider with several instances needs it. */
|
|
@@ -113722,6 +113766,7 @@ integrationId: /* @__PURE__ */ string().optional() }), /* @__PURE__ */ object({
|
|
|
113722
113766
|
kind: "mutation",
|
|
113723
113767
|
auth: "admin"
|
|
113724
113768
|
}),
|
|
113769
|
+
/** Whether devices can be created by hand through this provider. */
|
|
113725
113770
|
supportsManualCreation: /* @__PURE__ */ method(/* @__PURE__ */ object({}), /* @__PURE__ */ boolean()),
|
|
113726
113771
|
/**
|
|
113727
113772
|
* Fetch the creation form schema for a given DeviceType. Returns
|
|
@@ -113734,6 +113779,7 @@ integrationId: /* @__PURE__ */ string().optional() }), /* @__PURE__ */ object({
|
|
|
113734
113779
|
/** The integration asked about; a provider whose integrations differ answers per one. */
|
|
113735
113780
|
integrationId: /* @__PURE__ */ string().optional()
|
|
113736
113781
|
}), CreationSchemaOutputSchema),
|
|
113782
|
+
/** Create a device of a given type with the given config. */
|
|
113737
113783
|
createDevice: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
113738
113784
|
type: /* @__PURE__ */ _enum(DeviceType),
|
|
113739
113785
|
config: /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ unknown()),
|
|
@@ -113843,11 +113889,13 @@ var deviceStateRefreshCapability = {
|
|
|
113843
113889
|
deviceNative: true,
|
|
113844
113890
|
mode: "singleton",
|
|
113845
113891
|
methods: {
|
|
113892
|
+
/** Re-read a device's state from the source now. */
|
|
113846
113893
|
refresh: /* @__PURE__ */ method(DeviceStateRefreshInputSchema, DeviceStateRefreshResultSchema, {
|
|
113847
113894
|
kind: "mutation",
|
|
113848
113895
|
auth: "admin",
|
|
113849
113896
|
notOperatorFacing: NOT_OPERATOR_FACING
|
|
113850
113897
|
}),
|
|
113898
|
+
/** Re-establish a device's live state subscription. */
|
|
113851
113899
|
resubscribe: /* @__PURE__ */ method(DeviceStateResubscribeInputSchema, DeviceStateRefreshResultSchema, {
|
|
113852
113900
|
kind: "mutation",
|
|
113853
113901
|
auth: "admin",
|
|
@@ -114060,7 +114108,10 @@ onPressed: {
|
|
|
114060
114108
|
};
|
|
114061
114109
|
//#endregion
|
|
114062
114110
|
//#region ../types/dist/esm/capabilities/error.cap.mjs
|
|
114063
|
-
/**
|
|
114111
|
+
/**
|
|
114112
|
+
* How loudly a fault wants the operator. An `error` raises the attention event;
|
|
114113
|
+
* a `warning` is shown on the device and opens a warning alert, nothing more.
|
|
114114
|
+
*/
|
|
114064
114115
|
var DeviceErrorSeveritySchema = /* @__PURE__ */ _enum(["warning", "error"]);
|
|
114065
114116
|
/** One fault of a device that can raise several at once. */
|
|
114066
114117
|
var DeviceFaultSchema = /* @__PURE__ */ object({
|
|
@@ -114514,7 +114565,9 @@ var imageSettingsCapability = {
|
|
|
114514
114565
|
tab: "image"
|
|
114515
114566
|
} },
|
|
114516
114567
|
methods: {
|
|
114568
|
+
/** The camera's picture-adjustment options and current values. */
|
|
114517
114569
|
getOptions: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), ImageSettingsOptionsSchema),
|
|
114570
|
+
/** Change the camera's picture settings (brightness, contrast, orientation, exposure, ...). */
|
|
114518
114571
|
setSettings: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
114519
114572
|
deviceId: /* @__PURE__ */ number(),
|
|
114520
114573
|
settings: ImageSettingsPatchSchema
|
|
@@ -114804,6 +114857,7 @@ var integrationInstancesCapability = {
|
|
|
114804
114857
|
scope: "system",
|
|
114805
114858
|
mode: "collection",
|
|
114806
114859
|
methods: {
|
|
114860
|
+
/** What kind of instances this addon's integration holds and how to configure them. */
|
|
114807
114861
|
describe: /* @__PURE__ */ method(/* @__PURE__ */ _void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }),
|
|
114808
114862
|
/** The form; `id: null` is the create form. */
|
|
114809
114863
|
instanceFormSchema: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
@@ -114819,10 +114873,12 @@ var integrationInstancesCapability = {
|
|
|
114819
114873
|
/** The discovery candidate the wizard was seeded from (`stableId`), if any. */
|
|
114820
114874
|
candidateStableId: /* @__PURE__ */ string().min(1).optional()
|
|
114821
114875
|
}), ConfigSchemaPassthrough, { auth: "admin" }),
|
|
114876
|
+
/** List the integration's instances (accounts, relays, destinations). */
|
|
114822
114877
|
listInstances: /* @__PURE__ */ method(/* @__PURE__ */ looseObject({}), /* @__PURE__ */ array(IntegrationInstanceSchema).readonly(), {
|
|
114823
114878
|
auth: "protected",
|
|
114824
114879
|
caller: "scoped"
|
|
114825
114880
|
}),
|
|
114881
|
+
/** Fetch one integration instance by id; null when absent. */
|
|
114826
114882
|
getInstance: /* @__PURE__ */ method(/* @__PURE__ */ object({ id: IntegrationInstanceIdSchema }), /* @__PURE__ */ IntegrationInstanceSchema.nullable(), {
|
|
114827
114883
|
auth: "protected",
|
|
114828
114884
|
caller: "scoped"
|
|
@@ -114862,6 +114918,7 @@ var integrationInstancesCapability = {
|
|
|
114862
114918
|
auth: "protected",
|
|
114863
114919
|
caller: "scoped"
|
|
114864
114920
|
}),
|
|
114921
|
+
/** Create or change an integration instance. */
|
|
114865
114922
|
updateInstance: /* @__PURE__ */ method(IntegrationInstancePatchSchema, /* @__PURE__ */ object({ ok: /* @__PURE__ */ literal(true) }), {
|
|
114866
114923
|
kind: "mutation",
|
|
114867
114924
|
auth: "protected",
|
|
@@ -114890,6 +114947,7 @@ var integrationInstancesCapability = {
|
|
|
114890
114947
|
auth: "protected",
|
|
114891
114948
|
caller: "scoped"
|
|
114892
114949
|
}),
|
|
114950
|
+
/** Test an instance's connection with the given values before saving. */
|
|
114893
114951
|
testInstance: /* @__PURE__ */ optionalMethod(/* @__PURE__ */ object({
|
|
114894
114952
|
id: /* @__PURE__ */ IntegrationInstanceIdSchema.nullable(),
|
|
114895
114953
|
values: /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ unknown()),
|
|
@@ -115007,6 +115065,7 @@ var intercomCapability = {
|
|
|
115007
115065
|
auth: "protected",
|
|
115008
115066
|
notOperatorFacing: "live-stream session plumbing driven by a viewer, never a discrete step"
|
|
115009
115067
|
}),
|
|
115068
|
+
/** Pass the viewer's SDP answer to an open two-way audio session. */
|
|
115010
115069
|
handleAnswer: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
115011
115070
|
deviceId: /* @__PURE__ */ number(),
|
|
115012
115071
|
sessionId: /* @__PURE__ */ string(),
|
|
@@ -115677,7 +115736,12 @@ DeviceType.Camera;
|
|
|
115677
115736
|
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
115678
115737
|
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
115679
115738
|
* clip: how many parallel sessions the node carries before latency, drops,
|
|
115680
|
-
* CPU, RAM or the event loop give out
|
|
115739
|
+
* CPU, RAM or the event loop give out;
|
|
115740
|
+
* - `decode` — the node, no accelerator of the inference plane: an encoded
|
|
115741
|
+
* camera-like stream (a profile: resolution, rate, codec) served on the
|
|
115742
|
+
* loopback and decoded by the session decode worker a camera gets, with a
|
|
115743
|
+
* motion pass on its frames: how many concurrent streams keep the profile
|
|
115744
|
+
* frame rate inside the same CPU and RAM limits (D1078).
|
|
115681
115745
|
*/
|
|
115682
115746
|
/** Defaults and bounds, one place. */
|
|
115683
115747
|
var NODE_BENCHMARK_DEFAULTS = {
|
|
@@ -115696,9 +115760,24 @@ var NODE_BENCHMARK_DEFAULTS = {
|
|
|
115696
115760
|
/** Candidate models per device in one run. */
|
|
115697
115761
|
maxModelsPerDevice: 6
|
|
115698
115762
|
};
|
|
115763
|
+
/**
|
|
115764
|
+
* The camera-like streams the `decode` measurement ramps, heaviest first: a
|
|
115765
|
+
* 4K H.265 main stream and a 1080p H.264 one, at a camera frame rate.
|
|
115766
|
+
*/
|
|
115767
|
+
var NODE_BENCH_DECODE_PROFILES = [{
|
|
115768
|
+
width: 3840,
|
|
115769
|
+
height: 2160,
|
|
115770
|
+
fps: 15,
|
|
115771
|
+
codec: "h265"
|
|
115772
|
+
}, {
|
|
115773
|
+
width: 1920,
|
|
115774
|
+
height: 1080,
|
|
115775
|
+
fps: 15,
|
|
115776
|
+
codec: "h264"
|
|
115777
|
+
}];
|
|
115699
115778
|
NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice;
|
|
115700
115779
|
NODE_BENCHMARK_DEFAULTS.fpsPerStream, NODE_BENCHMARK_DEFAULTS.budgetMinutes;
|
|
115701
|
-
NODE_BENCHMARK_DEFAULTS.settleSec, NODE_BENCHMARK_DEFAULTS.measureSec;
|
|
115780
|
+
[...NODE_BENCH_DECODE_PROFILES], NODE_BENCHMARK_DEFAULTS.settleSec, NODE_BENCHMARK_DEFAULTS.measureSec;
|
|
115702
115781
|
/**
|
|
115703
115782
|
* Per-camera tunable ranges + defaults. Single source of truth used
|
|
115704
115783
|
* by both the Zod data schema (validation + default fallback) and
|
|
@@ -116058,7 +116137,9 @@ var motionTriggerCapability = {
|
|
|
116058
116137
|
DeviceType.Siren,
|
|
116059
116138
|
DeviceType.Switch
|
|
116060
116139
|
],
|
|
116061
|
-
methods: {
|
|
116140
|
+
methods: {
|
|
116141
|
+
/** Turn on or off activating the accessory when the camera detects motion. */
|
|
116142
|
+
setMotionTrigger: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
116062
116143
|
deviceId: /* @__PURE__ */ number().int().nonnegative(),
|
|
116063
116144
|
enabled: /* @__PURE__ */ boolean()
|
|
116064
116145
|
}), /* @__PURE__ */ _void(), {
|
|
@@ -116177,7 +116258,9 @@ var motionZonesCapability = {
|
|
|
116177
116258
|
label: "Motion Zones"
|
|
116178
116259
|
} },
|
|
116179
116260
|
methods: {
|
|
116261
|
+
/** The camera's onboard motion zone options and current zone. */
|
|
116180
116262
|
getOptions: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), MotionZoneOptionsSchema),
|
|
116263
|
+
/** Change the camera's onboard motion zone. */
|
|
116181
116264
|
setZone: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
116182
116265
|
deviceId: /* @__PURE__ */ number(),
|
|
116183
116266
|
patch: MotionZonePatchSchema
|
|
@@ -116305,7 +116388,9 @@ var nativeObjectDetectionCapability = {
|
|
|
116305
116388
|
mode: "singleton",
|
|
116306
116389
|
deviceTypes: [DeviceType.Camera],
|
|
116307
116390
|
methods: {
|
|
116391
|
+
/** The object classes the camera's onboard detection supports and its current settings. */
|
|
116308
116392
|
getOptions: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), NativeObjectDetectionOptionsSchema),
|
|
116393
|
+
/** Change the camera's onboard object detection settings. */
|
|
116309
116394
|
setSettings: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
116310
116395
|
deviceId: /* @__PURE__ */ number(),
|
|
116311
116396
|
settings: NativeObjectDetectionSettingsPatchSchema
|
|
@@ -116313,6 +116398,7 @@ var nativeObjectDetectionCapability = {
|
|
|
116313
116398
|
kind: "mutation",
|
|
116314
116399
|
auth: "admin"
|
|
116315
116400
|
}),
|
|
116401
|
+
/** Turn the camera's onboard object detection on or off. */
|
|
116316
116402
|
setEnabled: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
116317
116403
|
deviceId: /* @__PURE__ */ number(),
|
|
116318
116404
|
enabled: /* @__PURE__ */ boolean()
|
|
@@ -116748,7 +116834,9 @@ var privacyMaskCapability = {
|
|
|
116748
116834
|
label: "Privacy Mask"
|
|
116749
116835
|
} },
|
|
116750
116836
|
methods: {
|
|
116837
|
+
/** The camera's privacy mask options and current mask. */
|
|
116751
116838
|
getOptions: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), PrivacyMaskOptionsSchema),
|
|
116839
|
+
/** Change the camera's privacy mask. */
|
|
116752
116840
|
setMask: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
116753
116841
|
deviceId: /* @__PURE__ */ number(),
|
|
116754
116842
|
patch: PrivacyMaskPatchSchema
|
|
@@ -117039,10 +117127,12 @@ var ptzCapability = {
|
|
|
117039
117127
|
order: 0
|
|
117040
117128
|
} },
|
|
117041
117129
|
methods: {
|
|
117130
|
+
/** Nudge the camera by a relative pan, tilt or zoom step. */
|
|
117042
117131
|
move: /* @__PURE__ */ method(/* @__PURE__ */ PtzMoveCommandSchema.extend({ deviceId: /* @__PURE__ */ number() }), /* @__PURE__ */ _void(), {
|
|
117043
117132
|
kind: "mutation",
|
|
117044
117133
|
notOperatorFacing: "a relative nudge from the live-view joystick; a fixed place is a preset"
|
|
117045
117134
|
}),
|
|
117135
|
+
/** Move the camera continuously until stopped. */
|
|
117046
117136
|
continuousMove: /* @__PURE__ */ method(/* @__PURE__ */ PtzMoveCommandSchema.extend({ deviceId: /* @__PURE__ */ number() }), /* @__PURE__ */ _void(), {
|
|
117047
117137
|
kind: "mutation",
|
|
117048
117138
|
notOperatorFacing: "joystick motion held until released — continuous, not a discrete step"
|
|
@@ -117061,7 +117151,9 @@ var ptzCapability = {
|
|
|
117061
117151
|
icon: "house"
|
|
117062
117152
|
}]
|
|
117063
117153
|
}),
|
|
117154
|
+
/** List the camera's PTZ presets. */
|
|
117064
117155
|
getPresets: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), /* @__PURE__ */ array(PtzPresetSchema)),
|
|
117156
|
+
/** Move the camera to a preset. */
|
|
117065
117157
|
goToPreset: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
117066
117158
|
deviceId: /* @__PURE__ */ number(),
|
|
117067
117159
|
presetId: /* @__PURE__ */ string()
|
|
@@ -117085,6 +117177,7 @@ var ptzCapability = {
|
|
|
117085
117177
|
}]
|
|
117086
117178
|
}]
|
|
117087
117179
|
}),
|
|
117180
|
+
/** Save the camera's current position as a named preset. */
|
|
117088
117181
|
savePreset: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
117089
117182
|
deviceId: /* @__PURE__ */ number(),
|
|
117090
117183
|
presetId: /* @__PURE__ */ string(),
|
|
@@ -117114,6 +117207,7 @@ var ptzCapability = {
|
|
|
117114
117207
|
}]
|
|
117115
117208
|
}]
|
|
117116
117209
|
}),
|
|
117210
|
+
/** Delete a PTZ preset. */
|
|
117117
117211
|
deletePreset: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
117118
117212
|
deviceId: /* @__PURE__ */ number(),
|
|
117119
117213
|
presetId: /* @__PURE__ */ string()
|
|
@@ -117121,7 +117215,9 @@ var ptzCapability = {
|
|
|
117121
117215
|
kind: "mutation",
|
|
117122
117216
|
auth: "admin"
|
|
117123
117217
|
}),
|
|
117218
|
+
/** What the camera's PTZ supports (axes, speeds, presets). */
|
|
117124
117219
|
getOptions: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), PtzOptionsSchema),
|
|
117220
|
+
/** Stop any PTZ movement. */
|
|
117125
117221
|
stop: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), /* @__PURE__ */ _void(), {
|
|
117126
117222
|
kind: "mutation",
|
|
117127
117223
|
actions: [{
|
|
@@ -117482,7 +117578,9 @@ var rebootCapability = {
|
|
|
117482
117578
|
DeviceType.Switch,
|
|
117483
117579
|
DeviceType.Gateway
|
|
117484
117580
|
],
|
|
117485
|
-
methods: {
|
|
117581
|
+
methods: {
|
|
117582
|
+
/** Reboot the device. */
|
|
117583
|
+
reboot: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number().int().nonnegative() }), /* @__PURE__ */ object({ success: /* @__PURE__ */ literal(true) }), {
|
|
117486
117584
|
kind: "mutation",
|
|
117487
117585
|
auth: "admin",
|
|
117488
117586
|
actions: [{
|
|
@@ -118199,6 +118297,7 @@ var videoclipsCapability = {
|
|
|
118199
118297
|
order: 100
|
|
118200
118298
|
} },
|
|
118201
118299
|
methods: {
|
|
118300
|
+
/** List a camera's clips in a time window, from every clip source. */
|
|
118202
118301
|
listClips: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
118203
118302
|
deviceId: /* @__PURE__ */ number(),
|
|
118204
118303
|
since: /* @__PURE__ */ number(),
|
|
@@ -118257,6 +118356,7 @@ var videoclipsCapability = {
|
|
|
118257
118356
|
kind: "query",
|
|
118258
118357
|
auth: "protected"
|
|
118259
118358
|
}),
|
|
118359
|
+
/** How to play one clip, at the requested quality. */
|
|
118260
118360
|
getClipPlayback: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
118261
118361
|
deviceId: /* @__PURE__ */ number(),
|
|
118262
118362
|
clipId: /* @__PURE__ */ string(),
|
|
@@ -118871,7 +118971,9 @@ var recordingOnboardCapability = {
|
|
|
118871
118971
|
tab: "recording"
|
|
118872
118972
|
} },
|
|
118873
118973
|
methods: {
|
|
118974
|
+
/** The camera's onboard recording options and current settings. */
|
|
118874
118975
|
getOptions: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), RecordingOnboardOptionsSchema),
|
|
118976
|
+
/** Change the camera's onboard recording settings. */
|
|
118875
118977
|
setSettings: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
118876
118978
|
deviceId: /* @__PURE__ */ number(),
|
|
118877
118979
|
settings: RecordingOnboardPatchSchema
|
|
@@ -119183,6 +119285,7 @@ var snapshotCapability = {
|
|
|
119183
119285
|
deviceTypes: [DeviceType.Camera],
|
|
119184
119286
|
exposesDeviceSettings: true,
|
|
119185
119287
|
methods: {
|
|
119288
|
+
/** A current snapshot image of a camera, optionally bypassing the cache. */
|
|
119186
119289
|
getSnapshot: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
119187
119290
|
deviceId: /* @__PURE__ */ number(),
|
|
119188
119291
|
streamId: /* @__PURE__ */ string().optional(),
|
|
@@ -119204,6 +119307,7 @@ var snapshotCapability = {
|
|
|
119204
119307
|
*/
|
|
119205
119308
|
force: /* @__PURE__ */ boolean().optional()
|
|
119206
119309
|
}), /* @__PURE__ */ SnapshotImageSchema.nullable()),
|
|
119310
|
+
/** Drop a camera's cached snapshot. */
|
|
119207
119311
|
invalidateCache: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), /* @__PURE__ */ _void(), {
|
|
119208
119312
|
kind: "mutation",
|
|
119209
119313
|
auth: "admin"
|
|
@@ -119455,7 +119559,9 @@ var streamCatalogCapability = {
|
|
|
119455
119559
|
deviceNative: true,
|
|
119456
119560
|
mode: "singleton",
|
|
119457
119561
|
deviceTypes: [DeviceType.Camera],
|
|
119458
|
-
methods: {
|
|
119562
|
+
methods: {
|
|
119563
|
+
/** List the streams a camera offers. */
|
|
119564
|
+
getCatalog: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number().int().nonnegative() }), /* @__PURE__ */ array(CamStreamDescriptorSchema).readonly()) },
|
|
119459
119565
|
runtimeState: StreamCatalogStateSchema,
|
|
119460
119566
|
/**
|
|
119461
119567
|
* Runtime-state durability: **restored** — see the schema doc. A cold
|
|
@@ -119587,7 +119693,9 @@ var streamParamsCapability = {
|
|
|
119587
119693
|
tab: "streaming"
|
|
119588
119694
|
} },
|
|
119589
119695
|
methods: {
|
|
119696
|
+
/** The camera's stream profiles and their encoding options. */
|
|
119590
119697
|
getOptions: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), StreamParamsOptionsSchema),
|
|
119698
|
+
/** Change the encoding settings of one stream profile. */
|
|
119591
119699
|
setProfile: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
119592
119700
|
deviceId: /* @__PURE__ */ number(),
|
|
119593
119701
|
profile: StreamProfileSchema,
|
|
@@ -119817,6 +119925,7 @@ var switchCapability = {
|
|
|
119817
119925
|
DeviceType.Fan
|
|
119818
119926
|
],
|
|
119819
119927
|
methods: {
|
|
119928
|
+
/** Turn the switch on or off. */
|
|
119820
119929
|
setState: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
119821
119930
|
deviceId: /* @__PURE__ */ number(),
|
|
119822
119931
|
on: /* @__PURE__ */ boolean()
|
|
@@ -119847,12 +119956,15 @@ var switchCapability = {
|
|
|
119847
119956
|
offeredWhen: SWITCH_SETTABLE_GATE
|
|
119848
119957
|
}]
|
|
119849
119958
|
}),
|
|
119959
|
+
/** The options the switch supports. */
|
|
119850
119960
|
getOptions: /* @__PURE__ */ optionalMethod(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), SwitchOptionsSchema, { auth: "protected" }),
|
|
119961
|
+
/** Power-cycle the device the switch powers. */
|
|
119851
119962
|
powerCycle: /* @__PURE__ */ optionalMethod(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), /* @__PURE__ */ _void(), {
|
|
119852
119963
|
kind: "mutation",
|
|
119853
119964
|
auth: "protected",
|
|
119854
119965
|
notOperatorFacing: "a power cycle is the forced restart of the device the switch powers (power-source), never a step of its own"
|
|
119855
119966
|
}),
|
|
119967
|
+
/** Flip the switch to the opposite state. */
|
|
119856
119968
|
toggle: /* @__PURE__ */ optionalMethod(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), /* @__PURE__ */ _void(), {
|
|
119857
119969
|
kind: "mutation",
|
|
119858
119970
|
auth: "protected",
|
|
@@ -121181,6 +121293,10 @@ async function declareDeviceIdentifiers(deps, raw, options = {}) {
|
|
|
121181
121293
|
}
|
|
121182
121294
|
}
|
|
121183
121295
|
//#endregion
|
|
121296
|
+
//#region ../types/dist/esm/notification/alert-episode.mjs
|
|
121297
|
+
/** The category of the alert a device's `error` cap opens for its fault. */
|
|
121298
|
+
var DEVICE_ERROR_ALERT_CATEGORY = "device.error";
|
|
121299
|
+
//#endregion
|
|
121184
121300
|
//#region ../types/dist/esm/device/device-error-episode.mjs
|
|
121185
121301
|
/**
|
|
121186
121302
|
* The edge between two readings, or `null` for no edge.
|
|
@@ -121196,6 +121312,75 @@ function deviceErrorEdge(previous, next) {
|
|
|
121196
121312
|
if (next.active === false && previous?.active === true) return "resolve";
|
|
121197
121313
|
return null;
|
|
121198
121314
|
}
|
|
121315
|
+
/**
|
|
121316
|
+
* The alert severity of a fault tier. `error` is the cap's top tier and asks
|
|
121317
|
+
* for attention (`critical`); `warning` stays a warning.
|
|
121318
|
+
*/
|
|
121319
|
+
function deviceErrorAlertSeverity(severity) {
|
|
121320
|
+
return severity === "error" ? "critical" : "warning";
|
|
121321
|
+
}
|
|
121322
|
+
var DEVICE_ERROR_ALERT_IDLE = {
|
|
121323
|
+
neverOpened: false,
|
|
121324
|
+
pending: null,
|
|
121325
|
+
attempts: 0
|
|
121326
|
+
};
|
|
121327
|
+
/**
|
|
121328
|
+
* The alert write a reading asks for.
|
|
121329
|
+
*
|
|
121330
|
+
* - a START opens; a `warning` fault that becomes an `error` opens again (same
|
|
121331
|
+
* alert id and episode, now critical). An error that eases to a warning
|
|
121332
|
+
* writes nothing: its critical alert stays until the fault resolves;
|
|
121333
|
+
* - a RESOLVE closes, except an alert this process knows was never accepted —
|
|
121334
|
+
* that one has nothing to close, and its failed open is dropped;
|
|
121335
|
+
* - with no edge, a failed write is tried again while the reading still asks
|
|
121336
|
+
* for it. An unknown reading asks for nothing (D49).
|
|
121337
|
+
*/
|
|
121338
|
+
function planDeviceErrorAlert(delivery, edge, previous, next) {
|
|
121339
|
+
if (edge === "start") return {
|
|
121340
|
+
write: "open",
|
|
121341
|
+
delivery: {
|
|
121342
|
+
neverOpened: true,
|
|
121343
|
+
pending: "open",
|
|
121344
|
+
attempts: 0
|
|
121345
|
+
}
|
|
121346
|
+
};
|
|
121347
|
+
if (edge === "resolve") {
|
|
121348
|
+
if (delivery.neverOpened) return {
|
|
121349
|
+
write: null,
|
|
121350
|
+
delivery: DEVICE_ERROR_ALERT_IDLE
|
|
121351
|
+
};
|
|
121352
|
+
return {
|
|
121353
|
+
write: "close",
|
|
121354
|
+
delivery: {
|
|
121355
|
+
neverOpened: false,
|
|
121356
|
+
pending: "close",
|
|
121357
|
+
attempts: 0
|
|
121358
|
+
}
|
|
121359
|
+
};
|
|
121360
|
+
}
|
|
121361
|
+
if (next.active === true) {
|
|
121362
|
+
if (previous?.active === true && previous.severity === "warning" && next.severity === "error") return {
|
|
121363
|
+
write: "open",
|
|
121364
|
+
delivery: {
|
|
121365
|
+
...delivery,
|
|
121366
|
+
pending: "open",
|
|
121367
|
+
attempts: 0
|
|
121368
|
+
}
|
|
121369
|
+
};
|
|
121370
|
+
if (delivery.pending === "open") return {
|
|
121371
|
+
write: "open",
|
|
121372
|
+
delivery
|
|
121373
|
+
};
|
|
121374
|
+
}
|
|
121375
|
+
if (next.active === false && delivery.pending === "close") return {
|
|
121376
|
+
write: "close",
|
|
121377
|
+
delivery
|
|
121378
|
+
};
|
|
121379
|
+
return {
|
|
121380
|
+
write: null,
|
|
121381
|
+
delivery
|
|
121382
|
+
};
|
|
121383
|
+
}
|
|
121199
121384
|
function deviceErrorAlertId(deviceId) {
|
|
121200
121385
|
return `device-error:${String(deviceId)}`;
|
|
121201
121386
|
}
|
|
@@ -121220,8 +121405,8 @@ function buildDeviceErrorAlert(deviceId, deviceName, status, now) {
|
|
|
121220
121405
|
const alertId = deviceErrorAlertId(deviceId);
|
|
121221
121406
|
return {
|
|
121222
121407
|
id: alertId,
|
|
121223
|
-
category:
|
|
121224
|
-
severity:
|
|
121408
|
+
category: DEVICE_ERROR_ALERT_CATEGORY,
|
|
121409
|
+
severity: deviceErrorAlertSeverity(status.severity),
|
|
121225
121410
|
title: `${deviceName}: ${label}`,
|
|
121226
121411
|
message: `${deviceName} reports a fault: ${label}.`,
|
|
121227
121412
|
action: {
|
|
@@ -121298,6 +121483,7 @@ var DEVICE_LOCAL_STATE_CAP_NAMES = {
|
|
|
121298
121483
|
intercom: "intercom",
|
|
121299
121484
|
irTransmitter: "ir-transmitter",
|
|
121300
121485
|
lawnMowerControl: "lawn-mower-control",
|
|
121486
|
+
location: "location",
|
|
121301
121487
|
lockControl: "lock-control",
|
|
121302
121488
|
lowPowerSleep: "low-power-sleep",
|
|
121303
121489
|
mediaPlayer: "media-player",
|
|
@@ -121336,6 +121522,7 @@ var DEVICE_LOCAL_STATE_CAP_NAMES = {
|
|
|
121336
121522
|
update: "update",
|
|
121337
121523
|
vacuumControl: "vacuum-control",
|
|
121338
121524
|
valve: "valve",
|
|
121525
|
+
vehicle: "vehicle",
|
|
121339
121526
|
vibration: "vibration",
|
|
121340
121527
|
waterHeater: "water-heater",
|
|
121341
121528
|
weather: "weather",
|
|
@@ -121355,6 +121542,8 @@ var BaseDevice = class {
|
|
|
121355
121542
|
statusIsExternal;
|
|
121356
121543
|
/** The fault catalog the integration declared; `[]` until it does. */
|
|
121357
121544
|
faultTypes = [];
|
|
121545
|
+
/** What the alerts cap accepted for this device's fault, and the write still owed to it. */
|
|
121546
|
+
errorAlertDelivery = DEVICE_ERROR_ALERT_IDLE;
|
|
121358
121547
|
name;
|
|
121359
121548
|
parentDeviceId;
|
|
121360
121549
|
role;
|
|
@@ -121707,51 +121896,81 @@ var BaseDevice = class {
|
|
|
121707
121896
|
/**
|
|
121708
121897
|
* Publish the device's fault. The slice is written; on an EDGE (a fault
|
|
121709
121898
|
* starts, or one resolves) an attention episode opens or closes through the
|
|
121710
|
-
* alerts cap,
|
|
121711
|
-
*
|
|
121712
|
-
*
|
|
121899
|
+
* alerts cap, at the severity of the fault's tier: an `error` fault is a
|
|
121900
|
+
* critical alert, which the notification center announces as
|
|
121901
|
+
* `device-attention-required` / `-resolved`; a `warning` fault is a warning
|
|
121902
|
+
* alert and announces nothing until it becomes an error. An unknown reading
|
|
121903
|
+
* is never an edge. No rule exists by default: it notifies when the operator
|
|
121904
|
+
* makes one.
|
|
121905
|
+
*
|
|
121906
|
+
* An alert write that fails is tried again on the next reading that still
|
|
121907
|
+
* asks for it, `DEVICE_ERROR_ALERT_MAX_ATTEMPTS` times at most.
|
|
121713
121908
|
*/
|
|
121714
121909
|
async publishError(reading) {
|
|
121715
121910
|
const previous = this.getCapSlice(errorCapability);
|
|
121716
121911
|
if (reading.active === null && previous !== null && previous.active !== null) return;
|
|
121717
121912
|
const now = Date.now();
|
|
121718
121913
|
const edge = deviceErrorEdge(previous, reading);
|
|
121719
|
-
const next = edge === "start"
|
|
121914
|
+
const next = this.withErrorSince(previous, reading, edge === "start", now);
|
|
121915
|
+
this.setCapSlice(errorCapability, next);
|
|
121916
|
+
const plan = planDeviceErrorAlert(this.errorAlertDelivery, edge, previous, next);
|
|
121917
|
+
this.errorAlertDelivery = plan.delivery;
|
|
121918
|
+
if (plan.write === null) return;
|
|
121919
|
+
await this.writeErrorAlert(plan.write, next, now);
|
|
121920
|
+
}
|
|
121921
|
+
/** A fault keeps the start it was given: stamped on the start, carried while it lasts. */
|
|
121922
|
+
withErrorSince(previous, reading, starts, now) {
|
|
121923
|
+
if (reading.active !== true || reading.since !== null) return reading;
|
|
121924
|
+
if (starts) return {
|
|
121720
121925
|
...reading,
|
|
121721
121926
|
since: now
|
|
121722
|
-
}
|
|
121723
|
-
|
|
121724
|
-
|
|
121725
|
-
|
|
121726
|
-
|
|
121727
|
-
|
|
121728
|
-
|
|
121729
|
-
|
|
121730
|
-
|
|
121731
|
-
return;
|
|
121732
|
-
}
|
|
121927
|
+
};
|
|
121928
|
+
return previous?.since == null ? reading : {
|
|
121929
|
+
...reading,
|
|
121930
|
+
since: previous.since
|
|
121931
|
+
};
|
|
121932
|
+
}
|
|
121933
|
+
/** One attempt at the alert write the plan asked for; a failure stays owed, under the bound. */
|
|
121934
|
+
async writeErrorAlert(write, status, now) {
|
|
121935
|
+
const attempt = this.errorAlertDelivery.attempts + 1;
|
|
121733
121936
|
try {
|
|
121734
|
-
|
|
121735
|
-
|
|
121736
|
-
|
|
121737
|
-
|
|
121738
|
-
|
|
121739
|
-
|
|
121740
|
-
|
|
121741
|
-
|
|
121742
|
-
|
|
121743
|
-
|
|
121937
|
+
const alerts = this.ctx.api.alerts;
|
|
121938
|
+
if (alerts === void 0) throw new Error("alerts capability missing");
|
|
121939
|
+
if (write === "open") {
|
|
121940
|
+
await alerts.emit.mutate(buildDeviceErrorAlert(this.id, this.name, status, now));
|
|
121941
|
+
this.errorAlertDelivery = DEVICE_ERROR_ALERT_IDLE;
|
|
121942
|
+
} else {
|
|
121943
|
+
await alerts.update.mutate({
|
|
121944
|
+
alertId: deviceErrorAlertId(this.id),
|
|
121945
|
+
patch: {
|
|
121946
|
+
status: "completed",
|
|
121947
|
+
read: true,
|
|
121948
|
+
updatedAt: now
|
|
121949
|
+
}
|
|
121950
|
+
});
|
|
121951
|
+
this.errorAlertDelivery = DEVICE_ERROR_ALERT_IDLE;
|
|
121952
|
+
}
|
|
121953
|
+
this.ctx.logger.info(`device error: ${write === "open" ? "raised" : "resolved"}`, {
|
|
121744
121954
|
tags: { deviceId: this.id },
|
|
121745
121955
|
meta: {
|
|
121746
|
-
code:
|
|
121747
|
-
label:
|
|
121956
|
+
code: status.code,
|
|
121957
|
+
label: status.label,
|
|
121958
|
+
severity: status.severity,
|
|
121959
|
+
attempt
|
|
121748
121960
|
}
|
|
121749
121961
|
});
|
|
121750
121962
|
} catch (err) {
|
|
121751
|
-
|
|
121963
|
+
const givenUp = attempt >= 5;
|
|
121964
|
+
this.errorAlertDelivery = {
|
|
121965
|
+
...this.errorAlertDelivery,
|
|
121966
|
+
pending: givenUp ? null : write,
|
|
121967
|
+
attempts: givenUp ? 0 : attempt
|
|
121968
|
+
};
|
|
121969
|
+
this.ctx.logger.warn(givenUp ? "device error: attention event given up, the alert is not written" : "device error: attention event failed, retried on the next reading", {
|
|
121752
121970
|
tags: { deviceId: this.id },
|
|
121753
121971
|
meta: {
|
|
121754
|
-
|
|
121972
|
+
write,
|
|
121973
|
+
attempt,
|
|
121755
121974
|
error: errMsg$3(err)
|
|
121756
121975
|
}
|
|
121757
121976
|
});
|
|
@@ -129724,12 +129943,21 @@ function reportsPowerSource(info) {
|
|
|
129724
129943
|
* sleep, or while on mains or a panel, reports `0` as a placeholder — device
|
|
129725
129944
|
* 3628 sat at 100% on its adapter and raised a low-battery notification on
|
|
129726
129945
|
* every hourly wake. Those zeros are UNMEASURED: the caller keeps the last real
|
|
129727
|
-
* level.
|
|
129728
|
-
*
|
|
129946
|
+
* level.
|
|
129947
|
+
*
|
|
129948
|
+
* The same placeholder also arrives with NO power source to blame (device 3628,
|
|
129949
|
+
* its own Baichuan read): `batteryPercent: 0, chargeStatus: "none",
|
|
129950
|
+
* adapterStatus: "none", voltage: 0, current: 0, temperature: 0`, awake — an
|
|
129951
|
+
* all-zero payload that raised an empty-battery alert; the next read was 99.
|
|
129952
|
+
* A `0` level with a present `voltage` of 0 carries no cell measurement at all,
|
|
129953
|
+
* so it is UNMEASURED too. A `0` from an awake camera on its cell alone with a
|
|
129954
|
+
* real voltage (or a payload without the field) is a genuine empty cell and
|
|
129955
|
+
* passes, as does every non-zero level.
|
|
129729
129956
|
*/
|
|
129730
129957
|
function isMeasuredCameraBatteryLevel(level, context) {
|
|
129731
129958
|
if (level !== 0) return true;
|
|
129732
129959
|
if (context.sleeping) return false;
|
|
129960
|
+
if (context.voltage === 0) return false;
|
|
129733
129961
|
return context.charging !== "dc" && context.charging !== "solar";
|
|
129734
129962
|
}
|
|
129735
129963
|
/** What the cell is doing, from `chargeStatus`. Absent is `'unknown'`, never `'idle'` (D315). */
|
|
@@ -132837,16 +133065,6 @@ function buildPirPayload(enable, cfg) {
|
|
|
132837
133065
|
...typeof cfg.interval === "number" ? { interval: cfg.interval } : {}
|
|
132838
133066
|
};
|
|
132839
133067
|
}
|
|
132840
|
-
/** Keep `enable` plus only the tuning fields the firmware reported on read. */
|
|
132841
|
-
function reducePirPayload(payload, reported) {
|
|
132842
|
-
const has = (key) => typeof reported?.[key] === "number";
|
|
132843
|
-
return {
|
|
132844
|
-
enable: payload.enable,
|
|
132845
|
-
...has("sensitive") && payload.sensitive !== void 0 ? { sensitive: payload.sensitive } : {},
|
|
132846
|
-
...has("reduceAlarm") && payload.reduceAlarm !== void 0 ? { reduceAlarm: payload.reduceAlarm } : {},
|
|
132847
|
-
...has("interval") && payload.interval !== void 0 ? { interval: payload.interval } : {}
|
|
132848
|
-
};
|
|
132849
|
-
}
|
|
132850
133068
|
/** True for the firmware's `responseCode 400` refusal. */
|
|
132851
133069
|
function isBaichuan400(err) {
|
|
132852
133070
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -133053,43 +133271,18 @@ var PirAccessory = class extends BaseDevice {
|
|
|
133053
133271
|
});
|
|
133054
133272
|
try {
|
|
133055
133273
|
await api.setPirInfo(payload, this.channel);
|
|
133056
|
-
return;
|
|
133057
133274
|
} catch (err) {
|
|
133058
133275
|
if (!isBaichuan400(err)) throw err;
|
|
133059
|
-
this.ctx.logger.warn("pir setPirInfo
|
|
133276
|
+
this.ctx.logger.warn("pir setPirInfo refused by the camera", {
|
|
133060
133277
|
tags: { deviceId: this.id },
|
|
133061
133278
|
meta: {
|
|
133062
133279
|
channel: this.channel,
|
|
133063
|
-
attempt: "full",
|
|
133064
133280
|
payload,
|
|
133065
133281
|
responseCode: 400,
|
|
133066
133282
|
error: err instanceof Error ? err.message : String(err)
|
|
133067
133283
|
}
|
|
133068
133284
|
});
|
|
133069
|
-
|
|
133070
|
-
const reduced = reducePirPayload(payload, (await api.getPirInfo(this.channel)).state);
|
|
133071
|
-
try {
|
|
133072
|
-
await api.setPirInfo(reduced, this.channel);
|
|
133073
|
-
this.ctx.logger.info("pir setPirInfo succeeded with the reduced payload", {
|
|
133074
|
-
tags: { deviceId: this.id },
|
|
133075
|
-
meta: {
|
|
133076
|
-
channel: this.channel,
|
|
133077
|
-
attempt: "reduced",
|
|
133078
|
-
payload: reduced
|
|
133079
|
-
}
|
|
133080
|
-
});
|
|
133081
|
-
} catch (err) {
|
|
133082
|
-
this.ctx.logger.warn("pir setPirInfo failed on both attempts", {
|
|
133083
|
-
tags: { deviceId: this.id },
|
|
133084
|
-
meta: {
|
|
133085
|
-
channel: this.channel,
|
|
133086
|
-
attempt: "reduced",
|
|
133087
|
-
payload: reduced,
|
|
133088
|
-
responseCode: isBaichuan400(err) ? 400 : null,
|
|
133089
|
-
error: err instanceof Error ? err.message : String(err)
|
|
133090
|
-
}
|
|
133091
|
-
});
|
|
133092
|
-
throw new Error("The camera rejected the PIR settings (full and reduced request). Try again once it is awake, or change the PIR settings in the Reolink app.");
|
|
133285
|
+
throw new Error("The camera rejected the PIR settings. Try again once it is awake, or change the PIR settings in the Reolink app.");
|
|
133093
133286
|
}
|
|
133094
133287
|
}
|
|
133095
133288
|
getSettingsUISchema() {
|
|
@@ -133921,6 +134114,35 @@ function accessoryChildrenAnswerFor(sliceProbed, sliceFlags, specs) {
|
|
|
133921
134114
|
children: specs
|
|
133922
134115
|
};
|
|
133923
134116
|
}
|
|
134117
|
+
/**
|
|
134118
|
+
* A wake the camera itself (or our own look at it) reported. `hub-reconcile`
|
|
134119
|
+
* and `hub-summary` come from the parent's periodic sweep, which lags the real
|
|
134120
|
+
* state by minutes: a probe driven by one can log in and WAKE a standalone UDP
|
|
134121
|
+
* battery camera that fell asleep again, so they never trigger a re-probe.
|
|
134122
|
+
*/
|
|
134123
|
+
function isFirstHandWake(reason) {
|
|
134124
|
+
return reason === "simple-event" || reason === "sleep-poll" || reason === "confirmed-wake";
|
|
134125
|
+
}
|
|
134126
|
+
var AccessoryReprobeWindow = class {
|
|
134127
|
+
#lastAttemptAt = 0;
|
|
134128
|
+
#inFlight = false;
|
|
134129
|
+
/**
|
|
134130
|
+
* True (and the attempt is recorded) when the last probe that ran is older
|
|
134131
|
+
* than the window, the last attempt is older than the retry gap, and none is
|
|
134132
|
+
* in flight.
|
|
134133
|
+
*/
|
|
134134
|
+
tryBegin(now, lastProbedAt) {
|
|
134135
|
+
if (this.#inFlight) return false;
|
|
134136
|
+
if (now - lastProbedAt < 216e5) return false;
|
|
134137
|
+
if (this.#lastAttemptAt > 0 && now - this.#lastAttemptAt < 6e5) return false;
|
|
134138
|
+
this.#lastAttemptAt = now;
|
|
134139
|
+
this.#inFlight = true;
|
|
134140
|
+
return true;
|
|
134141
|
+
}
|
|
134142
|
+
end() {
|
|
134143
|
+
this.#inFlight = false;
|
|
134144
|
+
}
|
|
134145
|
+
};
|
|
133924
134146
|
//#endregion
|
|
133925
134147
|
//#region src/metadata-populator.ts
|
|
133926
134148
|
var EXTENDED_INFO_TAGS = [
|
|
@@ -136001,6 +136223,13 @@ var REOLINK_AUDIO_STREAM_KEYS = [
|
|
|
136001
136223
|
"thirdStream"
|
|
136002
136224
|
];
|
|
136003
136225
|
/** Generate a short random hex token for per-stream RTSP-style credentials. */
|
|
136226
|
+
/**
|
|
136227
|
+
* The error a login dialled with replaced settings ends with. A caller still
|
|
136228
|
+
* awaiting it retries through `ensureApi`, which dials with the new settings.
|
|
136229
|
+
*/
|
|
136230
|
+
function supersededLoginError(cause) {
|
|
136231
|
+
return new Error("Reolink login superseded by a connection settings change", { cause: cause ?? void 0 });
|
|
136232
|
+
}
|
|
136004
136233
|
function randomToken(bytes) {
|
|
136005
136234
|
return (0, node_crypto.randomBytes)(bytes).toString("hex");
|
|
136006
136235
|
}
|
|
@@ -136401,6 +136630,14 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
136401
136630
|
}
|
|
136402
136631
|
/** Login lock — concurrent demand events must not race the login flow. */
|
|
136403
136632
|
loginPromise = null;
|
|
136633
|
+
/**
|
|
136634
|
+
* Bumped by `disconnectAll`. A login started under an older generation was
|
|
136635
|
+
* dialled with the OLD settings (e.g. the relay before the operator picked
|
|
136636
|
+
* local-direct): it is closed and discarded instead of becoming `this.api`.
|
|
136637
|
+
*/
|
|
136638
|
+
loginGeneration = 0;
|
|
136639
|
+
/** The client a login in flight is dialling, so `disconnectAll` can abort it. */
|
|
136640
|
+
pendingLoginApi = null;
|
|
136404
136641
|
/** Wall-clock ms of the last video packet the stream server produced; 0 = none yet. */
|
|
136405
136642
|
lastVideoFlowAt = 0;
|
|
136406
136643
|
/** True once we've discovered (via getBatteryInfo) that this is a battery cam. */
|
|
@@ -136451,6 +136688,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
136451
136688
|
* `sleep-state-decision.ts` for the measurement (D603).
|
|
136452
136689
|
*/
|
|
136453
136690
|
sleepStateChangedAt = 0;
|
|
136691
|
+
accessoryReprobeWindow = new AccessoryReprobeWindow();
|
|
136454
136692
|
/**
|
|
136455
136693
|
* Wall-clock ms of the last PROACTIVE wake — one we issued on our own
|
|
136456
136694
|
* initiative (background snapshot refresh), not because the operator
|
|
@@ -137772,7 +138010,8 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
137772
138010
|
const reported = typeof info.batteryPercent === "number" ? Math.max(0, Math.min(100, Math.round(info.batteryPercent))) : void 0;
|
|
137773
138011
|
const measured = reported !== void 0 && isMeasuredCameraBatteryLevel(reported, {
|
|
137774
138012
|
sleeping,
|
|
137775
|
-
charging
|
|
138013
|
+
charging,
|
|
138014
|
+
voltage: info.voltage
|
|
137776
138015
|
});
|
|
137777
138016
|
if (reported === 0) this.ctx.logger.info("battery read reporting 0", {
|
|
137778
138017
|
tags: { deviceId: this.id },
|
|
@@ -141864,6 +142103,42 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
141864
142103
|
networkLinkFailureWarned = false;
|
|
141865
142104
|
static CONTACT_WRITE_QUANTUM_MS = 5 * 6e4;
|
|
141866
142105
|
/**
|
|
142106
|
+
* A battery camera probes its abilities once, so an accessory the firmware
|
|
142107
|
+
* never really had (a PIR switch on a camera without a PIR) could not be
|
|
142108
|
+
* pruned: the kernel needs a second probe on a later `lastProbedAt`. A natural
|
|
142109
|
+
* wake is the free moment — at most once per `ACCESSORY_REPROBE_WINDOW_MS`
|
|
142110
|
+
* (measured from the last probe that ran), never overlapping.
|
|
142111
|
+
*
|
|
142112
|
+
* ONLY a first-hand awake observation may trigger it. The periodic hub sweep
|
|
142113
|
+
* (`hub-reconcile`, `hub-summary`) also drives `onWakeTransition` but lags the
|
|
142114
|
+
* real state by minutes, and `onProbe` is gated by that same lagging flag: a
|
|
142115
|
+
* probe from there could log in and WAKE a camera that already went back to sleep.
|
|
142116
|
+
*/
|
|
142117
|
+
async reprobeAccessoriesIfStale(reason) {
|
|
142118
|
+
if (!this.isBattery || !isFirstHandWake(reason)) return;
|
|
142119
|
+
const lastProbedAt = this.runtimeState.getCapState("feature-probe")?.lastProbedAt ?? 0;
|
|
142120
|
+
const now = Date.now();
|
|
142121
|
+
if (!this.accessoryReprobeWindow.tryBegin(now, lastProbedAt)) return;
|
|
142122
|
+
this.ctx.logger.info("wake transition — accessory re-probe (last probe older than the window)", {
|
|
142123
|
+
tags: { deviceId: this.id },
|
|
142124
|
+
meta: {
|
|
142125
|
+
reason,
|
|
142126
|
+
lastProbedAt,
|
|
142127
|
+
ageMs: lastProbedAt > 0 ? now - lastProbedAt : null
|
|
142128
|
+
}
|
|
142129
|
+
});
|
|
142130
|
+
try {
|
|
142131
|
+
await this.reprobe();
|
|
142132
|
+
} catch (err) {
|
|
142133
|
+
this.ctx.logger.debug("onWakeTransition: accessory re-probe failed — a later first-hand wake retries", {
|
|
142134
|
+
tags: { deviceId: this.id },
|
|
142135
|
+
meta: { error: err instanceof Error ? err.message : String(err) }
|
|
142136
|
+
});
|
|
142137
|
+
} finally {
|
|
142138
|
+
this.accessoryReprobeWindow.end();
|
|
142139
|
+
}
|
|
142140
|
+
}
|
|
142141
|
+
/**
|
|
141867
142142
|
* Shared wake-transition handler invoked by both the simpleEvent
|
|
141868
142143
|
* `awake` push (canonical fast path) and the sleep poll's
|
|
141869
142144
|
* `sleeping → awake` flip (backstop). Fan out the refreshes that
|
|
@@ -141904,6 +142179,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
141904
142179
|
meta: { error: err instanceof Error ? err.message : String(err) }
|
|
141905
142180
|
});
|
|
141906
142181
|
}
|
|
142182
|
+
else await this.reprobeAccessoriesIfStale(reason);
|
|
141907
142183
|
if (!(this.isBattery ? await this.getBatteryRefresh().noteAwake().catch(() => false) : false)) {
|
|
141908
142184
|
await this.warmCapSlicesOnWake();
|
|
141909
142185
|
await this.warmSnapshotOnWake();
|
|
@@ -142239,6 +142515,13 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
142239
142515
|
const entries = [...this.active.values()];
|
|
142240
142516
|
this.active.clear();
|
|
142241
142517
|
this.keepAwake.stop();
|
|
142518
|
+
this.loginGeneration += 1;
|
|
142519
|
+
this.loginPromise = null;
|
|
142520
|
+
const pending = this.pendingLoginApi;
|
|
142521
|
+
this.pendingLoginApi = null;
|
|
142522
|
+
if (pending) try {
|
|
142523
|
+
await pending.close({ reason: "login-superseded" });
|
|
142524
|
+
} catch {}
|
|
142242
142525
|
for (const entry of entries) try {
|
|
142243
142526
|
await entry.server.close("disconnect-all");
|
|
142244
142527
|
} catch {}
|
|
@@ -143362,7 +143645,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
143362
143645
|
if (Object.keys(rest).length === 0 && !hasOsdPatch) return;
|
|
143363
143646
|
if (Object.keys(rest).length > 0) await this.config.setAll(rest);
|
|
143364
143647
|
const typedPatch = patch;
|
|
143365
|
-
if (typedPatch.host || typedPatch.port || typedPatch.username || typedPatch.password) {
|
|
143648
|
+
if (typedPatch.host || typedPatch.port || typedPatch.username || typedPatch.password || typedPatch.transport || typedPatch.uid || typedPatch.udpDiscoveryMethod) {
|
|
143366
143649
|
await this.disconnectAll();
|
|
143367
143650
|
return;
|
|
143368
143651
|
}
|
|
@@ -143848,6 +144131,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
143848
144131
|
debugOptions: debugOptions === void 0 ? null : Object.keys(debugOptions)
|
|
143849
144132
|
}
|
|
143850
144133
|
});
|
|
144134
|
+
const generation = this.loginGeneration;
|
|
143851
144135
|
this.loginPromise = (async () => {
|
|
143852
144136
|
const api = new ReolinkBaichuanApi({
|
|
143853
144137
|
host,
|
|
@@ -143860,14 +144144,24 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
143860
144144
|
...debugOptions ? { debugOptions } : {},
|
|
143861
144145
|
logger: this.libLoggerAdapter()
|
|
143862
144146
|
});
|
|
144147
|
+
this.pendingLoginApi = api;
|
|
143863
144148
|
try {
|
|
143864
144149
|
await api.login();
|
|
143865
144150
|
} catch (err) {
|
|
144151
|
+
if (generation !== this.loginGeneration) throw supersededLoginError(err);
|
|
144152
|
+
this.pendingLoginApi = null;
|
|
143866
144153
|
this.loginPromise = null;
|
|
143867
144154
|
if (isConnectivityFailure(err)) this.noteUnreachable(err instanceof Error ? err.message : String(err));
|
|
143868
144155
|
else if (this.ownsReachability()) this.reachability.noteReachable();
|
|
143869
144156
|
throw err;
|
|
143870
144157
|
}
|
|
144158
|
+
if (generation !== this.loginGeneration) {
|
|
144159
|
+
try {
|
|
144160
|
+
await api.close({ reason: "login-superseded" });
|
|
144161
|
+
} catch {}
|
|
144162
|
+
throw supersededLoginError(null);
|
|
144163
|
+
}
|
|
144164
|
+
this.pendingLoginApi = null;
|
|
143871
144165
|
this.api = api;
|
|
143872
144166
|
this.loginPromise = null;
|
|
143873
144167
|
this.reconnectAttempts = 0;
|
|
@@ -144438,7 +144732,8 @@ var AutodetectCache = class {
|
|
|
144438
144732
|
input.username,
|
|
144439
144733
|
passHash,
|
|
144440
144734
|
input.uid?.trim() ?? "",
|
|
144441
|
-
input.transport
|
|
144735
|
+
input.transport,
|
|
144736
|
+
input.udpDiscoveryMethod ?? ""
|
|
144442
144737
|
].join(":");
|
|
144443
144738
|
}
|
|
144444
144739
|
/**
|
|
@@ -144501,6 +144796,34 @@ var AutodetectCache = class {
|
|
|
144501
144796
|
}
|
|
144502
144797
|
};
|
|
144503
144798
|
//#endregion
|
|
144799
|
+
//#region src/autodetect-inputs.ts
|
|
144800
|
+
function readString(obj, key) {
|
|
144801
|
+
const v = obj[key];
|
|
144802
|
+
return typeof v === "string" ? v : "";
|
|
144803
|
+
}
|
|
144804
|
+
function readTransportMode(obj) {
|
|
144805
|
+
const v = obj["transport"];
|
|
144806
|
+
return v === "tcp" || v === "udp" || v === "auto" ? v : "auto";
|
|
144807
|
+
}
|
|
144808
|
+
/** `auto` / unknown / absent mean "race every method"; only a real method is kept. */
|
|
144809
|
+
function readDiscoveryMethod(obj) {
|
|
144810
|
+
const parsed = ReolinkUdpDiscoveryMethodSchema.safeParse(obj["udpDiscoveryMethod"]);
|
|
144811
|
+
return parsed.success ? parsed.data : void 0;
|
|
144812
|
+
}
|
|
144813
|
+
function buildAutodetectInputs(form) {
|
|
144814
|
+
const rawUid = readString(form, "uid").trim();
|
|
144815
|
+
const rawPort = form["port"];
|
|
144816
|
+
return {
|
|
144817
|
+
host: readString(form, "host").trim(),
|
|
144818
|
+
username: (readString(form, "username") || "admin").trim(),
|
|
144819
|
+
password: readString(form, "password"),
|
|
144820
|
+
uid: rawUid.length > 0 ? rawUid : void 0,
|
|
144821
|
+
transport: readTransportMode(form),
|
|
144822
|
+
port: typeof rawPort === "number" && Number.isFinite(rawPort) ? rawPort : 9e3,
|
|
144823
|
+
udpDiscoveryMethod: readDiscoveryMethod(form)
|
|
144824
|
+
};
|
|
144825
|
+
}
|
|
144826
|
+
//#endregion
|
|
144504
144827
|
//#region src/creation-schema.ts
|
|
144505
144828
|
/**
|
|
144506
144829
|
* Creation form for Reolink devices.
|
|
@@ -144678,6 +145001,28 @@ function buildCreationFormSchema() {
|
|
|
144678
145001
|
field: "transport",
|
|
144679
145002
|
notEquals: "tcp"
|
|
144680
145003
|
}
|
|
145004
|
+
},
|
|
145005
|
+
{
|
|
145006
|
+
type: "select",
|
|
145007
|
+
key: "udpDiscoveryMethod",
|
|
145008
|
+
label: "UDP discovery",
|
|
145009
|
+
labelKey: "provider-reolink:creation.s_connection.udpDiscoveryMethod.label",
|
|
145010
|
+
default: "auto",
|
|
145011
|
+
description: "Auto races every method and may settle on the Reolink relay. \"Local only\" talks straight to the camera IP and never uses Reolink servers.",
|
|
145012
|
+
descriptionKey: "provider-reolink:creation.s_connection.udpDiscoveryMethod.description",
|
|
145013
|
+
options: [{
|
|
145014
|
+
value: "auto",
|
|
145015
|
+
label: "Auto (may use the Reolink relay)",
|
|
145016
|
+
labelKey: "provider-reolink:creation.s_connection.udpDiscoveryMethod.o_auto.label"
|
|
145017
|
+
}, {
|
|
145018
|
+
value: "local-direct",
|
|
145019
|
+
label: "Local only (direct to the camera IP)",
|
|
145020
|
+
labelKey: "provider-reolink:creation.s_connection.udpDiscoveryMethod.o_local.label"
|
|
145021
|
+
}],
|
|
145022
|
+
showWhen: {
|
|
145023
|
+
field: "transport",
|
|
145024
|
+
notEquals: "tcp"
|
|
145025
|
+
}
|
|
144681
145026
|
}
|
|
144682
145027
|
]
|
|
144683
145028
|
},
|
|
@@ -146409,28 +146754,6 @@ function getString(obj, key) {
|
|
|
146409
146754
|
const v = obj[key];
|
|
146410
146755
|
return typeof v === "string" ? v : "";
|
|
146411
146756
|
}
|
|
146412
|
-
function getNumber(obj, key, fallback) {
|
|
146413
|
-
const v = obj[key];
|
|
146414
|
-
return typeof v === "number" && Number.isFinite(v) ? v : fallback;
|
|
146415
|
-
}
|
|
146416
|
-
function getTransportMode(obj) {
|
|
146417
|
-
const v = obj["transport"];
|
|
146418
|
-
return v === "tcp" || v === "udp" || v === "auto" ? v : "auto";
|
|
146419
|
-
}
|
|
146420
|
-
function buildAutodetectInputs(form) {
|
|
146421
|
-
const host = getString(form, "host").trim();
|
|
146422
|
-
const username = (getString(form, "username") || "admin").trim();
|
|
146423
|
-
const password = getString(form, "password");
|
|
146424
|
-
const rawUid = getString(form, "uid").trim();
|
|
146425
|
-
return {
|
|
146426
|
-
host,
|
|
146427
|
-
username,
|
|
146428
|
-
password,
|
|
146429
|
-
uid: rawUid.length > 0 ? rawUid : void 0,
|
|
146430
|
-
transport: getTransportMode(form),
|
|
146431
|
-
port: getNumber(form, "port", 9e3)
|
|
146432
|
-
};
|
|
146433
|
-
}
|
|
146434
146757
|
function buildAutodetectLabels(result) {
|
|
146435
146758
|
const labels = [];
|
|
146436
146759
|
const model = result.deviceInfo?.type;
|
|
@@ -147424,6 +147747,7 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
|
|
|
147424
147747
|
username: inputs.username,
|
|
147425
147748
|
password: inputs.password,
|
|
147426
147749
|
...inputs.uid ? { uid: inputs.uid } : {},
|
|
147750
|
+
...inputs.udpDiscoveryMethod ? { udpDiscoveryMethod: inputs.udpDiscoveryMethod } : {},
|
|
147427
147751
|
mode: inputs.transport
|
|
147428
147752
|
});
|
|
147429
147753
|
} else this.ctx.logger.info("autodetect cache hit — reusing api", {
|
|
@@ -147572,6 +147896,7 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
|
|
|
147572
147896
|
username: inputs.username,
|
|
147573
147897
|
password: inputs.password,
|
|
147574
147898
|
...inputs.uid ? { uid: inputs.uid } : {},
|
|
147899
|
+
...inputs.udpDiscoveryMethod ? { udpDiscoveryMethod: inputs.udpDiscoveryMethod } : {},
|
|
147575
147900
|
mode: inputs.transport,
|
|
147576
147901
|
logger: buildAutodetectLibLogger(probeLogger)
|
|
147577
147902
|
});
|