@apocaliss92/nodelink-js 0.4.34 → 0.4.36

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.
@@ -16308,7 +16308,19 @@ function computeDeviceCapabilities(params) {
16308
16308
  // lightType >= 2 indicates controllable white LED / floodlight (1 = IR only).
16309
16309
  // ledCtrl > 1 is a secondary signal that rescues firmwares like the Duo 3
16310
16310
  // WiFi which under-report lightType (=1) despite having a real spotlight.
16311
- hasFloodlight: Number.isFinite(lightType) ? lightType >= 2 || hasFloodlightFromLedCtrl : hasFloodlightFromAbilities || hasFloodlightFromLedCtrl,
16311
+ //
16312
+ // Doorbell exception: the Reolink desktop app's native SDK exposes
16313
+ // three SEPARATE ability flags — `supportFloodLight`, `supportDoorbellLight`
16314
+ // (with KeepOff/KeepOn sub-flags) and `supportIndicatorLight`. Doorbell-class
16315
+ // devices route the ring / button-area LED through `supportDoorbellLight`,
16316
+ // which is NOT a controllable white-light floodlight. We don't have a
16317
+ // documented bit-level mapping for ledCtrl, so we use the narrowest
16318
+ // rule that matches Reolink's own taxonomy: when the firmware is
16319
+ // categorical with lightType=0 AND the device identifies itself as a
16320
+ // doorbell (doorbellVersion > 0), trust lightType=0 and ignore the
16321
+ // ledCtrl bitmask. Verified against UID 9527000ICL1T1MDS (lightType=0,
16322
+ // ledCtrl=3073, doorbellVersion=31, no spotlight hardware).
16323
+ hasFloodlight: Number.isFinite(lightType) ? lightType >= 2 || hasFloodlightFromLedCtrl && !(isDoorbellFromSupport && lightType === 0) : hasFloodlightFromAbilities || hasFloodlightFromLedCtrl,
16312
16324
  hasPir: hasPirFromAbilities || hasPirFromSupport,
16313
16325
  isDoorbell,
16314
16326
  hasAutotracking: ptzDisabledBySupport ? false : hasAutotrackingFromSupport || hasAutotrackingFromAbilities,
@@ -26885,8 +26897,18 @@ ${xml}`
26885
26897
  * This is more reliable than autoPt in SupportInfo which can be a false positive
26886
26898
  * (e.g., NVR channels report autoPt=1 but don't actually support autotracking).
26887
26899
  *
26900
+ * Doorbell exception (mirrors the {@link computeDeviceCapabilities} floodlight
26901
+ * rule): video-doorbell firmwares (doorbellVersion > 0) ship AiCfg with
26902
+ * `smartTrackMode=1` (the current mode) yet `smartTrackModeAbility=0` (the
26903
+ * firmware's own "no, this device cannot autotrack" flag). Without a PT
26904
+ * motor a doorbell physically cannot autotrack, so when the caller flags the
26905
+ * device as a doorbell AND the firmware admits `smartTrackModeAbility=0`,
26906
+ * trust the firmware and return false. Verified against UID
26907
+ * 9527000ICL1T1MDS: smartTrackMode=1, smartTrackModeAbility=0,
26908
+ * ptzType=0, ptzMode="none", doorbellVersion=31.
26909
+ *
26888
26910
  * @param channel - Channel number (0-based)
26889
- * @param options - Optional timeout
26911
+ * @param options - Optional timeout and doorbell context hint
26890
26912
  * @returns true if autotracking is supported, false otherwise
26891
26913
  */
26892
26914
  async probeAutotrackingSupport(channel, options) {
@@ -26896,6 +26918,14 @@ ${xml}`
26896
26918
  const xml = await this.sendXml({ cmdId: 299, channel: ch, timeoutMs });
26897
26919
  const smartTrackModeRaw = getXmlText(xml, "smartTrackMode");
26898
26920
  const smartTrackMode = Number(smartTrackModeRaw ?? 0);
26921
+ const smartTrackModeAbilityRaw = getXmlText(
26922
+ xml,
26923
+ "smartTrackModeAbility"
26924
+ );
26925
+ const smartTrackModeAbility = smartTrackModeAbilityRaw === void 0 ? void 0 : Number(smartTrackModeAbilityRaw);
26926
+ if (options?.isDoorbell && Number.isFinite(smartTrackModeAbility) && smartTrackModeAbility === 0) {
26927
+ return false;
26928
+ }
26899
26929
  return smartTrackMode > 0;
26900
26930
  } catch {
26901
26931
  return false;
@@ -26988,7 +27018,8 @@ ${xml}`
26988
27018
  const features = this.parseFeaturesFromSupport(support);
26989
27019
  const objects = await this.getAiDetectTypes(ch, { timeoutMs: 1500 });
26990
27020
  const autotrackingProbed = await this.probeAutotrackingSupport(ch, {
26991
- timeoutMs: 1500
27021
+ timeoutMs: 1500,
27022
+ isDoorbell: capabilities.isDoorbell === true
26992
27023
  });
26993
27024
  capabilities.hasAutotracking = autotrackingProbed;
26994
27025
  let presets;