@apocaliss92/nodedreame 1.12.3 → 1.12.4
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 +31 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -134,7 +134,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
134
134
|
|
|
135
135
|
// src/support/version.ts
|
|
136
136
|
var LIBRARY_NAME = "nodedreame";
|
|
137
|
-
var LIBRARY_VERSION = "1.12.
|
|
137
|
+
var LIBRARY_VERSION = "1.12.4";
|
|
138
138
|
|
|
139
139
|
// src/transport/errors.ts
|
|
140
140
|
var DreameError = class extends Error {
|
|
@@ -2885,34 +2885,6 @@ var VACUUM_ACTIONS = {
|
|
|
2885
2885
|
autoEmpty: { siid: 15, aiid: 1 }
|
|
2886
2886
|
};
|
|
2887
2887
|
|
|
2888
|
-
// src/video/monitor/vendor.ts
|
|
2889
|
-
function videoVendorSwitchParams(vendor) {
|
|
2890
|
-
return { vendor };
|
|
2891
|
-
}
|
|
2892
|
-
function parseVideoVendorStatus(raw) {
|
|
2893
|
-
const text = typeof raw === "string" ? raw : typeof raw === "object" && raw !== null ? null : null;
|
|
2894
|
-
const source = text === null ? raw : safeJson(text);
|
|
2895
|
-
if (typeof source !== "object" || source === null) {
|
|
2896
|
-
return { vendor: null, initStatus: null };
|
|
2897
|
-
}
|
|
2898
|
-
const v = Reflect.get(source, "vendor");
|
|
2899
|
-
const s = Reflect.get(source, "initStatus");
|
|
2900
|
-
return {
|
|
2901
|
-
vendor: v === "ali" || v === "tx" ? v : null,
|
|
2902
|
-
initStatus: typeof s === "number" ? s : null
|
|
2903
|
-
};
|
|
2904
|
-
}
|
|
2905
|
-
function safeJson(text) {
|
|
2906
|
-
try {
|
|
2907
|
-
return JSON.parse(text);
|
|
2908
|
-
} catch {
|
|
2909
|
-
return null;
|
|
2910
|
-
}
|
|
2911
|
-
}
|
|
2912
|
-
function vendorSwitchSettled(status, wanted) {
|
|
2913
|
-
return status.vendor === wanted && status.initStatus === 1;
|
|
2914
|
-
}
|
|
2915
|
-
|
|
2916
2888
|
// src/video/monitor/protocol.ts
|
|
2917
2889
|
var import_node_crypto4 = require("crypto");
|
|
2918
2890
|
function makeMonitorSession(accountId, now = Date.now()) {
|
|
@@ -2989,6 +2961,34 @@ function firstOutValue(res) {
|
|
|
2989
2961
|
return Array.isArray(out) && out.length > 0 ? out[0]?.value : void 0;
|
|
2990
2962
|
}
|
|
2991
2963
|
|
|
2964
|
+
// src/video/monitor/vendor.ts
|
|
2965
|
+
function videoVendorSwitchParams(vendor) {
|
|
2966
|
+
return { vendor };
|
|
2967
|
+
}
|
|
2968
|
+
function parseVideoVendorStatus(raw) {
|
|
2969
|
+
const text = typeof raw === "string" ? raw : typeof raw === "object" && raw !== null ? null : null;
|
|
2970
|
+
const source = text === null ? raw : safeJson(text);
|
|
2971
|
+
if (typeof source !== "object" || source === null) {
|
|
2972
|
+
return { vendor: null, initStatus: null };
|
|
2973
|
+
}
|
|
2974
|
+
const v = Reflect.get(source, "vendor");
|
|
2975
|
+
const s = Reflect.get(source, "initStatus");
|
|
2976
|
+
return {
|
|
2977
|
+
vendor: v === "ali" || v === "tx" ? v : null,
|
|
2978
|
+
initStatus: typeof s === "number" ? s : null
|
|
2979
|
+
};
|
|
2980
|
+
}
|
|
2981
|
+
function safeJson(text) {
|
|
2982
|
+
try {
|
|
2983
|
+
return JSON.parse(text);
|
|
2984
|
+
} catch {
|
|
2985
|
+
return null;
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
function vendorSwitchSettled(status, wanted) {
|
|
2989
|
+
return status.vendor === wanted && status.initStatus === 1;
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
2992
|
// src/video/monitor/controller.ts
|
|
2993
2993
|
var DEFAULT_KEEP_ALIVE_MS = 1e4;
|
|
2994
2994
|
var DEFAULT_AREA = "4";
|
|
@@ -5605,8 +5605,9 @@ var VacuumDevice = class _VacuumDevice extends BaseDevice {
|
|
|
5605
5605
|
if (vendorSwitchSettled(already, vendor)) {
|
|
5606
5606
|
return already;
|
|
5607
5607
|
}
|
|
5608
|
+
const session = makeMonitorSession(this.currentSession().uid);
|
|
5608
5609
|
await this.callAction(MONITOR_SIID, MONITOR_AIID.VIDEO_VENDOR, [
|
|
5609
|
-
|
|
5610
|
+
buildActionInput(MONITOR_PIID.VIDEO_VENDOR_STATUS, videoVendorSwitchParams(vendor), session)
|
|
5610
5611
|
]);
|
|
5611
5612
|
const every = opts?.pollIntervalMs ?? 5e3;
|
|
5612
5613
|
const deadline = Date.now() + (opts?.timeoutMs ?? every * 10);
|