@apocaliss92/scrypted-reolink-native 0.3.3 → 0.3.5

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,9 +1,13 @@
1
1
  {
2
2
  "name": "@apocaliss92/scrypted-reolink-native",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
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",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/apocaliss92/scrypted-reolink-native"
10
+ },
7
11
  "scripts": {
8
12
  "build:lib": "./build-lib.sh",
9
13
  "scrypted-setup-project": "scrypted-setup-project",
package/src/camera.ts CHANGED
@@ -241,12 +241,7 @@ export class ReolinkCamera extends BaseBaichuanClass implements VideoCamera, Cam
241
241
  description: 'Order preference for video streams. Default: RTSP -> RTMP -> Native',
242
242
  defaultValue: 'Default',
243
243
  choices: ['Default', 'Native', 'RTSP', 'RTMP'],
244
- subgroup: 'Streaming',
245
244
  },
246
- // capabilities: {
247
- // json: true,
248
- // hide: true,
249
- // },
250
245
  multifocalInfo: {
251
246
  json: true,
252
247
  hide: true,
package/src/nvr.ts CHANGED
@@ -369,6 +369,22 @@ export class ReolinkNativeNvrDevice extends BaseBaichuanClass implements Setting
369
369
  isMultifocal,
370
370
  identifier,
371
371
  });
372
+
373
+ // Check if device already exists in cameraNativeMap with a different nativeId format
374
+ // (e.g., with chN- prefix). If so, use that nativeId for the mapping.
375
+ let actualNativeId = nativeId;
376
+ const existingDevice = Array.from(this.cameraNativeMap.entries()).find(([id, camera]) => {
377
+ // Check if the camera matches by channel or UID
378
+ const cameraChannel = camera.storageSettings.values.rtspChannel;
379
+ const cameraUid = camera.storageSettings.values.uid;
380
+ return cameraChannel === channel || (uid && cameraUid === uid);
381
+ });
382
+
383
+ if (existingDevice) {
384
+ actualNativeId = existingDevice[0];
385
+ logger.debug(`[syncEntities] Using existing nativeId for channel ${channel}: ${actualNativeId} (instead of ${nativeId})`);
386
+ }
387
+
372
388
  const interfaces = [ScryptedInterface.VideoCamera];
373
389
  if (isBattery) {
374
390
  interfaces.push(ScryptedInterface.Battery);
@@ -388,7 +404,7 @@ export class ReolinkNativeNvrDevice extends BaseBaichuanClass implements Setting
388
404
  }
389
405
  };
390
406
 
391
- this.channelToNativeIdMap.set(channel, nativeId);
407
+ this.channelToNativeIdMap.set(channel, actualNativeId);
392
408
 
393
409
  const allNativeIds = sdk.deviceManager.getNativeIds().filter(nid => !!nid);
394
410