@mega-yfue/eufy-sdk 0.2.0-beta.11 → 0.2.0-beta.13
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.
|
@@ -90,8 +90,33 @@ export type BatteryActions = Surface<typeof BATTERY_MEMBERS>;
|
|
|
90
90
|
* The richer raw `APP_CMD_SET_POWER_SOURCE` blob is a separate param, surfaced as `powerSourceInfo`.
|
|
91
91
|
*/
|
|
92
92
|
declare function decodePowerSource(raw: string | number | boolean): number | string;
|
|
93
|
-
/**
|
|
94
|
-
|
|
93
|
+
/**
|
|
94
|
+
* The params whose subject IS the physical cell — so every member reading one must carry
|
|
95
|
+
* {@link notMainsCamera}.
|
|
96
|
+
*
|
|
97
|
+
* The ONE place that fact is declared. {@link cellGated} applies {@link notMainsCamera} from this list
|
|
98
|
+
* when the table is built, so a member never states the gate itself: adding a cell read is adding its
|
|
99
|
+
* param here, and there is no second place for it to be missing from. A per-member `available` was the
|
|
100
|
+
* alternative and is what the first two passes of this guard got wrong, in both directions — first by
|
|
101
|
+
* covering two of the seven, then by reading `unexposed` as covering a third.
|
|
102
|
+
*
|
|
103
|
+
* What is NOT here matters as much.
|
|
104
|
+
*
|
|
105
|
+
* - `workingMode` and the three `record*` settings describe how hard the camera works, not what powers
|
|
106
|
+
* it, and a mains camera genuinely has them. They are the reason the capability stays attached.
|
|
107
|
+
* - `cameraInfo` (1103) is a number whose meaning is unevidenced. Gating it would assert it is a
|
|
108
|
+
* battery fact, which is the kind of claim this guard exists to stop making.
|
|
109
|
+
* - `powerSource` (1293) is the open one. Both values it names — `Battery` and `External Solar Panel` —
|
|
110
|
+
* describe how a CELL is fed, so by this list's own rule it arguably belongs here. It is out because
|
|
111
|
+
* every param above is one a live mains camera was observed to publish and 1293 was not among them,
|
|
112
|
+
* and because it is `requires`-gated on its own param, so it appears only where the device reports
|
|
113
|
+
* it. Gating it would also withhold a described WRITE rather than a read, which is a different class
|
|
114
|
+
* of change. Unresolved rather than decided: see the note in the pull request.
|
|
115
|
+
*
|
|
116
|
+
* The two solar params ARE here: a panel exists to charge a cell, so a device without one has no solar
|
|
117
|
+
* harvest to report either.
|
|
118
|
+
*/
|
|
119
|
+
export declare const CELL_PARAMS: readonly number[];
|
|
95
120
|
/**
|
|
96
121
|
* Every `battery` feature, declared once — the property schema, the evidence-gated getters, the derived
|
|
97
122
|
* setters, the intent routes and the descriptions all come out of this table. Order is schema order.
|
|
@@ -117,7 +142,6 @@ export declare const BATTERY_MEMBERS: {
|
|
|
117
142
|
readonly unit: "%";
|
|
118
143
|
readonly kind: "percent";
|
|
119
144
|
readonly provenance: "verified";
|
|
120
|
-
readonly available: typeof notMainsCamera;
|
|
121
145
|
readonly description: "Battery level 0-100 (verified: param 1101).";
|
|
122
146
|
};
|
|
123
147
|
/**
|
|
@@ -130,7 +154,6 @@ export declare const BATTERY_MEMBERS: {
|
|
|
130
154
|
readonly type: "bool";
|
|
131
155
|
readonly kind: "boolean";
|
|
132
156
|
readonly provenance: "apk";
|
|
133
|
-
readonly available: typeof notMainsCamera;
|
|
134
157
|
readonly coerce: (v: string | number | boolean) => boolean;
|
|
135
158
|
readonly description: string;
|
|
136
159
|
};
|
|
@@ -300,6 +323,11 @@ export declare const BATTERY_MEMBERS: {
|
|
|
300
323
|
* Reported, so it stays in the schema and answers through `getProperty` — but given no typed getter:
|
|
301
324
|
* the payload's fields have never been decoded, and a getter would hand back an opaque blob typed as
|
|
302
325
|
* though it meant something.
|
|
326
|
+
*
|
|
327
|
+
* `unexposed` is NOT a substitute for the cell gate. It suppresses the fluent GETTER; `propertiesOf`
|
|
328
|
+
* filters `writeOnly` and `available` and deliberately not `unexposed`, because a schema entry
|
|
329
|
+
* reachable through `getProperty` is the whole point of the mark. So a cell param needs
|
|
330
|
+
* {@link CELL_PARAMS} either way, or a mains camera publishes "battery power history" and answers it.
|
|
303
331
|
*/
|
|
304
332
|
readonly batteryPowerStats: {
|
|
305
333
|
readonly param: 3100;
|
|
@@ -54,6 +54,15 @@ export declare function getCapabilityModule(cap: Capability): CapabilityModule |
|
|
|
54
54
|
* @internal
|
|
55
55
|
*/
|
|
56
56
|
export declare const CAPABILITY_MODULES: Record<Capability, CapabilityModule>;
|
|
57
|
+
/**
|
|
58
|
+
* Every param these capabilities declare before any gate — the set a device's schema is a subset of.
|
|
59
|
+
*
|
|
60
|
+
* A param in here that a device's schema does NOT carry is one a gate withheld: the capability resolved,
|
|
61
|
+
* and its member decided the read does not describe this device — a cell reading on a mains model, a mode
|
|
62
|
+
* a family does not carry. Read-aliases count, since a member reads them under its own name.
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
export declare function claimedParams(caps: Capability[]): Set<number>;
|
|
57
66
|
/**
|
|
58
67
|
* Merge the property schemas of several capabilities into one flat, de-duplicated list.
|
|
59
68
|
*
|
package/dist/model/device.d.ts
CHANGED
|
@@ -62,6 +62,11 @@ export declare class Device {
|
|
|
62
62
|
* different wire ids across device families still resolves to one named value.
|
|
63
63
|
*/
|
|
64
64
|
private specByParam;
|
|
65
|
+
/**
|
|
66
|
+
* Params a resolved capability declares that this device's schema does not carry — withheld by a
|
|
67
|
+
* member's gate, so not named from the param dictionary either. See {@link Device.applyParams}.
|
|
68
|
+
*/
|
|
69
|
+
private withheld;
|
|
65
70
|
/** Which param namespace this device's ids live in (clean DPs vs security P2P). */
|
|
66
71
|
private namespace;
|
|
67
72
|
/** The record's `device_name` as stated, before the {@link modelName} fallback is applied. */
|
|
@@ -201,6 +206,16 @@ export declare class Device {
|
|
|
201
206
|
* Apply a raw param map (cloud record or P2P notification). Known params update their named
|
|
202
207
|
* property; unrecognised params are retained as `unknown_<paramType>` so nothing is lost.
|
|
203
208
|
*
|
|
209
|
+
* Naming precedence: this device's own `PropertySpec` (curated), then the param dictionary for its
|
|
210
|
+
* namespace, then the `unknown_<paramType>` passthrough. The dictionary def is consulted even where a
|
|
211
|
+
* spec exists, because `encoding` lives there.
|
|
212
|
+
*
|
|
213
|
+
* A param a resolved capability's gate WITHHELD takes the passthrough instead of its dictionary name.
|
|
214
|
+
* The gate decided the read does not describe this device, the dictionary names it what the member
|
|
215
|
+
* would have, and republishing it there hands a caller a reading indistinguishable from one the device
|
|
216
|
+
* really answered. A capability that never resolved withholds nothing: a param arriving before its
|
|
217
|
+
* capability is still the device's own, and keeps its dictionary name.
|
|
218
|
+
*
|
|
204
219
|
* @param params param_type → raw value.
|
|
205
220
|
* @param ts observation time (epoch ms); defaults to `Date.now()`.
|
|
206
221
|
* @returns the list of property names whose value changed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mega-yfue/eufy-sdk",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.13",
|
|
4
4
|
"description": "One typed TypeScript client for the Anker eufy v6 cloud — capability-driven devices, realtime events over P2P/MQTT/push, and live media",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "mega-yfue",
|