@mega-yfue/eufy-sdk 0.2.0-beta.28 → 0.2.0-beta.29
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/device-registry.d.ts +14 -28
- package/dist/core/contracts.d.ts +21 -0
- package/dist/core/solix-types.d.ts +6 -0
- package/dist/index.js +104 -46
- package/dist/index.js.map +3 -3
- package/dist/model/solix-device.d.ts +6 -5
- package/dist/transport/p2p/command-router.d.ts +0 -2
- package/dist/transport/p2p/live-trace.d.ts +9 -0
- package/dist/transport/p2p/station-channels.d.ts +54 -0
- package/package.json +1 -1
|
@@ -123,12 +123,13 @@ export declare function discoverSolixDevices(client: SolixDeviceReader, opts?: {
|
|
|
123
123
|
}): Promise<SolixDevice[]>;
|
|
124
124
|
/**
|
|
125
125
|
* Reduce a site "scene" snapshot to per-device telemetry readings — the BACKSTOP counterpart to the
|
|
126
|
-
* realtime `ff09` decode. It emits
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
126
|
+
* realtime `ff09` decode. It emits the fields the scene reliably carries that the fast MQTT frame does
|
|
127
|
+
* NOT: `batteryTemperature` (the realtime frame's BMS blob is empty, so `solixReadings` withholds it),
|
|
128
|
+
* `batterySoc` (a cross-check/seed for the `0xa3` SOC), and `expansionPacks` — the count of ATTACHED
|
|
129
|
+
* add-on battery packs (0 on a standalone main unit). Each reading is shaped exactly like a `SolixMqtt`
|
|
130
|
+
* `reading` event — `{ deviceSn, values }` — so a caller can feed it straight into
|
|
130
131
|
* {@link SolixDevice.applyReading} and broadcast it on the same path as a live frame. Entries with no
|
|
131
|
-
* usable value are dropped
|
|
132
|
+
* usable value are dropped.
|
|
132
133
|
*/
|
|
133
134
|
export declare function solarbankSceneReadings(scene: SolixSiteScene): {
|
|
134
135
|
deviceSn: string;
|
|
@@ -163,8 +163,6 @@ export declare class P2PCommandRouter {
|
|
|
163
163
|
closeAll(): Promise<void>;
|
|
164
164
|
/** This serial's loaded record, or `undefined` — the one place the cached list is searched by serial. */
|
|
165
165
|
private recordFor;
|
|
166
|
-
/** The parent-station key a device's session lives under (its HomeBase, or itself if standalone). */
|
|
167
|
-
private stationKeyFor;
|
|
168
166
|
/**
|
|
169
167
|
* The parent-station serial a device serial's session lives under — the single source of truth for
|
|
170
168
|
* session keying, used by the facade (e.g. to pre-warm the right station for an event). Returns the
|
|
@@ -180,6 +180,15 @@ export type LiveTrace =
|
|
|
180
180
|
stationAdmin: "self" | "other" | "unstated";
|
|
181
181
|
stationModel?: string;
|
|
182
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* The call's device has no usable channel on the station it resolved: its record states none (`missing`), or
|
|
185
|
+
* another device attached to the same station states the same one (`shared`). The call is refused with
|
|
186
|
+
* `DeviceChannelUnresolvedError` and nothing is sent.
|
|
187
|
+
*/
|
|
188
|
+
| {
|
|
189
|
+
phase: "station-channel-unresolved";
|
|
190
|
+
issue: "missing" | "shared";
|
|
191
|
+
}
|
|
183
192
|
/** A shared source began warming, with the interval it re-issues on and the deadline it fails at. */
|
|
184
193
|
| {
|
|
185
194
|
phase: "warming";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Station topology and per-station channel addressing, from the device records alone.
|
|
3
|
+
*
|
|
4
|
+
* Both sides of the P2P wire key on a device's channel within its station: a media start and every
|
|
5
|
+
* per-channel command address it, and an inbound frame is attributed to the device on its channel. Resolving
|
|
6
|
+
* it once, here, keeps the two sides from ever disagreeing about which device a channel means.
|
|
7
|
+
*
|
|
8
|
+
* @module transport/p2p/station-channels
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
import type { EufyDevice } from "../../core/types.js";
|
|
12
|
+
/**
|
|
13
|
+
* The station a device's traffic belongs to, from its cloud record and its own serial.
|
|
14
|
+
*
|
|
15
|
+
* `parent_sn` carries the parent on a HomeBase-attached device. `station_sn` is frequently absent there —
|
|
16
|
+
* empty on every attached sensor of a T8010 — and serves only as a fallback. An empty string states no
|
|
17
|
+
* station.
|
|
18
|
+
*
|
|
19
|
+
* A device naming no parent answers its own serial, so every device has a station.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolvedStationSn(raw: Record<string, unknown>, sn: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* The parent station a device's traffic belongs to — the session key the router opens and the station the
|
|
24
|
+
* frame resolver attributes by.
|
|
25
|
+
*
|
|
26
|
+
* `parent_sn` on the cloud record is the field that is actually populated for a HomeBase-attached device, so
|
|
27
|
+
* it wins; `stationSn` is frequently absent (observed empty on every attached sensor of a T8010), so keying on
|
|
28
|
+
* it alone silently resolves an attached device to ITSELF and no frame ever matches. Answering the device's
|
|
29
|
+
* OWN serial is what "stands alone" means.
|
|
30
|
+
*/
|
|
31
|
+
export declare function stationOf(dev: EufyDevice): string;
|
|
32
|
+
/**
|
|
33
|
+
* A device's channel within its station, or why it has none. `shared` keeps the channel it `claimed`, so a
|
|
34
|
+
* frame arriving on it is known to belong to one of the claimants rather than to the station.
|
|
35
|
+
*/
|
|
36
|
+
export type StationChannel = {
|
|
37
|
+
channel: number;
|
|
38
|
+
} | {
|
|
39
|
+
issue: "missing";
|
|
40
|
+
} | {
|
|
41
|
+
issue: "shared";
|
|
42
|
+
claimed: number;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The channel each device is addressed by within its station.
|
|
46
|
+
*
|
|
47
|
+
* A standalone device is its own station, addressed by the channel its record states, or 0. An attached
|
|
48
|
+
* device has a channel only when its record states one that no other device attached to the same station
|
|
49
|
+
* also states. A missing channel names no device, and a channel two attached devices both state cannot say
|
|
50
|
+
* which of them it means, so either resolves to an issue rather than to a channel: guessing would address
|
|
51
|
+
* another device, streaming its video or attributing its frames under this serial. Every attached device
|
|
52
|
+
* counts towards a clash, whatever its kind, and the answer does not depend on list order.
|
|
53
|
+
*/
|
|
54
|
+
export declare function stationChannels(devices: readonly EufyDevice[]): Map<string, StationChannel>;
|
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.29",
|
|
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",
|