@mega-yfue/eufy-sdk 0.6.0-beta.25 → 0.6.0-beta.26
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
|
@@ -3474,12 +3474,13 @@ function describe(description, fn, m) {
|
|
|
3474
3474
|
function reports(requires, ctx) {
|
|
3475
3475
|
return !requires || requires.some((p) => ctx.paramIds.has(p));
|
|
3476
3476
|
}
|
|
3477
|
-
function narrow(type, read, prop) {
|
|
3477
|
+
function narrow(type, read, prop, values) {
|
|
3478
3478
|
if (type === "bool")
|
|
3479
3479
|
return readBool(read, prop);
|
|
3480
3480
|
if (type === "string")
|
|
3481
3481
|
return readStr(read, prop);
|
|
3482
|
-
|
|
3482
|
+
const n = readNum(read, prop);
|
|
3483
|
+
return values && n !== void 0 && !(n in values) ? void 0 : n;
|
|
3483
3484
|
}
|
|
3484
3485
|
function reads(m, ctx) {
|
|
3485
3486
|
return m.realtime === true || sent(m, ctx);
|
|
@@ -3532,7 +3533,9 @@ function bindMembers(members, deps) {
|
|
|
3532
3533
|
if (reported && !m.writeOnly && !m.unexposed) {
|
|
3533
3534
|
const decode = m.decode;
|
|
3534
3535
|
const raw = () => read(prop)?.value ?? (borrowed === void 0 ? void 0 : read(borrowed)?.value);
|
|
3535
|
-
const
|
|
3536
|
+
const { values, dynamic } = resolvedEnum(m, ctx);
|
|
3537
|
+
const domain = (dynamic ? "enum" : m.kind) === "enum" ? values : void 0;
|
|
3538
|
+
const get = decode ? () => decode(raw(), rawDp2, ctx) : () => narrow(m.type, read, prop, domain);
|
|
3536
3539
|
Object.defineProperty(out, name, { get, enumerable: true, configurable: true });
|
|
3537
3540
|
}
|
|
3538
3541
|
if (!m.write || m.unverified || !installs(m, ctx))
|
|
@@ -4802,7 +4805,7 @@ var BATTERY_MEMBERS = cellGated({
|
|
|
4802
4805
|
/**
|
|
4803
4806
|
* 1293 is the READABLE indicator (6445 is write-only/cloud-hidden). Verified live on a T8124R via an
|
|
4804
4807
|
* app-toggle before/after diff: 0 = Battery, 1 = External Solar Panel. Values beyond 0/1 (some models
|
|
4805
|
-
* report 5)
|
|
4808
|
+
* report 5) read as `undefined` — `enumValues` holds only the two that are confirmed.
|
|
4806
4809
|
*
|
|
4807
4810
|
* The write is a `1350` SET_PAYLOAD, inner cmd 1293, `{charge_mode:N}`, `mValue3` 0 (the app uses 0,
|
|
4808
4811
|
* not the cmd id), and the setter accepts a NAME as well as the index the getter answers.
|
|
@@ -4817,7 +4820,7 @@ var BATTERY_MEMBERS = cellGated({
|
|
|
4817
4820
|
requires: [BATTERY_PARAM.POWER_CHARGE],
|
|
4818
4821
|
args: [{ name: "source", kind: "enum", description: "The raw value, or the name `battery`/`external`." }],
|
|
4819
4822
|
...accepts(),
|
|
4820
|
-
description: "Configured power source (1293): 0 = Battery, 1 = External Solar Panel. Verified live on T8124R. The richer raw APP_CMD_SET_POWER_SOURCE blob is surfaced separately as `powerSourceInfo` (6445). Format varies by model (plain int or JSON {power_source:N});
|
|
4823
|
+
description: "Configured power source (1293): 0 = Battery, 1 = External Solar Panel. Verified live on T8124R. The richer raw APP_CMD_SET_POWER_SOURCE blob is surfaced separately as `powerSourceInfo` (6445). Format varies by model (plain int or JSON {power_source:N}); a value beyond 0/1 reads undefined.",
|
|
4821
4824
|
write: (v, ctx) => setPayload(BATTERY_PARAM.POWER_CHARGE, { charge_mode: v === "external" ? 1 : v === "battery" ? 0 : asBool(v) ? 1 : 0 }, ctx, 0, void 0, "auto")
|
|
4822
4825
|
},
|
|
4823
4826
|
/**
|
|
@@ -6199,6 +6202,10 @@ var CAMERA_MEMBERS = {
|
|
|
6199
6202
|
* sensor omits it, and the wire accepts the value regardless — the device's own reported set is the
|
|
6200
6203
|
* only statement of which of the three it has. `coerceEnumValue` rejects a value outside
|
|
6201
6204
|
* {@link NightVision} rather than coercing it. The payload key on the wire is `night_sion`.
|
|
6205
|
+
*
|
|
6206
|
+
* 1277 carries more than these three on some models: the V6 app's per-model mappings put modes on
|
|
6207
|
+
* 3, 5, 6 and 8 as well, and which model takes which mapping is not in the app bundle. A reported value
|
|
6208
|
+
* outside the published options reads as `undefined` rather than as an unnamed number.
|
|
6202
6209
|
*/
|
|
6203
6210
|
nightVision: {
|
|
6204
6211
|
param: CAMERA_CMD.NIGHT_VISION_TYPE,
|
|
@@ -14187,7 +14194,7 @@ var Device = class _Device {
|
|
|
14187
14194
|
const spec = this.specByName.get(name);
|
|
14188
14195
|
if (!spec)
|
|
14189
14196
|
continue;
|
|
14190
|
-
const value = spec.raw ? void 0 : narrow(spec.type, (n) => this.state.get(n), name);
|
|
14197
|
+
const value = spec.raw ? void 0 : narrow(spec.type, (n) => this.state.get(n), name, spec.kind === "enum" ? spec.enumValues : void 0);
|
|
14191
14198
|
out.push(value === void 0 ? { property: name } : { property: name, value });
|
|
14192
14199
|
}
|
|
14193
14200
|
return out;
|