@mega-yfue/eufy-sdk 0.6.0-beta.4 → 0.6.0-beta.6
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
|
@@ -3681,7 +3681,7 @@ var isIndoorPanTiltS350 = (ctx) => has(INDOOR_PT_S350_TYPES, ctx.deviceType);
|
|
|
3681
3681
|
var isHomeBase = (ctx) => has(HOMEBASE_TYPES, ctx.deviceType);
|
|
3682
3682
|
var isStation9000 = (ctx) => ctx.deviceType === DeviceType.STATION_9000;
|
|
3683
3683
|
var isNvrT8N00 = (ctx) => ctx.model === "T8N00";
|
|
3684
|
-
var isNvrMediaCamera = (ctx) => ctx.model === "T8E00" || ctx.model === "T8P00";
|
|
3684
|
+
var isNvrMediaCamera = (ctx) => ctx.model === "T8E00" || ctx.model === "T8P00" || ctx.model === "T8P10";
|
|
3685
3685
|
var isNvrDualLensCamera = (ctx) => ctx.model === "T8E00";
|
|
3686
3686
|
var isCallDoorbell = (ctx) => ctx.model === "T8223" || ctx.model === "T8224";
|
|
3687
3687
|
var isAiotVacuum = (ctx) => ctx.category !== "eufy_home_tuya";
|
|
@@ -4711,7 +4711,7 @@ function decodePowerSource(raw) {
|
|
|
4711
4711
|
function recordSetting(param, value, ctx) {
|
|
4712
4712
|
return setStationScalar(param, value, ctx.channel);
|
|
4713
4713
|
}
|
|
4714
|
-
var MAINS_CAMERA_MODELS = ["T8425", "T8419", "T8410", "T84A1", "T8423", "T8E00", "T8P00"];
|
|
4714
|
+
var MAINS_CAMERA_MODELS = ["T8425", "T8419", "T8410", "T84A1", "T8423", "T8E00", "T8P00", "T8P10"];
|
|
4715
4715
|
function cameraPowerTier(model, capabilities) {
|
|
4716
4716
|
return capabilities.has("battery") && notMainsCamera({ model }) ? "battery" : "wired";
|
|
4717
4717
|
}
|
|
@@ -16201,6 +16201,9 @@ function traceLiveStart(logger, trace, source) {
|
|
|
16201
16201
|
logger.debug(LIVE_TRACE_MESSAGE, source === void 0 ? trace : { ...trace, source });
|
|
16202
16202
|
}
|
|
16203
16203
|
|
|
16204
|
+
// dist/transport/p2p/level2-settle.js
|
|
16205
|
+
var LEVEL2_SETTLE_MS = 8e3;
|
|
16206
|
+
|
|
16204
16207
|
// dist/transport/p2p/p2p-session.js
|
|
16205
16208
|
var LOCAL_LOOKUP_PORT = 32108;
|
|
16206
16209
|
var HEARTBEAT_MS = 5e3;
|
|
@@ -17777,7 +17780,7 @@ var P2PSession = class _P2PSession extends EventEmitter2 {
|
|
|
17777
17780
|
});
|
|
17778
17781
|
const body = Buffer.concat([
|
|
17779
17782
|
buildCommandHeader(this.seqNumber, CMD_SET_PAYLOAD),
|
|
17780
|
-
|
|
17783
|
+
this.databasePayload(value, channel)
|
|
17781
17784
|
]);
|
|
17782
17785
|
this.seqNumber = this.seqNumber + 1 & 65535;
|
|
17783
17786
|
this.logger.debug(`[p2p] ${this.cfg.stationSn} requestImage ${filePath}`);
|
|
@@ -17815,12 +17818,20 @@ var P2PSession = class _P2PSession extends EventEmitter2 {
|
|
|
17815
17818
|
});
|
|
17816
17819
|
const body = Buffer.concat([
|
|
17817
17820
|
buildCommandHeader(this.seqNumber, CMD_SET_PAYLOAD),
|
|
17818
|
-
|
|
17821
|
+
this.databasePayload(value, channel)
|
|
17819
17822
|
]);
|
|
17820
17823
|
this.seqNumber = this.seqNumber + 1 & 65535;
|
|
17821
17824
|
this.logger.debug(`[p2p] ${this.cfg.stationSn} queryDatabase ${table} ch=${channel}`);
|
|
17822
17825
|
this.send(this.connectAddress, RequestMessageType.DATA, body);
|
|
17823
17826
|
}
|
|
17827
|
+
/**
|
|
17828
|
+
* The `CMD_SET_PAYLOAD` payload of a database read or stored-image request: the JSON level-1 encrypted, or
|
|
17829
|
+
* in the clear with header bytes from {@link nextClearCommandBytes} on a session that {@link sendsInTheClear}
|
|
17830
|
+
* and holds no level-2 key.
|
|
17831
|
+
*/
|
|
17832
|
+
databasePayload(value, channel) {
|
|
17833
|
+
return !this.level2Key && this.sendsInTheClear() ? buildRawCommandPayload(Buffer.from(value, "utf-8"), channel, 0, this.nextClearCommandBytes(), 0) : buildStringCommandPayload(value, channel, this.level1Key, 1);
|
|
17834
|
+
}
|
|
17824
17835
|
/**
|
|
17825
17836
|
* Standard "give me the whole table" query params the eufy app uses for a direct
|
|
17826
17837
|
* `CMD_DATABASE` read (inner `cmd 10000`). `count` bounds the row count.
|
|
@@ -17893,10 +17904,15 @@ var P2PSession = class _P2PSession extends EventEmitter2 {
|
|
|
17893
17904
|
*
|
|
17894
17905
|
* One read at a time per session: while one is accumulating, every {@link queryDatabase} on the
|
|
17895
17906
|
* session throws, so a second reply cannot land in this buffer.
|
|
17907
|
+
*
|
|
17908
|
+
* The query's framing follows the cipher the gateway-info reply names, so on a session still negotiating
|
|
17909
|
+
* its level-2 key the query waits for that to settle, up to {@link LEVEL2_SETTLE_MS} from connect.
|
|
17896
17910
|
*/
|
|
17897
17911
|
async readDatabase(table, opts = {}) {
|
|
17898
17912
|
if (opts.signal?.aborted)
|
|
17899
17913
|
throw new Error("readDatabase: aborted");
|
|
17914
|
+
if (this.level2Pending)
|
|
17915
|
+
await abortable(this.awaitLevel2Key(LEVEL2_SETTLE_MS, "session"), opts.signal);
|
|
17900
17916
|
this.queryDatabase(table, {
|
|
17901
17917
|
accountId: opts.accountId,
|
|
17902
17918
|
innerCmd: opts.innerCmd,
|
|
@@ -18199,6 +18215,8 @@ var P2PSession = class _P2PSession extends EventEmitter2 {
|
|
|
18199
18215
|
} catch {
|
|
18200
18216
|
}
|
|
18201
18217
|
}
|
|
18218
|
+
} else if (header.commandId === CMD_DATABASE && this.sendsInTheClear()) {
|
|
18219
|
+
this.emit("dbChunk", { stationSn: this.cfg.stationSn, text: payload.toString("latin1") });
|
|
18202
18220
|
}
|
|
18203
18221
|
const frame = {
|
|
18204
18222
|
...header,
|
|
@@ -22030,7 +22048,6 @@ function stationChannels(devices) {
|
|
|
22030
22048
|
// dist/transport/p2p/command-router.js
|
|
22031
22049
|
var DIRECT_CMD_SENDS = 5;
|
|
22032
22050
|
var LEVEL2_GRACE_MS = 25e3;
|
|
22033
|
-
var LEVEL2_SETTLE_MS = 8e3;
|
|
22034
22051
|
var KEEP_LEVEL1_SESSION_MODELS = /* @__PURE__ */ new Set(["T8423"]);
|
|
22035
22052
|
var P2P_STATION_WAITS = {
|
|
22036
22053
|
connect: CONNECT_TIMEOUT_MS,
|