@apocaliss92/nodedreame 1.12.0 → 1.12.2

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/index.cjs CHANGED
@@ -91,6 +91,7 @@ __export(index_exports, {
91
91
  decodeWifiSignalMap: () => decodeWifiSignalMap,
92
92
  encodeAiFeatureWrite: () => encodeAiFeatureWrite,
93
93
  encodeAutoSwitchWrite: () => encodeAutoSwitchWrite,
94
+ explainNoCameraChannel: () => explainNoCameraChannel,
94
95
  extractMowerConsumableValues: () => extractMowerConsumableValues,
95
96
  getAliyunAuthCode: () => getAliyunAuthCode,
96
97
  getDeviceVideoProfile: () => getDeviceVideoProfile,
@@ -131,7 +132,7 @@ module.exports = __toCommonJS(index_exports);
131
132
 
132
133
  // src/support/version.ts
133
134
  var LIBRARY_NAME = "nodedreame";
134
- var LIBRARY_VERSION = "1.12.0";
135
+ var LIBRARY_VERSION = "1.12.2";
135
136
 
136
137
  // src/transport/errors.ts
137
138
  var DreameError = class extends Error {
@@ -2728,6 +2729,26 @@ var DreameVideoSession = class {
2728
2729
  }
2729
2730
  };
2730
2731
 
2732
+ // src/video/camera-availability.ts
2733
+ function explainNoCameraChannel(profile) {
2734
+ if (profile.iotId) {
2735
+ return null;
2736
+ }
2737
+ const who = `${profile.model || "unknown model"} (${profile.did || "no did"})`;
2738
+ if (!profile.videoCapable) {
2739
+ return `${who} is not a camera: the cloud lists no video permit and no supported video vendor for it, so there is no channel to open.`;
2740
+ }
2741
+ if (!profile.online) {
2742
+ return `${who} is a camera but is OFFLINE. The video binding is published by the device itself, so there is nothing to read until it connects \u2014 this is not a provisioning fault.`;
2743
+ }
2744
+ const supports = profile.supportedVendors.length > 0 ? profile.supportedVendors.join(", ") : "none";
2745
+ if (profile.currentVendor === "tx") {
2746
+ return `${who} is a camera and online, but is provisioned on the TENCENT video vendor (vendor: tx; supports: ${supports}), and this library implements only the Aliyun LinkVisual path \u2014 the channel id it needs lives on Aliyun and a tx device has none. Re-pairing or re-opening the camera in the app will not change this.`;
2747
+ }
2748
+ const on = profile.currentVendor ?? "none";
2749
+ return `${who} is a camera and online, but has no video channel yet (vendor: ${on}; supports: ${supports}). The device has not bound to the video service \u2014 open its camera once in the Dreame app to create the binding, then retry.`;
2750
+ }
2751
+
2731
2752
  // src/video/monitor/constants.ts
2732
2753
  var MONITOR_SIID = 10001;
2733
2754
  var MONITOR_AIID = {
@@ -5447,9 +5468,13 @@ var VacuumDevice = class _VacuumDevice extends BaseDevice {
5447
5468
  const session = this.currentSession();
5448
5469
  const region = this.region;
5449
5470
  const relay = opts?.relay ?? new DreameVideoSession({ session, region });
5450
- const iotId = opts?.iotId ?? (await getDeviceVideoProfile({ session, region, did: this.deviceId })).iotId;
5471
+ let iotId = opts?.iotId ?? null;
5451
5472
  if (!iotId) {
5452
- throw new DreameError("device has no LinkVisual iotId; not a camera device or not provisioned");
5473
+ const profile = await getDeviceVideoProfile({ session, region, did: this.deviceId });
5474
+ iotId = profile.iotId;
5475
+ if (!iotId) {
5476
+ throw new DreameError(explainNoCameraChannel(profile) ?? "device has no video channel");
5477
+ }
5453
5478
  }
5454
5479
  return new DreameCameraController({
5455
5480
  device: this,
@@ -8542,6 +8567,7 @@ var DreameCameraStream = class extends TypedEmitter {
8542
8567
  decodeWifiSignalMap,
8543
8568
  encodeAiFeatureWrite,
8544
8569
  encodeAutoSwitchWrite,
8570
+ explainNoCameraChannel,
8545
8571
  extractMowerConsumableValues,
8546
8572
  getAliyunAuthCode,
8547
8573
  getDeviceVideoProfile,