@mega-yfue/eufy-sdk 0.5.0-beta.56 → 0.5.0-beta.58
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 +13 -4
- package/dist/index.js +35 -21
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
|
@@ -185,7 +185,8 @@ export declare class EufyMega extends EventEmitter {
|
|
|
185
185
|
*
|
|
186
186
|
* Skipped entirely for a device with a pollable cloud record, for an already-reporting device, and
|
|
187
187
|
* when realtime is off — so the common path adds nothing. Resolving on timeout leaves a silent device
|
|
188
|
-
* read-less rather than failing the lookup.
|
|
188
|
+
* read-less rather than failing the lookup. A Tuya clean-line device waits on the Tuya cloud read the
|
|
189
|
+
* bring-up started, so no broker is brought up for it.
|
|
189
190
|
*/
|
|
190
191
|
private awaitFirstRealtimeState;
|
|
191
192
|
/**
|
|
@@ -245,8 +246,17 @@ export declare class EufyMega extends EventEmitter {
|
|
|
245
246
|
* to land it under the property's name.
|
|
246
247
|
*/
|
|
247
248
|
private rebindReads;
|
|
248
|
-
/**
|
|
249
|
+
/**
|
|
250
|
+
* The distinct credential scopes the current MQTT roster needs — no devices on a scope, no connection.
|
|
251
|
+
* A Tuya clean-line device (`eufy_home_tuya`) needs none: the broker refuses its topics, and its state
|
|
252
|
+
* is read from the Tuya cloud.
|
|
253
|
+
*/
|
|
249
254
|
private mqttScopesInUse;
|
|
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.
|
|
258
|
+
*/
|
|
259
|
+
private readTuyaDevices;
|
|
250
260
|
/**
|
|
251
261
|
* Emit a semantic capability event whose name is only known at runtime (`decodeCapabilityEvent`
|
|
252
262
|
* returns a plain-string `event` + `payload`). The typed `emit` overload requires a literal event
|
|
@@ -793,8 +803,7 @@ export declare class EufyMega extends EventEmitter {
|
|
|
793
803
|
* unreachable device must not stop the rest of the roster from coming up).
|
|
794
804
|
*
|
|
795
805
|
* A Tuya clean-line device (`eufy_home_tuya`) is not subscribed: its state lives on the Tuya cloud,
|
|
796
|
-
* and the broker refuses its `eufy_home` topics on every credential.
|
|
797
|
-
* cloud instead.
|
|
806
|
+
* and the broker refuses its `eufy_home` topics on every credential.
|
|
798
807
|
*/
|
|
799
808
|
private subscribeMqttDevices;
|
|
800
809
|
/**
|
package/dist/index.js
CHANGED
|
@@ -4601,7 +4601,7 @@ function decodePowerSource(raw) {
|
|
|
4601
4601
|
function recordSetting(param, value, ctx) {
|
|
4602
4602
|
return setStationScalar(param, value, ctx.channel);
|
|
4603
4603
|
}
|
|
4604
|
-
var MAINS_CAMERA_MODELS = ["T8425", "T8419", "T8410", "T84A1", "T8423"];
|
|
4604
|
+
var MAINS_CAMERA_MODELS = ["T8425", "T8419", "T8410", "T84A1", "T8423", "T8E00", "T8P00"];
|
|
4605
4605
|
function cameraPowerTier(model, capabilities) {
|
|
4606
4606
|
return capabilities.has("battery") && notMainsCamera({ model }) ? "battery" : "wired";
|
|
4607
4607
|
}
|
|
@@ -17585,7 +17585,7 @@ var P2PSession = class _P2PSession extends EventEmitter2 {
|
|
|
17585
17585
|
} catch {
|
|
17586
17586
|
}
|
|
17587
17587
|
}
|
|
17588
|
-
if (header.commandId === CMD_GATEWAYINFO && header.signCode
|
|
17588
|
+
if (header.commandId === CMD_GATEWAYINFO && header.signCode <= 1 && !this.level2Key && !this.level2Negotiating && this.cfg.resolveCipherKey) {
|
|
17589
17589
|
this.negotiateLevel2Key(data);
|
|
17590
17590
|
}
|
|
17591
17591
|
if (header.commandId === CMD_DATABASE && header.signCode > 0) {
|
|
@@ -28301,7 +28301,8 @@ var EufyMega = class extends EventEmitter13 {
|
|
|
28301
28301
|
*
|
|
28302
28302
|
* Skipped entirely for a device with a pollable cloud record, for an already-reporting device, and
|
|
28303
28303
|
* when realtime is off — so the common path adds nothing. Resolving on timeout leaves a silent device
|
|
28304
|
-
* read-less rather than failing the lookup.
|
|
28304
|
+
* read-less rather than failing the lookup. A Tuya clean-line device waits on the Tuya cloud read the
|
|
28305
|
+
* bring-up started, so no broker is brought up for it.
|
|
28305
28306
|
*/
|
|
28306
28307
|
async awaitFirstRealtimeState(sn) {
|
|
28307
28308
|
if (this.opts.autoRealtime === false || this.realtimeGeneration?.epoch !== this.realtimeEpoch)
|
|
@@ -28319,10 +28320,12 @@ var EufyMega = class extends EventEmitter13 {
|
|
|
28319
28320
|
const caps = this.registry.capabilitiesForDevice(sn);
|
|
28320
28321
|
if (!caps || !hasRealtimeReads(caps))
|
|
28321
28322
|
return;
|
|
28322
|
-
|
|
28323
|
-
|
|
28324
|
-
|
|
28325
|
-
|
|
28323
|
+
if (!isTuyaVacuum(dev)) {
|
|
28324
|
+
try {
|
|
28325
|
+
await this.ensureMqttStarted(mqttScopeFor(dev));
|
|
28326
|
+
} catch {
|
|
28327
|
+
return;
|
|
28328
|
+
}
|
|
28326
28329
|
}
|
|
28327
28330
|
await this.registry.awaitRealtimeState(sn, timeoutMs);
|
|
28328
28331
|
}
|
|
@@ -28429,9 +28432,27 @@ var EufyMega = class extends EventEmitter13 {
|
|
|
28429
28432
|
this.reportError(e);
|
|
28430
28433
|
}
|
|
28431
28434
|
}
|
|
28432
|
-
/**
|
|
28435
|
+
/**
|
|
28436
|
+
* The distinct credential scopes the current MQTT roster needs — no devices on a scope, no connection.
|
|
28437
|
+
* A Tuya clean-line device (`eufy_home_tuya`) needs none: the broker refuses its topics, and its state
|
|
28438
|
+
* is read from the Tuya cloud.
|
|
28439
|
+
*/
|
|
28433
28440
|
mqttScopesInUse() {
|
|
28434
|
-
return [
|
|
28441
|
+
return [
|
|
28442
|
+
...new Set(this.getMqttDevices().filter((d) => !isTuyaVacuum(d)).map(mqttScopeFor))
|
|
28443
|
+
];
|
|
28444
|
+
}
|
|
28445
|
+
/**
|
|
28446
|
+
* Read every Tuya clean-line device's DPs from the Tuya cloud and deliver them as realtime state. A
|
|
28447
|
+
* failed read is reported, not fatal, and leaves that device's state as it was.
|
|
28448
|
+
*/
|
|
28449
|
+
readTuyaDevices() {
|
|
28450
|
+
for (const d of this.getMqttDevices().filter(isTuyaVacuum)) {
|
|
28451
|
+
this.tuya.fetchDps(d.sn).then((dps) => {
|
|
28452
|
+
if (dps)
|
|
28453
|
+
this.tuyaDpRouter.deliver(d.sn, dps);
|
|
28454
|
+
}).catch((e) => this.reportError(e));
|
|
28455
|
+
}
|
|
28435
28456
|
}
|
|
28436
28457
|
/**
|
|
28437
28458
|
* Emit a semantic capability event whose name is only known at runtime (`decodeCapabilityEvent`
|
|
@@ -28942,7 +28963,7 @@ var EufyMega = class extends EventEmitter13 {
|
|
|
28942
28963
|
}
|
|
28943
28964
|
if (cmd.kind === "aiot-dp") {
|
|
28944
28965
|
const dev = this.registry.require(sn);
|
|
28945
|
-
if (dev
|
|
28966
|
+
if (isTuyaVacuum(dev))
|
|
28946
28967
|
return this.tuya.dispatchCommand(sn, cmd);
|
|
28947
28968
|
return this.mqtt.dispatchCommand(sn, cmd);
|
|
28948
28969
|
}
|
|
@@ -29000,7 +29021,7 @@ var EufyMega = class extends EventEmitter13 {
|
|
|
29000
29021
|
async getDevices() {
|
|
29001
29022
|
const devices = await this.registry.getDevices();
|
|
29002
29023
|
for (const dev of devices) {
|
|
29003
|
-
if (dev
|
|
29024
|
+
if (!isTuyaVacuum(dev))
|
|
29004
29025
|
continue;
|
|
29005
29026
|
const raw = dev.raw ?? {};
|
|
29006
29027
|
this.tuya.registerDevice(dev.sn, tuyaDevIdFrom(raw) ?? dev.sn);
|
|
@@ -29174,6 +29195,7 @@ var EufyMega = class extends EventEmitter13 {
|
|
|
29174
29195
|
await this.getDevices();
|
|
29175
29196
|
if (epoch !== this.realtimeEpoch)
|
|
29176
29197
|
return this.settleRealtimeGeneration(generation, "superseded");
|
|
29198
|
+
this.readTuyaDevices();
|
|
29177
29199
|
const scopes = this.mqttScopesInUse();
|
|
29178
29200
|
readiness.mqtt = createPlaneReadiness(scopes.length);
|
|
29179
29201
|
let push;
|
|
@@ -29663,18 +29685,10 @@ var EufyMega = class extends EventEmitter13 {
|
|
|
29663
29685
|
* unreachable device must not stop the rest of the roster from coming up).
|
|
29664
29686
|
*
|
|
29665
29687
|
* A Tuya clean-line device (`eufy_home_tuya`) is not subscribed: its state lives on the Tuya cloud,
|
|
29666
|
-
* and the broker refuses its `eufy_home` topics on every credential.
|
|
29667
|
-
* cloud instead.
|
|
29688
|
+
* and the broker refuses its `eufy_home` topics on every credential.
|
|
29668
29689
|
*/
|
|
29669
29690
|
async subscribeMqttDevices(scope, transport) {
|
|
29670
|
-
for (const d of this.getMqttDevices().filter((dev) => mqttScopeFor(dev) === scope)) {
|
|
29671
|
-
if (d.category === "eufy_home_tuya") {
|
|
29672
|
-
this.tuya.fetchDps(d.sn).then((dps) => {
|
|
29673
|
-
if (dps)
|
|
29674
|
-
this.tuyaDpRouter.deliver(d.sn, dps);
|
|
29675
|
-
}).catch((e) => this.reportError(e));
|
|
29676
|
-
continue;
|
|
29677
|
-
}
|
|
29691
|
+
for (const d of this.getMqttDevices().filter((dev) => !isTuyaVacuum(dev) && mqttScopeFor(dev) === scope)) {
|
|
29678
29692
|
try {
|
|
29679
29693
|
await transport.subscribeDevice(d);
|
|
29680
29694
|
await this.sendRealtimeInit(d.sn);
|