@mega-yfue/eufy-sdk 0.5.0-beta.8 → 0.5.0-beta.9
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 +6 -0
- package/dist/index.js +17 -5
- package/dist/index.js.map +2 -2
- package/dist/model/registry.d.ts +3 -2
- package/dist/model/types.d.ts +6 -0
- package/package.json +1 -1
|
@@ -234,6 +234,11 @@ export declare class EufyMega extends EventEmitter {
|
|
|
234
234
|
*
|
|
235
235
|
* The evidence set is widened, never replaced: the ids come back through the cloud record, and a
|
|
236
236
|
* record that omits a realtime-only id would otherwise un-know it and re-trigger on the next report.
|
|
237
|
+
*
|
|
238
|
+
* The device is re-resolved against the fresh record before binding. A property gated on a
|
|
239
|
+
* realtime-only param enters the schema only once that param is evidence, and the value that made it
|
|
240
|
+
* evidence was stored before the property existed, so the record's realtime params are applied again
|
|
241
|
+
* to land it under the property's name.
|
|
237
242
|
*/
|
|
238
243
|
private rebindReads;
|
|
239
244
|
/** The distinct credential scopes the current MQTT roster needs — no devices on a scope, no connection. */
|
|
@@ -860,6 +865,7 @@ export declare class EufyMega extends EventEmitter {
|
|
|
860
865
|
* exactly the reads it has.
|
|
861
866
|
*/
|
|
862
867
|
private fetchDpCatalog;
|
|
868
|
+
/** The {@link CommandContext} for a device, built from `known` when that record is already in hand. */
|
|
863
869
|
private commandContext;
|
|
864
870
|
/**
|
|
865
871
|
* **Generic P2P request/reply query** — sends a `SET_PAYLOAD` sub-command and resolves with the
|
package/dist/index.js
CHANGED
|
@@ -11179,8 +11179,10 @@ function resolveDevice(rec) {
|
|
|
11179
11179
|
}
|
|
11180
11180
|
function resolveProperties(rec, codec, capabilities) {
|
|
11181
11181
|
const paramIds = /* @__PURE__ */ new Set();
|
|
11182
|
-
|
|
11183
|
-
|
|
11182
|
+
for (const reported of [rec.params, rec.dpParams]) {
|
|
11183
|
+
if (!reported || typeof reported !== "object")
|
|
11184
|
+
continue;
|
|
11185
|
+
for (const k of Object.keys(reported)) {
|
|
11184
11186
|
const n = Number(k);
|
|
11185
11187
|
if (Number.isFinite(n))
|
|
11186
11188
|
paramIds.add(n);
|
|
@@ -26004,13 +26006,22 @@ var EufyMega = class extends EventEmitter9 {
|
|
|
26004
26006
|
*
|
|
26005
26007
|
* The evidence set is widened, never replaced: the ids come back through the cloud record, and a
|
|
26006
26008
|
* record that omits a realtime-only id would otherwise un-know it and re-trigger on the next report.
|
|
26009
|
+
*
|
|
26010
|
+
* The device is re-resolved against the fresh record before binding. A property gated on a
|
|
26011
|
+
* realtime-only param enters the schema only once that param is evidence, and the value that made it
|
|
26012
|
+
* evidence was stored before the property existed, so the record's realtime params are applied again
|
|
26013
|
+
* to land it under the property's name.
|
|
26007
26014
|
*/
|
|
26008
26015
|
async rebindReads(sn) {
|
|
26009
26016
|
const dev = this.liveDevices.get(sn)?.deref();
|
|
26010
26017
|
if (!dev)
|
|
26011
26018
|
return;
|
|
26012
26019
|
try {
|
|
26013
|
-
const
|
|
26020
|
+
const rec = await this.registry.record(sn);
|
|
26021
|
+
dev.reresolve(rec);
|
|
26022
|
+
if (rec.dpParams)
|
|
26023
|
+
this.applyAndAnnounce(dev, rec.dpParams);
|
|
26024
|
+
const ctx = await this.commandContext(sn, rec);
|
|
26014
26025
|
dev.bindActions(ctx, this.commandSinkFor(sn), this.mediaProviderFor(sn), this.ff09SettingsReaderFor(sn, ctx), rawDpCodec);
|
|
26015
26026
|
this.boundParamIds.set(sn, /* @__PURE__ */ new Set([...this.boundParamIds.get(sn) ?? [], ...ctx.paramIds]));
|
|
26016
26027
|
this.emit("deviceState", this.deviceState(sn));
|
|
@@ -27376,8 +27387,9 @@ var EufyMega = class extends EventEmitter9 {
|
|
|
27376
27387
|
return EMPTY_DP_CATALOG;
|
|
27377
27388
|
}
|
|
27378
27389
|
}
|
|
27379
|
-
|
|
27380
|
-
|
|
27390
|
+
/** The {@link CommandContext} for a device, built from `known` when that record is already in hand. */
|
|
27391
|
+
async commandContext(sn, known) {
|
|
27392
|
+
const rec = known ?? await this.registry.record(sn);
|
|
27381
27393
|
const dev = this.registry.require(sn);
|
|
27382
27394
|
const raw = dev.raw ?? {};
|
|
27383
27395
|
const rawChannel = raw.device_channel;
|