@apocaliss92/scrypted-reolink-native 0.1.27 → 0.1.29

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.27",
3
+ "version": "0.1.29",
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/common.ts CHANGED
@@ -1058,11 +1058,9 @@ export abstract class CommonCameraMixin extends BaseBaichuanClass implements Vid
1058
1058
 
1059
1059
  const { hasSiren, hasFloodlight, hasPir } = abilities;
1060
1060
 
1061
- const devices: Device[] = [];
1062
-
1063
1061
  if (hasSiren) {
1064
1062
  const sirenNativeId = `${this.nativeId}${sirenSuffix}`;
1065
- devices.push({
1063
+ const device: Device = {
1066
1064
  providerNativeId: this.nativeId,
1067
1065
  name: `${this.name} Siren`,
1068
1066
  nativeId: sirenNativeId,
@@ -1071,12 +1069,13 @@ export abstract class CommonCameraMixin extends BaseBaichuanClass implements Vid
1071
1069
  },
1072
1070
  interfaces: [ScryptedInterface.OnOff, ScryptedInterface.Settings],
1073
1071
  type: ScryptedDeviceType.Siren,
1074
- });
1072
+ };
1073
+ sdk.deviceManager.onDeviceDiscovered(device);
1075
1074
  }
1076
1075
 
1077
1076
  if (hasFloodlight) {
1078
1077
  const floodlightNativeId = `${this.nativeId}${floodlightSuffix}`;
1079
- devices.push({
1078
+ const device: Device = {
1080
1079
  providerNativeId: this.nativeId,
1081
1080
  name: `${this.name} Floodlight`,
1082
1081
  nativeId: floodlightNativeId,
@@ -1085,12 +1084,13 @@ export abstract class CommonCameraMixin extends BaseBaichuanClass implements Vid
1085
1084
  },
1086
1085
  interfaces: [ScryptedInterface.OnOff, ScryptedInterface.Settings],
1087
1086
  type: ScryptedDeviceType.Light,
1088
- });
1087
+ };
1088
+ sdk.deviceManager.onDeviceDiscovered(device);
1089
1089
  }
1090
1090
 
1091
1091
  if (hasPir) {
1092
1092
  const pirNativeId = `${this.nativeId}${pirSuffix}`;
1093
- devices.push({
1093
+ const device: Device = {
1094
1094
  providerNativeId: this.nativeId,
1095
1095
  name: `${this.name} PIR`,
1096
1096
  nativeId: pirNativeId,
@@ -1099,13 +1099,9 @@ export abstract class CommonCameraMixin extends BaseBaichuanClass implements Vid
1099
1099
  },
1100
1100
  interfaces: [ScryptedInterface.OnOff, ScryptedInterface.Settings],
1101
1101
  type: ScryptedDeviceType.Switch,
1102
- });
1102
+ };
1103
+ sdk.deviceManager.onDeviceDiscovered(device);
1103
1104
  }
1104
-
1105
- sdk.deviceManager.onDevicesChanged({
1106
- providerNativeId: this.nativeId,
1107
- devices,
1108
- });
1109
1105
  }
1110
1106
 
1111
1107
  async getSettings(): Promise<Setting[]> {
package/src/multiFocal.ts CHANGED
@@ -216,6 +216,11 @@ export class ReolinkNativeMultiFocalDevice extends CommonCameraMixin implements
216
216
 
217
217
  const camera = await this.getDevice(nativeId);
218
218
 
219
+ if (!camera) {
220
+ logger.error(`Failed to get device ${nativeId}`);
221
+ continue;
222
+ }
223
+
219
224
  camera.storageSettings.values.rtspChannel = channel;
220
225
  camera.classes = objects;
221
226
  camera.presets = presets;
@@ -227,6 +232,8 @@ export class ReolinkNativeMultiFocalDevice extends CommonCameraMixin implements
227
232
  camera.storageSettings.values.uid = uid;
228
233
  }
229
234
  }
235
+
236
+ await super.reportDevices();
230
237
  }
231
238
 
232
239
  async getDevice(nativeId: string) {