@mega-yfue/eufy-sdk 0.5.0-beta.70 → 0.5.0-beta.72
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/core/contracts.d.ts +1 -0
- package/dist/index.js +102 -20
- package/dist/index.js.map +2 -2
- package/dist/model/capabilities/lock.d.ts +21 -7
- package/dist/model/capabilities/types.d.ts +4 -0
- package/dist/model/device-family.d.ts +2 -0
- package/dist/transport/p2p/command-router.d.ts +1 -0
- package/dist/transport/rtc/command-router.d.ts +3 -3
- package/dist/transport/rtc/session.d.ts +6 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Surface } from "./members.js";
|
|
2
2
|
import type { AvailabilityContext, CapabilityModule, CommandContext } from "./types.js";
|
|
3
|
-
import type { Command, AutoLockSnapshot } from "../../core/contracts.js";
|
|
3
|
+
import type { Command, AutoLockSnapshot, MediaProvider } from "../../core/contracts.js";
|
|
4
4
|
/**
|
|
5
5
|
* Setting-id selectors for the compact `ff09-setting-toggle` write — this capability's OWN wire
|
|
6
6
|
* vocabulary, named not inlined per the capability wire-id convention, so `setRainMode`
|
|
@@ -107,10 +107,14 @@ export declare const LOCK_MEMBERS: {
|
|
|
107
107
|
readonly provenance: "verified";
|
|
108
108
|
readonly description: "Lock signal strength (verified: param 1141 = RSSI).";
|
|
109
109
|
};
|
|
110
|
-
/** Lock the deadbolt/door.
|
|
111
|
-
readonly lock: import("./members.js").MethodMember<() => Promise<void
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
/** Lock the deadbolt/door. Resolves after sending; does not confirm physical state. */
|
|
111
|
+
readonly lock: import("./members.js").MethodMember<() => Promise<void>> & {
|
|
112
|
+
available: (ctx: CommandContext) => boolean;
|
|
113
|
+
};
|
|
114
|
+
/** Unlock the deadbolt/door. Resolves after sending; does not confirm physical state. */
|
|
115
|
+
readonly unlock: import("./members.js").MethodMember<() => Promise<void>> & {
|
|
116
|
+
available: (ctx: CommandContext) => boolean;
|
|
117
|
+
};
|
|
114
118
|
/**
|
|
115
119
|
* Read-modify-write the auto-lock setting: the transport GETs the device's current settings, changes
|
|
116
120
|
* only `enabled` (+ `delaySeconds` if given — otherwise the current delay is preserved), and writes the
|
|
@@ -120,7 +124,9 @@ export declare const LOCK_MEMBERS: {
|
|
|
120
124
|
* **Unlike `lock`/`unlock` this can reject on a device TIMEOUT**, not just missing identity — the GET
|
|
121
125
|
* step is a genuine precondition, so this one is not fire-and-forget.
|
|
122
126
|
*/
|
|
123
|
-
readonly setAutoLock: import("./members.js").MethodMember<(enabled: boolean, delaySeconds?: number) => Promise<void
|
|
127
|
+
readonly setAutoLock: import("./members.js").MethodMember<(enabled: boolean, delaySeconds?: number) => Promise<void>> & {
|
|
128
|
+
available: (ctx: CommandContext) => boolean;
|
|
129
|
+
};
|
|
124
130
|
/**
|
|
125
131
|
* Toggle Rain Mode — a pure blind write, unlike `setAutoLock`: the compact frame carries only this one
|
|
126
132
|
* field, so there is no GET pass and it is fire-and-forget. Confirmed on-device end-to-end in both
|
|
@@ -220,6 +226,14 @@ export declare const LOCK_MEMBERS: {
|
|
|
220
226
|
readonly description: "One-touch rear locking (setting-id 11). Wire shape confirmed in the app's own JS, NOT captured.";
|
|
221
227
|
readonly write: (v: string | number | boolean, ctx: CommandContext) => Command;
|
|
222
228
|
};
|
|
229
|
+
/** Read the current device-reported state; undefined means no settled locked/unlocked state. */
|
|
230
|
+
readonly refreshStatus: {
|
|
231
|
+
readonly needs: "media";
|
|
232
|
+
readonly provided: (provider: MediaProvider, deps: import("./members.js").MemberDeps) => (() => Promise<boolean | undefined>) | undefined;
|
|
233
|
+
readonly description: string;
|
|
234
|
+
readonly requiredCapabilities?: readonly import("../types.js").Capability[];
|
|
235
|
+
readonly answers: true;
|
|
236
|
+
};
|
|
223
237
|
/**
|
|
224
238
|
* Read the device's current auto-lock settings via a live `GET_SETTINGS` round-trip — the SAME read
|
|
225
239
|
* `setAutoLock` does internally, exposed standalone with no write attached. Works over BOTH transports.
|
|
@@ -230,7 +244,7 @@ export declare const LOCK_MEMBERS: {
|
|
|
230
244
|
*/
|
|
231
245
|
readonly getAutoLockState: {
|
|
232
246
|
readonly needs: "ff09Settings";
|
|
233
|
-
readonly provided: (provider: import("../../core/contracts.js").Ff09SettingsReader, deps: import("./members.js").MemberDeps) => () => Promise<AutoLockSnapshot
|
|
247
|
+
readonly provided: (provider: import("../../core/contracts.js").Ff09SettingsReader, deps: import("./members.js").MemberDeps) => (() => Promise<AutoLockSnapshot>) | undefined;
|
|
234
248
|
readonly description: string;
|
|
235
249
|
readonly requiredCapabilities?: readonly import("../types.js").Capability[];
|
|
236
250
|
readonly answers: true;
|
|
@@ -60,6 +60,8 @@ export type ProductLine = "security" | "life" | "clean" | "print" | "display" |
|
|
|
60
60
|
* `p2p-frame` shape of {@link InboundSignal}.
|
|
61
61
|
*/
|
|
62
62
|
export interface CapabilityFrame {
|
|
63
|
+
/** Cloud device type resolved from the reporting station/channel. */
|
|
64
|
+
deviceType?: number;
|
|
63
65
|
stationSn: string;
|
|
64
66
|
commandId: number;
|
|
65
67
|
channel: number;
|
|
@@ -255,6 +257,8 @@ export interface AvailabilityContext {
|
|
|
255
257
|
stationDeviceType?: number;
|
|
256
258
|
}
|
|
257
259
|
export interface CommandContext extends AvailabilityContext {
|
|
260
|
+
/** Vendor-formatted timezone reported by the station; never inferred from the host. */
|
|
261
|
+
timezone?: string;
|
|
258
262
|
/** Device channel (0 for standalone, `device_channel` on a HomeBase). */
|
|
259
263
|
channel: number;
|
|
260
264
|
/** eufy DeviceType, when known. */
|
|
@@ -78,3 +78,5 @@ export declare const isAiotVacuum: (ctx: FamilyContext) => boolean;
|
|
|
78
78
|
* vacuums receive the same write actions as AIoT ones, routed by the facade's `routeCommand`.
|
|
79
79
|
*/
|
|
80
80
|
export declare const isTuyaVacuum: (ctx: FamilyContext) => boolean;
|
|
81
|
+
/** Video Smart Lock S330, identified by its distinct cloud device type. */
|
|
82
|
+
export declare const isVideoSmartLock: (ctx: FamilyContext) => boolean;
|
|
@@ -548,6 +548,7 @@ export declare class P2PCommandRouter {
|
|
|
548
548
|
*/
|
|
549
549
|
p2pQuery(sn: string, subCmd: number, opts?: {
|
|
550
550
|
timeoutMs?: number;
|
|
551
|
+
payload?: Record<string, unknown>;
|
|
551
552
|
}): Promise<Record<string, unknown>>;
|
|
552
553
|
/**
|
|
553
554
|
* **Generic control-payload request/reply query.** Sends a `CONTROL_PAYLOAD` (1700) `{commandType,
|
|
@@ -113,9 +113,9 @@ export declare class RtcCommandRouter {
|
|
|
113
113
|
private stationSession;
|
|
114
114
|
/**
|
|
115
115
|
* One bounded bring-up: the session is up when its command channel opens, and it fails, with the
|
|
116
|
-
* session closed and every listener gone, when `connect()` throws, the session closes first
|
|
117
|
-
*
|
|
118
|
-
* rejecting unheard.
|
|
116
|
+
* session closed and every listener gone, when `connect()` throws, the session closes first (rejecting
|
|
117
|
+
* with the failure that closed it, when it carries one), or {@link CONNECT_TIMEOUT_MS} passes. A single
|
|
118
|
+
* promise, so an early failure cannot leave a second one rejecting unheard.
|
|
119
119
|
*/
|
|
120
120
|
private bringUp;
|
|
121
121
|
/**
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
*
|
|
16
16
|
* The command data channel is the session: `close` fires once, when the channel closes, the peer fails,
|
|
17
17
|
* the signalling socket drops or {@link RtcSession.close} is called, even while the peer connection is
|
|
18
|
-
* nominally up.
|
|
18
|
+
* nominally up. A peer that cannot be built when the hub grants the relay ends the session there: the
|
|
19
|
+
* failure is emitted as `error` and `close` fires carrying it.
|
|
19
20
|
*
|
|
20
21
|
* A session whose peer is a {@link RtcPeerOptions.mediaTrack} peer has no command channel: `close` fires
|
|
21
22
|
* when the peer fails or closes, and the video track's packets are emitted as `rtp`.
|
|
@@ -32,7 +33,8 @@ export interface RtcSessionOptions extends RtcSignalingOptions {
|
|
|
32
33
|
}
|
|
33
34
|
export interface RtcSessionEvents {
|
|
34
35
|
connected: [];
|
|
35
|
-
|
|
36
|
+
/** The session ended; `err` is the failure that ended it, when one did. */
|
|
37
|
+
close: [err?: Error];
|
|
36
38
|
error: [err: Error];
|
|
37
39
|
/** A reassembled command or notify frame: portal packet bytes + the link type it arrived on. */
|
|
38
40
|
commandData: [frame: Buffer, linkType: number];
|
|
@@ -73,6 +75,8 @@ export declare class RtcSession extends EventEmitter<RtcSessionEvents> {
|
|
|
73
75
|
* `connect()` still waiting for the signalling auth is rejected and its timer stopped.
|
|
74
76
|
*/
|
|
75
77
|
close(): void;
|
|
78
|
+
/** {@link RtcSession.close}, with the failure that ended the session handed to `close` when one did. */
|
|
79
|
+
private shutdown;
|
|
76
80
|
/**
|
|
77
81
|
* Trickle one local candidate, or the empty end-of-candidates. The native peer can report one after the
|
|
78
82
|
* signalling socket has closed, and sending then throws inside a native callback, where the throw can't
|
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.72",
|
|
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",
|