@apocaliss92/scrypted-reolink-native 0.5.32 → 0.5.33

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.5.32",
3
+ "version": "0.5.33",
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/camera.ts CHANGED
@@ -3944,20 +3944,26 @@ export class ReolinkCamera
3944
3944
  }
3945
3945
  }
3946
3946
  } else if (sleepStatus.state === "awake") {
3947
- // Camera is awake
3947
+ // Camera is awake — but DON'T do any proactive networking
3948
+ // here. Sleep inference can flicker (idle_disconnect FIN
3949
+ // packets, brief housekeeping packets from the cam, etc.),
3950
+ // and reacting to every flicker with `ensureClient + wakeUp
3951
+ // + takePicture + battery + aux state` ends up waking the cam
3952
+ // far more than the original flicker — the reconnect alone
3953
+ // re-logs in, re-subscribes events, and triggers a fresh
3954
+ // sleep/awake cycle. Real motion-triggered wake-ups arrive
3955
+ // via SMTP / native push and have their own snapshot refresh
3956
+ // path (`refreshSnapshotOnMotion`). Periodic battery polling
3957
+ // is owned by `batteryUpdateTimer` (hourly), not by sleep
3958
+ // inference. So here we only flip the local state flag.
3948
3959
  const wasSleeping = this.sleeping;
3949
3960
  if (wasSleeping) {
3950
3961
  this.getBaichuanLogger().log(`Camera is awake`);
3951
3962
  this.sleeping = false;
3952
- const client = await this.ensureClient();
3953
- await client.wakeUp();
3954
- await this.takePictureInternal(client);
3955
- }
3956
-
3957
- if (wasSleeping) {
3958
- this.updateBatteryInfo().catch(() => {});
3959
- this.alignAuxDevicesState().catch(() => {});
3960
3963
  if (this.forceNewSnapshot) {
3964
+ // Honor an explicit refresh requested by some other path
3965
+ // (e.g. user-triggered or capability discovery) — they
3966
+ // set `forceNewSnapshot=true` and we serve it here.
3961
3967
  this.takePicture().catch(() => {});
3962
3968
  }
3963
3969
  }