@apocaliss92/nodedreame 1.12.0 → 1.12.1

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,
@@ -2728,6 +2729,23 @@ 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 on = profile.currentVendor ?? "none";
2745
+ const supports = profile.supportedVendors.length > 0 ? profile.supportedVendors.join(", ") : "none";
2746
+ 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.`;
2747
+ }
2748
+
2731
2749
  // src/video/monitor/constants.ts
2732
2750
  var MONITOR_SIID = 10001;
2733
2751
  var MONITOR_AIID = {
@@ -5447,9 +5465,13 @@ var VacuumDevice = class _VacuumDevice extends BaseDevice {
5447
5465
  const session = this.currentSession();
5448
5466
  const region = this.region;
5449
5467
  const relay = opts?.relay ?? new DreameVideoSession({ session, region });
5450
- const iotId = opts?.iotId ?? (await getDeviceVideoProfile({ session, region, did: this.deviceId })).iotId;
5468
+ let iotId = opts?.iotId ?? null;
5451
5469
  if (!iotId) {
5452
- throw new DreameError("device has no LinkVisual iotId; not a camera device or not provisioned");
5470
+ const profile = await getDeviceVideoProfile({ session, region, did: this.deviceId });
5471
+ iotId = profile.iotId;
5472
+ if (!iotId) {
5473
+ throw new DreameError(explainNoCameraChannel(profile) ?? "device has no video channel");
5474
+ }
5453
5475
  }
5454
5476
  return new DreameCameraController({
5455
5477
  device: this,
@@ -8542,6 +8564,7 @@ var DreameCameraStream = class extends TypedEmitter {
8542
8564
  decodeWifiSignalMap,
8543
8565
  encodeAiFeatureWrite,
8544
8566
  encodeAutoSwitchWrite,
8567
+ explainNoCameraChannel,
8545
8568
  extractMowerConsumableValues,
8546
8569
  getAliyunAuthCode,
8547
8570
  getDeviceVideoProfile,