@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.mjs
CHANGED
|
@@ -29159,7 +29159,7 @@ var require_lz4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
29159
29159
|
};
|
|
29160
29160
|
}));
|
|
29161
29161
|
//#endregion
|
|
29162
|
-
//#region node_modules/@apocaliss92/nodelink-js/dist/chunk-
|
|
29162
|
+
//#region node_modules/@apocaliss92/nodelink-js/dist/chunk-2XVZ5ZZL.js
|
|
29163
29163
|
var import_fxp = require_fxp();
|
|
29164
29164
|
var import_lz4 = /* @__PURE__ */ __toESM(require_lz4(), 1);
|
|
29165
29165
|
function bcHeaderLen(messageClass, buf, bodyLen) {
|
|
@@ -37534,7 +37534,7 @@ function computeDeviceCapabilities(params) {
|
|
|
37534
37534
|
const hasZoomFromAbilities = ptzExplicitlyDisabledBySupportItem ? false : abilitiesHasAny(flat, /zoom|zoomFocus|StartZoomFocus/i);
|
|
37535
37535
|
const hasPresetsFromAbilities = abilitiesHasAny(flat, /preset/i);
|
|
37536
37536
|
const hasPirFromAbilities = abilitiesHasAny(flat, /(^|_)pir/i) || abilitiesHasAny(flat, /rfAlarm/i) || abilitiesHasAny(flat, /mdWithPir/i);
|
|
37537
|
-
const hasPirFromSupport = supportItem ? isTruthyNumberLike(supportItem.rfCfg) || isTruthyNumberLike(supportItem.newRfCfg) || isTruthyNumberLike(supportItem.rfVersion)
|
|
37537
|
+
const hasPirFromSupport = supportItem ? isTruthyNumberLike(supportItem.rfCfg) || isTruthyNumberLike(supportItem.newRfCfg) || isTruthyNumberLike(supportItem.rfVersion) : false;
|
|
37538
37538
|
const hasAutotrackingFromSupport = supportItem ? isTruthyNumberLike(supportItem.autoPt) || isTruthyNumberLike(supportItem.smartAI) : false;
|
|
37539
37539
|
const hasAutotrackingFromAbilities = abilitiesHasAny(flat, /smartTrack/i);
|
|
37540
37540
|
const hasBattery = hasBatteryFromSupport || hasBatteryFromAbilities;
|
|
@@ -105922,9 +105922,9 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
105922
105922
|
*/
|
|
105923
105923
|
EventCategory["DeviceStateChanged"] = "device.state-changed";
|
|
105924
105924
|
/**
|
|
105925
|
-
* A device COMMAND (a vocabulary action, D920/D983)
|
|
105926
|
-
*
|
|
105927
|
-
* failed. Never a device's own change. Payload: `DeviceCommandSettledEvent`
|
|
105925
|
+
* A device COMMAND (a vocabulary action, D920/D983) completed, as the hub's
|
|
105926
|
+
* command audit saw it (D1022, D1084): the call returned (`ok`) or threw
|
|
105927
|
+
* (`failed`). Never a device's own change, and never proof the device obeyed. Payload: `DeviceCommandSettledEvent`
|
|
105928
105928
|
* (`{deviceId, action, outcome, actor, at}`, no arguments). It feeds
|
|
105929
105929
|
* the Notification Center `device-command` kind. Telemetry (D8): losing one
|
|
105930
105930
|
* costs a notification, never state; the audit row is the record.
|
|
@@ -109023,6 +109023,15 @@ var BaseAddon = class {
|
|
|
109023
109023
|
/** The instance kinds whose switch move this process already ran (or tried), by record kind name. */
|
|
109024
109024
|
switchMoved = /* @__PURE__ */ new Set();
|
|
109025
109025
|
lastDeclared = [];
|
|
109026
|
+
/**
|
|
109027
|
+
* Every switch migration this process added to a declaration so far, by id. The engine replaces
|
|
109028
|
+
* an owner's catalogue on each declare, so a later one (a late kind) carries them all: dropping
|
|
109029
|
+
* an earlier id would read its applied ledger row as a newer database.
|
|
109030
|
+
*/
|
|
109031
|
+
switchDeclared = /* @__PURE__ */ new Map();
|
|
109032
|
+
/** The seq each kind's move got, fixed at its first declare so its id and seq never change. */
|
|
109033
|
+
switchSeqs = /* @__PURE__ */ new Map();
|
|
109034
|
+
moveInDeclared = false;
|
|
109026
109035
|
registrySwitchBound() {
|
|
109027
109036
|
const api = this.ctx.migrationApi;
|
|
109028
109037
|
const spec = this.registrySwitchSpec;
|
|
@@ -109033,7 +109042,7 @@ var BaseAddon = class {
|
|
|
109033
109042
|
return [];
|
|
109034
109043
|
}
|
|
109035
109044
|
const date = "2026-11-06";
|
|
109036
|
-
const moveIn = spec === null ? [] : migrationSet([registrySwitchToBodyMigration({
|
|
109045
|
+
const moveIn = spec === null || this.moveInDeclared ? [] : migrationSet([registrySwitchToBodyMigration({
|
|
109037
109046
|
addonId: this.ctx.id,
|
|
109038
109047
|
date,
|
|
109039
109048
|
seq: 1e3,
|
|
@@ -109043,12 +109052,15 @@ var BaseAddon = class {
|
|
|
109043
109052
|
records: switchRecordsOverMigrationApi(a),
|
|
109044
109053
|
kind: spec.kind
|
|
109045
109054
|
})).bind(api);
|
|
109046
|
-
|
|
109055
|
+
if (spec !== null) this.moveInDeclared = true;
|
|
109056
|
+
const moveBack = kinds.flatMap(({ kind }) => {
|
|
109047
109057
|
this.switchMoved.add(kind.name);
|
|
109058
|
+
const seq = 1001 + this.switchSeqs.size;
|
|
109059
|
+
this.switchSeqs.set(kind.name, seq);
|
|
109048
109060
|
return migrationSet([bodySwitchToRegistryMigration({
|
|
109049
109061
|
addonId: this.ctx.id,
|
|
109050
109062
|
date: "2026-11-19",
|
|
109051
|
-
seq
|
|
109063
|
+
seq,
|
|
109052
109064
|
kindName: kind.name,
|
|
109053
109065
|
...spec === null ? {} : { followsDate: date }
|
|
109054
109066
|
})], (a) => bodySwitchPortsOver({
|
|
@@ -109086,7 +109098,8 @@ var BaseAddon = class {
|
|
|
109086
109098
|
async runBound(declared, options) {
|
|
109087
109099
|
this.lastDeclared = declared;
|
|
109088
109100
|
const added = this.registrySwitchBound();
|
|
109089
|
-
const
|
|
109101
|
+
for (const m of added) this.switchDeclared.set(m.meta.id, m);
|
|
109102
|
+
const migrations = [...declared, ...[...this.switchDeclared.values()].filter((m) => !declared.some((d) => d.meta.id === m.meta.id))];
|
|
109090
109103
|
const widened = options?.only === void 0 || added.length === 0 ? options : {
|
|
109091
109104
|
...options,
|
|
109092
109105
|
only: [...new Set([...options.only, ...added.map((m) => m.meta.id)])]
|
|
@@ -110256,6 +110269,7 @@ function method(input, output, options) {
|
|
|
110256
110269
|
...options?.caller !== void 0 ? { caller: options.caller } : {},
|
|
110257
110270
|
...options?.actions !== void 0 ? { actions: options.actions } : {},
|
|
110258
110271
|
...options?.notOperatorFacing !== void 0 ? { notOperatorFacing: options.notOperatorFacing } : {},
|
|
110272
|
+
...options?.description !== void 0 ? { description: options.description } : {},
|
|
110259
110273
|
timeoutMs: options?.timeoutMs
|
|
110260
110274
|
};
|
|
110261
110275
|
}
|
|
@@ -111871,6 +111885,11 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
|
111871
111885
|
* water, cooling, solar), its system modes and its power. One main read-only
|
|
111872
111886
|
* `heat-pump-status` cap carries all of it; `heat-pump-control` sets it (D1026). */
|
|
111873
111887
|
DeviceType["HeatPump"] = "heat-pump";
|
|
111888
|
+
/** A road vehicle reached through its maker's connected-car account: odometer, range,
|
|
111889
|
+
* openings, tyre warnings and the 12 V battery in one read-only `vehicle` cap; where it
|
|
111890
|
+
* is in `location`; fuel, fluids and service in `consumables`. Its lock and its cabin
|
|
111891
|
+
* climate are accessory children (`lock-vehicle`, `climate-vehicle`). */
|
|
111892
|
+
DeviceType["Vehicle"] = "vehicle";
|
|
111874
111893
|
/** A home energy installation (any vendor): solar, grid, house, a metered heat pump
|
|
111875
111894
|
* and the storage as branches of one bus. One read-only `energy-system` cap carries
|
|
111876
111895
|
* every value; the storage is a field of it, never the `battery` cap (#513, #522). */
|
|
@@ -112113,6 +112132,14 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
112113
112132
|
/** One heating/cooling circuit of a heat pump: a water loop with comfort /
|
|
112114
112133
|
* eco setpoints and a heat/cool mode, no room sensor. */
|
|
112115
112134
|
DeviceRole["ClimateHeatPumpCircuit"] = "climate-heat-pump-circuit";
|
|
112135
|
+
/** A car's cabin: pre-conditioning (start / stop, target temperature) through the
|
|
112136
|
+
* maker's connected-car account. An accessory child of a vehicle. */
|
|
112137
|
+
DeviceRole["ClimateVehicle"] = "climate-vehicle";
|
|
112138
|
+
/** A car's central locking, an accessory child of a vehicle. Slow, cloud-held
|
|
112139
|
+
* commands; exports decide by `isVehicleLock`. */
|
|
112140
|
+
DeviceRole["LockVehicle"] = "lock-vehicle";
|
|
112141
|
+
/** A television: power, volume, channel, source and apps. */
|
|
112142
|
+
DeviceRole["MediaPlayerTv"] = "media-player-tv";
|
|
112116
112143
|
/** Generic motion / occupancy / moving event source. Distinct from
|
|
112117
112144
|
* the camera accessory PirSensor role: that one is a camera child;
|
|
112118
112145
|
* this is a standalone HA / 3rd-party motion sensor. */
|
|
@@ -112687,7 +112714,9 @@ var brightnessCapability = {
|
|
|
112687
112714
|
deviceNative: true,
|
|
112688
112715
|
mode: "singleton",
|
|
112689
112716
|
deviceTypes: [DeviceType.Light],
|
|
112690
|
-
methods: {
|
|
112717
|
+
methods: {
|
|
112718
|
+
/** Set the light's brightness level from 0 to 100. */
|
|
112719
|
+
setBrightness: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
112691
112720
|
deviceId: /* @__PURE__ */ number().int().nonnegative(),
|
|
112692
112721
|
level: /* @__PURE__ */ number().min(0).max(100)
|
|
112693
112722
|
}), /* @__PURE__ */ _void(), {
|
|
@@ -112883,7 +112912,9 @@ var dayNightCapability = {
|
|
|
112883
112912
|
tab: "image"
|
|
112884
112913
|
} },
|
|
112885
112914
|
methods: {
|
|
112915
|
+
/** The camera's day/night modes and current settings. */
|
|
112886
112916
|
getOptions: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), DayNightOptionsSchema),
|
|
112917
|
+
/** Change the camera's day/night mode, sensitivity or switch delay. */
|
|
112887
112918
|
setSettings: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
112888
112919
|
deviceId: /* @__PURE__ */ number(),
|
|
112889
112920
|
settings: DayNightSettingsPatchSchema
|
|
@@ -113248,21 +113279,28 @@ var deviceAdoptionCapability = {
|
|
|
113248
113279
|
kind: "poll"
|
|
113249
113280
|
},
|
|
113250
113281
|
methods: {
|
|
113282
|
+
/** The filters an integration offers to narrow its discovered candidates. */
|
|
113251
113283
|
listCandidateFilters: /* @__PURE__ */ method(/* @__PURE__ */ object({ integrationId: /* @__PURE__ */ string() }), /* @__PURE__ */ object({ filters: /* @__PURE__ */ array(AdoptionFilterSchema) }), { auth: "admin" }),
|
|
113284
|
+
/** List the devices an integration has discovered and that can be adopted. */
|
|
113252
113285
|
listCandidates: /* @__PURE__ */ method(ListCandidatesInputSchema, ListCandidatesOutputSchema, { auth: "admin" }),
|
|
113286
|
+
/** Fetch one discovered candidate; null when unknown. */
|
|
113253
113287
|
getCandidate: /* @__PURE__ */ method(GetCandidateInputSchema, /* @__PURE__ */ DiscoveredChildDeviceSchema.nullable(), { auth: "admin" }),
|
|
113288
|
+
/** Rescan an integration for new candidates and report the adoption status. */
|
|
113254
113289
|
refresh: /* @__PURE__ */ method(/* @__PURE__ */ object({ integrationId: /* @__PURE__ */ string() }), AdoptionStatusSchema, {
|
|
113255
113290
|
kind: "mutation",
|
|
113256
113291
|
auth: "admin"
|
|
113257
113292
|
}),
|
|
113293
|
+
/** Adopt a discovered candidate as a device. */
|
|
113258
113294
|
adopt: /* @__PURE__ */ method(AdoptInputSchema, AdoptResultSchema, {
|
|
113259
113295
|
kind: "mutation",
|
|
113260
113296
|
auth: "admin"
|
|
113261
113297
|
}),
|
|
113298
|
+
/** Release an adopted device back to the candidate list. */
|
|
113262
113299
|
release: /* @__PURE__ */ method(ReleaseInputSchema, /* @__PURE__ */ _void(), {
|
|
113263
113300
|
kind: "mutation",
|
|
113264
113301
|
auth: "admin"
|
|
113265
113302
|
}),
|
|
113303
|
+
/** Re-read an adopted device from the integration and reconcile it. */
|
|
113266
113304
|
resync: /* @__PURE__ */ method(ResyncInputSchema, ResyncResultSchema, {
|
|
113267
113305
|
kind: "mutation",
|
|
113268
113306
|
auth: "admin"
|
|
@@ -113626,9 +113664,13 @@ var deviceProviderCapability = {
|
|
|
113626
113664
|
scope: "system",
|
|
113627
113665
|
mode: "collection",
|
|
113628
113666
|
methods: {
|
|
113667
|
+
/** Start the provider so it begins serving its devices. */
|
|
113629
113668
|
start: /* @__PURE__ */ method(/* @__PURE__ */ _void(), /* @__PURE__ */ _void(), { kind: "mutation" }),
|
|
113669
|
+
/** Stop the provider. */
|
|
113630
113670
|
stop: /* @__PURE__ */ method(/* @__PURE__ */ _void(), /* @__PURE__ */ _void(), { kind: "mutation" }),
|
|
113671
|
+
/** The provider's current status. */
|
|
113631
113672
|
getStatus: /* @__PURE__ */ method(/* @__PURE__ */ _void(), ProviderStatusSchema),
|
|
113673
|
+
/** List the devices the provider serves. */
|
|
113632
113674
|
getDevices: /* @__PURE__ */ method(/* @__PURE__ */ _void(), /* @__PURE__ */ array(/* @__PURE__ */ object({
|
|
113633
113675
|
id: /* @__PURE__ */ string(),
|
|
113634
113676
|
name: /* @__PURE__ */ string(),
|
|
@@ -113663,6 +113705,7 @@ var deviceProviderCapability = {
|
|
|
113663
113705
|
kind: "mutation",
|
|
113664
113706
|
timeoutMs: 3 * 6e4
|
|
113665
113707
|
}),
|
|
113708
|
+
/** Whether the provider can discover devices on the network. */
|
|
113666
113709
|
supportsDiscovery: /* @__PURE__ */ method(/* @__PURE__ */ object({}), /* @__PURE__ */ boolean()),
|
|
113667
113710
|
/**
|
|
113668
113711
|
* Run a network scan. `params` carries optional provider-specific scan
|
|
@@ -113708,6 +113751,7 @@ var deviceProviderCapability = {
|
|
|
113708
113751
|
getManualCreationType: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
113709
113752
|
/** The integration asked about; a provider whose integrations differ answers per one. */
|
|
113710
113753
|
integrationId: /* @__PURE__ */ string().optional() }), /* @__PURE__ */ object({ deviceType: /* @__PURE__ */ _enum(DeviceType).nullable() })),
|
|
113754
|
+
/** Adopt a discovered candidate as a device, optionally into an integration instance. */
|
|
113711
113755
|
adoptDiscoveredDevice: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
113712
113756
|
candidate: DiscoveryCandidateSchema,
|
|
113713
113757
|
/** The integration the operator adopts into; a provider with several instances needs it. */
|
|
@@ -113716,6 +113760,7 @@ integrationId: /* @__PURE__ */ string().optional() }), /* @__PURE__ */ object({
|
|
|
113716
113760
|
kind: "mutation",
|
|
113717
113761
|
auth: "admin"
|
|
113718
113762
|
}),
|
|
113763
|
+
/** Whether devices can be created by hand through this provider. */
|
|
113719
113764
|
supportsManualCreation: /* @__PURE__ */ method(/* @__PURE__ */ object({}), /* @__PURE__ */ boolean()),
|
|
113720
113765
|
/**
|
|
113721
113766
|
* Fetch the creation form schema for a given DeviceType. Returns
|
|
@@ -113728,6 +113773,7 @@ integrationId: /* @__PURE__ */ string().optional() }), /* @__PURE__ */ object({
|
|
|
113728
113773
|
/** The integration asked about; a provider whose integrations differ answers per one. */
|
|
113729
113774
|
integrationId: /* @__PURE__ */ string().optional()
|
|
113730
113775
|
}), CreationSchemaOutputSchema),
|
|
113776
|
+
/** Create a device of a given type with the given config. */
|
|
113731
113777
|
createDevice: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
113732
113778
|
type: /* @__PURE__ */ _enum(DeviceType),
|
|
113733
113779
|
config: /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ unknown()),
|
|
@@ -113837,11 +113883,13 @@ var deviceStateRefreshCapability = {
|
|
|
113837
113883
|
deviceNative: true,
|
|
113838
113884
|
mode: "singleton",
|
|
113839
113885
|
methods: {
|
|
113886
|
+
/** Re-read a device's state from the source now. */
|
|
113840
113887
|
refresh: /* @__PURE__ */ method(DeviceStateRefreshInputSchema, DeviceStateRefreshResultSchema, {
|
|
113841
113888
|
kind: "mutation",
|
|
113842
113889
|
auth: "admin",
|
|
113843
113890
|
notOperatorFacing: NOT_OPERATOR_FACING
|
|
113844
113891
|
}),
|
|
113892
|
+
/** Re-establish a device's live state subscription. */
|
|
113845
113893
|
resubscribe: /* @__PURE__ */ method(DeviceStateResubscribeInputSchema, DeviceStateRefreshResultSchema, {
|
|
113846
113894
|
kind: "mutation",
|
|
113847
113895
|
auth: "admin",
|
|
@@ -114054,7 +114102,10 @@ onPressed: {
|
|
|
114054
114102
|
};
|
|
114055
114103
|
//#endregion
|
|
114056
114104
|
//#region ../types/dist/esm/capabilities/error.cap.mjs
|
|
114057
|
-
/**
|
|
114105
|
+
/**
|
|
114106
|
+
* How loudly a fault wants the operator. An `error` raises the attention event;
|
|
114107
|
+
* a `warning` is shown on the device and opens a warning alert, nothing more.
|
|
114108
|
+
*/
|
|
114058
114109
|
var DeviceErrorSeveritySchema = /* @__PURE__ */ _enum(["warning", "error"]);
|
|
114059
114110
|
/** One fault of a device that can raise several at once. */
|
|
114060
114111
|
var DeviceFaultSchema = /* @__PURE__ */ object({
|
|
@@ -114508,7 +114559,9 @@ var imageSettingsCapability = {
|
|
|
114508
114559
|
tab: "image"
|
|
114509
114560
|
} },
|
|
114510
114561
|
methods: {
|
|
114562
|
+
/** The camera's picture-adjustment options and current values. */
|
|
114511
114563
|
getOptions: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), ImageSettingsOptionsSchema),
|
|
114564
|
+
/** Change the camera's picture settings (brightness, contrast, orientation, exposure, ...). */
|
|
114512
114565
|
setSettings: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
114513
114566
|
deviceId: /* @__PURE__ */ number(),
|
|
114514
114567
|
settings: ImageSettingsPatchSchema
|
|
@@ -114798,6 +114851,7 @@ var integrationInstancesCapability = {
|
|
|
114798
114851
|
scope: "system",
|
|
114799
114852
|
mode: "collection",
|
|
114800
114853
|
methods: {
|
|
114854
|
+
/** What kind of instances this addon's integration holds and how to configure them. */
|
|
114801
114855
|
describe: /* @__PURE__ */ method(/* @__PURE__ */ _void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }),
|
|
114802
114856
|
/** The form; `id: null` is the create form. */
|
|
114803
114857
|
instanceFormSchema: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
@@ -114813,10 +114867,12 @@ var integrationInstancesCapability = {
|
|
|
114813
114867
|
/** The discovery candidate the wizard was seeded from (`stableId`), if any. */
|
|
114814
114868
|
candidateStableId: /* @__PURE__ */ string().min(1).optional()
|
|
114815
114869
|
}), ConfigSchemaPassthrough, { auth: "admin" }),
|
|
114870
|
+
/** List the integration's instances (accounts, relays, destinations). */
|
|
114816
114871
|
listInstances: /* @__PURE__ */ method(/* @__PURE__ */ looseObject({}), /* @__PURE__ */ array(IntegrationInstanceSchema).readonly(), {
|
|
114817
114872
|
auth: "protected",
|
|
114818
114873
|
caller: "scoped"
|
|
114819
114874
|
}),
|
|
114875
|
+
/** Fetch one integration instance by id; null when absent. */
|
|
114820
114876
|
getInstance: /* @__PURE__ */ method(/* @__PURE__ */ object({ id: IntegrationInstanceIdSchema }), /* @__PURE__ */ IntegrationInstanceSchema.nullable(), {
|
|
114821
114877
|
auth: "protected",
|
|
114822
114878
|
caller: "scoped"
|
|
@@ -114856,6 +114912,7 @@ var integrationInstancesCapability = {
|
|
|
114856
114912
|
auth: "protected",
|
|
114857
114913
|
caller: "scoped"
|
|
114858
114914
|
}),
|
|
114915
|
+
/** Create or change an integration instance. */
|
|
114859
114916
|
updateInstance: /* @__PURE__ */ method(IntegrationInstancePatchSchema, /* @__PURE__ */ object({ ok: /* @__PURE__ */ literal(true) }), {
|
|
114860
114917
|
kind: "mutation",
|
|
114861
114918
|
auth: "protected",
|
|
@@ -114884,6 +114941,7 @@ var integrationInstancesCapability = {
|
|
|
114884
114941
|
auth: "protected",
|
|
114885
114942
|
caller: "scoped"
|
|
114886
114943
|
}),
|
|
114944
|
+
/** Test an instance's connection with the given values before saving. */
|
|
114887
114945
|
testInstance: /* @__PURE__ */ optionalMethod(/* @__PURE__ */ object({
|
|
114888
114946
|
id: /* @__PURE__ */ IntegrationInstanceIdSchema.nullable(),
|
|
114889
114947
|
values: /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ unknown()),
|
|
@@ -115001,6 +115059,7 @@ var intercomCapability = {
|
|
|
115001
115059
|
auth: "protected",
|
|
115002
115060
|
notOperatorFacing: "live-stream session plumbing driven by a viewer, never a discrete step"
|
|
115003
115061
|
}),
|
|
115062
|
+
/** Pass the viewer's SDP answer to an open two-way audio session. */
|
|
115004
115063
|
handleAnswer: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
115005
115064
|
deviceId: /* @__PURE__ */ number(),
|
|
115006
115065
|
sessionId: /* @__PURE__ */ string(),
|
|
@@ -115671,7 +115730,12 @@ DeviceType.Camera;
|
|
|
115671
115730
|
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
115672
115731
|
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
115673
115732
|
* clip: how many parallel sessions the node carries before latency, drops,
|
|
115674
|
-
* CPU, RAM or the event loop give out
|
|
115733
|
+
* CPU, RAM or the event loop give out;
|
|
115734
|
+
* - `decode` — the node, no accelerator of the inference plane: an encoded
|
|
115735
|
+
* camera-like stream (a profile: resolution, rate, codec) served on the
|
|
115736
|
+
* loopback and decoded by the session decode worker a camera gets, with a
|
|
115737
|
+
* motion pass on its frames: how many concurrent streams keep the profile
|
|
115738
|
+
* frame rate inside the same CPU and RAM limits (D1078).
|
|
115675
115739
|
*/
|
|
115676
115740
|
/** Defaults and bounds, one place. */
|
|
115677
115741
|
var NODE_BENCHMARK_DEFAULTS = {
|
|
@@ -115690,9 +115754,24 @@ var NODE_BENCHMARK_DEFAULTS = {
|
|
|
115690
115754
|
/** Candidate models per device in one run. */
|
|
115691
115755
|
maxModelsPerDevice: 6
|
|
115692
115756
|
};
|
|
115757
|
+
/**
|
|
115758
|
+
* The camera-like streams the `decode` measurement ramps, heaviest first: a
|
|
115759
|
+
* 4K H.265 main stream and a 1080p H.264 one, at a camera frame rate.
|
|
115760
|
+
*/
|
|
115761
|
+
var NODE_BENCH_DECODE_PROFILES = [{
|
|
115762
|
+
width: 3840,
|
|
115763
|
+
height: 2160,
|
|
115764
|
+
fps: 15,
|
|
115765
|
+
codec: "h265"
|
|
115766
|
+
}, {
|
|
115767
|
+
width: 1920,
|
|
115768
|
+
height: 1080,
|
|
115769
|
+
fps: 15,
|
|
115770
|
+
codec: "h264"
|
|
115771
|
+
}];
|
|
115693
115772
|
NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice;
|
|
115694
115773
|
NODE_BENCHMARK_DEFAULTS.fpsPerStream, NODE_BENCHMARK_DEFAULTS.budgetMinutes;
|
|
115695
|
-
NODE_BENCHMARK_DEFAULTS.settleSec, NODE_BENCHMARK_DEFAULTS.measureSec;
|
|
115774
|
+
[...NODE_BENCH_DECODE_PROFILES], NODE_BENCHMARK_DEFAULTS.settleSec, NODE_BENCHMARK_DEFAULTS.measureSec;
|
|
115696
115775
|
/**
|
|
115697
115776
|
* Per-camera tunable ranges + defaults. Single source of truth used
|
|
115698
115777
|
* by both the Zod data schema (validation + default fallback) and
|
|
@@ -116052,7 +116131,9 @@ var motionTriggerCapability = {
|
|
|
116052
116131
|
DeviceType.Siren,
|
|
116053
116132
|
DeviceType.Switch
|
|
116054
116133
|
],
|
|
116055
|
-
methods: {
|
|
116134
|
+
methods: {
|
|
116135
|
+
/** Turn on or off activating the accessory when the camera detects motion. */
|
|
116136
|
+
setMotionTrigger: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
116056
116137
|
deviceId: /* @__PURE__ */ number().int().nonnegative(),
|
|
116057
116138
|
enabled: /* @__PURE__ */ boolean()
|
|
116058
116139
|
}), /* @__PURE__ */ _void(), {
|
|
@@ -116171,7 +116252,9 @@ var motionZonesCapability = {
|
|
|
116171
116252
|
label: "Motion Zones"
|
|
116172
116253
|
} },
|
|
116173
116254
|
methods: {
|
|
116255
|
+
/** The camera's onboard motion zone options and current zone. */
|
|
116174
116256
|
getOptions: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), MotionZoneOptionsSchema),
|
|
116257
|
+
/** Change the camera's onboard motion zone. */
|
|
116175
116258
|
setZone: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
116176
116259
|
deviceId: /* @__PURE__ */ number(),
|
|
116177
116260
|
patch: MotionZonePatchSchema
|
|
@@ -116299,7 +116382,9 @@ var nativeObjectDetectionCapability = {
|
|
|
116299
116382
|
mode: "singleton",
|
|
116300
116383
|
deviceTypes: [DeviceType.Camera],
|
|
116301
116384
|
methods: {
|
|
116385
|
+
/** The object classes the camera's onboard detection supports and its current settings. */
|
|
116302
116386
|
getOptions: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), NativeObjectDetectionOptionsSchema),
|
|
116387
|
+
/** Change the camera's onboard object detection settings. */
|
|
116303
116388
|
setSettings: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
116304
116389
|
deviceId: /* @__PURE__ */ number(),
|
|
116305
116390
|
settings: NativeObjectDetectionSettingsPatchSchema
|
|
@@ -116307,6 +116392,7 @@ var nativeObjectDetectionCapability = {
|
|
|
116307
116392
|
kind: "mutation",
|
|
116308
116393
|
auth: "admin"
|
|
116309
116394
|
}),
|
|
116395
|
+
/** Turn the camera's onboard object detection on or off. */
|
|
116310
116396
|
setEnabled: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
116311
116397
|
deviceId: /* @__PURE__ */ number(),
|
|
116312
116398
|
enabled: /* @__PURE__ */ boolean()
|
|
@@ -116742,7 +116828,9 @@ var privacyMaskCapability = {
|
|
|
116742
116828
|
label: "Privacy Mask"
|
|
116743
116829
|
} },
|
|
116744
116830
|
methods: {
|
|
116831
|
+
/** The camera's privacy mask options and current mask. */
|
|
116745
116832
|
getOptions: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), PrivacyMaskOptionsSchema),
|
|
116833
|
+
/** Change the camera's privacy mask. */
|
|
116746
116834
|
setMask: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
116747
116835
|
deviceId: /* @__PURE__ */ number(),
|
|
116748
116836
|
patch: PrivacyMaskPatchSchema
|
|
@@ -117033,10 +117121,12 @@ var ptzCapability = {
|
|
|
117033
117121
|
order: 0
|
|
117034
117122
|
} },
|
|
117035
117123
|
methods: {
|
|
117124
|
+
/** Nudge the camera by a relative pan, tilt or zoom step. */
|
|
117036
117125
|
move: /* @__PURE__ */ method(/* @__PURE__ */ PtzMoveCommandSchema.extend({ deviceId: /* @__PURE__ */ number() }), /* @__PURE__ */ _void(), {
|
|
117037
117126
|
kind: "mutation",
|
|
117038
117127
|
notOperatorFacing: "a relative nudge from the live-view joystick; a fixed place is a preset"
|
|
117039
117128
|
}),
|
|
117129
|
+
/** Move the camera continuously until stopped. */
|
|
117040
117130
|
continuousMove: /* @__PURE__ */ method(/* @__PURE__ */ PtzMoveCommandSchema.extend({ deviceId: /* @__PURE__ */ number() }), /* @__PURE__ */ _void(), {
|
|
117041
117131
|
kind: "mutation",
|
|
117042
117132
|
notOperatorFacing: "joystick motion held until released — continuous, not a discrete step"
|
|
@@ -117055,7 +117145,9 @@ var ptzCapability = {
|
|
|
117055
117145
|
icon: "house"
|
|
117056
117146
|
}]
|
|
117057
117147
|
}),
|
|
117148
|
+
/** List the camera's PTZ presets. */
|
|
117058
117149
|
getPresets: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), /* @__PURE__ */ array(PtzPresetSchema)),
|
|
117150
|
+
/** Move the camera to a preset. */
|
|
117059
117151
|
goToPreset: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
117060
117152
|
deviceId: /* @__PURE__ */ number(),
|
|
117061
117153
|
presetId: /* @__PURE__ */ string()
|
|
@@ -117079,6 +117171,7 @@ var ptzCapability = {
|
|
|
117079
117171
|
}]
|
|
117080
117172
|
}]
|
|
117081
117173
|
}),
|
|
117174
|
+
/** Save the camera's current position as a named preset. */
|
|
117082
117175
|
savePreset: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
117083
117176
|
deviceId: /* @__PURE__ */ number(),
|
|
117084
117177
|
presetId: /* @__PURE__ */ string(),
|
|
@@ -117108,6 +117201,7 @@ var ptzCapability = {
|
|
|
117108
117201
|
}]
|
|
117109
117202
|
}]
|
|
117110
117203
|
}),
|
|
117204
|
+
/** Delete a PTZ preset. */
|
|
117111
117205
|
deletePreset: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
117112
117206
|
deviceId: /* @__PURE__ */ number(),
|
|
117113
117207
|
presetId: /* @__PURE__ */ string()
|
|
@@ -117115,7 +117209,9 @@ var ptzCapability = {
|
|
|
117115
117209
|
kind: "mutation",
|
|
117116
117210
|
auth: "admin"
|
|
117117
117211
|
}),
|
|
117212
|
+
/** What the camera's PTZ supports (axes, speeds, presets). */
|
|
117118
117213
|
getOptions: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), PtzOptionsSchema),
|
|
117214
|
+
/** Stop any PTZ movement. */
|
|
117119
117215
|
stop: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), /* @__PURE__ */ _void(), {
|
|
117120
117216
|
kind: "mutation",
|
|
117121
117217
|
actions: [{
|
|
@@ -117476,7 +117572,9 @@ var rebootCapability = {
|
|
|
117476
117572
|
DeviceType.Switch,
|
|
117477
117573
|
DeviceType.Gateway
|
|
117478
117574
|
],
|
|
117479
|
-
methods: {
|
|
117575
|
+
methods: {
|
|
117576
|
+
/** Reboot the device. */
|
|
117577
|
+
reboot: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number().int().nonnegative() }), /* @__PURE__ */ object({ success: /* @__PURE__ */ literal(true) }), {
|
|
117480
117578
|
kind: "mutation",
|
|
117481
117579
|
auth: "admin",
|
|
117482
117580
|
actions: [{
|
|
@@ -118193,6 +118291,7 @@ var videoclipsCapability = {
|
|
|
118193
118291
|
order: 100
|
|
118194
118292
|
} },
|
|
118195
118293
|
methods: {
|
|
118294
|
+
/** List a camera's clips in a time window, from every clip source. */
|
|
118196
118295
|
listClips: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
118197
118296
|
deviceId: /* @__PURE__ */ number(),
|
|
118198
118297
|
since: /* @__PURE__ */ number(),
|
|
@@ -118251,6 +118350,7 @@ var videoclipsCapability = {
|
|
|
118251
118350
|
kind: "query",
|
|
118252
118351
|
auth: "protected"
|
|
118253
118352
|
}),
|
|
118353
|
+
/** How to play one clip, at the requested quality. */
|
|
118254
118354
|
getClipPlayback: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
118255
118355
|
deviceId: /* @__PURE__ */ number(),
|
|
118256
118356
|
clipId: /* @__PURE__ */ string(),
|
|
@@ -118865,7 +118965,9 @@ var recordingOnboardCapability = {
|
|
|
118865
118965
|
tab: "recording"
|
|
118866
118966
|
} },
|
|
118867
118967
|
methods: {
|
|
118968
|
+
/** The camera's onboard recording options and current settings. */
|
|
118868
118969
|
getOptions: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), RecordingOnboardOptionsSchema),
|
|
118970
|
+
/** Change the camera's onboard recording settings. */
|
|
118869
118971
|
setSettings: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
118870
118972
|
deviceId: /* @__PURE__ */ number(),
|
|
118871
118973
|
settings: RecordingOnboardPatchSchema
|
|
@@ -119177,6 +119279,7 @@ var snapshotCapability = {
|
|
|
119177
119279
|
deviceTypes: [DeviceType.Camera],
|
|
119178
119280
|
exposesDeviceSettings: true,
|
|
119179
119281
|
methods: {
|
|
119282
|
+
/** A current snapshot image of a camera, optionally bypassing the cache. */
|
|
119180
119283
|
getSnapshot: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
119181
119284
|
deviceId: /* @__PURE__ */ number(),
|
|
119182
119285
|
streamId: /* @__PURE__ */ string().optional(),
|
|
@@ -119198,6 +119301,7 @@ var snapshotCapability = {
|
|
|
119198
119301
|
*/
|
|
119199
119302
|
force: /* @__PURE__ */ boolean().optional()
|
|
119200
119303
|
}), /* @__PURE__ */ SnapshotImageSchema.nullable()),
|
|
119304
|
+
/** Drop a camera's cached snapshot. */
|
|
119201
119305
|
invalidateCache: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), /* @__PURE__ */ _void(), {
|
|
119202
119306
|
kind: "mutation",
|
|
119203
119307
|
auth: "admin"
|
|
@@ -119449,7 +119553,9 @@ var streamCatalogCapability = {
|
|
|
119449
119553
|
deviceNative: true,
|
|
119450
119554
|
mode: "singleton",
|
|
119451
119555
|
deviceTypes: [DeviceType.Camera],
|
|
119452
|
-
methods: {
|
|
119556
|
+
methods: {
|
|
119557
|
+
/** List the streams a camera offers. */
|
|
119558
|
+
getCatalog: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number().int().nonnegative() }), /* @__PURE__ */ array(CamStreamDescriptorSchema).readonly()) },
|
|
119453
119559
|
runtimeState: StreamCatalogStateSchema,
|
|
119454
119560
|
/**
|
|
119455
119561
|
* Runtime-state durability: **restored** — see the schema doc. A cold
|
|
@@ -119581,7 +119687,9 @@ var streamParamsCapability = {
|
|
|
119581
119687
|
tab: "streaming"
|
|
119582
119688
|
} },
|
|
119583
119689
|
methods: {
|
|
119690
|
+
/** The camera's stream profiles and their encoding options. */
|
|
119584
119691
|
getOptions: /* @__PURE__ */ method(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), StreamParamsOptionsSchema),
|
|
119692
|
+
/** Change the encoding settings of one stream profile. */
|
|
119585
119693
|
setProfile: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
119586
119694
|
deviceId: /* @__PURE__ */ number(),
|
|
119587
119695
|
profile: StreamProfileSchema,
|
|
@@ -119811,6 +119919,7 @@ var switchCapability = {
|
|
|
119811
119919
|
DeviceType.Fan
|
|
119812
119920
|
],
|
|
119813
119921
|
methods: {
|
|
119922
|
+
/** Turn the switch on or off. */
|
|
119814
119923
|
setState: /* @__PURE__ */ method(/* @__PURE__ */ object({
|
|
119815
119924
|
deviceId: /* @__PURE__ */ number(),
|
|
119816
119925
|
on: /* @__PURE__ */ boolean()
|
|
@@ -119841,12 +119950,15 @@ var switchCapability = {
|
|
|
119841
119950
|
offeredWhen: SWITCH_SETTABLE_GATE
|
|
119842
119951
|
}]
|
|
119843
119952
|
}),
|
|
119953
|
+
/** The options the switch supports. */
|
|
119844
119954
|
getOptions: /* @__PURE__ */ optionalMethod(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), SwitchOptionsSchema, { auth: "protected" }),
|
|
119955
|
+
/** Power-cycle the device the switch powers. */
|
|
119845
119956
|
powerCycle: /* @__PURE__ */ optionalMethod(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), /* @__PURE__ */ _void(), {
|
|
119846
119957
|
kind: "mutation",
|
|
119847
119958
|
auth: "protected",
|
|
119848
119959
|
notOperatorFacing: "a power cycle is the forced restart of the device the switch powers (power-source), never a step of its own"
|
|
119849
119960
|
}),
|
|
119961
|
+
/** Flip the switch to the opposite state. */
|
|
119850
119962
|
toggle: /* @__PURE__ */ optionalMethod(/* @__PURE__ */ object({ deviceId: /* @__PURE__ */ number() }), /* @__PURE__ */ _void(), {
|
|
119851
119963
|
kind: "mutation",
|
|
119852
119964
|
auth: "protected",
|
|
@@ -121175,6 +121287,10 @@ async function declareDeviceIdentifiers(deps, raw, options = {}) {
|
|
|
121175
121287
|
}
|
|
121176
121288
|
}
|
|
121177
121289
|
//#endregion
|
|
121290
|
+
//#region ../types/dist/esm/notification/alert-episode.mjs
|
|
121291
|
+
/** The category of the alert a device's `error` cap opens for its fault. */
|
|
121292
|
+
var DEVICE_ERROR_ALERT_CATEGORY = "device.error";
|
|
121293
|
+
//#endregion
|
|
121178
121294
|
//#region ../types/dist/esm/device/device-error-episode.mjs
|
|
121179
121295
|
/**
|
|
121180
121296
|
* The edge between two readings, or `null` for no edge.
|
|
@@ -121190,6 +121306,75 @@ function deviceErrorEdge(previous, next) {
|
|
|
121190
121306
|
if (next.active === false && previous?.active === true) return "resolve";
|
|
121191
121307
|
return null;
|
|
121192
121308
|
}
|
|
121309
|
+
/**
|
|
121310
|
+
* The alert severity of a fault tier. `error` is the cap's top tier and asks
|
|
121311
|
+
* for attention (`critical`); `warning` stays a warning.
|
|
121312
|
+
*/
|
|
121313
|
+
function deviceErrorAlertSeverity(severity) {
|
|
121314
|
+
return severity === "error" ? "critical" : "warning";
|
|
121315
|
+
}
|
|
121316
|
+
var DEVICE_ERROR_ALERT_IDLE = {
|
|
121317
|
+
neverOpened: false,
|
|
121318
|
+
pending: null,
|
|
121319
|
+
attempts: 0
|
|
121320
|
+
};
|
|
121321
|
+
/**
|
|
121322
|
+
* The alert write a reading asks for.
|
|
121323
|
+
*
|
|
121324
|
+
* - a START opens; a `warning` fault that becomes an `error` opens again (same
|
|
121325
|
+
* alert id and episode, now critical). An error that eases to a warning
|
|
121326
|
+
* writes nothing: its critical alert stays until the fault resolves;
|
|
121327
|
+
* - a RESOLVE closes, except an alert this process knows was never accepted —
|
|
121328
|
+
* that one has nothing to close, and its failed open is dropped;
|
|
121329
|
+
* - with no edge, a failed write is tried again while the reading still asks
|
|
121330
|
+
* for it. An unknown reading asks for nothing (D49).
|
|
121331
|
+
*/
|
|
121332
|
+
function planDeviceErrorAlert(delivery, edge, previous, next) {
|
|
121333
|
+
if (edge === "start") return {
|
|
121334
|
+
write: "open",
|
|
121335
|
+
delivery: {
|
|
121336
|
+
neverOpened: true,
|
|
121337
|
+
pending: "open",
|
|
121338
|
+
attempts: 0
|
|
121339
|
+
}
|
|
121340
|
+
};
|
|
121341
|
+
if (edge === "resolve") {
|
|
121342
|
+
if (delivery.neverOpened) return {
|
|
121343
|
+
write: null,
|
|
121344
|
+
delivery: DEVICE_ERROR_ALERT_IDLE
|
|
121345
|
+
};
|
|
121346
|
+
return {
|
|
121347
|
+
write: "close",
|
|
121348
|
+
delivery: {
|
|
121349
|
+
neverOpened: false,
|
|
121350
|
+
pending: "close",
|
|
121351
|
+
attempts: 0
|
|
121352
|
+
}
|
|
121353
|
+
};
|
|
121354
|
+
}
|
|
121355
|
+
if (next.active === true) {
|
|
121356
|
+
if (previous?.active === true && previous.severity === "warning" && next.severity === "error") return {
|
|
121357
|
+
write: "open",
|
|
121358
|
+
delivery: {
|
|
121359
|
+
...delivery,
|
|
121360
|
+
pending: "open",
|
|
121361
|
+
attempts: 0
|
|
121362
|
+
}
|
|
121363
|
+
};
|
|
121364
|
+
if (delivery.pending === "open") return {
|
|
121365
|
+
write: "open",
|
|
121366
|
+
delivery
|
|
121367
|
+
};
|
|
121368
|
+
}
|
|
121369
|
+
if (next.active === false && delivery.pending === "close") return {
|
|
121370
|
+
write: "close",
|
|
121371
|
+
delivery
|
|
121372
|
+
};
|
|
121373
|
+
return {
|
|
121374
|
+
write: null,
|
|
121375
|
+
delivery
|
|
121376
|
+
};
|
|
121377
|
+
}
|
|
121193
121378
|
function deviceErrorAlertId(deviceId) {
|
|
121194
121379
|
return `device-error:${String(deviceId)}`;
|
|
121195
121380
|
}
|
|
@@ -121214,8 +121399,8 @@ function buildDeviceErrorAlert(deviceId, deviceName, status, now) {
|
|
|
121214
121399
|
const alertId = deviceErrorAlertId(deviceId);
|
|
121215
121400
|
return {
|
|
121216
121401
|
id: alertId,
|
|
121217
|
-
category:
|
|
121218
|
-
severity:
|
|
121402
|
+
category: DEVICE_ERROR_ALERT_CATEGORY,
|
|
121403
|
+
severity: deviceErrorAlertSeverity(status.severity),
|
|
121219
121404
|
title: `${deviceName}: ${label}`,
|
|
121220
121405
|
message: `${deviceName} reports a fault: ${label}.`,
|
|
121221
121406
|
action: {
|
|
@@ -121292,6 +121477,7 @@ var DEVICE_LOCAL_STATE_CAP_NAMES = {
|
|
|
121292
121477
|
intercom: "intercom",
|
|
121293
121478
|
irTransmitter: "ir-transmitter",
|
|
121294
121479
|
lawnMowerControl: "lawn-mower-control",
|
|
121480
|
+
location: "location",
|
|
121295
121481
|
lockControl: "lock-control",
|
|
121296
121482
|
lowPowerSleep: "low-power-sleep",
|
|
121297
121483
|
mediaPlayer: "media-player",
|
|
@@ -121330,6 +121516,7 @@ var DEVICE_LOCAL_STATE_CAP_NAMES = {
|
|
|
121330
121516
|
update: "update",
|
|
121331
121517
|
vacuumControl: "vacuum-control",
|
|
121332
121518
|
valve: "valve",
|
|
121519
|
+
vehicle: "vehicle",
|
|
121333
121520
|
vibration: "vibration",
|
|
121334
121521
|
waterHeater: "water-heater",
|
|
121335
121522
|
weather: "weather",
|
|
@@ -121349,6 +121536,8 @@ var BaseDevice = class {
|
|
|
121349
121536
|
statusIsExternal;
|
|
121350
121537
|
/** The fault catalog the integration declared; `[]` until it does. */
|
|
121351
121538
|
faultTypes = [];
|
|
121539
|
+
/** What the alerts cap accepted for this device's fault, and the write still owed to it. */
|
|
121540
|
+
errorAlertDelivery = DEVICE_ERROR_ALERT_IDLE;
|
|
121352
121541
|
name;
|
|
121353
121542
|
parentDeviceId;
|
|
121354
121543
|
role;
|
|
@@ -121701,51 +121890,81 @@ var BaseDevice = class {
|
|
|
121701
121890
|
/**
|
|
121702
121891
|
* Publish the device's fault. The slice is written; on an EDGE (a fault
|
|
121703
121892
|
* starts, or one resolves) an attention episode opens or closes through the
|
|
121704
|
-
* alerts cap,
|
|
121705
|
-
*
|
|
121706
|
-
*
|
|
121893
|
+
* alerts cap, at the severity of the fault's tier: an `error` fault is a
|
|
121894
|
+
* critical alert, which the notification center announces as
|
|
121895
|
+
* `device-attention-required` / `-resolved`; a `warning` fault is a warning
|
|
121896
|
+
* alert and announces nothing until it becomes an error. An unknown reading
|
|
121897
|
+
* is never an edge. No rule exists by default: it notifies when the operator
|
|
121898
|
+
* makes one.
|
|
121899
|
+
*
|
|
121900
|
+
* An alert write that fails is tried again on the next reading that still
|
|
121901
|
+
* asks for it, `DEVICE_ERROR_ALERT_MAX_ATTEMPTS` times at most.
|
|
121707
121902
|
*/
|
|
121708
121903
|
async publishError(reading) {
|
|
121709
121904
|
const previous = this.getCapSlice(errorCapability);
|
|
121710
121905
|
if (reading.active === null && previous !== null && previous.active !== null) return;
|
|
121711
121906
|
const now = Date.now();
|
|
121712
121907
|
const edge = deviceErrorEdge(previous, reading);
|
|
121713
|
-
const next = edge === "start"
|
|
121908
|
+
const next = this.withErrorSince(previous, reading, edge === "start", now);
|
|
121909
|
+
this.setCapSlice(errorCapability, next);
|
|
121910
|
+
const plan = planDeviceErrorAlert(this.errorAlertDelivery, edge, previous, next);
|
|
121911
|
+
this.errorAlertDelivery = plan.delivery;
|
|
121912
|
+
if (plan.write === null) return;
|
|
121913
|
+
await this.writeErrorAlert(plan.write, next, now);
|
|
121914
|
+
}
|
|
121915
|
+
/** A fault keeps the start it was given: stamped on the start, carried while it lasts. */
|
|
121916
|
+
withErrorSince(previous, reading, starts, now) {
|
|
121917
|
+
if (reading.active !== true || reading.since !== null) return reading;
|
|
121918
|
+
if (starts) return {
|
|
121714
121919
|
...reading,
|
|
121715
121920
|
since: now
|
|
121716
|
-
}
|
|
121717
|
-
|
|
121718
|
-
|
|
121719
|
-
|
|
121720
|
-
|
|
121721
|
-
|
|
121722
|
-
|
|
121723
|
-
|
|
121724
|
-
|
|
121725
|
-
return;
|
|
121726
|
-
}
|
|
121921
|
+
};
|
|
121922
|
+
return previous?.since == null ? reading : {
|
|
121923
|
+
...reading,
|
|
121924
|
+
since: previous.since
|
|
121925
|
+
};
|
|
121926
|
+
}
|
|
121927
|
+
/** One attempt at the alert write the plan asked for; a failure stays owed, under the bound. */
|
|
121928
|
+
async writeErrorAlert(write, status, now) {
|
|
121929
|
+
const attempt = this.errorAlertDelivery.attempts + 1;
|
|
121727
121930
|
try {
|
|
121728
|
-
|
|
121729
|
-
|
|
121730
|
-
|
|
121731
|
-
|
|
121732
|
-
|
|
121733
|
-
|
|
121734
|
-
|
|
121735
|
-
|
|
121736
|
-
|
|
121737
|
-
|
|
121931
|
+
const alerts = this.ctx.api.alerts;
|
|
121932
|
+
if (alerts === void 0) throw new Error("alerts capability missing");
|
|
121933
|
+
if (write === "open") {
|
|
121934
|
+
await alerts.emit.mutate(buildDeviceErrorAlert(this.id, this.name, status, now));
|
|
121935
|
+
this.errorAlertDelivery = DEVICE_ERROR_ALERT_IDLE;
|
|
121936
|
+
} else {
|
|
121937
|
+
await alerts.update.mutate({
|
|
121938
|
+
alertId: deviceErrorAlertId(this.id),
|
|
121939
|
+
patch: {
|
|
121940
|
+
status: "completed",
|
|
121941
|
+
read: true,
|
|
121942
|
+
updatedAt: now
|
|
121943
|
+
}
|
|
121944
|
+
});
|
|
121945
|
+
this.errorAlertDelivery = DEVICE_ERROR_ALERT_IDLE;
|
|
121946
|
+
}
|
|
121947
|
+
this.ctx.logger.info(`device error: ${write === "open" ? "raised" : "resolved"}`, {
|
|
121738
121948
|
tags: { deviceId: this.id },
|
|
121739
121949
|
meta: {
|
|
121740
|
-
code:
|
|
121741
|
-
label:
|
|
121950
|
+
code: status.code,
|
|
121951
|
+
label: status.label,
|
|
121952
|
+
severity: status.severity,
|
|
121953
|
+
attempt
|
|
121742
121954
|
}
|
|
121743
121955
|
});
|
|
121744
121956
|
} catch (err) {
|
|
121745
|
-
|
|
121957
|
+
const givenUp = attempt >= 5;
|
|
121958
|
+
this.errorAlertDelivery = {
|
|
121959
|
+
...this.errorAlertDelivery,
|
|
121960
|
+
pending: givenUp ? null : write,
|
|
121961
|
+
attempts: givenUp ? 0 : attempt
|
|
121962
|
+
};
|
|
121963
|
+
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", {
|
|
121746
121964
|
tags: { deviceId: this.id },
|
|
121747
121965
|
meta: {
|
|
121748
|
-
|
|
121966
|
+
write,
|
|
121967
|
+
attempt,
|
|
121749
121968
|
error: errMsg$3(err)
|
|
121750
121969
|
}
|
|
121751
121970
|
});
|
|
@@ -129718,12 +129937,21 @@ function reportsPowerSource(info) {
|
|
|
129718
129937
|
* sleep, or while on mains or a panel, reports `0` as a placeholder — device
|
|
129719
129938
|
* 3628 sat at 100% on its adapter and raised a low-battery notification on
|
|
129720
129939
|
* every hourly wake. Those zeros are UNMEASURED: the caller keeps the last real
|
|
129721
|
-
* level.
|
|
129722
|
-
*
|
|
129940
|
+
* level.
|
|
129941
|
+
*
|
|
129942
|
+
* The same placeholder also arrives with NO power source to blame (device 3628,
|
|
129943
|
+
* its own Baichuan read): `batteryPercent: 0, chargeStatus: "none",
|
|
129944
|
+
* adapterStatus: "none", voltage: 0, current: 0, temperature: 0`, awake — an
|
|
129945
|
+
* all-zero payload that raised an empty-battery alert; the next read was 99.
|
|
129946
|
+
* A `0` level with a present `voltage` of 0 carries no cell measurement at all,
|
|
129947
|
+
* so it is UNMEASURED too. A `0` from an awake camera on its cell alone with a
|
|
129948
|
+
* real voltage (or a payload without the field) is a genuine empty cell and
|
|
129949
|
+
* passes, as does every non-zero level.
|
|
129723
129950
|
*/
|
|
129724
129951
|
function isMeasuredCameraBatteryLevel(level, context) {
|
|
129725
129952
|
if (level !== 0) return true;
|
|
129726
129953
|
if (context.sleeping) return false;
|
|
129954
|
+
if (context.voltage === 0) return false;
|
|
129727
129955
|
return context.charging !== "dc" && context.charging !== "solar";
|
|
129728
129956
|
}
|
|
129729
129957
|
/** What the cell is doing, from `chargeStatus`. Absent is `'unknown'`, never `'idle'` (D315). */
|
|
@@ -132831,16 +133059,6 @@ function buildPirPayload(enable, cfg) {
|
|
|
132831
133059
|
...typeof cfg.interval === "number" ? { interval: cfg.interval } : {}
|
|
132832
133060
|
};
|
|
132833
133061
|
}
|
|
132834
|
-
/** Keep `enable` plus only the tuning fields the firmware reported on read. */
|
|
132835
|
-
function reducePirPayload(payload, reported) {
|
|
132836
|
-
const has = (key) => typeof reported?.[key] === "number";
|
|
132837
|
-
return {
|
|
132838
|
-
enable: payload.enable,
|
|
132839
|
-
...has("sensitive") && payload.sensitive !== void 0 ? { sensitive: payload.sensitive } : {},
|
|
132840
|
-
...has("reduceAlarm") && payload.reduceAlarm !== void 0 ? { reduceAlarm: payload.reduceAlarm } : {},
|
|
132841
|
-
...has("interval") && payload.interval !== void 0 ? { interval: payload.interval } : {}
|
|
132842
|
-
};
|
|
132843
|
-
}
|
|
132844
133062
|
/** True for the firmware's `responseCode 400` refusal. */
|
|
132845
133063
|
function isBaichuan400(err) {
|
|
132846
133064
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -133047,43 +133265,18 @@ var PirAccessory = class extends BaseDevice {
|
|
|
133047
133265
|
});
|
|
133048
133266
|
try {
|
|
133049
133267
|
await api.setPirInfo(payload, this.channel);
|
|
133050
|
-
return;
|
|
133051
133268
|
} catch (err) {
|
|
133052
133269
|
if (!isBaichuan400(err)) throw err;
|
|
133053
|
-
this.ctx.logger.warn("pir setPirInfo
|
|
133270
|
+
this.ctx.logger.warn("pir setPirInfo refused by the camera", {
|
|
133054
133271
|
tags: { deviceId: this.id },
|
|
133055
133272
|
meta: {
|
|
133056
133273
|
channel: this.channel,
|
|
133057
|
-
attempt: "full",
|
|
133058
133274
|
payload,
|
|
133059
133275
|
responseCode: 400,
|
|
133060
133276
|
error: err instanceof Error ? err.message : String(err)
|
|
133061
133277
|
}
|
|
133062
133278
|
});
|
|
133063
|
-
|
|
133064
|
-
const reduced = reducePirPayload(payload, (await api.getPirInfo(this.channel)).state);
|
|
133065
|
-
try {
|
|
133066
|
-
await api.setPirInfo(reduced, this.channel);
|
|
133067
|
-
this.ctx.logger.info("pir setPirInfo succeeded with the reduced payload", {
|
|
133068
|
-
tags: { deviceId: this.id },
|
|
133069
|
-
meta: {
|
|
133070
|
-
channel: this.channel,
|
|
133071
|
-
attempt: "reduced",
|
|
133072
|
-
payload: reduced
|
|
133073
|
-
}
|
|
133074
|
-
});
|
|
133075
|
-
} catch (err) {
|
|
133076
|
-
this.ctx.logger.warn("pir setPirInfo failed on both attempts", {
|
|
133077
|
-
tags: { deviceId: this.id },
|
|
133078
|
-
meta: {
|
|
133079
|
-
channel: this.channel,
|
|
133080
|
-
attempt: "reduced",
|
|
133081
|
-
payload: reduced,
|
|
133082
|
-
responseCode: isBaichuan400(err) ? 400 : null,
|
|
133083
|
-
error: err instanceof Error ? err.message : String(err)
|
|
133084
|
-
}
|
|
133085
|
-
});
|
|
133086
|
-
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.");
|
|
133279
|
+
throw new Error("The camera rejected the PIR settings. Try again once it is awake, or change the PIR settings in the Reolink app.");
|
|
133087
133280
|
}
|
|
133088
133281
|
}
|
|
133089
133282
|
getSettingsUISchema() {
|
|
@@ -133915,6 +134108,35 @@ function accessoryChildrenAnswerFor(sliceProbed, sliceFlags, specs) {
|
|
|
133915
134108
|
children: specs
|
|
133916
134109
|
};
|
|
133917
134110
|
}
|
|
134111
|
+
/**
|
|
134112
|
+
* A wake the camera itself (or our own look at it) reported. `hub-reconcile`
|
|
134113
|
+
* and `hub-summary` come from the parent's periodic sweep, which lags the real
|
|
134114
|
+
* state by minutes: a probe driven by one can log in and WAKE a standalone UDP
|
|
134115
|
+
* battery camera that fell asleep again, so they never trigger a re-probe.
|
|
134116
|
+
*/
|
|
134117
|
+
function isFirstHandWake(reason) {
|
|
134118
|
+
return reason === "simple-event" || reason === "sleep-poll" || reason === "confirmed-wake";
|
|
134119
|
+
}
|
|
134120
|
+
var AccessoryReprobeWindow = class {
|
|
134121
|
+
#lastAttemptAt = 0;
|
|
134122
|
+
#inFlight = false;
|
|
134123
|
+
/**
|
|
134124
|
+
* True (and the attempt is recorded) when the last probe that ran is older
|
|
134125
|
+
* than the window, the last attempt is older than the retry gap, and none is
|
|
134126
|
+
* in flight.
|
|
134127
|
+
*/
|
|
134128
|
+
tryBegin(now, lastProbedAt) {
|
|
134129
|
+
if (this.#inFlight) return false;
|
|
134130
|
+
if (now - lastProbedAt < 216e5) return false;
|
|
134131
|
+
if (this.#lastAttemptAt > 0 && now - this.#lastAttemptAt < 6e5) return false;
|
|
134132
|
+
this.#lastAttemptAt = now;
|
|
134133
|
+
this.#inFlight = true;
|
|
134134
|
+
return true;
|
|
134135
|
+
}
|
|
134136
|
+
end() {
|
|
134137
|
+
this.#inFlight = false;
|
|
134138
|
+
}
|
|
134139
|
+
};
|
|
133918
134140
|
//#endregion
|
|
133919
134141
|
//#region src/metadata-populator.ts
|
|
133920
134142
|
var EXTENDED_INFO_TAGS = [
|
|
@@ -135995,6 +136217,13 @@ var REOLINK_AUDIO_STREAM_KEYS = [
|
|
|
135995
136217
|
"thirdStream"
|
|
135996
136218
|
];
|
|
135997
136219
|
/** Generate a short random hex token for per-stream RTSP-style credentials. */
|
|
136220
|
+
/**
|
|
136221
|
+
* The error a login dialled with replaced settings ends with. A caller still
|
|
136222
|
+
* awaiting it retries through `ensureApi`, which dials with the new settings.
|
|
136223
|
+
*/
|
|
136224
|
+
function supersededLoginError(cause) {
|
|
136225
|
+
return new Error("Reolink login superseded by a connection settings change", { cause: cause ?? void 0 });
|
|
136226
|
+
}
|
|
135998
136227
|
function randomToken(bytes) {
|
|
135999
136228
|
return randomBytes(bytes).toString("hex");
|
|
136000
136229
|
}
|
|
@@ -136395,6 +136624,14 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
136395
136624
|
}
|
|
136396
136625
|
/** Login lock — concurrent demand events must not race the login flow. */
|
|
136397
136626
|
loginPromise = null;
|
|
136627
|
+
/**
|
|
136628
|
+
* Bumped by `disconnectAll`. A login started under an older generation was
|
|
136629
|
+
* dialled with the OLD settings (e.g. the relay before the operator picked
|
|
136630
|
+
* local-direct): it is closed and discarded instead of becoming `this.api`.
|
|
136631
|
+
*/
|
|
136632
|
+
loginGeneration = 0;
|
|
136633
|
+
/** The client a login in flight is dialling, so `disconnectAll` can abort it. */
|
|
136634
|
+
pendingLoginApi = null;
|
|
136398
136635
|
/** Wall-clock ms of the last video packet the stream server produced; 0 = none yet. */
|
|
136399
136636
|
lastVideoFlowAt = 0;
|
|
136400
136637
|
/** True once we've discovered (via getBatteryInfo) that this is a battery cam. */
|
|
@@ -136445,6 +136682,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
136445
136682
|
* `sleep-state-decision.ts` for the measurement (D603).
|
|
136446
136683
|
*/
|
|
136447
136684
|
sleepStateChangedAt = 0;
|
|
136685
|
+
accessoryReprobeWindow = new AccessoryReprobeWindow();
|
|
136448
136686
|
/**
|
|
136449
136687
|
* Wall-clock ms of the last PROACTIVE wake — one we issued on our own
|
|
136450
136688
|
* initiative (background snapshot refresh), not because the operator
|
|
@@ -137766,7 +138004,8 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
137766
138004
|
const reported = typeof info.batteryPercent === "number" ? Math.max(0, Math.min(100, Math.round(info.batteryPercent))) : void 0;
|
|
137767
138005
|
const measured = reported !== void 0 && isMeasuredCameraBatteryLevel(reported, {
|
|
137768
138006
|
sleeping,
|
|
137769
|
-
charging
|
|
138007
|
+
charging,
|
|
138008
|
+
voltage: info.voltage
|
|
137770
138009
|
});
|
|
137771
138010
|
if (reported === 0) this.ctx.logger.info("battery read reporting 0", {
|
|
137772
138011
|
tags: { deviceId: this.id },
|
|
@@ -141858,6 +142097,42 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
141858
142097
|
networkLinkFailureWarned = false;
|
|
141859
142098
|
static CONTACT_WRITE_QUANTUM_MS = 5 * 6e4;
|
|
141860
142099
|
/**
|
|
142100
|
+
* A battery camera probes its abilities once, so an accessory the firmware
|
|
142101
|
+
* never really had (a PIR switch on a camera without a PIR) could not be
|
|
142102
|
+
* pruned: the kernel needs a second probe on a later `lastProbedAt`. A natural
|
|
142103
|
+
* wake is the free moment — at most once per `ACCESSORY_REPROBE_WINDOW_MS`
|
|
142104
|
+
* (measured from the last probe that ran), never overlapping.
|
|
142105
|
+
*
|
|
142106
|
+
* ONLY a first-hand awake observation may trigger it. The periodic hub sweep
|
|
142107
|
+
* (`hub-reconcile`, `hub-summary`) also drives `onWakeTransition` but lags the
|
|
142108
|
+
* real state by minutes, and `onProbe` is gated by that same lagging flag: a
|
|
142109
|
+
* probe from there could log in and WAKE a camera that already went back to sleep.
|
|
142110
|
+
*/
|
|
142111
|
+
async reprobeAccessoriesIfStale(reason) {
|
|
142112
|
+
if (!this.isBattery || !isFirstHandWake(reason)) return;
|
|
142113
|
+
const lastProbedAt = this.runtimeState.getCapState("feature-probe")?.lastProbedAt ?? 0;
|
|
142114
|
+
const now = Date.now();
|
|
142115
|
+
if (!this.accessoryReprobeWindow.tryBegin(now, lastProbedAt)) return;
|
|
142116
|
+
this.ctx.logger.info("wake transition — accessory re-probe (last probe older than the window)", {
|
|
142117
|
+
tags: { deviceId: this.id },
|
|
142118
|
+
meta: {
|
|
142119
|
+
reason,
|
|
142120
|
+
lastProbedAt,
|
|
142121
|
+
ageMs: lastProbedAt > 0 ? now - lastProbedAt : null
|
|
142122
|
+
}
|
|
142123
|
+
});
|
|
142124
|
+
try {
|
|
142125
|
+
await this.reprobe();
|
|
142126
|
+
} catch (err) {
|
|
142127
|
+
this.ctx.logger.debug("onWakeTransition: accessory re-probe failed — a later first-hand wake retries", {
|
|
142128
|
+
tags: { deviceId: this.id },
|
|
142129
|
+
meta: { error: err instanceof Error ? err.message : String(err) }
|
|
142130
|
+
});
|
|
142131
|
+
} finally {
|
|
142132
|
+
this.accessoryReprobeWindow.end();
|
|
142133
|
+
}
|
|
142134
|
+
}
|
|
142135
|
+
/**
|
|
141861
142136
|
* Shared wake-transition handler invoked by both the simpleEvent
|
|
141862
142137
|
* `awake` push (canonical fast path) and the sleep poll's
|
|
141863
142138
|
* `sleeping → awake` flip (backstop). Fan out the refreshes that
|
|
@@ -141898,6 +142173,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
141898
142173
|
meta: { error: err instanceof Error ? err.message : String(err) }
|
|
141899
142174
|
});
|
|
141900
142175
|
}
|
|
142176
|
+
else await this.reprobeAccessoriesIfStale(reason);
|
|
141901
142177
|
if (!(this.isBattery ? await this.getBatteryRefresh().noteAwake().catch(() => false) : false)) {
|
|
141902
142178
|
await this.warmCapSlicesOnWake();
|
|
141903
142179
|
await this.warmSnapshotOnWake();
|
|
@@ -142233,6 +142509,13 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
142233
142509
|
const entries = [...this.active.values()];
|
|
142234
142510
|
this.active.clear();
|
|
142235
142511
|
this.keepAwake.stop();
|
|
142512
|
+
this.loginGeneration += 1;
|
|
142513
|
+
this.loginPromise = null;
|
|
142514
|
+
const pending = this.pendingLoginApi;
|
|
142515
|
+
this.pendingLoginApi = null;
|
|
142516
|
+
if (pending) try {
|
|
142517
|
+
await pending.close({ reason: "login-superseded" });
|
|
142518
|
+
} catch {}
|
|
142236
142519
|
for (const entry of entries) try {
|
|
142237
142520
|
await entry.server.close("disconnect-all");
|
|
142238
142521
|
} catch {}
|
|
@@ -143356,7 +143639,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
143356
143639
|
if (Object.keys(rest).length === 0 && !hasOsdPatch) return;
|
|
143357
143640
|
if (Object.keys(rest).length > 0) await this.config.setAll(rest);
|
|
143358
143641
|
const typedPatch = patch;
|
|
143359
|
-
if (typedPatch.host || typedPatch.port || typedPatch.username || typedPatch.password) {
|
|
143642
|
+
if (typedPatch.host || typedPatch.port || typedPatch.username || typedPatch.password || typedPatch.transport || typedPatch.uid || typedPatch.udpDiscoveryMethod) {
|
|
143360
143643
|
await this.disconnectAll();
|
|
143361
143644
|
return;
|
|
143362
143645
|
}
|
|
@@ -143842,6 +144125,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
143842
144125
|
debugOptions: debugOptions === void 0 ? null : Object.keys(debugOptions)
|
|
143843
144126
|
}
|
|
143844
144127
|
});
|
|
144128
|
+
const generation = this.loginGeneration;
|
|
143845
144129
|
this.loginPromise = (async () => {
|
|
143846
144130
|
const api = new ReolinkBaichuanApi({
|
|
143847
144131
|
host,
|
|
@@ -143854,14 +144138,24 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
143854
144138
|
...debugOptions ? { debugOptions } : {},
|
|
143855
144139
|
logger: this.libLoggerAdapter()
|
|
143856
144140
|
});
|
|
144141
|
+
this.pendingLoginApi = api;
|
|
143857
144142
|
try {
|
|
143858
144143
|
await api.login();
|
|
143859
144144
|
} catch (err) {
|
|
144145
|
+
if (generation !== this.loginGeneration) throw supersededLoginError(err);
|
|
144146
|
+
this.pendingLoginApi = null;
|
|
143860
144147
|
this.loginPromise = null;
|
|
143861
144148
|
if (isConnectivityFailure(err)) this.noteUnreachable(err instanceof Error ? err.message : String(err));
|
|
143862
144149
|
else if (this.ownsReachability()) this.reachability.noteReachable();
|
|
143863
144150
|
throw err;
|
|
143864
144151
|
}
|
|
144152
|
+
if (generation !== this.loginGeneration) {
|
|
144153
|
+
try {
|
|
144154
|
+
await api.close({ reason: "login-superseded" });
|
|
144155
|
+
} catch {}
|
|
144156
|
+
throw supersededLoginError(null);
|
|
144157
|
+
}
|
|
144158
|
+
this.pendingLoginApi = null;
|
|
143865
144159
|
this.api = api;
|
|
143866
144160
|
this.loginPromise = null;
|
|
143867
144161
|
this.reconnectAttempts = 0;
|
|
@@ -144432,7 +144726,8 @@ var AutodetectCache = class {
|
|
|
144432
144726
|
input.username,
|
|
144433
144727
|
passHash,
|
|
144434
144728
|
input.uid?.trim() ?? "",
|
|
144435
|
-
input.transport
|
|
144729
|
+
input.transport,
|
|
144730
|
+
input.udpDiscoveryMethod ?? ""
|
|
144436
144731
|
].join(":");
|
|
144437
144732
|
}
|
|
144438
144733
|
/**
|
|
@@ -144495,6 +144790,34 @@ var AutodetectCache = class {
|
|
|
144495
144790
|
}
|
|
144496
144791
|
};
|
|
144497
144792
|
//#endregion
|
|
144793
|
+
//#region src/autodetect-inputs.ts
|
|
144794
|
+
function readString(obj, key) {
|
|
144795
|
+
const v = obj[key];
|
|
144796
|
+
return typeof v === "string" ? v : "";
|
|
144797
|
+
}
|
|
144798
|
+
function readTransportMode(obj) {
|
|
144799
|
+
const v = obj["transport"];
|
|
144800
|
+
return v === "tcp" || v === "udp" || v === "auto" ? v : "auto";
|
|
144801
|
+
}
|
|
144802
|
+
/** `auto` / unknown / absent mean "race every method"; only a real method is kept. */
|
|
144803
|
+
function readDiscoveryMethod(obj) {
|
|
144804
|
+
const parsed = ReolinkUdpDiscoveryMethodSchema.safeParse(obj["udpDiscoveryMethod"]);
|
|
144805
|
+
return parsed.success ? parsed.data : void 0;
|
|
144806
|
+
}
|
|
144807
|
+
function buildAutodetectInputs(form) {
|
|
144808
|
+
const rawUid = readString(form, "uid").trim();
|
|
144809
|
+
const rawPort = form["port"];
|
|
144810
|
+
return {
|
|
144811
|
+
host: readString(form, "host").trim(),
|
|
144812
|
+
username: (readString(form, "username") || "admin").trim(),
|
|
144813
|
+
password: readString(form, "password"),
|
|
144814
|
+
uid: rawUid.length > 0 ? rawUid : void 0,
|
|
144815
|
+
transport: readTransportMode(form),
|
|
144816
|
+
port: typeof rawPort === "number" && Number.isFinite(rawPort) ? rawPort : 9e3,
|
|
144817
|
+
udpDiscoveryMethod: readDiscoveryMethod(form)
|
|
144818
|
+
};
|
|
144819
|
+
}
|
|
144820
|
+
//#endregion
|
|
144498
144821
|
//#region src/creation-schema.ts
|
|
144499
144822
|
/**
|
|
144500
144823
|
* Creation form for Reolink devices.
|
|
@@ -144672,6 +144995,28 @@ function buildCreationFormSchema() {
|
|
|
144672
144995
|
field: "transport",
|
|
144673
144996
|
notEquals: "tcp"
|
|
144674
144997
|
}
|
|
144998
|
+
},
|
|
144999
|
+
{
|
|
145000
|
+
type: "select",
|
|
145001
|
+
key: "udpDiscoveryMethod",
|
|
145002
|
+
label: "UDP discovery",
|
|
145003
|
+
labelKey: "provider-reolink:creation.s_connection.udpDiscoveryMethod.label",
|
|
145004
|
+
default: "auto",
|
|
145005
|
+
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.",
|
|
145006
|
+
descriptionKey: "provider-reolink:creation.s_connection.udpDiscoveryMethod.description",
|
|
145007
|
+
options: [{
|
|
145008
|
+
value: "auto",
|
|
145009
|
+
label: "Auto (may use the Reolink relay)",
|
|
145010
|
+
labelKey: "provider-reolink:creation.s_connection.udpDiscoveryMethod.o_auto.label"
|
|
145011
|
+
}, {
|
|
145012
|
+
value: "local-direct",
|
|
145013
|
+
label: "Local only (direct to the camera IP)",
|
|
145014
|
+
labelKey: "provider-reolink:creation.s_connection.udpDiscoveryMethod.o_local.label"
|
|
145015
|
+
}],
|
|
145016
|
+
showWhen: {
|
|
145017
|
+
field: "transport",
|
|
145018
|
+
notEquals: "tcp"
|
|
145019
|
+
}
|
|
144675
145020
|
}
|
|
144676
145021
|
]
|
|
144677
145022
|
},
|
|
@@ -146403,28 +146748,6 @@ function getString(obj, key) {
|
|
|
146403
146748
|
const v = obj[key];
|
|
146404
146749
|
return typeof v === "string" ? v : "";
|
|
146405
146750
|
}
|
|
146406
|
-
function getNumber(obj, key, fallback) {
|
|
146407
|
-
const v = obj[key];
|
|
146408
|
-
return typeof v === "number" && Number.isFinite(v) ? v : fallback;
|
|
146409
|
-
}
|
|
146410
|
-
function getTransportMode(obj) {
|
|
146411
|
-
const v = obj["transport"];
|
|
146412
|
-
return v === "tcp" || v === "udp" || v === "auto" ? v : "auto";
|
|
146413
|
-
}
|
|
146414
|
-
function buildAutodetectInputs(form) {
|
|
146415
|
-
const host = getString(form, "host").trim();
|
|
146416
|
-
const username = (getString(form, "username") || "admin").trim();
|
|
146417
|
-
const password = getString(form, "password");
|
|
146418
|
-
const rawUid = getString(form, "uid").trim();
|
|
146419
|
-
return {
|
|
146420
|
-
host,
|
|
146421
|
-
username,
|
|
146422
|
-
password,
|
|
146423
|
-
uid: rawUid.length > 0 ? rawUid : void 0,
|
|
146424
|
-
transport: getTransportMode(form),
|
|
146425
|
-
port: getNumber(form, "port", 9e3)
|
|
146426
|
-
};
|
|
146427
|
-
}
|
|
146428
146751
|
function buildAutodetectLabels(result) {
|
|
146429
146752
|
const labels = [];
|
|
146430
146753
|
const model = result.deviceInfo?.type;
|
|
@@ -147418,6 +147741,7 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
|
|
|
147418
147741
|
username: inputs.username,
|
|
147419
147742
|
password: inputs.password,
|
|
147420
147743
|
...inputs.uid ? { uid: inputs.uid } : {},
|
|
147744
|
+
...inputs.udpDiscoveryMethod ? { udpDiscoveryMethod: inputs.udpDiscoveryMethod } : {},
|
|
147421
147745
|
mode: inputs.transport
|
|
147422
147746
|
});
|
|
147423
147747
|
} else this.ctx.logger.info("autodetect cache hit — reusing api", {
|
|
@@ -147566,6 +147890,7 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
|
|
|
147566
147890
|
username: inputs.username,
|
|
147567
147891
|
password: inputs.password,
|
|
147568
147892
|
...inputs.uid ? { uid: inputs.uid } : {},
|
|
147893
|
+
...inputs.udpDiscoveryMethod ? { udpDiscoveryMethod: inputs.udpDiscoveryMethod } : {},
|
|
147569
147894
|
mode: inputs.transport,
|
|
147570
147895
|
logger: buildAutodetectLibLogger(probeLogger)
|
|
147571
147896
|
});
|