@apocaliss92/scrypted-reolink-native 0.4.49 → 0.4.51

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.49",
3
+ "version": "0.4.51",
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
@@ -458,13 +458,14 @@ export class ReolinkNativeNvrDevice
458
458
  // const { ipAddress } = this.storageSettings.values;
459
459
 
460
460
  const api = await this.ensureBaichuanClient();
461
- const { devices, channels } = await api.getNvrChannelsSummary({
462
- source: "cgi",
463
- });
461
+ // source:"cgi" uses HTTP GetChannelstatus which returns the channel list immediately,
462
+ // without depending on the async cmd_id 145 Baichuan push. This avoids the race
463
+ // condition where getNvrChannelsSummary returns empty right after login.
464
+ const { devices, channels } = await api.getNvrChannelsSummary({ source: "cgi" });
464
465
 
465
466
  if (!channels.length) {
466
467
  logger.debug(
467
- `No channels found, ${JSON.stringify({ channels, devices })}`,
468
+ `No channels found, retrying in 1s. ${JSON.stringify({ channels, devices })}`,
468
469
  );
469
470
  await new Promise((resolve) => setTimeout(resolve, 1000));
470
471
  await this.syncEntitiesFromRemote();
@@ -538,7 +539,7 @@ export class ReolinkNativeNvrDevice
538
539
 
539
540
  const allNativeIds = sdk.deviceManager
540
541
  .getNativeIds()
541
- .filter((nid) => !!nid);
542
+ .filter((nid) => !!nid && nid !== this.nativeId);
542
543
 
543
544
  const matchingNativeId = allNativeIds.find(
544
545
  (nid) =>