@mega-yfue/eufy-sdk 0.5.0-beta.27 → 0.5.0-beta.28
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/client/eufy-mega.d.ts +8 -0
- package/dist/index.js +38 -10
- package/dist/index.js.map +2 -2
- package/dist/model/capabilities/types.d.ts +6 -0
- package/package.json +1 -1
|
@@ -401,6 +401,14 @@ export declare class EufyMega extends EventEmitter {
|
|
|
401
401
|
* other kind is P2P.
|
|
402
402
|
*/
|
|
403
403
|
private commandSinkFor;
|
|
404
|
+
/**
|
|
405
|
+
* The station a device's commands go through: the device itself, or the HomeBase the registry links it
|
|
406
|
+
* to. Answers the target record, the station record and serial, the station's `device_type`, and the
|
|
407
|
+
* `t9000` / `t8n00` family flags.
|
|
408
|
+
*/
|
|
409
|
+
private stationOf;
|
|
410
|
+
/** The vendor DeviceType of the station a device hangs off; `undefined` for a station itself. */
|
|
411
|
+
private stationDeviceTypeOf;
|
|
404
412
|
/**
|
|
405
413
|
* Combine explicit P2P media with the optional passive push-thumbnail provider.
|
|
406
414
|
*
|
package/dist/index.js
CHANGED
|
@@ -5877,8 +5877,9 @@ function isStationAlarmOutput(ctx) {
|
|
|
5877
5877
|
function isEvidencedStationAlarm(ctx) {
|
|
5878
5878
|
return isStationAlarmOutput(ctx) && HUB_ALARM_EVIDENCE.some((param) => ctx.paramIds.has(param));
|
|
5879
5879
|
}
|
|
5880
|
+
var S1_PRO_ALARM_MODELS = /* @__PURE__ */ new Set(["T8134"]);
|
|
5880
5881
|
function isEvidencedAttachedCamera(ctx) {
|
|
5881
|
-
return ctx.codec === "camera" && ctx.homeBaseAttached === true && hasReportedEasSwitch(ctx);
|
|
5882
|
+
return ctx.codec === "camera" && ctx.homeBaseAttached === true && hasReportedEasSwitch(ctx) && (!isStation9000({ deviceType: ctx.stationDeviceType }) || S1_PRO_ALARM_MODELS.has(ctx.model ?? ""));
|
|
5882
5883
|
}
|
|
5883
5884
|
function reportsParam(source, param) {
|
|
5884
5885
|
return source.paramIds?.has(param) === true || Object.hasOwn(source.params ?? {}, param);
|
|
@@ -5897,7 +5898,18 @@ function homeBaseAlarm(seconds, ctx) {
|
|
|
5897
5898
|
throw new Error("station-family HomeBase alarm output requires the acting account name");
|
|
5898
5899
|
return setPayload(SIREN_CMD.HOMEBASE_TONE, { time_out: seconds, user_name: ctx.accountName }, ctx, 0, STATION_CHANNEL);
|
|
5899
5900
|
}
|
|
5901
|
+
var PORTAL_MANUAL_ALARM_TYPE = 10;
|
|
5900
5902
|
function cameraAlarm(seconds, ctx) {
|
|
5903
|
+
if (isStation9000({ deviceType: ctx.stationDeviceType })) {
|
|
5904
|
+
if (!ctx.accountName)
|
|
5905
|
+
throw new Error("a camera alarm behind a HomeBase S1 Pro requires the acting account name");
|
|
5906
|
+
return setPayload(SIREN_CMD.CAMERA_TONE, {
|
|
5907
|
+
time_out: seconds,
|
|
5908
|
+
type: PORTAL_MANUAL_ALARM_TYPE,
|
|
5909
|
+
channel: ctx.channel,
|
|
5910
|
+
username: ctx.accountName
|
|
5911
|
+
}, ctx);
|
|
5912
|
+
}
|
|
5901
5913
|
return {
|
|
5902
5914
|
kind: "p2p-int-string",
|
|
5903
5915
|
cmd: SIREN_CMD.CAMERA_TONE,
|
|
@@ -28283,6 +28295,28 @@ var EufyMega = class extends EventEmitter13 {
|
|
|
28283
28295
|
}
|
|
28284
28296
|
};
|
|
28285
28297
|
}
|
|
28298
|
+
/**
|
|
28299
|
+
* The station a device's commands go through: the device itself, or the HomeBase the registry links it
|
|
28300
|
+
* to. Answers the target record, the station record and serial, the station's `device_type`, and the
|
|
28301
|
+
* `t9000` / `t8n00` family flags.
|
|
28302
|
+
*/
|
|
28303
|
+
stationOf(sn) {
|
|
28304
|
+
const devices = this.registry.list();
|
|
28305
|
+
const target = devices.find((d) => d.sn === sn);
|
|
28306
|
+
const stationSn = target?.stationSn || sn;
|
|
28307
|
+
const station = devices.find((d) => d.sn === stationSn);
|
|
28308
|
+
const raw = station?.raw ?? {};
|
|
28309
|
+
const deviceType = typeof raw.device_type === "number" ? raw.device_type : void 0;
|
|
28310
|
+
const family = { deviceType, model: station?.model };
|
|
28311
|
+
return { target, station, stationSn, raw, deviceType, t9000: isStation9000(family), t8n00: isNvrT8N00(family) };
|
|
28312
|
+
}
|
|
28313
|
+
/** The vendor DeviceType of the station a device hangs off; `undefined` for a station itself. */
|
|
28314
|
+
stationDeviceTypeOf(sn) {
|
|
28315
|
+
const st = this.stationOf(sn);
|
|
28316
|
+
if (!st.station || st.stationSn === sn)
|
|
28317
|
+
return void 0;
|
|
28318
|
+
return st.deviceType;
|
|
28319
|
+
}
|
|
28286
28320
|
/**
|
|
28287
28321
|
* Combine explicit P2P media with the optional passive push-thumbnail provider.
|
|
28288
28322
|
*
|
|
@@ -28367,15 +28401,8 @@ var EufyMega = class extends EventEmitter13 {
|
|
|
28367
28401
|
* `member.admin_user_id`, else the logged-in user.
|
|
28368
28402
|
*/
|
|
28369
28403
|
rtcRouteFor(sn) {
|
|
28370
|
-
const
|
|
28371
|
-
|
|
28372
|
-
const stationSn = target?.stationSn || sn;
|
|
28373
|
-
const station = devices.find((d) => d.sn === stationSn);
|
|
28374
|
-
const raw = station?.raw ?? {};
|
|
28375
|
-
const deviceType = typeof raw.device_type === "number" ? raw.device_type : void 0;
|
|
28376
|
-
const family = { deviceType, model: station?.model };
|
|
28377
|
-
const native = isNvrT8N00(family);
|
|
28378
|
-
if (!target || !station || !(isStation9000(family) || native))
|
|
28404
|
+
const { target, station, stationSn, raw, t9000, t8n00: native } = this.stationOf(sn);
|
|
28405
|
+
if (!target || !station || !(t9000 || native))
|
|
28379
28406
|
return void 0;
|
|
28380
28407
|
const member = raw.member?.admin_user_id;
|
|
28381
28408
|
const adminUserId = typeof member === "string" && member ? member : void 0;
|
|
@@ -29341,6 +29368,7 @@ var EufyMega = class extends EventEmitter13 {
|
|
|
29341
29368
|
hasP2p: P2PCommandRouter.claimsDevice(dev),
|
|
29342
29369
|
// Topology as the record states it: a parent that isn't the device itself means HomeBase-attached.
|
|
29343
29370
|
homeBaseAttached: !!raw.parent_sn && raw.parent_sn !== dev.sn,
|
|
29371
|
+
stationDeviceType: this.stationDeviceTypeOf(sn),
|
|
29344
29372
|
dpCatalog
|
|
29345
29373
|
};
|
|
29346
29374
|
}
|