@camstack/addon-provider-reolink 1.2.228 → 1.2.229
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 +6 -0
- package/dist/addon.js +82 -15
- package/dist/addon.mjs +82 -15
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.229] - 2026-11-05
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- A Reolink Home Hub / NVR integration no longer offers the manual Enter parameters add in Add device
|
|
15
|
+
|
|
10
16
|
## [1.2.228] - 2026-11-05
|
|
11
17
|
|
|
12
18
|
### Fixed
|
package/dist/addon.js
CHANGED
|
@@ -114374,12 +114374,22 @@ var RecordIntegrationInstances = class {
|
|
|
114374
114374
|
...this.hooks.description,
|
|
114375
114375
|
mintsId: true
|
|
114376
114376
|
};
|
|
114377
|
-
|
|
114377
|
+
/**
|
|
114378
|
+
* The record an id names. A caller holding the `integrations` registry id (the Integrations
|
|
114379
|
+
* page) reaches a kind whose body links to it through `integrationId`; an id that is itself a
|
|
114380
|
+
* record id answers as it is. An id that names nothing comes back unchanged.
|
|
114381
|
+
*/
|
|
114382
|
+
async resolveRecordId(id) {
|
|
114383
|
+
if (await this.handle.get(id) !== null) return id;
|
|
114384
|
+
const linked = (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.find((record) => record.data["integrationId"] === id);
|
|
114385
|
+
return linked === void 0 ? id : linked.id;
|
|
114386
|
+
}
|
|
114387
|
+
instanceFormSchema = async ({ id }) => this.hooks.formSchema(id === null ? null : await this.resolveRecordId(id));
|
|
114378
114388
|
listInstances = async () => {
|
|
114379
114389
|
return (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.map((record) => this.viewOf(record));
|
|
114380
114390
|
};
|
|
114381
114391
|
getInstance = async ({ id }) => {
|
|
114382
|
-
const record = await this.handle.get(id);
|
|
114392
|
+
const record = await this.handle.get(await this.resolveRecordId(id));
|
|
114383
114393
|
return record === null ? null : this.viewOf(record);
|
|
114384
114394
|
};
|
|
114385
114395
|
/** Insert ONE row (`ifRev: 0`: an existing id is refused, never overwritten). */
|
|
@@ -114396,7 +114406,8 @@ var RecordIntegrationInstances = class {
|
|
|
114396
114406
|
await this.hooks.onChanged?.(minted, "created");
|
|
114397
114407
|
return { id: minted };
|
|
114398
114408
|
};
|
|
114399
|
-
updateInstance = async ({ id, name, values }) => {
|
|
114409
|
+
updateInstance = async ({ id: askedId, name, values }) => {
|
|
114410
|
+
const id = await this.resolveRecordId(askedId);
|
|
114400
114411
|
const patch = {};
|
|
114401
114412
|
for (const [key, value] of Object.entries(values)) {
|
|
114402
114413
|
if (value === void 0) continue;
|
|
@@ -114431,7 +114442,10 @@ var RecordIntegrationInstances = class {
|
|
|
114431
114442
|
status: "unsupported",
|
|
114432
114443
|
error: "This integration declares no connection test"
|
|
114433
114444
|
};
|
|
114434
|
-
return this.hooks.test(input
|
|
114445
|
+
return this.hooks.test(input.id === null ? input : {
|
|
114446
|
+
...input,
|
|
114447
|
+
id: await this.resolveRecordId(input.id)
|
|
114448
|
+
});
|
|
114435
114449
|
};
|
|
114436
114450
|
/** The flat provider object to hand to `registerProvider`. */
|
|
114437
114451
|
toProvider() {
|
|
@@ -153613,7 +153627,14 @@ var DiscoveryCandidateSchema = object({
|
|
|
153613
153627
|
/** `stableId` of the gateway candidate this device was found BEHIND. */
|
|
153614
153628
|
parentStableId: string().optional(),
|
|
153615
153629
|
/** `false` = shown for context but not pickable. Default true. */
|
|
153616
|
-
selectable: boolean().optional()
|
|
153630
|
+
selectable: boolean().optional(),
|
|
153631
|
+
/**
|
|
153632
|
+
* Keys of the provider's creation form (`getChildCreationSchema`) this candidate
|
|
153633
|
+
* cannot be adopted without — a key for an encrypted board, a pairing code. The
|
|
153634
|
+
* admin asks for exactly these, on the creation form prefilled with
|
|
153635
|
+
* `prefilledConfig`, before it adopts. Absent or empty = adopt as it is.
|
|
153636
|
+
*/
|
|
153637
|
+
needsParams: array(string()).optional()
|
|
153617
153638
|
});
|
|
153618
153639
|
/**
|
|
153619
153640
|
* Flat device summary returned by `createDevice` / `adoptDiscoveredDevice`.
|
|
@@ -153740,8 +153761,14 @@ var deviceProviderCapability = {
|
|
|
153740
153761
|
* provider does not support manual creation. Lets the Add-Device dialog
|
|
153741
153762
|
* pick the right type instead of assuming Camera.
|
|
153742
153763
|
*/
|
|
153743
|
-
getManualCreationType: method(object({
|
|
153744
|
-
|
|
153764
|
+
getManualCreationType: method(object({
|
|
153765
|
+
/** The integration asked about; a provider whose integrations differ answers per one. */
|
|
153766
|
+
integrationId: string().optional() }), object({ deviceType: _enum(DeviceType).nullable() })),
|
|
153767
|
+
adoptDiscoveredDevice: method(object({
|
|
153768
|
+
candidate: DiscoveryCandidateSchema,
|
|
153769
|
+
/** The integration the operator adopts into; a provider with several instances needs it. */
|
|
153770
|
+
integrationId: string().optional()
|
|
153771
|
+
}), DeviceSummarySchema, {
|
|
153745
153772
|
kind: "mutation",
|
|
153746
153773
|
auth: "admin"
|
|
153747
153774
|
}),
|
|
@@ -153752,10 +153779,16 @@ var deviceProviderCapability = {
|
|
|
153752
153779
|
* devices of that type. The output is a `ConfigUISchema` — the
|
|
153753
153780
|
* router type-asserts it at the boundary.
|
|
153754
153781
|
*/
|
|
153755
|
-
getChildCreationSchema: method(object({
|
|
153782
|
+
getChildCreationSchema: method(object({
|
|
153783
|
+
type: _enum(DeviceType),
|
|
153784
|
+
/** The integration asked about; a provider whose integrations differ answers per one. */
|
|
153785
|
+
integrationId: string().optional()
|
|
153786
|
+
}), CreationSchemaOutputSchema),
|
|
153756
153787
|
createDevice: method(object({
|
|
153757
153788
|
type: _enum(DeviceType),
|
|
153758
|
-
config: record(string(), unknown())
|
|
153789
|
+
config: record(string(), unknown()),
|
|
153790
|
+
/** The integration the operator adds the device to; a provider with several instances needs it. */
|
|
153791
|
+
integrationId: string().optional()
|
|
153759
153792
|
}), DeviceSummarySchema, {
|
|
153760
153793
|
kind: "mutation",
|
|
153761
153794
|
auth: "admin"
|
|
@@ -154480,7 +154513,10 @@ method(object({
|
|
|
154480
154513
|
auth: "admin"
|
|
154481
154514
|
}), method(object({
|
|
154482
154515
|
addonId: string(),
|
|
154483
|
-
type: _enum(DeviceType)
|
|
154516
|
+
type: _enum(DeviceType),
|
|
154517
|
+
/** The integration the form is for; a provider whose integrations differ (a hub
|
|
154518
|
+
* integration takes no manual add) answers per integration. Absent = the addon's own. */
|
|
154519
|
+
integrationId: string().optional()
|
|
154484
154520
|
}), unknown().nullable()), method(object({
|
|
154485
154521
|
addonId: string(),
|
|
154486
154522
|
type: _enum(DeviceType),
|
|
@@ -154564,7 +154600,11 @@ method(object({
|
|
|
154564
154600
|
kind: "mutation",
|
|
154565
154601
|
auth: "admin",
|
|
154566
154602
|
timeoutMs: 12e4
|
|
154567
|
-
}), method(object({
|
|
154603
|
+
}), method(object({
|
|
154604
|
+
addonId: string(),
|
|
154605
|
+
/** The integration the Add-Device dialog is open on; absent = the addon's own. */
|
|
154606
|
+
integrationId: string().optional()
|
|
154607
|
+
}), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
154568
154608
|
deviceId: number(),
|
|
154569
154609
|
key: string(),
|
|
154570
154610
|
value: unknown()
|
|
@@ -184768,7 +184808,7 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
184768
184808
|
* `deviceClasses` map (first registered type). `null` when manual creation is
|
|
184769
184809
|
* unsupported. Lets the Add-Device dialog pick the right type per provider.
|
|
184770
184810
|
*/
|
|
184771
|
-
async getManualCreationType() {
|
|
184811
|
+
async getManualCreationType(_input) {
|
|
184772
184812
|
if (!await this.supportsManualCreation()) return { deviceType: null };
|
|
184773
184813
|
return { deviceType: Object.values(DeviceType).find((t) => this.deviceClasses[t] !== void 0) ?? null };
|
|
184774
184814
|
}
|
|
@@ -184779,7 +184819,7 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
184779
184819
|
return true;
|
|
184780
184820
|
}
|
|
184781
184821
|
async getChildCreationSchema(input) {
|
|
184782
|
-
return this.onGetCreationSchema(input.type);
|
|
184822
|
+
return this.onGetCreationSchema(input.type, { integrationId: input.integrationId });
|
|
184783
184823
|
}
|
|
184784
184824
|
/**
|
|
184785
184825
|
* Default kernel-orchestrated `createDevice` implementation. The
|
|
@@ -184791,7 +184831,7 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
184791
184831
|
* `deviceClasses` instead.
|
|
184792
184832
|
*/
|
|
184793
184833
|
async createDevice(input) {
|
|
184794
|
-
const spec = await this.onCreateDevice(input.type, input.config);
|
|
184834
|
+
const spec = await this.onCreateDevice(input.type, input.config, { ...input.integrationId !== void 0 ? { integrationId: input.integrationId } : {} });
|
|
184795
184835
|
const Class = this.deviceClasses[spec.meta.type];
|
|
184796
184836
|
if (!Class) throw new Error(`${this.providerName} provider: no device class registered for type "${spec.meta.type}" — add it to the deviceClasses map`);
|
|
184797
184837
|
const stableId = this.generateStableId(spec.meta.type, spec.config);
|
|
@@ -221703,6 +221743,19 @@ function reolinkInstancesProvider(instances, deps) {
|
|
|
221703
221743
|
}
|
|
221704
221744
|
};
|
|
221705
221745
|
}
|
|
221746
|
+
/**
|
|
221747
|
+
* Whether an integration IS one NVR / Home Hub (its devices come from the hub, so there is no
|
|
221748
|
+
* manual add by IP). An integration the registry cannot name is not a hub for this question.
|
|
221749
|
+
*/
|
|
221750
|
+
async function integrationIsHub(instances, deps, id) {
|
|
221751
|
+
const [evidence, body] = await Promise.all([deps.registryEvidenceOf(id), instances.getResolved(id)]);
|
|
221752
|
+
if (evidence === null) return false;
|
|
221753
|
+
return isHubIntegration({
|
|
221754
|
+
originStableId: evidence.originStableId,
|
|
221755
|
+
info: evidence.info,
|
|
221756
|
+
settings: body === null ? {} : hubSettingsOf(body)
|
|
221757
|
+
});
|
|
221758
|
+
}
|
|
221706
221759
|
//#endregion
|
|
221707
221760
|
//#region src/migrations/integration-rows-to-record.ts
|
|
221708
221761
|
/**
|
|
@@ -222481,6 +222534,7 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
|
|
|
222481
222534
|
autodetectCache = new AutodetectCache();
|
|
222482
222535
|
hubManager = null;
|
|
222483
222536
|
instances = null;
|
|
222537
|
+
hubIntegrationProbe = null;
|
|
222484
222538
|
/**
|
|
222485
222539
|
* The camera mailbox bridge (`email-push-bridge.ts`, D999): battery cameras mail motion to a
|
|
222486
222540
|
* mailbox of the `smtp-inbound` broker, the bridge turns each message into the camera's
|
|
@@ -222991,6 +223045,7 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
|
|
|
222991
223045
|
registryEvidenceOf
|
|
222992
223046
|
});
|
|
222993
223047
|
this.instances = instances;
|
|
223048
|
+
this.hubIntegrationProbe = (id) => integrationIsHub(instances, { registryEvidenceOf }, id);
|
|
222994
223049
|
await this.runMigrations([...defineAddonMigrations(REOLINK_MIGRATIONS, this.migrationPorts()), ...defineAddonMigrations(REOLINK_INTEGRATION_MIGRATIONS, integrationPorts)]);
|
|
222995
223050
|
this.wireEmailBridge();
|
|
222996
223051
|
const wireSleepPushResolvers = (event, via) => {
|
|
@@ -223324,10 +223379,22 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
|
|
|
223324
223379
|
config: input.candidate.prefilledConfig
|
|
223325
223380
|
});
|
|
223326
223381
|
}
|
|
223327
|
-
async onGetCreationSchema(type) {
|
|
223382
|
+
async onGetCreationSchema(type, context) {
|
|
223328
223383
|
if (type !== DeviceType.Camera) return null;
|
|
223384
|
+
if (await this.isHubIntegrationId(context?.integrationId)) return null;
|
|
223329
223385
|
return buildCreationFormSchema();
|
|
223330
223386
|
}
|
|
223387
|
+
/** A hub integration's devices come from the hub: no manual add by IP for it. */
|
|
223388
|
+
async getManualCreationType(input) {
|
|
223389
|
+
if (await this.isHubIntegrationId(input?.integrationId)) return { deviceType: null };
|
|
223390
|
+
return super.getManualCreationType(input);
|
|
223391
|
+
}
|
|
223392
|
+
/** `false` for no integration, or one the registry cannot name (the addon's own default). */
|
|
223393
|
+
async isHubIntegrationId(id) {
|
|
223394
|
+
const probe = this.hubIntegrationProbe;
|
|
223395
|
+
if (id === void 0 || probe === null) return false;
|
|
223396
|
+
return probe(id);
|
|
223397
|
+
}
|
|
223331
223398
|
async onCreateDevice(type, config) {
|
|
223332
223399
|
if (type !== DeviceType.Camera) throw new Error(`Reolink provider does not support device type: ${type}`);
|
|
223333
223400
|
const name = getString(config, "name").trim();
|
package/dist/addon.mjs
CHANGED
|
@@ -114366,12 +114366,22 @@ var RecordIntegrationInstances = class {
|
|
|
114366
114366
|
...this.hooks.description,
|
|
114367
114367
|
mintsId: true
|
|
114368
114368
|
};
|
|
114369
|
-
|
|
114369
|
+
/**
|
|
114370
|
+
* The record an id names. A caller holding the `integrations` registry id (the Integrations
|
|
114371
|
+
* page) reaches a kind whose body links to it through `integrationId`; an id that is itself a
|
|
114372
|
+
* record id answers as it is. An id that names nothing comes back unchanged.
|
|
114373
|
+
*/
|
|
114374
|
+
async resolveRecordId(id) {
|
|
114375
|
+
if (await this.handle.get(id) !== null) return id;
|
|
114376
|
+
const linked = (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.find((record) => record.data["integrationId"] === id);
|
|
114377
|
+
return linked === void 0 ? id : linked.id;
|
|
114378
|
+
}
|
|
114379
|
+
instanceFormSchema = async ({ id }) => this.hooks.formSchema(id === null ? null : await this.resolveRecordId(id));
|
|
114370
114380
|
listInstances = async () => {
|
|
114371
114381
|
return (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.map((record) => this.viewOf(record));
|
|
114372
114382
|
};
|
|
114373
114383
|
getInstance = async ({ id }) => {
|
|
114374
|
-
const record = await this.handle.get(id);
|
|
114384
|
+
const record = await this.handle.get(await this.resolveRecordId(id));
|
|
114375
114385
|
return record === null ? null : this.viewOf(record);
|
|
114376
114386
|
};
|
|
114377
114387
|
/** Insert ONE row (`ifRev: 0`: an existing id is refused, never overwritten). */
|
|
@@ -114388,7 +114398,8 @@ var RecordIntegrationInstances = class {
|
|
|
114388
114398
|
await this.hooks.onChanged?.(minted, "created");
|
|
114389
114399
|
return { id: minted };
|
|
114390
114400
|
};
|
|
114391
|
-
updateInstance = async ({ id, name, values }) => {
|
|
114401
|
+
updateInstance = async ({ id: askedId, name, values }) => {
|
|
114402
|
+
const id = await this.resolveRecordId(askedId);
|
|
114392
114403
|
const patch = {};
|
|
114393
114404
|
for (const [key, value] of Object.entries(values)) {
|
|
114394
114405
|
if (value === void 0) continue;
|
|
@@ -114423,7 +114434,10 @@ var RecordIntegrationInstances = class {
|
|
|
114423
114434
|
status: "unsupported",
|
|
114424
114435
|
error: "This integration declares no connection test"
|
|
114425
114436
|
};
|
|
114426
|
-
return this.hooks.test(input
|
|
114437
|
+
return this.hooks.test(input.id === null ? input : {
|
|
114438
|
+
...input,
|
|
114439
|
+
id: await this.resolveRecordId(input.id)
|
|
114440
|
+
});
|
|
114427
114441
|
};
|
|
114428
114442
|
/** The flat provider object to hand to `registerProvider`. */
|
|
114429
114443
|
toProvider() {
|
|
@@ -153605,7 +153619,14 @@ var DiscoveryCandidateSchema = object({
|
|
|
153605
153619
|
/** `stableId` of the gateway candidate this device was found BEHIND. */
|
|
153606
153620
|
parentStableId: string().optional(),
|
|
153607
153621
|
/** `false` = shown for context but not pickable. Default true. */
|
|
153608
|
-
selectable: boolean().optional()
|
|
153622
|
+
selectable: boolean().optional(),
|
|
153623
|
+
/**
|
|
153624
|
+
* Keys of the provider's creation form (`getChildCreationSchema`) this candidate
|
|
153625
|
+
* cannot be adopted without — a key for an encrypted board, a pairing code. The
|
|
153626
|
+
* admin asks for exactly these, on the creation form prefilled with
|
|
153627
|
+
* `prefilledConfig`, before it adopts. Absent or empty = adopt as it is.
|
|
153628
|
+
*/
|
|
153629
|
+
needsParams: array(string()).optional()
|
|
153609
153630
|
});
|
|
153610
153631
|
/**
|
|
153611
153632
|
* Flat device summary returned by `createDevice` / `adoptDiscoveredDevice`.
|
|
@@ -153732,8 +153753,14 @@ var deviceProviderCapability = {
|
|
|
153732
153753
|
* provider does not support manual creation. Lets the Add-Device dialog
|
|
153733
153754
|
* pick the right type instead of assuming Camera.
|
|
153734
153755
|
*/
|
|
153735
|
-
getManualCreationType: method(object({
|
|
153736
|
-
|
|
153756
|
+
getManualCreationType: method(object({
|
|
153757
|
+
/** The integration asked about; a provider whose integrations differ answers per one. */
|
|
153758
|
+
integrationId: string().optional() }), object({ deviceType: _enum(DeviceType).nullable() })),
|
|
153759
|
+
adoptDiscoveredDevice: method(object({
|
|
153760
|
+
candidate: DiscoveryCandidateSchema,
|
|
153761
|
+
/** The integration the operator adopts into; a provider with several instances needs it. */
|
|
153762
|
+
integrationId: string().optional()
|
|
153763
|
+
}), DeviceSummarySchema, {
|
|
153737
153764
|
kind: "mutation",
|
|
153738
153765
|
auth: "admin"
|
|
153739
153766
|
}),
|
|
@@ -153744,10 +153771,16 @@ var deviceProviderCapability = {
|
|
|
153744
153771
|
* devices of that type. The output is a `ConfigUISchema` — the
|
|
153745
153772
|
* router type-asserts it at the boundary.
|
|
153746
153773
|
*/
|
|
153747
|
-
getChildCreationSchema: method(object({
|
|
153774
|
+
getChildCreationSchema: method(object({
|
|
153775
|
+
type: _enum(DeviceType),
|
|
153776
|
+
/** The integration asked about; a provider whose integrations differ answers per one. */
|
|
153777
|
+
integrationId: string().optional()
|
|
153778
|
+
}), CreationSchemaOutputSchema),
|
|
153748
153779
|
createDevice: method(object({
|
|
153749
153780
|
type: _enum(DeviceType),
|
|
153750
|
-
config: record(string(), unknown())
|
|
153781
|
+
config: record(string(), unknown()),
|
|
153782
|
+
/** The integration the operator adds the device to; a provider with several instances needs it. */
|
|
153783
|
+
integrationId: string().optional()
|
|
153751
153784
|
}), DeviceSummarySchema, {
|
|
153752
153785
|
kind: "mutation",
|
|
153753
153786
|
auth: "admin"
|
|
@@ -154472,7 +154505,10 @@ method(object({
|
|
|
154472
154505
|
auth: "admin"
|
|
154473
154506
|
}), method(object({
|
|
154474
154507
|
addonId: string(),
|
|
154475
|
-
type: _enum(DeviceType)
|
|
154508
|
+
type: _enum(DeviceType),
|
|
154509
|
+
/** The integration the form is for; a provider whose integrations differ (a hub
|
|
154510
|
+
* integration takes no manual add) answers per integration. Absent = the addon's own. */
|
|
154511
|
+
integrationId: string().optional()
|
|
154476
154512
|
}), unknown().nullable()), method(object({
|
|
154477
154513
|
addonId: string(),
|
|
154478
154514
|
type: _enum(DeviceType),
|
|
@@ -154556,7 +154592,11 @@ method(object({
|
|
|
154556
154592
|
kind: "mutation",
|
|
154557
154593
|
auth: "admin",
|
|
154558
154594
|
timeoutMs: 12e4
|
|
154559
|
-
}), method(object({
|
|
154595
|
+
}), method(object({
|
|
154596
|
+
addonId: string(),
|
|
154597
|
+
/** The integration the Add-Device dialog is open on; absent = the addon's own. */
|
|
154598
|
+
integrationId: string().optional()
|
|
154599
|
+
}), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
154560
154600
|
deviceId: number(),
|
|
154561
154601
|
key: string(),
|
|
154562
154602
|
value: unknown()
|
|
@@ -184760,7 +184800,7 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
184760
184800
|
* `deviceClasses` map (first registered type). `null` when manual creation is
|
|
184761
184801
|
* unsupported. Lets the Add-Device dialog pick the right type per provider.
|
|
184762
184802
|
*/
|
|
184763
|
-
async getManualCreationType() {
|
|
184803
|
+
async getManualCreationType(_input) {
|
|
184764
184804
|
if (!await this.supportsManualCreation()) return { deviceType: null };
|
|
184765
184805
|
return { deviceType: Object.values(DeviceType).find((t) => this.deviceClasses[t] !== void 0) ?? null };
|
|
184766
184806
|
}
|
|
@@ -184771,7 +184811,7 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
184771
184811
|
return true;
|
|
184772
184812
|
}
|
|
184773
184813
|
async getChildCreationSchema(input) {
|
|
184774
|
-
return this.onGetCreationSchema(input.type);
|
|
184814
|
+
return this.onGetCreationSchema(input.type, { integrationId: input.integrationId });
|
|
184775
184815
|
}
|
|
184776
184816
|
/**
|
|
184777
184817
|
* Default kernel-orchestrated `createDevice` implementation. The
|
|
@@ -184783,7 +184823,7 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
184783
184823
|
* `deviceClasses` instead.
|
|
184784
184824
|
*/
|
|
184785
184825
|
async createDevice(input) {
|
|
184786
|
-
const spec = await this.onCreateDevice(input.type, input.config);
|
|
184826
|
+
const spec = await this.onCreateDevice(input.type, input.config, { ...input.integrationId !== void 0 ? { integrationId: input.integrationId } : {} });
|
|
184787
184827
|
const Class = this.deviceClasses[spec.meta.type];
|
|
184788
184828
|
if (!Class) throw new Error(`${this.providerName} provider: no device class registered for type "${spec.meta.type}" — add it to the deviceClasses map`);
|
|
184789
184829
|
const stableId = this.generateStableId(spec.meta.type, spec.config);
|
|
@@ -221695,6 +221735,19 @@ function reolinkInstancesProvider(instances, deps) {
|
|
|
221695
221735
|
}
|
|
221696
221736
|
};
|
|
221697
221737
|
}
|
|
221738
|
+
/**
|
|
221739
|
+
* Whether an integration IS one NVR / Home Hub (its devices come from the hub, so there is no
|
|
221740
|
+
* manual add by IP). An integration the registry cannot name is not a hub for this question.
|
|
221741
|
+
*/
|
|
221742
|
+
async function integrationIsHub(instances, deps, id) {
|
|
221743
|
+
const [evidence, body] = await Promise.all([deps.registryEvidenceOf(id), instances.getResolved(id)]);
|
|
221744
|
+
if (evidence === null) return false;
|
|
221745
|
+
return isHubIntegration({
|
|
221746
|
+
originStableId: evidence.originStableId,
|
|
221747
|
+
info: evidence.info,
|
|
221748
|
+
settings: body === null ? {} : hubSettingsOf(body)
|
|
221749
|
+
});
|
|
221750
|
+
}
|
|
221698
221751
|
//#endregion
|
|
221699
221752
|
//#region src/migrations/integration-rows-to-record.ts
|
|
221700
221753
|
/**
|
|
@@ -222473,6 +222526,7 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
|
|
|
222473
222526
|
autodetectCache = new AutodetectCache();
|
|
222474
222527
|
hubManager = null;
|
|
222475
222528
|
instances = null;
|
|
222529
|
+
hubIntegrationProbe = null;
|
|
222476
222530
|
/**
|
|
222477
222531
|
* The camera mailbox bridge (`email-push-bridge.ts`, D999): battery cameras mail motion to a
|
|
222478
222532
|
* mailbox of the `smtp-inbound` broker, the bridge turns each message into the camera's
|
|
@@ -222983,6 +223037,7 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
|
|
|
222983
223037
|
registryEvidenceOf
|
|
222984
223038
|
});
|
|
222985
223039
|
this.instances = instances;
|
|
223040
|
+
this.hubIntegrationProbe = (id) => integrationIsHub(instances, { registryEvidenceOf }, id);
|
|
222986
223041
|
await this.runMigrations([...defineAddonMigrations(REOLINK_MIGRATIONS, this.migrationPorts()), ...defineAddonMigrations(REOLINK_INTEGRATION_MIGRATIONS, integrationPorts)]);
|
|
222987
223042
|
this.wireEmailBridge();
|
|
222988
223043
|
const wireSleepPushResolvers = (event, via) => {
|
|
@@ -223316,10 +223371,22 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
|
|
|
223316
223371
|
config: input.candidate.prefilledConfig
|
|
223317
223372
|
});
|
|
223318
223373
|
}
|
|
223319
|
-
async onGetCreationSchema(type) {
|
|
223374
|
+
async onGetCreationSchema(type, context) {
|
|
223320
223375
|
if (type !== DeviceType.Camera) return null;
|
|
223376
|
+
if (await this.isHubIntegrationId(context?.integrationId)) return null;
|
|
223321
223377
|
return buildCreationFormSchema();
|
|
223322
223378
|
}
|
|
223379
|
+
/** A hub integration's devices come from the hub: no manual add by IP for it. */
|
|
223380
|
+
async getManualCreationType(input) {
|
|
223381
|
+
if (await this.isHubIntegrationId(input?.integrationId)) return { deviceType: null };
|
|
223382
|
+
return super.getManualCreationType(input);
|
|
223383
|
+
}
|
|
223384
|
+
/** `false` for no integration, or one the registry cannot name (the addon's own default). */
|
|
223385
|
+
async isHubIntegrationId(id) {
|
|
223386
|
+
const probe = this.hubIntegrationProbe;
|
|
223387
|
+
if (id === void 0 || probe === null) return false;
|
|
223388
|
+
return probe(id);
|
|
223389
|
+
}
|
|
223323
223390
|
async onCreateDevice(type, config) {
|
|
223324
223391
|
if (type !== DeviceType.Camera) throw new Error(`Reolink provider does not support device type: ${type}`);
|
|
223325
223392
|
const name = getString(config, "name").trim();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-provider-reolink",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.229",
|
|
4
4
|
"description": "Reolink camera device provider addon for CamStack — native Baichuan protocol",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"werift"
|
|
97
97
|
],
|
|
98
98
|
"requires": {
|
|
99
|
-
"server": ">=1.2.
|
|
99
|
+
"server": ">=1.2.779"
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
102
|
"files": [
|