@apocaliss92/scrypted-reolink-native 0.4.48 → 0.4.49

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.4.48",
3
+ "version": "0.4.49",
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",
package/src/nvr.ts CHANGED
@@ -345,7 +345,10 @@ export class ReolinkNativeNvrDevice
345
345
  async init() {
346
346
  await this.ensureBaichuanClient();
347
347
  await this.subscribeToEvents();
348
- await this.discoverDevices(true);
348
+ const discovered = await this.discoverDevices(true);
349
+ if (discovered.length > 0) {
350
+ await this.onDeviceEvent(ScryptedInterface.DeviceDiscovery, discovered);
351
+ }
349
352
 
350
353
  await this.updateDeviceInfo();
351
354
  }
@@ -537,21 +540,26 @@ export class ReolinkNativeNvrDevice
537
540
  .getNativeIds()
538
541
  .filter((nid) => !!nid);
539
542
 
540
- if (
541
- allNativeIds.some(
542
- (nid) =>
543
- nid.includes(uid) ||
544
- nid.includes(`channel-${channel}`) ||
545
- // nid.includes(mac) ||
546
- // nid.includes(ip) ||
547
- nid.includes(name) ||
548
- nid === nativeId,
549
- )
550
- ) {
543
+ const matchingNativeId = allNativeIds.find(
544
+ (nid) =>
545
+ nid.includes(uid) ||
546
+ nid.includes(`channel-${channel}`) ||
547
+ // nid.includes(mac) ||
548
+ // nid.includes(ip) ||
549
+ nid.includes(name) ||
550
+ nid === nativeId,
551
+ );
552
+ if (matchingNativeId) {
553
+ logger.debug(
554
+ `[syncEntities] Skipping channel ${channel} (${name}): already registered as nativeId="${matchingNativeId}" (computed="${nativeId}", uid="${uid}")`,
555
+ );
551
556
  continue;
552
557
  }
553
558
 
554
559
  if (this.discoveredDevices.has(nativeId)) {
560
+ logger.debug(
561
+ `[syncEntities] Skipping channel ${channel} (${name}): already in discoveredDevices cache (nativeId="${nativeId}")`,
562
+ );
555
563
  continue;
556
564
  }
557
565