@mega-yfue/eufy-sdk 0.5.0-beta.51 → 0.5.0-beta.53
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 +7 -2
- package/dist/index.js +65 -52
- package/dist/index.js.map +2 -2
- package/dist/model/capabilities/arming.d.ts +12 -6
- package/dist/transport/tuya/client.d.ts +4 -3
- package/dist/transport/tuya/command-router.d.ts +10 -14
- package/dist/transport/tuya/request.d.ts +3 -3
- package/package.json +1 -1
|
@@ -112,8 +112,11 @@ export declare const ARMING_CMD: {
|
|
|
112
112
|
*/
|
|
113
113
|
readonly SET_ALL_ACTION: 1255;
|
|
114
114
|
};
|
|
115
|
-
/**
|
|
116
|
-
|
|
115
|
+
/**
|
|
116
|
+
* The guard modes whose device notification is read and written. Home and away are replayed on a T8010;
|
|
117
|
+
* `custom1` (wire 3) is captured on a T8170, whose own params report it on 1148.
|
|
118
|
+
*/
|
|
119
|
+
export type DeviceNotificationMode = Extract<ArmingMode, "home" | "away" | "custom1">;
|
|
117
120
|
/**
|
|
118
121
|
* Alarm-delay durations the app's OWN picker UI offers — `AlarmDelaySeconds` is both the const
|
|
119
122
|
* value-object (`AlarmDelaySeconds.sec45`) and the union type of its values, so callers pass the
|
|
@@ -237,7 +240,8 @@ export declare const ARMING_MEMBERS: {
|
|
|
237
240
|
/**
|
|
238
241
|
* Whether the device on `channel` sends a push notification in `mode`: its {@link DEVICE_NOTIFY_FLAG}
|
|
239
242
|
* in the action table the station reports for that mode. `undefined` where the station reports no table
|
|
240
|
-
* or the table does not list `channel`. A
|
|
243
|
+
* or the table does not list `channel`. A standalone camera answers from its own 1225/1239/1148 flags,
|
|
244
|
+
* for its own channel only. A device's channel is `EufyDevice.channel`.
|
|
241
245
|
*/
|
|
242
246
|
readonly deviceNotification: import("./members.js").MethodMember<(mode: DeviceNotificationMode, channel: number) => boolean | undefined> & {
|
|
243
247
|
available: (ctx: CommandContext) => boolean;
|
|
@@ -245,9 +249,11 @@ export declare const ARMING_MEMBERS: {
|
|
|
245
249
|
/**
|
|
246
250
|
* Turn the push notification of the device on `channel` on or off in `mode` (cmd
|
|
247
251
|
* {@link ARMING_CMD.SET_ALL_ACTION}): the station's reported table written back with that one flag
|
|
248
|
-
* changed.
|
|
249
|
-
*
|
|
250
|
-
*
|
|
252
|
+
* changed. A standalone camera is sent a one-entry `{mode_id, devices}` table built from its own flags,
|
|
253
|
+
* for its own channel only. Rejects, sending nothing, where the table does not list `channel`. A write
|
|
254
|
+
* builds on the last one sent for that mode until the device reports a table (`${mode}Action` on a
|
|
255
|
+
* standalone camera) observed 15 s after it, so a second write does not revert it; a write whose dispatch
|
|
256
|
+
* rejects is not built on.
|
|
251
257
|
*/
|
|
252
258
|
readonly setDeviceNotification: import("./members.js").MethodMember<(mode: DeviceNotificationMode, channel: number, on: boolean) => Promise<void>> & {
|
|
253
259
|
available: (ctx: CommandContext) => boolean;
|
|
@@ -81,10 +81,11 @@ export declare class TuyaClient {
|
|
|
81
81
|
*/
|
|
82
82
|
login(eufyUserId: string, phoneCode?: string): Promise<TuyaLoginResult>;
|
|
83
83
|
/**
|
|
84
|
-
* READ
|
|
85
|
-
* Builds the request without needing a working signer; the signer is
|
|
84
|
+
* READ a device's current data-points (`smartlife.m.device.dp.get`). The envelope's `result` is a
|
|
85
|
+
* flat `{ "<dpId>": value }` map. Builds the request without needing a working signer; the signer is
|
|
86
|
+
* only exercised on send.
|
|
86
87
|
*/
|
|
87
|
-
getDeviceDps<T = unknown>(devId: string
|
|
88
|
+
getDeviceDps<T = unknown>(devId: string): Promise<TuyaEnvelope<T>>;
|
|
88
89
|
/**
|
|
89
90
|
* CONTROL: publish data-points to a device (`smartlife.m.device.dp.publish`). `dps` is
|
|
90
91
|
* `{ "<dpId>": <value> }`. `gwId` is the gateway/parent id (equals `devId` for a standalone gw).
|
|
@@ -32,9 +32,9 @@ export declare class TuyaCommandRouter {
|
|
|
32
32
|
/** Promise that resolves once Tuya login has completed. Reset by {@link bind}. */
|
|
33
33
|
private loginOnce;
|
|
34
34
|
/**
|
|
35
|
-
* eufy SN → Tuya device ids, populated
|
|
36
|
-
* The
|
|
37
|
-
* `
|
|
35
|
+
* eufy SN → Tuya device ids, populated via {@link registerDevice} once the device list loads.
|
|
36
|
+
* The Tuya id is the record's first non-empty `tuya_uuid` / `tuya_virtual_id` / `tuya_device_id` /
|
|
37
|
+
* `virtualId`, or the device's serial when the record carries none of them.
|
|
38
38
|
*/
|
|
39
39
|
private readonly snMap;
|
|
40
40
|
constructor(config?: TuyaCommandRouterConfig);
|
|
@@ -48,21 +48,17 @@ export declare class TuyaCommandRouter {
|
|
|
48
48
|
*/
|
|
49
49
|
bind(userId: string, regionShard?: string, isoCode?: string): void;
|
|
50
50
|
/**
|
|
51
|
-
* Register a eufy SN → Tuya devId mapping
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
51
|
+
* Register a eufy SN → Tuya devId mapping for an `eufy_home_tuya` device. `devId` is the record's
|
|
52
|
+
* first non-empty `tuya_uuid` / `tuya_virtual_id` / `tuya_device_id` / `virtualId`, or the device's
|
|
53
|
+
* serial when the record carries none of them. `gwId` defaults to `devId` — standalone devices
|
|
54
|
+
* share the two.
|
|
55
55
|
*/
|
|
56
56
|
registerDevice(sn: string, devId: string, gwId?: string): void;
|
|
57
57
|
private ensureLoggedIn;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
60
|
-
* the
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* The response shape from `getDeviceDps` is not yet pinned from a live capture. The defensive
|
|
64
|
-
* extraction tries both `result.dps` (a nested map) and bare `result` (a flat map), and returns
|
|
65
|
-
* `null` when neither yields a non-empty record.
|
|
59
|
+
* Read a device's current DPs from the Tuya cloud (`smartlife.m.device.dp.get`) and answer the DP
|
|
60
|
+
* map: the reply's flat `result`, kept to integer DP keys with scalar values. Answers `null` for an
|
|
61
|
+
* unregistered device, a failed reply, or a reply with no DPs.
|
|
66
62
|
*/
|
|
67
63
|
fetchDps(sn: string): Promise<Record<string, unknown> | null>;
|
|
68
64
|
/**
|
|
@@ -140,10 +140,10 @@ export declare function sendApiRequest<T = unknown>(params: Record<string, strin
|
|
|
140
140
|
*/
|
|
141
141
|
export declare function buildPublishDpsAction(devId: string, gwId: string, dps: Record<string, unknown>): TuyaAction;
|
|
142
142
|
/**
|
|
143
|
-
* READ
|
|
144
|
-
*
|
|
143
|
+
* READ: a device's current data-points. Action `smartlife.m.device.dp.get` v1.0, postData `{ devId }`.
|
|
144
|
+
* The reply `result` is a flat `{ "<dpId>": value }` map.
|
|
145
145
|
*/
|
|
146
|
-
export declare function buildGetDeviceDpsAction(devId: string
|
|
146
|
+
export declare function buildGetDeviceDpsAction(devId: string): TuyaAction;
|
|
147
147
|
/**
|
|
148
148
|
* LOGIN step 1: fetch a pre-login RSA token for a Tuya uid.
|
|
149
149
|
* Wire-confirmed from the eufy Security app (`com.oceanwing.battery.cam`):
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mega-yfue/eufy-sdk",
|
|
3
|
-
"version": "0.5.0-beta.
|
|
3
|
+
"version": "0.5.0-beta.53",
|
|
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",
|