@mega-yfue/eufy-sdk 0.2.0-beta.24 → 0.2.0-beta.25

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
@@ -7029,32 +7029,32 @@ function settingToggle(settingId, name, enabled, ctx, sink) {
7029
7029
  var overP2p = (ctx) => ctx.hasP2p === true;
7030
7030
  var LOCK_MEMBERS = {
7031
7031
  /**
7032
- * The lock's own state, and the weakest thing in this table: 1200 is a `guessed` placeholder because
7033
- * the lock announces (un)locking as a pushed event rather than holding a param, so the evidence gate
7034
- * will normally leave this getter uninstalled and `lockState` is the real read. `writtenElsewhere`
7035
- * points at the `lock`/`unlock` methods — a single `write` cannot express two verbs that carry no
7036
- * value.
7032
+ * The lock's own state, verified on param 6000: "4" = locked, "3" = unlocked.
7033
+ * `writtenElsewhere` points at the `lock`/`unlock` methods — a single `write` cannot express two
7034
+ * verbs that carry no value.
7037
7035
  */
7038
7036
  locked: {
7039
- param: 1200,
7037
+ param: 6e3,
7040
7038
  type: "bool",
7041
7039
  kind: "boolean",
7042
- provenance: "guessed",
7040
+ provenance: "verified",
7043
7041
  writtenElsewhere: true,
7044
- description: "Lock state, true=locked. UNVERIFIED: no stable state param to key off; placeholder id pending verification."
7042
+ coerce: (raw) => String(raw).trim() === "4",
7043
+ description: "Lock state, true=locked (verified: param 6000, 4=locked, 3=unlocked)."
7045
7044
  },
7046
7045
  /**
7047
- * Cell charge as a percentage, on the same param 1101 every battery device reports. Named `battery`
7046
+ * Cell charge as a percentage, on param 1101 or smart-lock param 6001. Named `battery`
7048
7047
  * within this capability rather than deferring to the `battery` capability: a lock resolves as a lock,
7049
7048
  * so the accessor is `dev.lock().battery`.
7050
7049
  */
7051
7050
  battery: {
7052
7051
  param: 1101,
7052
+ readAliases: [{ paramType: 6001 }],
7053
7053
  type: "number",
7054
7054
  unit: "%",
7055
7055
  kind: "percent",
7056
7056
  provenance: "verified",
7057
- description: "Lock battery level 0-100 (verified: param 1101)."
7057
+ description: "Lock battery level 0-100 (verified: param 1101, alias 6001)."
7058
7058
  },
7059
7059
  /**
7060
7060
  * Link quality in dBm as the lock measures it, on the shared param 1141. Both actuation methods here
@@ -7212,16 +7212,26 @@ function settingToggleCommand(settingId, enabled, ctx) {
7212
7212
  value: asBool(enabled)
7213
7213
  };
7214
7214
  }
7215
+ function decodeLockTransition(signal) {
7216
+ if (signal.source !== "push" || signal.eventType === void 0)
7217
+ return {};
7218
+ const e = signal.eventType;
7219
+ if (e >= LockPushEvent.MANUAL_LOCK && e <= LockPushEvent.TEMPORARY_PW_LOCK)
7220
+ return { locked: true };
7221
+ const unlocked = e >= LockPushEvent.MANUAL_UNLOCK && e <= LockPushEvent.APP_UNLOCK || e === LockPushEvent.TEMPORARY_PW_UNLOCK;
7222
+ return unlocked ? { locked: false } : {};
7223
+ }
7215
7224
  var LOCK = {
7216
7225
  capability: "lock",
7217
7226
  description: "Smart-lock locked/unlocked state and battery.",
7218
7227
  members: LOCK_MEMBERS,
7219
7228
  properties: propertiesOf(LOCK_MEMBERS),
7220
- // Lock state is reported via CommandType (no stable param); the model name (lock/safe) is a
7229
+ // Lock state is reported via param 6000 (verified: 4=locked, 3=unlocked); the model name (lock/safe) is a
7221
7230
  // signal, and every lock-codec device has the lock capability as its baseline.
7222
- detection: { modelHints: [/lock/i, /safe/i], codecs: ["lock"] },
7223
- // Inbound FCM lock events (LockPushEvent 257..771: (un)lock actions + alarms) → one "lockState".
7224
- events: [{ source: "push", match: [257, 771], emit: "lockState" }]
7231
+ detection: { evidenceParams: [6e3], modelHints: [/lock/i, /safe/i], codecs: ["lock"] },
7232
+ // Inbound FCM lock events (LockPushEvent 257..771: (un)lock actions + alarms) → one "lockState", whose
7233
+ // payload carries a decoded `locked` boolean for the (un)lock actions (see decodeLockTransition).
7234
+ events: [{ source: "push", match: [257, 771], emit: "lockState", derive: decodeLockTransition }]
7225
7235
  };
7226
7236
 
7227
7237
  // dist/model/capabilities/keypad.js
@@ -11937,6 +11947,16 @@ var SECURITY_PARAMS = {
11937
11947
  type: "string",
11938
11948
  provenance: "guessed"
11939
11949
  },
11950
+ 6e3: {
11951
+ name: "lockStatus",
11952
+ type: "number",
11953
+ provenance: "verified"
11954
+ },
11955
+ 6001: {
11956
+ name: "lockBattery",
11957
+ type: "number",
11958
+ provenance: "verified"
11959
+ },
11940
11960
  6010: {
11941
11961
  name: "pwList",
11942
11962
  type: "bool",