@apocaliss92/scrypted-reolink-native 0.1.24 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/plugin.zip CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apocaliss92/scrypted-reolink-native",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "Use any reolink camera with Scrypted, even older/unsupported models without HTTP protocol support",
5
5
  "author": "@apocaliss92",
6
6
  "license": "Apache",
@@ -120,8 +120,7 @@ export class ReolinkNativeBatteryCamera extends CommonCameraMixin {
120
120
 
121
121
  logger.log('Starting periodic tasks for battery camera');
122
122
 
123
- // Check sleeping state every 5 seconds (non-blocking)
124
- if (!this.nvrDevice) {
123
+ if (!this.nvrDevice && !this.multiFocalDevice) {
125
124
  this.sleepCheckTimer = setInterval(async () => {
126
125
  try {
127
126
  const api = this.baichuanApi;
package/src/common.ts CHANGED
@@ -527,8 +527,8 @@ export abstract class CommonCameraMixin extends BaseBaichuanClass implements Vid
527
527
  thisDevice: Settings
528
528
 
529
529
  constructor(
530
- nativeId: string,
531
- public plugin: ReolinkNativePlugin,
530
+ nativeId: string,
531
+ public plugin: ReolinkNativePlugin,
532
532
  public options: CommonCameraMixinOptions
533
533
  ) {
534
534
  super(nativeId);
@@ -654,7 +654,7 @@ export abstract class CommonCameraMixin extends BaseBaichuanClass implements Vid
654
654
  }
655
655
 
656
656
  public getAbilities(): DeviceCapabilities {
657
- if(this.options.multiFocalDevice) {
657
+ if (this.options.multiFocalDevice) {
658
658
  return this.options.multiFocalDevice.getInterfaces(this.storageSettings.values.rtspChannel).capabilities;
659
659
  } else {
660
660
  return this.storageSettings.values.capabilities;
@@ -1116,6 +1116,11 @@ export abstract class CommonCameraMixin extends BaseBaichuanClass implements Vid
1116
1116
  async updateDeviceInfo(): Promise<void> {
1117
1117
  const logger = this.getBaichuanLogger();
1118
1118
 
1119
+ if (this.options.multiFocalDevice) {
1120
+ this.info = this.options.multiFocalDevice.info;
1121
+ return;
1122
+ }
1123
+
1119
1124
  const { ipAddress, rtspChannel } = this.storageSettings.values;
1120
1125
  try {
1121
1126
  const api = await this.ensureClient();
@@ -1446,38 +1451,41 @@ export abstract class CommonCameraMixin extends BaseBaichuanClass implements Vid
1446
1451
  const channel = this.storageSettings.values.rtspChannel;
1447
1452
 
1448
1453
  try {
1449
- const { capabilities, abilities, support, presets, objects } = await this.withBaichuanRetry(async () => {
1450
- const api = await this.ensureClient();
1451
- return await api.getDeviceCapabilities(channel);
1452
- });
1453
- this.classes = objects;
1454
- this.presets = presets;
1455
- this.storageSettings.values.capabilities = capabilities;
1456
- this.ptzPresets.setCachedPtzPresets(presets);
1457
-
1458
- try {
1459
- const { interfaces, type } = getDeviceInterfaces({
1460
- capabilities,
1461
- logger: this.console,
1454
+ if (this.options.multiFocalDevice) {
1455
+ // do nothing for now
1456
+ } else {
1457
+ const { capabilities, abilities, support, presets, objects } = await this.withBaichuanRetry(async () => {
1458
+ const api = await this.ensureClient();
1459
+ return await api.getDeviceCapabilities(channel);
1462
1460
  });
1461
+ this.classes = objects;
1462
+ this.presets = presets;
1463
+ this.ptzPresets.setCachedPtzPresets(presets);
1463
1464
 
1464
- const device: Device = {
1465
- nativeId: this.nativeId,
1466
- providerNativeId: this.nvrDevice?.nativeId ?? this.plugin?.nativeId,
1467
- name: this.name,
1468
- interfaces,
1469
- type,
1470
- info: this.info,
1471
- };
1472
-
1473
- logger.log(`Updating device interfaces: ${JSON.stringify(device)}`);
1465
+ try {
1466
+ const { interfaces, type } = getDeviceInterfaces({
1467
+ capabilities,
1468
+ logger: this.console,
1469
+ });
1470
+
1471
+ const device: Device = {
1472
+ nativeId: this.nativeId,
1473
+ providerNativeId: this.nvrDevice?.nativeId ?? this.plugin?.nativeId,
1474
+ name: this.name,
1475
+ interfaces,
1476
+ type,
1477
+ info: this.info,
1478
+ };
1479
+
1480
+ logger.log(`Updating device interfaces: ${JSON.stringify(device)}`);
1481
+
1482
+ await sdk.deviceManager.onDeviceDiscovered(device);
1483
+ } catch (e) {
1484
+ logger.error('Failed to update device interfaces', e);
1485
+ }
1474
1486
 
1475
- await sdk.deviceManager.onDeviceDiscovered(device);
1476
- } catch (e) {
1477
- logger.error('Failed to update device interfaces', e);
1487
+ logger.log(`Refreshed device capabilities: ${JSON.stringify({ capabilities, abilities, support, presets })}`);
1478
1488
  }
1479
-
1480
- logger.log(`Refreshed device capabilities: ${JSON.stringify({ capabilities, abilities, support, presets })}`);
1481
1489
  }
1482
1490
  catch (e) {
1483
1491
  logger.error('Failed to refresh abilities', e);
package/src/multiFocal.ts CHANGED
@@ -232,7 +232,7 @@ export class ReolinkNativeMultiFocalDevice extends BaseBaichuanClass implements
232
232
  async reportDevices(): Promise<void> {
233
233
  const api = await this.ensureBaichuanClient();
234
234
  const logger = this.getBaichuanLogger();
235
- const { protocol, username, password, ipAddress, uid } = this.storageSettings.values;
235
+ const { username, password, ipAddress, uid } = this.storageSettings.values;
236
236
 
237
237
  const { capabilities, support, abilities, features, objects, presets } = await api.getDeviceCapabilities();
238
238