@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.
@@ -112,8 +112,11 @@ export declare const ARMING_CMD: {
112
112
  */
113
113
  readonly SET_ALL_ACTION: 1255;
114
114
  };
115
- /** The guard modes whose device notification is read and written: both replayed on a T8010. */
116
- export type DeviceNotificationMode = Extract<AlarmDelayMode, "home" | "away">;
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 device's channel is `EufyDevice.channel`.
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. Rejects, sending nothing, where the table does not list `channel`. A write builds on the last
249
- * one sent for that mode until the station reports a table observed 15 s after it, so a second write does
250
- * not revert it; a write whose dispatch rejects is not built on.
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/dump a device's cached data-points (`smartlife.m.device.cache.dp.get`).
85
- * Builds the request without needing a working signer; the signer is only exercised on send.
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, dpCacheType?: number): Promise<TuyaEnvelope<T>>;
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 by the facade via {@link registerDevice}.
36
- * The facade extracts the Tuya id from the `raw` device record fields (`tuya_uuid`,
37
- * `tuya_virtual_id`, `tuya_device_id`, `virtualId`) and registers it once the device list loads.
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. Called by the facade for each `eufy_home_tuya`
52
- * device after the cloud device list loads. The facade extracts the Tuya id from the device's
53
- * raw record (`tuya_uuid` / `tuya_virtual_id` / `tuya_device_id` / `virtualId` fields).
54
- * `gwId` defaults to `devId` — standalone devices share the two.
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
- * Fetch a device's cached DPs from the Tuya cloud (`smartlife.m.device.cache.dp.get`) and deliver
60
- * the raw DP map to the caller. Used for initial state hydration after MQTT subscribe — gets the
61
- * last-known state without waiting for the first realtime push.
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/dump: fetch a device's cached data-points. Action `smartlife.m.device.cache.dp.get` v2.0.
144
- * TODO(verify): `dpCacheType` default (1) was not pinned from the capture.
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, dpCacheType?: number): TuyaAction;
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.51",
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",