@mega-yfue/eufy-sdk 0.5.0-beta.63 → 0.5.0-beta.65

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.
@@ -253,8 +253,8 @@ export declare class EufyMega extends EventEmitter {
253
253
  */
254
254
  private mqttScopesInUse;
255
255
  /**
256
- * Read every Tuya clean-line device's DPs from the Tuya cloud and deliver them as realtime state. A
257
- * failed read is reported, not fatal, and leaves that device's state as it was.
256
+ * Read every Tuya clean-line device's DPs from the Tuya cloud and deliver them as realtime state,
257
+ * concurrently. A failed read is reported, not fatal, and leaves that device's state as it was.
258
258
  */
259
259
  private readTuyaDevices;
260
260
  /**
@@ -619,6 +619,11 @@ export declare class EufyMega extends EventEmitter {
619
619
  * an unchanged VALUE, which is no state change to report but is fresh proof the device is alive. A
620
620
  * device absent from the previous pass is skipped — first sight is discovery, not a transition;
621
621
  * {@link deviceState} answers an initial reading.
622
+ *
623
+ * Then re-reads every Tuya clean-line robot from the Tuya cloud ({@link readTuyaDevices}): its state
624
+ * is not in the cloud record this pass diffs and no live channel carries it, so the poll is where it
625
+ * stays fresh. That read runs after the `try`, not inside it, so a cloud error on the list diff does
626
+ * not skip it; it reports its own failures and never rejects.
622
627
  */
623
628
  private pollOnce;
624
629
  /**
package/dist/index.js CHANGED
@@ -3599,6 +3599,65 @@ var VIDEO = {
3599
3599
  detection: { evidenceParams: [1056], codecs: ["camera"] }
3600
3600
  };
3601
3601
 
3602
+ // dist/model/device-family.js
3603
+ var INDOOR_CAMERA_TYPES = /* @__PURE__ */ new Set([
3604
+ DeviceType.INDOOR_CAMERA,
3605
+ DeviceType.INDOOR_CAMERA_1080,
3606
+ DeviceType.INDOOR_PT_CAMERA,
3607
+ DeviceType.INDOOR_PT_CAMERA_1080,
3608
+ DeviceType.INDOOR_OUTDOOR_CAMERA_1080P,
3609
+ DeviceType.INDOOR_OUTDOOR_CAMERA_1080P_NO_LIGHT,
3610
+ DeviceType.INDOOR_OUTDOOR_CAMERA_2K,
3611
+ DeviceType.INDOOR_COST_DOWN_CAMERA,
3612
+ DeviceType.INDOOR_PT_CAMERA_S350,
3613
+ DeviceType.INDOOR_PT_CAMERA_E30,
3614
+ DeviceType.INDOOR_PT_CAMERA_C210,
3615
+ DeviceType.INDOOR_PT_CAMERA_C220,
3616
+ DeviceType.INDOOR_PT_CAMERA_C220_V2
3617
+ ]);
3618
+ var INDOOR_PT_S350_TYPES = /* @__PURE__ */ new Set([
3619
+ DeviceType.INDOOR_PT_CAMERA_S350,
3620
+ DeviceType.INDOOR_PT_CAMERA_E30,
3621
+ DeviceType.INDOOR_PT_CAMERA_C210,
3622
+ DeviceType.INDOOR_PT_CAMERA_C220,
3623
+ DeviceType.INDOOR_PT_CAMERA_C220_V2
3624
+ ]);
3625
+ var OUTDOOR_PT_TYPES = /* @__PURE__ */ new Set([
3626
+ DeviceType.OUTDOOR_PT_CAMERA,
3627
+ DeviceType.SOLO_CAMERA_E30,
3628
+ DeviceType.CAMERA_S4,
3629
+ DeviceType.SOLOCAM_E42,
3630
+ DeviceType.CAMERA_4G_S330
3631
+ ]);
3632
+ var FLOODLIGHT_TYPES = /* @__PURE__ */ new Set([
3633
+ DeviceType.FLOODLIGHT,
3634
+ DeviceType.FLOODLIGHT_CAMERA_8422,
3635
+ DeviceType.FLOODLIGHT_CAMERA_8423,
3636
+ DeviceType.FLOODLIGHT_CAMERA_8424,
3637
+ DeviceType.FLOODLIGHT_CAMERA_8425,
3638
+ DeviceType.FLOODLIGHT_CAMERA_8426
3639
+ ]);
3640
+ var WALL_LIGHT_TYPES = /* @__PURE__ */ new Set([
3641
+ DeviceType.WALL_LIGHT_CAM,
3642
+ DeviceType.WALL_LIGHT_CAM_81A0
3643
+ ]);
3644
+ var HOMEBASE_TYPES = /* @__PURE__ */ new Set([
3645
+ DeviceType.STATION,
3646
+ DeviceType.HB3,
3647
+ DeviceType.STATION_9000,
3648
+ DeviceType.MINIBASE_CHIME,
3649
+ DeviceType.HOMEBASE_MINI
3650
+ ]);
3651
+ var has = (set, t) => t !== void 0 && set.has(t);
3652
+ var isIndoorCamera = (ctx) => has(INDOOR_CAMERA_TYPES, ctx.deviceType);
3653
+ var isIndoorCamMini = (ctx) => ctx.deviceType === DeviceType.INDOOR_COST_DOWN_CAMERA;
3654
+ var isIndoorPanTiltS350 = (ctx) => has(INDOOR_PT_S350_TYPES, ctx.deviceType);
3655
+ var isHomeBase = (ctx) => has(HOMEBASE_TYPES, ctx.deviceType);
3656
+ var isStation9000 = (ctx) => ctx.deviceType === DeviceType.STATION_9000;
3657
+ var isNvrT8N00 = (ctx) => ctx.model === "T8N00";
3658
+ var isAiotVacuum = (ctx) => ctx.category !== "eufy_home_tuya";
3659
+ var isTuyaVacuum = (ctx) => ctx.category === "eufy_home_tuya";
3660
+
3602
3661
  // dist/model/capabilities/rtsp.js
3603
3662
  var RTSP_PARAM = {
3604
3663
  /**
@@ -3653,6 +3712,9 @@ var RtspRecordingMode = {
3653
3712
  /** Record continuously. */
3654
3713
  Continuous: 1
3655
3714
  };
3715
+ function publishable(ctx) {
3716
+ return !isStation9000({ deviceType: ctx.stationDeviceType });
3717
+ }
3656
3718
  function publishCommand(on, ctx) {
3657
3719
  return setScalar(RTSP_PARAM.STREAM_SWITCH, on ? 1 : 0, ctx);
3658
3720
  }
@@ -3677,7 +3739,8 @@ var RTSP_MEMBERS = {
3677
3739
  provenance: "apk",
3678
3740
  description: "Whether this camera's stream is published over RTSP (1145 NAS_STREAM_SWITHC). Name from the apk; the WRITE is verified live on a HomeBase-attached doorbell and two indoor cameras, both directions (DESCRIBE 404\u2192200 with a real SDP, and back).",
3679
3741
  write: (v, ctx) => publishCommand(asBool(v), ctx),
3680
- aliases: { publish: true, withdraw: false }
3742
+ aliases: { publish: true, withdraw: false },
3743
+ available: publishable
3681
3744
  },
3682
3745
  /**
3683
3746
  * The device-reported RTSP URL — the full `rtsp://user:pass@host/path`, carrying the credentials the
@@ -3731,9 +3794,9 @@ var RTSP_MEMBERS = {
3731
3794
  description: "What the NAS records: 0 = events only, 1 = continuous (6050 NAS_VIDEO_TYPE_EVENT). The app sends a PAIR of 1700-wrapped frames (6050 + 6010) for one change; setRecordingMode sends both. 6050 is the readable half. Name from the apk; the WRITE is verified live on a T8030 by param readback (0 \u2192 1 \u2192 0)."
3732
3795
  },
3733
3796
  /** Persistently publish this camera's stream. The enabling caller owns withdrawing it when done. */
3734
- publish: method(({ ctx, sink }) => () => sink.dispatch(publishCommand(true, ctx)), "Publish the stream."),
3797
+ publish: method(({ ctx, sink }) => () => sink.dispatch(publishCommand(true, ctx)), "Publish the stream.", publishable),
3735
3798
  /** Withdraw this camera's persistent publication; consumer retries do not ask the SDK to republish it. */
3736
- withdraw: method(({ ctx, sink }) => () => sink.dispatch(publishCommand(false, ctx)), "Withdraw the stream."),
3799
+ withdraw: method(({ ctx, sink }) => () => sink.dispatch(publishCommand(false, ctx)), "Withdraw the stream.", publishable),
3737
3800
  /**
3738
3801
  * Store credentials and request authentication on this camera's stream. Served enforcement is
3739
3802
  * topology-dependent and must be verified with `DESCRIBE` (401 = challenged, 200 = open).
@@ -5090,65 +5153,6 @@ var CONTACT = {
5090
5153
  }
5091
5154
  };
5092
5155
 
5093
- // dist/model/device-family.js
5094
- var INDOOR_CAMERA_TYPES = /* @__PURE__ */ new Set([
5095
- DeviceType.INDOOR_CAMERA,
5096
- DeviceType.INDOOR_CAMERA_1080,
5097
- DeviceType.INDOOR_PT_CAMERA,
5098
- DeviceType.INDOOR_PT_CAMERA_1080,
5099
- DeviceType.INDOOR_OUTDOOR_CAMERA_1080P,
5100
- DeviceType.INDOOR_OUTDOOR_CAMERA_1080P_NO_LIGHT,
5101
- DeviceType.INDOOR_OUTDOOR_CAMERA_2K,
5102
- DeviceType.INDOOR_COST_DOWN_CAMERA,
5103
- DeviceType.INDOOR_PT_CAMERA_S350,
5104
- DeviceType.INDOOR_PT_CAMERA_E30,
5105
- DeviceType.INDOOR_PT_CAMERA_C210,
5106
- DeviceType.INDOOR_PT_CAMERA_C220,
5107
- DeviceType.INDOOR_PT_CAMERA_C220_V2
5108
- ]);
5109
- var INDOOR_PT_S350_TYPES = /* @__PURE__ */ new Set([
5110
- DeviceType.INDOOR_PT_CAMERA_S350,
5111
- DeviceType.INDOOR_PT_CAMERA_E30,
5112
- DeviceType.INDOOR_PT_CAMERA_C210,
5113
- DeviceType.INDOOR_PT_CAMERA_C220,
5114
- DeviceType.INDOOR_PT_CAMERA_C220_V2
5115
- ]);
5116
- var OUTDOOR_PT_TYPES = /* @__PURE__ */ new Set([
5117
- DeviceType.OUTDOOR_PT_CAMERA,
5118
- DeviceType.SOLO_CAMERA_E30,
5119
- DeviceType.CAMERA_S4,
5120
- DeviceType.SOLOCAM_E42,
5121
- DeviceType.CAMERA_4G_S330
5122
- ]);
5123
- var FLOODLIGHT_TYPES = /* @__PURE__ */ new Set([
5124
- DeviceType.FLOODLIGHT,
5125
- DeviceType.FLOODLIGHT_CAMERA_8422,
5126
- DeviceType.FLOODLIGHT_CAMERA_8423,
5127
- DeviceType.FLOODLIGHT_CAMERA_8424,
5128
- DeviceType.FLOODLIGHT_CAMERA_8425,
5129
- DeviceType.FLOODLIGHT_CAMERA_8426
5130
- ]);
5131
- var WALL_LIGHT_TYPES = /* @__PURE__ */ new Set([
5132
- DeviceType.WALL_LIGHT_CAM,
5133
- DeviceType.WALL_LIGHT_CAM_81A0
5134
- ]);
5135
- var HOMEBASE_TYPES = /* @__PURE__ */ new Set([
5136
- DeviceType.STATION,
5137
- DeviceType.HB3,
5138
- DeviceType.STATION_9000,
5139
- DeviceType.MINIBASE_CHIME,
5140
- DeviceType.HOMEBASE_MINI
5141
- ]);
5142
- var has = (set, t) => t !== void 0 && set.has(t);
5143
- var isIndoorCamera = (ctx) => has(INDOOR_CAMERA_TYPES, ctx.deviceType);
5144
- var isIndoorCamMini = (ctx) => ctx.deviceType === DeviceType.INDOOR_COST_DOWN_CAMERA;
5145
- var isIndoorPanTiltS350 = (ctx) => has(INDOOR_PT_S350_TYPES, ctx.deviceType);
5146
- var isHomeBase = (ctx) => has(HOMEBASE_TYPES, ctx.deviceType);
5147
- var isStation9000 = (ctx) => ctx.deviceType === DeviceType.STATION_9000;
5148
- var isNvrT8N00 = (ctx) => ctx.model === "T8N00";
5149
- var isAiotVacuum = (ctx) => ctx.category !== "eufy_home_tuya";
5150
- var isTuyaVacuum = (ctx) => ctx.category === "eufy_home_tuya";
5151
-
5152
5156
  // dist/model/capabilities/audio.js
5153
5157
  var AUDIO_CMD = {
5154
5158
  /**
@@ -28468,16 +28472,14 @@ var EufyMega = class extends EventEmitter13 {
28468
28472
  ];
28469
28473
  }
28470
28474
  /**
28471
- * Read every Tuya clean-line device's DPs from the Tuya cloud and deliver them as realtime state. A
28472
- * failed read is reported, not fatal, and leaves that device's state as it was.
28475
+ * Read every Tuya clean-line device's DPs from the Tuya cloud and deliver them as realtime state,
28476
+ * concurrently. A failed read is reported, not fatal, and leaves that device's state as it was.
28473
28477
  */
28474
- readTuyaDevices() {
28475
- for (const d of this.getMqttDevices().filter(isTuyaVacuum)) {
28476
- this.tuya.fetchDps(d.sn).then((dps) => {
28477
- if (dps)
28478
- this.tuyaDpRouter.deliver(d.sn, dps);
28479
- }).catch((e) => this.reportError(e));
28480
- }
28478
+ async readTuyaDevices() {
28479
+ await Promise.all(this.getMqttDevices().filter(isTuyaVacuum).map((d) => this.tuya.fetchDps(d.sn).then((dps) => {
28480
+ if (dps)
28481
+ this.tuyaDpRouter.deliver(d.sn, dps);
28482
+ }).catch((e) => this.reportError(e))));
28481
28483
  }
28482
28484
  /**
28483
28485
  * Emit a semantic capability event whose name is only known at runtime (`decodeCapabilityEvent`
@@ -29220,7 +29222,7 @@ var EufyMega = class extends EventEmitter13 {
29220
29222
  await this.getDevices();
29221
29223
  if (epoch !== this.realtimeEpoch)
29222
29224
  return this.settleRealtimeGeneration(generation, "superseded");
29223
- this.readTuyaDevices();
29225
+ void this.readTuyaDevices();
29224
29226
  const scopes = this.mqttScopesInUse();
29225
29227
  readiness.mqtt = createPlaneReadiness(scopes.length);
29226
29228
  let push;
@@ -29354,6 +29356,11 @@ var EufyMega = class extends EventEmitter13 {
29354
29356
  * an unchanged VALUE, which is no state change to report but is fresh proof the device is alive. A
29355
29357
  * device absent from the previous pass is skipped — first sight is discovery, not a transition;
29356
29358
  * {@link deviceState} answers an initial reading.
29359
+ *
29360
+ * Then re-reads every Tuya clean-line robot from the Tuya cloud ({@link readTuyaDevices}): its state
29361
+ * is not in the cloud record this pass diffs and no live channel carries it, so the poll is where it
29362
+ * stays fresh. That read runs after the `try`, not inside it, so a cloud error on the list diff does
29363
+ * not skip it; it reports its own failures and never rejects.
29357
29364
  */
29358
29365
  async pollOnce() {
29359
29366
  try {
@@ -29373,6 +29380,7 @@ var EufyMega = class extends EventEmitter13 {
29373
29380
  } catch (e) {
29374
29381
  this.reportError(e);
29375
29382
  }
29383
+ await this.readTuyaDevices();
29376
29384
  }
29377
29385
  /**
29378
29386
  * Land a poll pass's CHANGES on every live {@link Device} and announce what moved, BEFORE anything