@mega-yfue/eufy-sdk 0.5.0-beta.86 → 0.5.0-beta.88

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/index.js CHANGED
@@ -4712,6 +4712,10 @@ function cellGated(members) {
4712
4712
  });
4713
4713
  return Object.fromEntries(gated);
4714
4714
  }
4715
+ function isChargingState(v) {
4716
+ const n = Number(v);
4717
+ return n !== 0 && n !== 2;
4718
+ }
4715
4719
  var BATTERY_MEMBERS = cellGated({
4716
4720
  /**
4717
4721
  * The headline percentage, and this capability's detection evidence: reporting 1101 is what proves a
@@ -4737,10 +4741,7 @@ var BATTERY_MEMBERS = cellGated({
4737
4741
  type: "bool",
4738
4742
  kind: "boolean",
4739
4743
  provenance: "apk",
4740
- coerce: (v) => {
4741
- const n = Number(v);
4742
- return n !== 0 && n !== 2;
4743
- },
4744
+ coerce: isChargingState,
4744
4745
  description: "Charging in progress \u2014 derived from BATTERY_STATUS (2111) as `value \u2209 {0,2}`, matching the app's own decode. 0/2 = not charging; a solar/USB charge (incl. a built-in solar panel, which reads 4) is non-zero."
4745
4746
  },
4746
4747
  /**
@@ -7809,36 +7810,34 @@ var LOCK = {
7809
7810
  // dist/model/capabilities/keypad.js
7810
7811
  var KEYPAD_MEMBERS = {
7811
7812
  /**
7812
- * `unexposed`, so it reaches a diagnosis through `getProperty` but gets no typed getter. 1103 is a
7813
- * placeholder AND a likely collision — the app's own param table names 1103 GET_CAMERA_INFO — so a
7814
- * getter here would be asserting a meaning nothing backs. The keypad's real battery state arrives
7815
- * under `keypadBatteryCapState`, whose low/charging semantics are not confirmed.
7813
+ * `APP_CMD_KEYPAD_BATTERY_CAP_STATE` (1653). The app's sensor parser maps it to `sensor_is_low_power`,
7814
+ * the field `APP_CMD_ENTRY_SENSOR_BAT_STATE` and `APP_CMD_MOTION_SENSOR_BAT_STATE` decode as a boolean,
7815
+ * yet gives 1653 itself no decode case. `unexposed` until a device confirms which value means low; in
7816
+ * the schema for `getProperty`, absent from the typed surface.
7816
7817
  */
7817
7818
  batteryLow: {
7818
- param: 1103,
7819
+ param: 1653,
7819
7820
  type: "bool",
7820
7821
  kind: "boolean",
7821
- provenance: "guessed",
7822
+ provenance: "apk",
7822
7823
  unexposed: true,
7823
- description: "Keypad low-battery flag. UNVERIFIED: placeholder id pending verification \u2014 and the app's own param table names 1103 GET_CAMERA_INFO, so the id is very likely wrong here."
7824
+ description: "Keypad low-battery flag (APP_CMD_KEYPAD_BATTERY_CAP_STATE, 1653). UNVERIFIED polarity: the app names it its low-battery field but does not decode its value."
7824
7825
  },
7825
7826
  /**
7826
- * The charging half of the battery pair, `unexposed` for the same reason as `batteryLow`: 1102 is a
7827
- * placeholder id, and the state the keypad actually reports (`keypadBatteryChargerState`) has no
7828
- * confirmed value space. In the schema for `getProperty`, absent from the typed surface.
7827
+ * `APP_CMD_KEYPAD_BATTERY_CHARGER_STATE` (1655), decoded the way the app's sensor parser decodes it:
7828
+ * `charging = value ∉ {0,2}` ({@link isChargingState}).
7829
7829
  */
7830
7830
  charging: {
7831
- param: 1102,
7831
+ param: 1655,
7832
7832
  type: "bool",
7833
7833
  kind: "boolean",
7834
- provenance: "guessed",
7835
- unexposed: true,
7836
- description: "Keypad charging flag. UNVERIFIED: placeholder id pending verification."
7834
+ provenance: "apk",
7835
+ coerce: isChargingState,
7836
+ description: "Keypad charging \u2014 derived from APP_CMD_KEYPAD_BATTERY_CHARGER_STATE (1655) as `value \u2209 {0,2}`, matching the app's own decode."
7837
7837
  },
7838
7838
  /**
7839
- * The keypad's link quality in dBm — the one verified read in this table, on the same param 1141 the
7840
- * other sub-1G sensors report signal strength on. Reported as the device measures it: raw dBm, never
7841
- * normalised to a bar count.
7839
+ * The keypad's link quality in dBm, on the same param 1141 the other sub-1G sensors report signal
7840
+ * strength on. Reported as the device measures it: raw dBm, never normalised to a bar count.
7842
7841
  */
7843
7842
  rssi: {
7844
7843
  param: 1141,
@@ -27402,6 +27401,11 @@ var PushClient = class _PushClient extends EventEmitter13 {
27402
27401
  closing = false;
27403
27402
  /** Consecutive MCS login rejections — transient ones self-heal via reconnect (see {@link onMessage}). */
27404
27403
  loginFailures = 0;
27404
+ /**
27405
+ * How many of {@link persistentIds} the last `LoginRequest` reported; a successful `LoginResponse`
27406
+ * acknowledges them, so they are dropped then.
27407
+ */
27408
+ reportedIds = 0;
27405
27409
  constructor(creds, logger = noopLogger) {
27406
27410
  super();
27407
27411
  this.creds = creds;
@@ -27460,6 +27464,7 @@ var PushClient = class _PushClient extends EventEmitter13 {
27460
27464
  clientEvent: [],
27461
27465
  receivedPersistentId: this.persistentIds
27462
27466
  };
27467
+ this.reportedIds = this.persistentIds.length;
27463
27468
  const buf = LoginRequest.encodeDelimited(obj).finish();
27464
27469
  return Buffer.concat([Buffer.from([MCS_VERSION, MessageTag.LoginRequest]), buf]);
27465
27470
  }
@@ -27483,6 +27488,8 @@ var PushClient = class _PushClient extends EventEmitter13 {
27483
27488
  this.loggedIn = true;
27484
27489
  this.currentDelay = 0;
27485
27490
  this.loginFailures = 0;
27491
+ this.persistentIds = this.persistentIds.slice(this.reportedIds);
27492
+ this.reportedIds = 0;
27486
27493
  this.startHeartbeat();
27487
27494
  this.logger.debug("[push] logged in");
27488
27495
  this.emit("connect");