@mega-yfue/eufy-sdk 0.5.0-beta.53 → 0.5.0-beta.55

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.
@@ -792,9 +792,9 @@ export declare class EufyMega extends EventEmitter {
792
792
  * Subscribe the devices on one credential scope; a failing subscribe is reported, not fatal (one
793
793
  * unreachable device must not stop the rest of the roster from coming up).
794
794
  *
795
- * A Tuya clean-line device's DPs are also read from the Tuya cloud, whether or not its subscribe
796
- * succeeded: the cloud read is a separate plane, and the broker can refuse a subscribe for a device
797
- * whose DPs the Tuya cloud still serves.
795
+ * A Tuya clean-line device (`eufy_home_tuya`) is not subscribed: its state lives on the Tuya cloud,
796
+ * and the broker refuses its `eufy_home` topics on every credential. Its DPs are read from the Tuya
797
+ * cloud instead.
798
798
  */
799
799
  private subscribeMqttDevices;
800
800
  /**
@@ -458,7 +458,7 @@ export interface CommandSink {
458
458
  dispatch(cmd: Command): Promise<void>;
459
459
  }
460
460
  /**
461
- * Inbound Tuya DP event contract — the transport parses a ThingClips MQTT payload
461
+ * Inbound Tuya DP event contract — the transport parses the Tuya cloud DP read
462
462
  * (string-keyed object → numeric-keyed record) and delivers it through this interface. The
463
463
  * transport owns the parse; a capability owns the semantics (which DP id means what). Mirrors
464
464
  * {@link DpInboundFrame} for the AIoT MQTT path; the capability layer never names the Tuya framing.
package/dist/index.js CHANGED
@@ -2963,6 +2963,8 @@ var KNOWN_VALUE_KINDS = [
2963
2963
  "dbm",
2964
2964
  "seconds",
2965
2965
  "hours",
2966
+ "minutes",
2967
+ "millimetres",
2966
2968
  "megabytes",
2967
2969
  "degrees",
2968
2970
  "scalar",
@@ -10663,6 +10665,221 @@ var SUCTION = {
10663
10665
  }
10664
10666
  };
10665
10667
 
10668
+ // dist/model/capabilities/mower.js
10669
+ var MOWER_DP = {
10670
+ BATTERY: 8,
10671
+ VOLUME: 26,
10672
+ CHILD_LOCK: 47,
10673
+ RAIN_AUTO_RETURN: 101,
10674
+ WIFI_SIGNAL: 109,
10675
+ MOW_HEIGHT: 110,
10676
+ SAVE_MAP_PROGRESS: 118,
10677
+ STATION_USED_TIME: 125,
10678
+ BLADE_USED_TIME: 126,
10679
+ EDGE_TRIM: 128,
10680
+ WORK_ANGLE_ENABLED: 130,
10681
+ WORK_ANGLE: 131,
10682
+ SMART_NO_GO_ZONES: 132,
10683
+ BIRD_VIEW_CAPTURE: 133,
10684
+ NETWORK: 134,
10685
+ CELLULAR_ENABLED: 137,
10686
+ EDGE_DISTANCE: 139,
10687
+ GPS_ANTI_THEFT: 140,
10688
+ SPARSE_LAWN_OPTIMIZATION: 141
10689
+ };
10690
+ var MOWER_NETWORKS = ["None", "Wifi", "Cellular"];
10691
+ var MOWER_MEMBERS = {
10692
+ /** Charge percentage (DP 8, `battery_percentage`). */
10693
+ battery: {
10694
+ param: MOWER_DP.BATTERY,
10695
+ type: "number",
10696
+ unit: "%",
10697
+ kind: "percent",
10698
+ provenance: "mega",
10699
+ description: "Battery level 0-100 (DP 8, battery_percentage). Read-only."
10700
+ },
10701
+ /** Speaker volume (DP 26, `volume_set`). */
10702
+ volume: {
10703
+ param: MOWER_DP.VOLUME,
10704
+ type: "number",
10705
+ unit: "%",
10706
+ kind: "percent",
10707
+ provenance: "mega",
10708
+ description: "Speaker volume 0-100 (DP 26, volume_set). Read-only."
10709
+ },
10710
+ /** Whether the child lock is on (DP 47, `child_lock`). */
10711
+ childLock: {
10712
+ param: MOWER_DP.CHILD_LOCK,
10713
+ type: "bool",
10714
+ kind: "boolean",
10715
+ provenance: "mega",
10716
+ description: "Child lock on (DP 47, child_lock). Read-only."
10717
+ },
10718
+ /** Whether the mower returns to its station when it detects rain (DP 101, `rain_auto_return`). */
10719
+ rainAutoReturn: {
10720
+ param: MOWER_DP.RAIN_AUTO_RETURN,
10721
+ type: "bool",
10722
+ kind: "boolean",
10723
+ provenance: "mega",
10724
+ description: "Return to the station when rain is detected (DP 101, rain_auto_return). Read-only."
10725
+ },
10726
+ /** Wi-Fi signal strength as a percentage (DP 109, `wifi_signal_strength`), not a dBm reading. */
10727
+ wifiSignal: {
10728
+ param: MOWER_DP.WIFI_SIGNAL,
10729
+ type: "number",
10730
+ unit: "%",
10731
+ kind: "percent",
10732
+ provenance: "mega",
10733
+ description: "Wi-Fi signal strength 0-100 % (DP 109, wifi_signal_strength). Read-only."
10734
+ },
10735
+ /** Cutting height in millimetres (DP 110, `mow_height`), 25-75. */
10736
+ cutHeight: {
10737
+ param: MOWER_DP.MOW_HEIGHT,
10738
+ type: "number",
10739
+ unit: "mm",
10740
+ kind: "millimetres",
10741
+ min: 25,
10742
+ max: 75,
10743
+ provenance: "mega",
10744
+ description: "Cutting height 25-75 mm (DP 110, mow_height). Read-only."
10745
+ },
10746
+ /** Progress of saving the map (DP 118, `save_map_process`). */
10747
+ mapSaveProgress: {
10748
+ param: MOWER_DP.SAVE_MAP_PROGRESS,
10749
+ type: "number",
10750
+ unit: "%",
10751
+ kind: "percent",
10752
+ provenance: "mega",
10753
+ description: "Map-save progress 0-100 % (DP 118, save_map_process). Read-only."
10754
+ },
10755
+ /** Total base-station use in minutes (DP 125, `base_station_used_time`). */
10756
+ stationUsedTime: {
10757
+ param: MOWER_DP.STATION_USED_TIME,
10758
+ type: "number",
10759
+ unit: "min",
10760
+ kind: "minutes",
10761
+ provenance: "mega",
10762
+ description: "Base-station use in minutes (DP 125, base_station_used_time). Read-only."
10763
+ },
10764
+ /** Total cutting-blade use in minutes (DP 126, `mow_blade_used_time`). */
10765
+ bladeUsedTime: {
10766
+ param: MOWER_DP.BLADE_USED_TIME,
10767
+ type: "number",
10768
+ unit: "min",
10769
+ kind: "minutes",
10770
+ provenance: "mega",
10771
+ description: "Cutting-blade use in minutes (DP 126, mow_blade_used_time). Read-only."
10772
+ },
10773
+ /** Whether edge trimming is on (DP 128, `edge_trim`). */
10774
+ edgeTrim: {
10775
+ param: MOWER_DP.EDGE_TRIM,
10776
+ type: "bool",
10777
+ kind: "boolean",
10778
+ provenance: "mega",
10779
+ description: "Edge trimming on (DP 128, edge_trim). Read-only."
10780
+ },
10781
+ /** Whether a fixed mowing angle is in use (DP 130, `enable_work_angle`); the angle is `workAngle`. */
10782
+ workAngleEnabled: {
10783
+ param: MOWER_DP.WORK_ANGLE_ENABLED,
10784
+ type: "bool",
10785
+ kind: "boolean",
10786
+ provenance: "mega",
10787
+ description: "Fixed mowing angle in use (DP 130, enable_work_angle). Read-only."
10788
+ },
10789
+ /** The mowing angle in degrees, -90 to 90 (DP 131, `work_angle`). */
10790
+ workAngle: {
10791
+ param: MOWER_DP.WORK_ANGLE,
10792
+ type: "number",
10793
+ unit: "\xB0",
10794
+ kind: "degrees",
10795
+ min: -90,
10796
+ max: 90,
10797
+ provenance: "mega",
10798
+ description: "Mowing angle -90 to 90 degrees (DP 131, work_angle). Read-only."
10799
+ },
10800
+ /** Whether smart no-go zones are on (DP 132, `enable_smart_forbid_zone`). */
10801
+ smartNoGoZones: {
10802
+ param: MOWER_DP.SMART_NO_GO_ZONES,
10803
+ type: "bool",
10804
+ kind: "boolean",
10805
+ provenance: "mega",
10806
+ description: "Smart no-go zones on (DP 132, enable_smart_forbid_zone). Read-only."
10807
+ },
10808
+ /** Whether bird's-eye-view capture is on (DP 133, `enable_bird_view_capture`). */
10809
+ birdViewCapture: {
10810
+ param: MOWER_DP.BIRD_VIEW_CAPTURE,
10811
+ type: "bool",
10812
+ kind: "boolean",
10813
+ provenance: "mega",
10814
+ description: "Bird's-eye-view capture on (DP 133, enable_bird_view_capture). Read-only."
10815
+ },
10816
+ /**
10817
+ * The network link in use (DP 134, `net_media_type`). Answers `undefined` for a value outside the
10818
+ * schema's range.
10819
+ */
10820
+ network: {
10821
+ param: MOWER_DP.NETWORK,
10822
+ type: "string",
10823
+ provenance: "mega",
10824
+ decode: (raw) => typeof raw === "string" && MOWER_NETWORKS.includes(raw) ? raw : void 0,
10825
+ decodedKind: "enum",
10826
+ decodedValues: MOWER_NETWORKS,
10827
+ description: "Network link: None, Wifi or Cellular (DP 134, net_media_type). Read-only."
10828
+ },
10829
+ /** Whether the cellular link is enabled (DP 137, `enable_cellular`). */
10830
+ cellularEnabled: {
10831
+ param: MOWER_DP.CELLULAR_ENABLED,
10832
+ type: "bool",
10833
+ kind: "boolean",
10834
+ provenance: "mega",
10835
+ description: "Cellular link enabled (DP 137, enable_cellular). Read-only."
10836
+ },
10837
+ /** Edge-following distance in millimetres (DP 139, `follow_edge_distance`), signed. */
10838
+ edgeDistance: {
10839
+ param: MOWER_DP.EDGE_DISTANCE,
10840
+ type: "number",
10841
+ unit: "mm",
10842
+ kind: "millimetres",
10843
+ min: -1e4,
10844
+ max: 1e4,
10845
+ provenance: "mega",
10846
+ description: "Edge-following distance in mm, signed (DP 139, follow_edge_distance). Read-only."
10847
+ },
10848
+ /** Whether GPS anti-theft is on (DP 140, `gps_location_check`). */
10849
+ gpsAntiTheft: {
10850
+ param: MOWER_DP.GPS_ANTI_THEFT,
10851
+ type: "bool",
10852
+ kind: "boolean",
10853
+ provenance: "mega",
10854
+ description: "GPS anti-theft on (DP 140, gps_location_check). Read-only."
10855
+ },
10856
+ /** Whether sparse-lawn optimisation is on (DP 141, `sparse_lawn_optimization`). */
10857
+ sparseLawnOptimization: {
10858
+ param: MOWER_DP.SPARSE_LAWN_OPTIMIZATION,
10859
+ type: "bool",
10860
+ kind: "boolean",
10861
+ provenance: "mega",
10862
+ description: "Sparse-lawn optimisation on (DP 141, sparse_lawn_optimization). Read-only."
10863
+ }
10864
+ };
10865
+ var MOWER_DP_IDS = Object.values(MOWER_DP);
10866
+ var MOWER = {
10867
+ capability: "mower",
10868
+ line: "clean",
10869
+ description: "Robot-mower state: battery, cutting height, settings and wear timers (read-only).",
10870
+ members: MOWER_MEMBERS,
10871
+ properties: propertiesOf(MOWER_MEMBERS),
10872
+ /**
10873
+ * The T2880 (E15) only: its Tuya product schema and a live report are the evidence for every member.
10874
+ * The E18 and C15 share the `mower` codec but neither has a schema or a report in hand.
10875
+ */
10876
+ detection: { detect: (record, codec) => codec === "mower" && record.model === "T2880" },
10877
+ decodeState(signal) {
10878
+ const params = pickDpParams(signal.source === "mqtt" ? signal.dpParams : void 0, MOWER_DP_IDS);
10879
+ return params ? { params } : null;
10880
+ }
10881
+ };
10882
+
10666
10883
  // dist/model/capabilities/dp-catalog.js
10667
10884
  var EMPTY_DP_CATALOG = {
10668
10885
  enumRanges: /* @__PURE__ */ new Map()
@@ -10918,6 +11135,7 @@ var MODULES = [
10918
11135
  VACUUM_CLEAN,
10919
11136
  VACUUM_DOCK,
10920
11137
  SUCTION,
11138
+ MOWER,
10921
11139
  LOCATE,
10922
11140
  DISPLAY,
10923
11141
  INFO
@@ -13131,6 +13349,103 @@ var DISPLAY_PARAMS = {
13131
13349
  provenance: "mega"
13132
13350
  }
13133
13351
  };
13352
+ var MOWER_PARAMS = {
13353
+ 8: {
13354
+ name: "battery",
13355
+ type: "number",
13356
+ provenance: "mega"
13357
+ },
13358
+ 26: {
13359
+ name: "volume",
13360
+ type: "number",
13361
+ provenance: "mega"
13362
+ },
13363
+ 47: {
13364
+ name: "childLock",
13365
+ type: "bool",
13366
+ provenance: "mega"
13367
+ },
13368
+ 101: {
13369
+ name: "rainAutoReturn",
13370
+ type: "bool",
13371
+ provenance: "mega"
13372
+ },
13373
+ 109: {
13374
+ name: "wifiSignal",
13375
+ type: "number",
13376
+ provenance: "mega"
13377
+ },
13378
+ 110: {
13379
+ name: "cutHeight",
13380
+ type: "number",
13381
+ provenance: "mega"
13382
+ },
13383
+ 118: {
13384
+ name: "mapSaveProgress",
13385
+ type: "number",
13386
+ provenance: "mega"
13387
+ },
13388
+ 125: {
13389
+ name: "stationUsedTime",
13390
+ type: "number",
13391
+ provenance: "mega"
13392
+ },
13393
+ 126: {
13394
+ name: "bladeUsedTime",
13395
+ type: "number",
13396
+ provenance: "mega"
13397
+ },
13398
+ 128: {
13399
+ name: "edgeTrim",
13400
+ type: "bool",
13401
+ provenance: "mega"
13402
+ },
13403
+ 130: {
13404
+ name: "workAngleEnabled",
13405
+ type: "bool",
13406
+ provenance: "mega"
13407
+ },
13408
+ 131: {
13409
+ name: "workAngle",
13410
+ type: "number",
13411
+ provenance: "mega"
13412
+ },
13413
+ 132: {
13414
+ name: "smartNoGoZones",
13415
+ type: "bool",
13416
+ provenance: "mega"
13417
+ },
13418
+ 133: {
13419
+ name: "birdViewCapture",
13420
+ type: "bool",
13421
+ provenance: "mega"
13422
+ },
13423
+ 134: {
13424
+ name: "network",
13425
+ type: "string",
13426
+ provenance: "mega"
13427
+ },
13428
+ 137: {
13429
+ name: "cellularEnabled",
13430
+ type: "bool",
13431
+ provenance: "mega"
13432
+ },
13433
+ 139: {
13434
+ name: "edgeDistance",
13435
+ type: "number",
13436
+ provenance: "mega"
13437
+ },
13438
+ 140: {
13439
+ name: "gpsAntiTheft",
13440
+ type: "bool",
13441
+ provenance: "mega"
13442
+ },
13443
+ 141: {
13444
+ name: "sparseLawnOptimization",
13445
+ type: "bool",
13446
+ provenance: "mega"
13447
+ }
13448
+ };
13134
13449
 
13135
13450
  // dist/model/life-params.js
13136
13451
  var LIFE_PARAMS = {
@@ -13154,6 +13469,8 @@ var LIFE_PARAMS = {
13154
13469
  var TABLES = {
13155
13470
  security: SECURITY_PARAMS,
13156
13471
  clean: CLEAN_PARAMS,
13472
+ // Robot mowers — their own Tuya DP space, so an id stays unnamed rather than reading as a vacuum's.
13473
+ mower: MOWER_PARAMS,
13157
13474
  life: LIFE_PARAMS,
13158
13475
  // 3D-printer (ankermake) id space — empty until a live capture confirms the param↔semantic map
13159
13476
  // (printer-support plan Stage 3). Present so the printer codec resolves to its OWN namespace rather
@@ -13173,7 +13490,7 @@ var NAMESPACE_BY_CODEC = {
13173
13490
  lock: "security",
13174
13491
  keypad: "security",
13175
13492
  vacuum: "clean",
13176
- mower: "clean",
13493
+ mower: "mower",
13177
13494
  light: "life",
13178
13495
  printer: "print",
13179
13496
  display: "display"
@@ -25743,33 +26060,6 @@ function parseTuyaDpEvent(payload) {
25743
26060
  }
25744
26061
  return Object.keys(result).length > 0 ? result : null;
25745
26062
  }
25746
- function parseTuyaDpReport(raw) {
25747
- if (!raw || typeof raw !== "object" || Array.isArray(raw))
25748
- return void 0;
25749
- const envelope = raw;
25750
- const payloadObj = jsonObject(envelope.payload);
25751
- if (payloadObj) {
25752
- const data2 = payloadObj.data;
25753
- if (data2 && typeof data2 === "object" && !Array.isArray(data2)) {
25754
- const dataObj = data2;
25755
- const dps = dataObj.dps;
25756
- if (dps && typeof dps === "object" && !Array.isArray(dps))
25757
- return dps;
25758
- const filtered = Object.fromEntries(Object.entries(dataObj).filter(([k]) => /^[1-9]\d*$/.test(k)));
25759
- return Object.keys(filtered).length > 0 ? filtered : void 0;
25760
- }
25761
- }
25762
- const topDps = envelope.dps;
25763
- if (topDps && typeof topDps === "object" && !Array.isArray(topDps))
25764
- return topDps;
25765
- const data = envelope.data;
25766
- if (data && typeof data === "object" && !Array.isArray(data)) {
25767
- const dataDps = data.dps;
25768
- if (dataDps && typeof dataDps === "object" && !Array.isArray(dataDps))
25769
- return dataDps;
25770
- }
25771
- return void 0;
25772
- }
25773
26063
  var TuyaDpRouter = class {
25774
26064
  listener;
25775
26065
  /** Register the inbound listener. Replaces any previously registered one. */
@@ -29329,16 +29619,6 @@ var EufyMega = class extends EventEmitter13 {
29329
29619
  transport.on("disconnect", (r) => this.emit("disconnect", r));
29330
29620
  transport.on("message", (m) => {
29331
29621
  this.emit("message", m);
29332
- if (m.deviceSn) {
29333
- const dev = this.registry.list().find((d) => d.sn === m.deviceSn);
29334
- if (dev?.category === "eufy_home_tuya") {
29335
- const dps = parseTuyaDpReport(m.raw);
29336
- if (dps) {
29337
- this.tuyaDpRouter.deliver(m.deviceSn, dps);
29338
- return;
29339
- }
29340
- }
29341
- }
29342
29622
  if (m.deviceSn) {
29343
29623
  const frame = parseBizMapFrame(m.raw);
29344
29624
  if (frame) {
@@ -29372,23 +29652,24 @@ var EufyMega = class extends EventEmitter13 {
29372
29652
  * Subscribe the devices on one credential scope; a failing subscribe is reported, not fatal (one
29373
29653
  * unreachable device must not stop the rest of the roster from coming up).
29374
29654
  *
29375
- * A Tuya clean-line device's DPs are also read from the Tuya cloud, whether or not its subscribe
29376
- * succeeded: the cloud read is a separate plane, and the broker can refuse a subscribe for a device
29377
- * whose DPs the Tuya cloud still serves.
29655
+ * A Tuya clean-line device (`eufy_home_tuya`) is not subscribed: its state lives on the Tuya cloud,
29656
+ * and the broker refuses its `eufy_home` topics on every credential. Its DPs are read from the Tuya
29657
+ * cloud instead.
29378
29658
  */
29379
29659
  async subscribeMqttDevices(scope, transport) {
29380
29660
  for (const d of this.getMqttDevices().filter((dev) => mqttScopeFor(dev) === scope)) {
29381
- try {
29382
- await transport.subscribeDevice(d);
29383
- await this.sendRealtimeInit(d.sn);
29384
- } catch (e) {
29385
- this.reportError(e);
29386
- }
29387
29661
  if (d.category === "eufy_home_tuya") {
29388
29662
  this.tuya.fetchDps(d.sn).then((dps) => {
29389
29663
  if (dps)
29390
29664
  this.tuyaDpRouter.deliver(d.sn, dps);
29391
29665
  }).catch((e) => this.reportError(e));
29666
+ continue;
29667
+ }
29668
+ try {
29669
+ await transport.subscribeDevice(d);
29670
+ await this.sendRealtimeInit(d.sn);
29671
+ } catch (e) {
29672
+ this.reportError(e);
29392
29673
  }
29393
29674
  }
29394
29675
  }
@@ -30938,6 +31219,7 @@ export {
30938
31219
  MODEL_REGISTRY,
30939
31220
  MOP_LEVELS,
30940
31221
  MOTION_MEMBERS,
31222
+ MOWER_MEMBERS,
30941
31223
  McsParser,
30942
31224
  MegaApiError,
30943
31225
  MegaHttpClient,