@mega-yfue/eufy-sdk 0.3.0-beta.7 → 0.3.0-beta.9
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.
|
@@ -674,7 +674,8 @@ export declare class EufyMega extends EventEmitter {
|
|
|
674
674
|
private warmWiredP2P;
|
|
675
675
|
/**
|
|
676
676
|
* A station's power tier for the P2P lifecycle: a HomeBase/station is `"wired"` (persistent); a
|
|
677
|
-
* standalone device is `"battery"` iff its resolved capabilities include `battery
|
|
677
|
+
* standalone device is `"battery"` iff its resolved capabilities include `battery` and it is not a
|
|
678
|
+
* confirmed mains-only camera model, else `"wired"`.
|
|
678
679
|
* Keyed on the STATION's own power, never a child's (a battery cam attached to a wired HomeBase draws
|
|
679
680
|
* from the base's persistent session). Reads capabilities on the client side — no model type leaks to
|
|
680
681
|
* transport (the router only ever sees the `"wired"|"battery"` string).
|
package/dist/index.js
CHANGED
|
@@ -2131,6 +2131,13 @@ function isNotAuthorized(err) {
|
|
|
2131
2131
|
var SecureMqtt = class extends EventEmitter {
|
|
2132
2132
|
kind = "smqtt";
|
|
2133
2133
|
client;
|
|
2134
|
+
/**
|
|
2135
|
+
* The in-flight or established connect. A client ID is exclusive at the broker, so a second mqtt.js
|
|
2136
|
+
* client under the same ID evicts the first, which reconnects and evicts it back, forever; `connect()`
|
|
2137
|
+
* therefore hands a later caller this same attempt instead of opening a rival. Cleared when the
|
|
2138
|
+
* attempt fails and on `disconnect()`, so a caller can still retry or deliberately reconnect.
|
|
2139
|
+
*/
|
|
2140
|
+
connecting;
|
|
2134
2141
|
o;
|
|
2135
2142
|
logger;
|
|
2136
2143
|
constructor(opts) {
|
|
@@ -2141,11 +2148,19 @@ var SecureMqtt = class extends EventEmitter {
|
|
|
2141
2148
|
get id() {
|
|
2142
2149
|
return this.o.clientId ?? this.o.credentials.thing_name ?? "";
|
|
2143
2150
|
}
|
|
2151
|
+
/** Connect, joining the attempt in `connecting` when one is already opening or open. */
|
|
2152
|
+
async connect() {
|
|
2153
|
+
this.connecting ??= this.open().catch((error) => {
|
|
2154
|
+
this.connecting = void 0;
|
|
2155
|
+
throw error;
|
|
2156
|
+
});
|
|
2157
|
+
return await this.connecting;
|
|
2158
|
+
}
|
|
2144
2159
|
/**
|
|
2145
2160
|
* Open the broker connection, resolving once it is established. Pinned to a broker instance's IP, or
|
|
2146
2161
|
* to the plain hostname; only the former needs its own TLS shape, see `./bare-ip-tls.ts`.
|
|
2147
2162
|
*/
|
|
2148
|
-
async
|
|
2163
|
+
async open() {
|
|
2149
2164
|
const mqtt = await loadMqtt();
|
|
2150
2165
|
const c = this.o.credentials;
|
|
2151
2166
|
const port = c.endpoint_port ?? 8883;
|
|
@@ -2273,6 +2288,7 @@ var SecureMqtt = class extends EventEmitter {
|
|
|
2273
2288
|
await this.client.publishAsync(topic, body, { qos: opts.qos ?? 1 });
|
|
2274
2289
|
}
|
|
2275
2290
|
async disconnect() {
|
|
2291
|
+
this.connecting = void 0;
|
|
2276
2292
|
await this.client?.endAsync(true);
|
|
2277
2293
|
this.client = void 0;
|
|
2278
2294
|
}
|
|
@@ -4310,7 +4326,10 @@ function decodePowerSource(raw) {
|
|
|
4310
4326
|
function recordSetting(param, value, ctx) {
|
|
4311
4327
|
return setStationScalar(param, value, ctx.channel);
|
|
4312
4328
|
}
|
|
4313
|
-
var MAINS_CAMERA_MODELS = ["T8425", "T8419", "T8410"];
|
|
4329
|
+
var MAINS_CAMERA_MODELS = ["T8425", "T8419", "T8410", "T84A1"];
|
|
4330
|
+
function cameraPowerTier(model, capabilities) {
|
|
4331
|
+
return capabilities.has("battery") && notMainsCamera({ model }) ? "battery" : "wired";
|
|
4332
|
+
}
|
|
4314
4333
|
var notMainsCamera = (ctx) => {
|
|
4315
4334
|
const model = (ctx.model ?? "").toUpperCase();
|
|
4316
4335
|
return !MAINS_CAMERA_MODELS.some((prefix) => model.startsWith(prefix));
|
|
@@ -5220,7 +5239,7 @@ function statusLedCommand(on, ctx) {
|
|
|
5220
5239
|
return setScalar(CAMERA_CMD.DEV_LED_SWITCH, on ? 1 : 0, ctx, "int-string");
|
|
5221
5240
|
}
|
|
5222
5241
|
function poweredOf(ctx) {
|
|
5223
|
-
return ctx.capabilities
|
|
5242
|
+
return cameraPowerTier(ctx.model, ctx.capabilities ?? /* @__PURE__ */ new Set());
|
|
5224
5243
|
}
|
|
5225
5244
|
function enablementReflection(on, ctx) {
|
|
5226
5245
|
const alias = CAMERA_MEMBERS.enabled.readAliases[0].paramType;
|
|
@@ -10870,6 +10889,8 @@ var MODEL_REGISTRY = {
|
|
|
10870
10889
|
T8400: { codec: "camera", caps: ["arming"], name: "Indoor Cam" },
|
|
10871
10890
|
T8410: { codec: "camera", caps: ["arming"], name: "Indoor Cam Pan & Tilt" },
|
|
10872
10891
|
T8442: { codec: "camera", caps: ["arming"], name: "Indoor/Outdoor Cam 1080p" },
|
|
10892
|
+
// Hardwired wall-light camera; mains power asserted in MAINS_CAMERA_MODELS.
|
|
10893
|
+
T84A1: { codec: "camera", name: "Wall Light Cam S100" },
|
|
10873
10894
|
// Sensors — the concrete sensor kind is curated (DeviceType 2 alone is ambiguous).
|
|
10874
10895
|
T8900: { codec: "sensor", caps: ["contact"], name: "Entry Sensor" },
|
|
10875
10896
|
T8910: { codec: "sensor", caps: ["battery"], name: "Motion Sensor" },
|
|
@@ -26368,7 +26389,8 @@ var EufyMega = class extends EventEmitter9 {
|
|
|
26368
26389
|
}
|
|
26369
26390
|
/**
|
|
26370
26391
|
* A station's power tier for the P2P lifecycle: a HomeBase/station is `"wired"` (persistent); a
|
|
26371
|
-
* standalone device is `"battery"` iff its resolved capabilities include `battery
|
|
26392
|
+
* standalone device is `"battery"` iff its resolved capabilities include `battery` and it is not a
|
|
26393
|
+
* confirmed mains-only camera model, else `"wired"`.
|
|
26372
26394
|
* Keyed on the STATION's own power, never a child's (a battery cam attached to a wired HomeBase draws
|
|
26373
26395
|
* from the base's persistent session). Reads capabilities on the client side — no model type leaks to
|
|
26374
26396
|
* transport (the router only ever sees the `"wired"|"battery"` string).
|
|
@@ -26386,7 +26408,7 @@ var EufyMega = class extends EventEmitter9 {
|
|
|
26386
26408
|
category: d.category,
|
|
26387
26409
|
params: d.params ?? {}
|
|
26388
26410
|
}).capabilities;
|
|
26389
|
-
return
|
|
26411
|
+
return cameraPowerTier(d.model, new Set(caps));
|
|
26390
26412
|
}
|
|
26391
26413
|
/**
|
|
26392
26414
|
* Speculatively open the P2P session of the station behind `deviceSn`, if the caller opted this
|