@mega-yfue/eufy-sdk 0.6.0-beta.44 → 0.6.0-beta.46

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
@@ -3736,6 +3736,9 @@ function holds(claim, installed, ctx) {
3736
3736
  return false;
3737
3737
  if (claim.reads?.some((name) => !installed.has(name)))
3738
3738
  return false;
3739
+ const things = ctx?.things;
3740
+ if (claim.things && things && !claim.things.some((id) => things.properties[id]))
3741
+ return false;
3739
3742
  if (claim.homeBaseAttached !== void 0 && ctx?.homeBaseAttached !== void 0) {
3740
3743
  return ctx.homeBaseAttached === claim.homeBaseAttached;
3741
3744
  }
@@ -4668,8 +4671,6 @@ var MOTION = {
4668
4671
  events: [
4669
4672
  { source: "push", match: DoorbellPushEvent.MOTION_DETECTION, emit: "motion" },
4670
4673
  { source: "push", match: CusPushEvent.MOTION_SENSOR_PIR, emit: "motion" },
4671
- { source: "push", match: IndoorPushEvent.CRYING_DETECTION, emit: "cryingDetected", claim: CAMERA_AI_CLAIM },
4672
- { source: "push", match: IndoorPushEvent.SOUND_DETECTION, emit: "soundDetected", claim: CAMERA_AI_CLAIM },
4673
4674
  { source: "push", match: IndoorPushEvent.PET_DETECTION, emit: "petDetection", claim: CAMERA_AI_CLAIM },
4674
4675
  { source: "push", match: DoorbellPushEvent.VEHICLE_DETECTION, emit: "vehicleDetected", claim: VEHICLE_CLAIM },
4675
4676
  { source: "push", match: HB3PairedDevicePushEvent.DOG_DETECTION, emit: "dogDetected", claim: DOG_CLAIM },
@@ -5150,31 +5151,6 @@ var CONTACT_MEMBERS = {
5150
5151
  provenance: "verified",
5151
5152
  description: "Contact state, true=open (verified: param 1550 entry-sensor contact)."
5152
5153
  },
5153
- /**
5154
- * Unix seconds at which the sensor last checked in — the liveness read beside the contact state, and
5155
- * the way to tell a genuinely closed door from a sensor that stopped reporting. A `timestamp` kind
5156
- * takes no `unit`: it is an instant, not a duration.
5157
- */
5158
- lastSeen: {
5159
- param: 1551,
5160
- type: "number",
5161
- kind: "timestamp",
5162
- provenance: "verified",
5163
- description: "Last-seen unix timestamp, seconds (verified: param 1551)."
5164
- },
5165
- /**
5166
- * Link quality to whichever radio the sensor is paired over, in dBm as the device measures it. The
5167
- * same param 1141 the other sub-1G sensors report on, so the number is comparable across them —
5168
- * unlike a bars mapping, which this SDK never applies.
5169
- */
5170
- rssi: {
5171
- param: 1141,
5172
- type: "number",
5173
- unit: "dBm",
5174
- kind: "dbm",
5175
- provenance: "verified",
5176
- description: "Sub-1G/Wi-Fi signal strength (verified: param 1141 = RSSI)."
5177
- },
5178
5154
  /**
5179
5155
  * Rejected, not clamped, outside the tone enum: a fire-and-forget write of a bogus tone would look like
5180
5156
  * it worked. The wire is a direct-binary scalar `[ch][value][acct]` at signCode 8 — the app's own
@@ -5229,7 +5205,7 @@ var CONTACT_MEMBERS = {
5229
5205
  };
5230
5206
  var CONTACT = {
5231
5207
  capability: "contact",
5232
- description: "Entry (door/window) sensor: contact state, last-seen, and the built-in alarm tone/volume.",
5208
+ description: "Entry (door/window) sensor: contact state and the built-in alarm tone/volume.",
5233
5209
  members: CONTACT_MEMBERS,
5234
5210
  properties: propertiesOf(CONTACT_MEMBERS),
5235
5211
  /** A reported entry-sensor contact param (1550) is the verified proof of a contact sensor. */
@@ -6532,6 +6508,21 @@ var CAMERA = {
6532
6508
  properties: propertiesOf(CAMERA_MEMBERS),
6533
6509
  /** Every camera-codec device has the power/privacy surface. */
6534
6510
  detection: { codecs: ["camera"] },
6511
+ /** The sound (3105) and crying (3104) pushes, each claimed on the product's thing property for it. */
6512
+ events: [
6513
+ {
6514
+ source: "push",
6515
+ match: IndoorPushEvent.SOUND_DETECTION,
6516
+ emit: "soundDetected",
6517
+ claim: { things: ["sound_detection_status", "sound_detection_type"] }
6518
+ },
6519
+ {
6520
+ source: "push",
6521
+ match: IndoorPushEvent.CRYING_DETECTION,
6522
+ emit: "cryingDetected",
6523
+ claim: { things: ["notification_ai_crying_switch", "sound_detection_type"] }
6524
+ }
6525
+ ],
6535
6526
  /** Only the no-argument power verbs, which carry no value for a member to hold. */
6536
6527
  actions({ ctx, sink }) {
6537
6528
  if (!isCameraCodec(ctx))
@@ -7596,18 +7587,6 @@ var LEAK_MEMBERS = {
7596
7587
  kind: "boolean",
7597
7588
  provenance: "guessed",
7598
7589
  description: "Water-leak detected. UNVERIFIED: actually delivered as a push event, not a state param; placeholder id pending capture verification."
7599
- },
7600
- /**
7601
- * Unix seconds at which the sensor last checked in — param 1551, the same last-seen id the other
7602
- * sensor capabilities read. A `timestamp` kind takes no `unit`: the number is an instant, not a
7603
- * duration, and declaring `unit: "s"` beside it fails the value-kind spec.
7604
- */
7605
- lastSeen: {
7606
- param: 1551,
7607
- type: "number",
7608
- kind: "timestamp",
7609
- provenance: "verified",
7610
- description: "Last-seen unix timestamp, seconds (verified: param 1551)."
7611
7590
  }
7612
7591
  };
7613
7592
  var LEAK = {
@@ -7633,18 +7612,6 @@ var SMOKE_MEMBERS = {
7633
7612
  kind: "boolean",
7634
7613
  provenance: "guessed",
7635
7614
  description: "Smoke detected. UNVERIFIED: placeholder id pending capture verification."
7636
- },
7637
- /**
7638
- * Unix seconds at which the detector last checked in — param 1551, the same last-seen id the other
7639
- * sensor capabilities read. A `timestamp` kind takes no `unit`: the number is an instant, not a
7640
- * duration, and declaring `unit: "s"` beside it fails the value-kind spec.
7641
- */
7642
- lastSeen: {
7643
- param: 1551,
7644
- type: "number",
7645
- kind: "timestamp",
7646
- provenance: "verified",
7647
- description: "Last-seen unix timestamp, seconds (verified: param 1551)."
7648
7615
  }
7649
7616
  };
7650
7617
  var SMOKE = {
@@ -7670,11 +7637,23 @@ var CO_MEMBERS = {
7670
7637
  kind: "boolean",
7671
7638
  provenance: "guessed",
7672
7639
  description: "Carbon-monoxide detected. UNVERIFIED: placeholder id pending capture verification."
7673
- },
7640
+ }
7641
+ };
7642
+ var CO = {
7643
+ capability: "co",
7644
+ description: "Carbon-monoxide (CO) detector alarm state.",
7645
+ members: CO_MEMBERS,
7646
+ properties: propertiesOf(CO_MEMBERS),
7647
+ // CO detectors expose no stable state param; the model/name (co/carbon) is the signal.
7648
+ detection: { modelHints: [/co\b|carbon/i] }
7649
+ };
7650
+
7651
+ // dist/model/capabilities/link.js
7652
+ var LINK_MEMBERS = {
7674
7653
  /**
7675
- * Unix seconds at which the detector last checked in — param 1551, the same last-seen id the other
7676
- * sensor capabilities read. A `timestamp` kind takes no `unit`: the number is an instant, not a
7677
- * duration, and declaring `unit: "s"` beside it fails the value-kind spec.
7654
+ * Unix seconds at which the device last checked in, as the device itself reports it — beside
7655
+ * `deviceState(sn).lastSeenMs`, which the SDK derives from the cloud's own update times. A
7656
+ * `timestamp` takes no `unit`: it is an instant, not a duration.
7678
7657
  */
7679
7658
  lastSeen: {
7680
7659
  param: 1551,
@@ -7682,15 +7661,23 @@ var CO_MEMBERS = {
7682
7661
  kind: "timestamp",
7683
7662
  provenance: "verified",
7684
7663
  description: "Last-seen unix timestamp, seconds (verified: param 1551)."
7664
+ },
7665
+ /** Link quality in dBm as the device measures it, never normalised to a bar count. */
7666
+ rssi: {
7667
+ param: 1141,
7668
+ type: "number",
7669
+ unit: "dBm",
7670
+ kind: "dbm",
7671
+ provenance: "verified",
7672
+ description: "Sub-1G/Wi-Fi signal strength (verified: param 1141 = RSSI)."
7685
7673
  }
7686
7674
  };
7687
- var CO = {
7688
- capability: "co",
7689
- description: "Carbon-monoxide (CO) detector alarm state.",
7690
- members: CO_MEMBERS,
7691
- properties: propertiesOf(CO_MEMBERS),
7692
- // CO detectors expose no stable state param; the model/name (co/carbon) is the signal.
7693
- detection: { modelHints: [/co\b|carbon/i] }
7675
+ var LINK = {
7676
+ capability: "link",
7677
+ description: "Check-in timestamp and signal strength, as the device reports them.",
7678
+ members: LINK_MEMBERS,
7679
+ properties: propertiesOf(LINK_MEMBERS),
7680
+ detection: { evidenceParams: [1551, 1141] }
7694
7681
  };
7695
7682
 
7696
7683
  // dist/model/capabilities/lock.js
@@ -7806,18 +7793,6 @@ var LOCK_MEMBERS = {
7806
7793
  provenance: "verified",
7807
7794
  description: "Lock battery level 0-100 (verified: param 1101, alias 6001)."
7808
7795
  },
7809
- /**
7810
- * Link quality in dBm as the lock measures it, on the shared param 1141. On the `ff09` wire the
7811
- * actuations are fire-and-forget, so a weak link is silent rather than an error.
7812
- */
7813
- rssi: {
7814
- param: 1141,
7815
- type: "number",
7816
- unit: "dBm",
7817
- kind: "dbm",
7818
- provenance: "verified",
7819
- description: "Lock signal strength (verified: param 1141 = RSSI)."
7820
- },
7821
7796
  /**
7822
7797
  * Lock the deadbolt/door. Resolves after sending, without confirming physical state — except on the
7823
7798
  * classic Wi-Fi lock, which answers: there it rejects on a device refusal or no reply as well.
@@ -8037,18 +8012,6 @@ var KEYPAD_MEMBERS = {
8037
8012
  provenance: "apk",
8038
8013
  coerce: isChargingState,
8039
8014
  description: "Keypad charging \u2014 derived from APP_CMD_KEYPAD_BATTERY_CHARGER_STATE (1655) as `value \u2209 {0,2}`, matching the app's own decode."
8040
- },
8041
- /**
8042
- * The keypad's link quality in dBm, on the same param 1141 the other sub-1G sensors report signal
8043
- * strength on. Reported as the device measures it: raw dBm, never normalised to a bar count.
8044
- */
8045
- rssi: {
8046
- param: 1141,
8047
- type: "number",
8048
- unit: "dBm",
8049
- kind: "dbm",
8050
- provenance: "verified",
8051
- description: "Keypad signal strength (verified: param 1141 = RSSI)."
8052
8015
  }
8053
8016
  };
8054
8017
  var KEYPAD = {
@@ -11575,6 +11538,7 @@ var MODULES = [
11575
11538
  LOCATE,
11576
11539
  SMART_DROP,
11577
11540
  DISPLAY,
11541
+ LINK,
11578
11542
  INFO
11579
11543
  ];
11580
11544
  var BY_CAP = new Map(MODULES.map((m) => [m.capability, m]));
@@ -14052,6 +14016,8 @@ var Device = class _Device {
14052
14016
  * answers a caller has to be able to tell apart.
14053
14017
  */
14054
14018
  bound = false;
14019
+ /** The product's thing description resolved for this device, as {@link bindActions} was given it. */
14020
+ things;
14055
14021
  /**
14056
14022
  * Read-through freshness policy (injected by the facade via {@link setFreshnessPolicy}; the model
14057
14023
  * stays transport-free — it only calls the supplied `refresh`). Default: caching OFF
@@ -14149,6 +14115,7 @@ var Device = class _Device {
14149
14115
  ff09Settings,
14150
14116
  rawDp: rawDp2
14151
14117
  });
14118
+ this.things = ctx.things;
14152
14119
  this.bound = true;
14153
14120
  }
14154
14121
  /**
@@ -14364,7 +14331,8 @@ var Device = class _Device {
14364
14331
  model: this.model,
14365
14332
  capabilities: new Set(this.capabilities),
14366
14333
  homeBaseAttached: this.stationSn !== this.sn,
14367
- stationSerial: this.stationSn
14334
+ stationSerial: this.stationSn,
14335
+ things: this.things
14368
14336
  })
14369
14337
  };
14370
14338
  }
@@ -33702,6 +33670,7 @@ export {
33702
33670
  LEAK_MEMBERS,
33703
33671
  LIFE_PARAMS,
33704
33672
  LIGHT_MEMBERS,
33673
+ LINK_MEMBERS,
33705
33674
  LIVE_TRACE_MESSAGE,
33706
33675
  LOCATE_MEMBERS,
33707
33676
  LOCK_MEMBERS,