@mega-yfue/eufy-sdk 0.5.0-beta.27 → 0.5.0-beta.29
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.
|
@@ -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
|
@@ -4252,6 +4252,10 @@ var MOTION_MEMBERS = {
|
|
|
4252
4252
|
* The raw sensitivity an indoor camera reports, on the one id whose write takes a `1700` control
|
|
4253
4253
|
* payload carrying an index rather than the `1350` envelope its siblings use — a frame-shape
|
|
4254
4254
|
* difference `sensitivityCommand` resolves from the scale. `unexposed` like its three siblings.
|
|
4255
|
+
*
|
|
4256
|
+
* Some devices report 6041 as a base64 JSON list of per-sensor entries
|
|
4257
|
+
* (`{"list":[{"sensor_id":…,"sensitivity":…}]}`) rather than a scalar. That value is stored verbatim
|
|
4258
|
+
* and this getter answers `undefined` for it: only the scalar form is confirmed to be this step.
|
|
4255
4259
|
*/
|
|
4256
4260
|
indoorSensitivity: {
|
|
4257
4261
|
param: MOTION_CMD.INDOOR_SENSITIVITY_INDEX,
|
|
@@ -4259,7 +4263,8 @@ var MOTION_MEMBERS = {
|
|
|
4259
4263
|
kind: "scalar",
|
|
4260
4264
|
provenance: "verified",
|
|
4261
4265
|
unexposed: true,
|
|
4262
|
-
description: "Raw sensitivity an indoor camera reports (verified: param 6041)."
|
|
4266
|
+
description: "Raw sensitivity an indoor camera reports (verified: param 6041).",
|
|
4267
|
+
decode: (raw) => typeof raw === "number" ? raw : void 0
|
|
4263
4268
|
},
|
|
4264
4269
|
/**
|
|
4265
4270
|
* The raw sensitivity on the INVERTED seven-step camera scale — a HIGHER number is LESS sensitive, so
|
|
@@ -5877,8 +5882,9 @@ function isStationAlarmOutput(ctx) {
|
|
|
5877
5882
|
function isEvidencedStationAlarm(ctx) {
|
|
5878
5883
|
return isStationAlarmOutput(ctx) && HUB_ALARM_EVIDENCE.some((param) => ctx.paramIds.has(param));
|
|
5879
5884
|
}
|
|
5885
|
+
var S1_PRO_ALARM_MODELS = /* @__PURE__ */ new Set(["T8134"]);
|
|
5880
5886
|
function isEvidencedAttachedCamera(ctx) {
|
|
5881
|
-
return ctx.codec === "camera" && ctx.homeBaseAttached === true && hasReportedEasSwitch(ctx);
|
|
5887
|
+
return ctx.codec === "camera" && ctx.homeBaseAttached === true && hasReportedEasSwitch(ctx) && (!isStation9000({ deviceType: ctx.stationDeviceType }) || S1_PRO_ALARM_MODELS.has(ctx.model ?? ""));
|
|
5882
5888
|
}
|
|
5883
5889
|
function reportsParam(source, param) {
|
|
5884
5890
|
return source.paramIds?.has(param) === true || Object.hasOwn(source.params ?? {}, param);
|
|
@@ -5897,7 +5903,18 @@ function homeBaseAlarm(seconds, ctx) {
|
|
|
5897
5903
|
throw new Error("station-family HomeBase alarm output requires the acting account name");
|
|
5898
5904
|
return setPayload(SIREN_CMD.HOMEBASE_TONE, { time_out: seconds, user_name: ctx.accountName }, ctx, 0, STATION_CHANNEL);
|
|
5899
5905
|
}
|
|
5906
|
+
var PORTAL_MANUAL_ALARM_TYPE = 10;
|
|
5900
5907
|
function cameraAlarm(seconds, ctx) {
|
|
5908
|
+
if (isStation9000({ deviceType: ctx.stationDeviceType })) {
|
|
5909
|
+
if (!ctx.accountName)
|
|
5910
|
+
throw new Error("a camera alarm behind a HomeBase S1 Pro requires the acting account name");
|
|
5911
|
+
return setPayload(SIREN_CMD.CAMERA_TONE, {
|
|
5912
|
+
time_out: seconds,
|
|
5913
|
+
type: PORTAL_MANUAL_ALARM_TYPE,
|
|
5914
|
+
channel: ctx.channel,
|
|
5915
|
+
username: ctx.accountName
|
|
5916
|
+
}, ctx);
|
|
5917
|
+
}
|
|
5901
5918
|
return {
|
|
5902
5919
|
kind: "p2p-int-string",
|
|
5903
5920
|
cmd: SIREN_CMD.CAMERA_TONE,
|
|
@@ -28283,6 +28300,28 @@ var EufyMega = class extends EventEmitter13 {
|
|
|
28283
28300
|
}
|
|
28284
28301
|
};
|
|
28285
28302
|
}
|
|
28303
|
+
/**
|
|
28304
|
+
* The station a device's commands go through: the device itself, or the HomeBase the registry links it
|
|
28305
|
+
* to. Answers the target record, the station record and serial, the station's `device_type`, and the
|
|
28306
|
+
* `t9000` / `t8n00` family flags.
|
|
28307
|
+
*/
|
|
28308
|
+
stationOf(sn) {
|
|
28309
|
+
const devices = this.registry.list();
|
|
28310
|
+
const target = devices.find((d) => d.sn === sn);
|
|
28311
|
+
const stationSn = target?.stationSn || sn;
|
|
28312
|
+
const station = devices.find((d) => d.sn === stationSn);
|
|
28313
|
+
const raw = station?.raw ?? {};
|
|
28314
|
+
const deviceType = typeof raw.device_type === "number" ? raw.device_type : void 0;
|
|
28315
|
+
const family = { deviceType, model: station?.model };
|
|
28316
|
+
return { target, station, stationSn, raw, deviceType, t9000: isStation9000(family), t8n00: isNvrT8N00(family) };
|
|
28317
|
+
}
|
|
28318
|
+
/** The vendor DeviceType of the station a device hangs off; `undefined` for a station itself. */
|
|
28319
|
+
stationDeviceTypeOf(sn) {
|
|
28320
|
+
const st = this.stationOf(sn);
|
|
28321
|
+
if (!st.station || st.stationSn === sn)
|
|
28322
|
+
return void 0;
|
|
28323
|
+
return st.deviceType;
|
|
28324
|
+
}
|
|
28286
28325
|
/**
|
|
28287
28326
|
* Combine explicit P2P media with the optional passive push-thumbnail provider.
|
|
28288
28327
|
*
|
|
@@ -28367,15 +28406,8 @@ var EufyMega = class extends EventEmitter13 {
|
|
|
28367
28406
|
* `member.admin_user_id`, else the logged-in user.
|
|
28368
28407
|
*/
|
|
28369
28408
|
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))
|
|
28409
|
+
const { target, station, stationSn, raw, t9000, t8n00: native } = this.stationOf(sn);
|
|
28410
|
+
if (!target || !station || !(t9000 || native))
|
|
28379
28411
|
return void 0;
|
|
28380
28412
|
const member = raw.member?.admin_user_id;
|
|
28381
28413
|
const adminUserId = typeof member === "string" && member ? member : void 0;
|
|
@@ -29341,6 +29373,7 @@ var EufyMega = class extends EventEmitter13 {
|
|
|
29341
29373
|
hasP2p: P2PCommandRouter.claimsDevice(dev),
|
|
29342
29374
|
// Topology as the record states it: a parent that isn't the device itself means HomeBase-attached.
|
|
29343
29375
|
homeBaseAttached: !!raw.parent_sn && raw.parent_sn !== dev.sn,
|
|
29376
|
+
stationDeviceType: this.stationDeviceTypeOf(sn),
|
|
29344
29377
|
dpCatalog
|
|
29345
29378
|
};
|
|
29346
29379
|
}
|