@apocaliss92/scrypted-reolink-native 0.1.13 → 0.1.15

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.13",
3
+ "version": "0.1.15",
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
@@ -566,6 +566,21 @@ export abstract class CommonCameraMixin extends BaseBaichuanClass implements Vid
566
566
  onClose: async () => {
567
567
  // Reset client state on close
568
568
  // The base class already handles cleanup
569
+ // For battery cameras, don't auto-resubscribe after idle disconnects
570
+ // (idle disconnects are normal for battery cameras to save power)
571
+ // Events will be resubscribed when ensureClient() is called for actual operations
572
+ const isBattery = this.options.type === 'battery';
573
+ if (!isBattery) {
574
+ // For non-battery cameras, resubscribe to events after reconnection
575
+ setTimeout(async () => {
576
+ try {
577
+ await this.subscribeToEvents();
578
+ } catch (e) {
579
+ const logger = this.getBaichuanLogger();
580
+ logger.warn('Failed to resubscribe to events after reconnection', e);
581
+ }
582
+ }, 1000);
583
+ }
569
584
  },
570
585
  onSimpleEvent: this.onSimpleEvent,
571
586
  getEventSubscriptionEnabled: () => this.isEventDispatchEnabled?.() ?? false,