@mega-yfue/eufy-sdk 0.5.0-beta.62 → 0.5.0-beta.64

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
@@ -2635,6 +2635,7 @@ var SecureMqtt = class extends EventEmitter {
2635
2635
  async open() {
2636
2636
  const mqtt = await loadMqtt();
2637
2637
  const c = this.o.credentials;
2638
+ const scope = c.app_name ?? "default";
2638
2639
  const port = c.endpoint_port ?? 8883;
2639
2640
  const pinned = this.o.instanceIp;
2640
2641
  const reconnectPeriod = this.o.reconnectPeriod ?? 5e3;
@@ -2674,10 +2675,11 @@ var SecureMqtt = class extends EventEmitter {
2674
2675
  }
2675
2676
  this.emit("connect");
2676
2677
  });
2677
- client.on("connect", () => this.logger.info(`[smqtt] connected (${c.app_name ?? "default"})`));
2678
+ client.on("connect", () => this.logger.info(`[smqtt] connected (${scope})`));
2678
2679
  client.on("reconnect", () => this.logger.warn("[smqtt] reconnecting"));
2679
2680
  client.on("close", () => this.emit("disconnect", "close"));
2680
2681
  client.on("error", (err) => {
2682
+ this.logger.warn(`[smqtt] socket error (${scope}): ${err.message}`);
2681
2683
  this.emit("error", err);
2682
2684
  if (!settled) {
2683
2685
  settled = true;
@@ -3597,6 +3599,65 @@ var VIDEO = {
3597
3599
  detection: { evidenceParams: [1056], codecs: ["camera"] }
3598
3600
  };
3599
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
+
3600
3661
  // dist/model/capabilities/rtsp.js
3601
3662
  var RTSP_PARAM = {
3602
3663
  /**
@@ -3651,6 +3712,9 @@ var RtspRecordingMode = {
3651
3712
  /** Record continuously. */
3652
3713
  Continuous: 1
3653
3714
  };
3715
+ function publishable(ctx) {
3716
+ return !isStation9000({ deviceType: ctx.stationDeviceType });
3717
+ }
3654
3718
  function publishCommand(on, ctx) {
3655
3719
  return setScalar(RTSP_PARAM.STREAM_SWITCH, on ? 1 : 0, ctx);
3656
3720
  }
@@ -3675,7 +3739,8 @@ var RTSP_MEMBERS = {
3675
3739
  provenance: "apk",
3676
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).",
3677
3741
  write: (v, ctx) => publishCommand(asBool(v), ctx),
3678
- aliases: { publish: true, withdraw: false }
3742
+ aliases: { publish: true, withdraw: false },
3743
+ available: publishable
3679
3744
  },
3680
3745
  /**
3681
3746
  * The device-reported RTSP URL — the full `rtsp://user:pass@host/path`, carrying the credentials the
@@ -3729,9 +3794,9 @@ var RTSP_MEMBERS = {
3729
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)."
3730
3795
  },
3731
3796
  /** Persistently publish this camera's stream. The enabling caller owns withdrawing it when done. */
3732
- 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),
3733
3798
  /** Withdraw this camera's persistent publication; consumer retries do not ask the SDK to republish it. */
3734
- 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),
3735
3800
  /**
3736
3801
  * Store credentials and request authentication on this camera's stream. Served enforcement is
3737
3802
  * topology-dependent and must be verified with `DESCRIBE` (401 = challenged, 200 = open).
@@ -5088,65 +5153,6 @@ var CONTACT = {
5088
5153
  }
5089
5154
  };
5090
5155
 
5091
- // dist/model/device-family.js
5092
- var INDOOR_CAMERA_TYPES = /* @__PURE__ */ new Set([
5093
- DeviceType.INDOOR_CAMERA,
5094
- DeviceType.INDOOR_CAMERA_1080,
5095
- DeviceType.INDOOR_PT_CAMERA,
5096
- DeviceType.INDOOR_PT_CAMERA_1080,
5097
- DeviceType.INDOOR_OUTDOOR_CAMERA_1080P,
5098
- DeviceType.INDOOR_OUTDOOR_CAMERA_1080P_NO_LIGHT,
5099
- DeviceType.INDOOR_OUTDOOR_CAMERA_2K,
5100
- DeviceType.INDOOR_COST_DOWN_CAMERA,
5101
- DeviceType.INDOOR_PT_CAMERA_S350,
5102
- DeviceType.INDOOR_PT_CAMERA_E30,
5103
- DeviceType.INDOOR_PT_CAMERA_C210,
5104
- DeviceType.INDOOR_PT_CAMERA_C220,
5105
- DeviceType.INDOOR_PT_CAMERA_C220_V2
5106
- ]);
5107
- var INDOOR_PT_S350_TYPES = /* @__PURE__ */ new Set([
5108
- DeviceType.INDOOR_PT_CAMERA_S350,
5109
- DeviceType.INDOOR_PT_CAMERA_E30,
5110
- DeviceType.INDOOR_PT_CAMERA_C210,
5111
- DeviceType.INDOOR_PT_CAMERA_C220,
5112
- DeviceType.INDOOR_PT_CAMERA_C220_V2
5113
- ]);
5114
- var OUTDOOR_PT_TYPES = /* @__PURE__ */ new Set([
5115
- DeviceType.OUTDOOR_PT_CAMERA,
5116
- DeviceType.SOLO_CAMERA_E30,
5117
- DeviceType.CAMERA_S4,
5118
- DeviceType.SOLOCAM_E42,
5119
- DeviceType.CAMERA_4G_S330
5120
- ]);
5121
- var FLOODLIGHT_TYPES = /* @__PURE__ */ new Set([
5122
- DeviceType.FLOODLIGHT,
5123
- DeviceType.FLOODLIGHT_CAMERA_8422,
5124
- DeviceType.FLOODLIGHT_CAMERA_8423,
5125
- DeviceType.FLOODLIGHT_CAMERA_8424,
5126
- DeviceType.FLOODLIGHT_CAMERA_8425,
5127
- DeviceType.FLOODLIGHT_CAMERA_8426
5128
- ]);
5129
- var WALL_LIGHT_TYPES = /* @__PURE__ */ new Set([
5130
- DeviceType.WALL_LIGHT_CAM,
5131
- DeviceType.WALL_LIGHT_CAM_81A0
5132
- ]);
5133
- var HOMEBASE_TYPES = /* @__PURE__ */ new Set([
5134
- DeviceType.STATION,
5135
- DeviceType.HB3,
5136
- DeviceType.STATION_9000,
5137
- DeviceType.MINIBASE_CHIME,
5138
- DeviceType.HOMEBASE_MINI
5139
- ]);
5140
- var has = (set, t) => t !== void 0 && set.has(t);
5141
- var isIndoorCamera = (ctx) => has(INDOOR_CAMERA_TYPES, ctx.deviceType);
5142
- var isIndoorCamMini = (ctx) => ctx.deviceType === DeviceType.INDOOR_COST_DOWN_CAMERA;
5143
- var isIndoorPanTiltS350 = (ctx) => has(INDOOR_PT_S350_TYPES, ctx.deviceType);
5144
- var isHomeBase = (ctx) => has(HOMEBASE_TYPES, ctx.deviceType);
5145
- var isStation9000 = (ctx) => ctx.deviceType === DeviceType.STATION_9000;
5146
- var isNvrT8N00 = (ctx) => ctx.model === "T8N00";
5147
- var isAiotVacuum = (ctx) => ctx.category !== "eufy_home_tuya";
5148
- var isTuyaVacuum = (ctx) => ctx.category === "eufy_home_tuya";
5149
-
5150
5156
  // dist/model/capabilities/audio.js
5151
5157
  var AUDIO_CMD = {
5152
5158
  /**
@@ -26875,7 +26881,10 @@ var PushClient = class _PushClient extends EventEmitter12 {
26875
26881
  });
26876
26882
  socket.on("data", (d) => this.parser.handleData(d));
26877
26883
  socket.on("close", () => this.onClose());
26878
- socket.on("error", (e) => this.emit("error", e));
26884
+ socket.on("error", (e) => {
26885
+ this.logger.warn(`[push] socket error: ${e.message}`);
26886
+ this.emit("error", e);
26887
+ });
26879
26888
  }
26880
26889
  buildLoginRequest() {
26881
26890
  const LoginRequest = mcsRoot().lookupType("mcs_proto.LoginRequest");