@tuya-miniapp/ark-extension-virtual-device 1.8.0 → 1.8.1-beta-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/worker/index.js +202 -116
- package/package.json +1 -1
package/dist/worker/index.js
CHANGED
|
@@ -220752,7 +220752,7 @@ var require_package2 = __commonJS({
|
|
|
220752
220752
|
"package.json"(exports, module2) {
|
|
220753
220753
|
module2.exports = {
|
|
220754
220754
|
name: "@tuya-miniapp/ark-extension-virtual-device",
|
|
220755
|
-
version: "1.8.
|
|
220755
|
+
version: "1.8.1-beta-1",
|
|
220756
220756
|
license: "MIT",
|
|
220757
220757
|
files: [
|
|
220758
220758
|
"manifest.json",
|
|
@@ -262807,9 +262807,21 @@ var getDeviceInfo = async (body) => {
|
|
|
262807
262807
|
devInfo.result.dataPointInfo = devInfo32.result?.dataPointInfo;
|
|
262808
262808
|
devInfo.result.meta = devInfo32.result?.meta;
|
|
262809
262809
|
devInfo.result.accessType = devInfo32.result?.accessType;
|
|
262810
|
+
devInfo.result.parentId = devInfo32.result?.deviceTopo.parentDevId;
|
|
262811
|
+
devInfo.result.nodeId = devInfo32.result?.deviceTopo.nodeId;
|
|
262810
262812
|
if (Object.hasOwn(devInfo32.result, "cloudOnline")) {
|
|
262811
262813
|
devInfo.result.cloudOnline = devInfo32.result?.cloudOnline;
|
|
262812
262814
|
}
|
|
262815
|
+
if (devInfo32.parentId) {
|
|
262816
|
+
const keys = await apiRequestByAtop({
|
|
262817
|
+
api: "tuya.m.device.key.get",
|
|
262818
|
+
version: "1.0",
|
|
262819
|
+
params: {
|
|
262820
|
+
gwId: devInfo32.parentId,
|
|
262821
|
+
nodeIds: [devInfo32.nodeId]
|
|
262822
|
+
}
|
|
262823
|
+
});
|
|
262824
|
+
}
|
|
262813
262825
|
try {
|
|
262814
262826
|
const pInfo = await apiRequestByAtop({
|
|
262815
262827
|
api: "tuya.m.product.ext.prop.batch.get",
|
|
@@ -263361,7 +263373,7 @@ function trimEnd(str) {
|
|
|
263361
263373
|
}
|
|
263362
263374
|
return str;
|
|
263363
263375
|
}
|
|
263364
|
-
var MqttListener = (topic, message) => {
|
|
263376
|
+
var MqttListener = async (topic, message) => {
|
|
263365
263377
|
console.log("topic:", topic, message);
|
|
263366
263378
|
if (topic.startsWith("tylink/")) {
|
|
263367
263379
|
const devId = topic.split("/")[1];
|
|
@@ -263461,8 +263473,12 @@ var MqttListener = (topic, message) => {
|
|
|
263461
263473
|
}
|
|
263462
263474
|
dispatchMessageToTTT(result, devOrGroupId, dps, topic, message);
|
|
263463
263475
|
if (result?.data?.cid) {
|
|
263464
|
-
|
|
263465
|
-
|
|
263476
|
+
const devId = await getDeviceId();
|
|
263477
|
+
const currentDevice = getCachedDevice()[devId];
|
|
263478
|
+
if (!currentDevice || currentDevice.nodeId !== result?.data?.cid) {
|
|
263479
|
+
console.log("\u5B50\u8BBE\u5907\u6D88\u606F", result?.data?.cid, result?.data?.devId);
|
|
263480
|
+
return;
|
|
263481
|
+
}
|
|
263466
263482
|
}
|
|
263467
263483
|
console.log("\u8F6C\u53D1MQTT", result?.data?.dps, result?.protocol, result);
|
|
263468
263484
|
ark.runtime.sendMessage(
|
|
@@ -263475,19 +263491,6 @@ var MqttListener = (topic, message) => {
|
|
|
263475
263491
|
};
|
|
263476
263492
|
async function dispatchMessageToTTT(result, devOrGroupId, dps, topic, message) {
|
|
263477
263493
|
console.log("dispatchMessageToTTT>>", result);
|
|
263478
|
-
ark.miniapp.emitPluginEvent({
|
|
263479
|
-
name: "TUNIDeviceControlManager.onMqttMessageReceived",
|
|
263480
|
-
data: {
|
|
263481
|
-
deviceId: result?.data?.devId,
|
|
263482
|
-
message: {
|
|
263483
|
-
...result?.data
|
|
263484
|
-
},
|
|
263485
|
-
protocol: result?.protocol,
|
|
263486
|
-
messageData: {
|
|
263487
|
-
...result?.data
|
|
263488
|
-
}
|
|
263489
|
-
}
|
|
263490
|
-
});
|
|
263491
263494
|
switch (result?.protocol) {
|
|
263492
263495
|
case 1:
|
|
263493
263496
|
if (typeof result.data?.online === "boolean") {
|
|
@@ -263527,6 +263530,7 @@ async function dispatchMessageToTTT(result, devOrGroupId, dps, topic, message) {
|
|
|
263527
263530
|
case 5:
|
|
263528
263531
|
{
|
|
263529
263532
|
if (result.data?.cid) {
|
|
263533
|
+
console.log("----->>>>>>>>>> gwId", devOrGroupId);
|
|
263530
263534
|
const { data: devList2 } = await getSubDeviceInfoList({
|
|
263531
263535
|
meshId: devOrGroupId
|
|
263532
263536
|
});
|
|
@@ -263540,6 +263544,13 @@ async function dispatchMessageToTTT(result, devOrGroupId, dps, topic, message) {
|
|
|
263540
263544
|
dps
|
|
263541
263545
|
}
|
|
263542
263546
|
});
|
|
263547
|
+
ark.miniapp.emitPluginEvent({
|
|
263548
|
+
name: "TUNIDeviceControlManager.onDpDataChange",
|
|
263549
|
+
data: {
|
|
263550
|
+
deviceId: dev?.devId,
|
|
263551
|
+
dps
|
|
263552
|
+
}
|
|
263553
|
+
});
|
|
263543
263554
|
} else {
|
|
263544
263555
|
ark.miniapp.emitPluginEvent({
|
|
263545
263556
|
name: "TYUniDeviceControlManager.onDpDataChange",
|
|
@@ -263707,12 +263718,14 @@ async function dispatchMessageToTTT(result, devOrGroupId, dps, topic, message) {
|
|
|
263707
263718
|
ark.miniapp.emitPluginEvent({
|
|
263708
263719
|
name: "TUNIDeviceControlManager.onMqttMessageReceived",
|
|
263709
263720
|
data: {
|
|
263710
|
-
deviceId:
|
|
263711
|
-
|
|
263712
|
-
|
|
263713
|
-
|
|
263721
|
+
deviceId: result?.data?.devId || devOrGroupId,
|
|
263722
|
+
message: {
|
|
263723
|
+
...result?.data
|
|
263724
|
+
},
|
|
263714
263725
|
protocol: result?.protocol,
|
|
263715
|
-
messageData: {
|
|
263726
|
+
messageData: {
|
|
263727
|
+
...result?.data
|
|
263728
|
+
}
|
|
263716
263729
|
}
|
|
263717
263730
|
});
|
|
263718
263731
|
}
|
|
@@ -263967,6 +263980,18 @@ var MqttClientManager = class _MqttClientManager {
|
|
|
263967
263980
|
viewLog(`[MQTT] @i18n(subscribeFailed) ${deviceInfo2.devId} ${err}`);
|
|
263968
263981
|
}
|
|
263969
263982
|
});
|
|
263983
|
+
if (deviceInfo2.nodeId && deviceInfo2.parentId && deviceInfo2.parentId !== deviceInfo2.devId) {
|
|
263984
|
+
if (MqttDevManager.deviceList.find(
|
|
263985
|
+
(item) => item.devId === deviceInfo2.parentId
|
|
263986
|
+
)) {
|
|
263987
|
+
return;
|
|
263988
|
+
}
|
|
263989
|
+
getDeviceInfo({ deviceId: deviceInfo2.parentId }).then((gatewayInfo) => {
|
|
263990
|
+
if (gatewayInfo.result) {
|
|
263991
|
+
this.addDeviceListener(gatewayInfo.result);
|
|
263992
|
+
}
|
|
263993
|
+
});
|
|
263994
|
+
}
|
|
263970
263995
|
} catch (error) {
|
|
263971
263996
|
console.log("=======\u6709\u5730\u65B9\u51FA\u4E86\u95EE\u9898", error);
|
|
263972
263997
|
}
|
|
@@ -279401,6 +279426,7 @@ function downloadFromNpm(npmName, version) {
|
|
|
279401
279426
|
headers: { "Content-Type": "application/json" }
|
|
279402
279427
|
}).then((response) => {
|
|
279403
279428
|
const { data, status } = response;
|
|
279429
|
+
console.log("---------response", data, status);
|
|
279404
279430
|
if (status === 200) {
|
|
279405
279431
|
const { versions } = data;
|
|
279406
279432
|
const lV = versions[version];
|
|
@@ -279418,7 +279444,7 @@ function downloadFromNpm(npmName, version) {
|
|
|
279418
279444
|
const dist2 = import_path11.default.join(
|
|
279419
279445
|
__dirname,
|
|
279420
279446
|
"../../../ark.virtual-devices-extensions",
|
|
279421
|
-
npmName
|
|
279447
|
+
npmName
|
|
279422
279448
|
);
|
|
279423
279449
|
esm_default.request(tarball, {
|
|
279424
279450
|
streaming: true,
|
|
@@ -279426,6 +279452,7 @@ function downloadFromNpm(npmName, version) {
|
|
|
279426
279452
|
}).then(
|
|
279427
279453
|
(result) => compressing2.tgz.uncompress(result.res, tempDir)
|
|
279428
279454
|
).then(() => {
|
|
279455
|
+
console.log("---------uncompress success", `${tempDir}/package`, dist2, process.env);
|
|
279429
279456
|
setTimeout(async () => {
|
|
279430
279457
|
try {
|
|
279431
279458
|
fs10.removeSync(dist2);
|
|
@@ -279931,10 +279958,9 @@ async function publishDps2(params) {
|
|
|
279931
279958
|
_atopDps = { ...pudp };
|
|
279932
279959
|
console.log("--------pudp", pudp);
|
|
279933
279960
|
}
|
|
279934
|
-
|
|
279935
|
-
const item = s2[i2];
|
|
279961
|
+
s2.map((item) => {
|
|
279936
279962
|
const { id, code: code2, property, type: oType } = item;
|
|
279937
|
-
const { type
|
|
279963
|
+
const { type } = property || {};
|
|
279938
279964
|
if (Object.keys(_dps).includes(`${id}`) && (type === "raw" || oType === "raw") && isHexString(_dps[id])) {
|
|
279939
279965
|
const b2 = Buffer.from(_dps[id], "hex");
|
|
279940
279966
|
_dps[id] = b2.toString("base64");
|
|
@@ -279943,40 +279969,30 @@ async function publishDps2(params) {
|
|
|
279943
279969
|
delete _dps[id];
|
|
279944
279970
|
}
|
|
279945
279971
|
if (Object.keys(_dps).includes(`${id}`) && (type === "value" || oType === "value") && !isInteger(_dps[id])) {
|
|
279946
|
-
viewLog("@i18n(number_publish_error)");
|
|
279947
|
-
return {
|
|
279948
|
-
errorCode: import_TYUniCode3.TYUniPluginError.DEVICEKIT_PUBLISH_DPS_WITH_TYPE_ERROR.code,
|
|
279949
|
-
errorMsg: import_TYUniCode3.TYUniPluginError.DEVICEKIT_PUBLISH_DPS_WITH_TYPE_ERROR.des,
|
|
279950
|
-
data: null
|
|
279951
|
-
};
|
|
279952
|
-
}
|
|
279953
|
-
if (Object.keys(_dps).includes(`${id}`) && type === "enum" && range.indexOf(_dps[id]) === -1) {
|
|
279954
|
-
delete _dps[id];
|
|
279955
|
-
viewLog("@i18n(enum_publish_error)");
|
|
279956
|
-
return {
|
|
279957
|
-
errorCode: import_TYUniCode3.TYUniPluginError.DEVICEKIT_PUBLISH_DPS_ERROR.code,
|
|
279958
|
-
errorMsg: import_TYUniCode3.TYUniPluginError.DEVICEKIT_PUBLISH_DPS_ERROR.des,
|
|
279959
|
-
ext: {
|
|
279960
|
-
errorCode: "3005",
|
|
279961
|
-
errorMsg: "dp\u70B9\u6570\u636E\u7C7B\u578B\u9519\u8BEF"
|
|
279962
|
-
}
|
|
279963
|
-
};
|
|
279972
|
+
showPublish && viewLog("@i18n(number_publish_error)");
|
|
279964
279973
|
}
|
|
279965
|
-
|
|
279966
|
-
}
|
|
279974
|
+
});
|
|
279967
279975
|
}
|
|
279968
279976
|
console.log("--------result publishDpsWithMqtt", deviceId, _dps);
|
|
279969
279977
|
let reason;
|
|
279970
279978
|
let result = true;
|
|
279971
|
-
|
|
279972
|
-
|
|
279973
|
-
|
|
279974
|
-
|
|
279975
|
-
|
|
279976
|
-
|
|
279977
|
-
|
|
279979
|
+
const { parentId, nodeId } = dev;
|
|
279980
|
+
const isSubDevice = parentId && nodeId;
|
|
279981
|
+
if (isSubDevice) {
|
|
279982
|
+
dev = cachedDevices2[parentId];
|
|
279983
|
+
if (!dev) {
|
|
279984
|
+
await getDeviceInfo2({ deviceId: parentId });
|
|
279985
|
+
dev = cachedDevices2[parentId];
|
|
279986
|
+
}
|
|
279978
279987
|
}
|
|
279979
|
-
const message = {
|
|
279988
|
+
const message = isSubDevice ? {
|
|
279989
|
+
t: `${(/* @__PURE__ */ new Date()).getTime()}`.substring(0, 10),
|
|
279990
|
+
protocol: 5,
|
|
279991
|
+
data: {
|
|
279992
|
+
cid: nodeId,
|
|
279993
|
+
dps: _dps
|
|
279994
|
+
}
|
|
279995
|
+
} : {
|
|
279980
279996
|
t: `${(/* @__PURE__ */ new Date()).getTime()}`.substring(0, 10),
|
|
279981
279997
|
protocol: 5,
|
|
279982
279998
|
data: {
|
|
@@ -279985,47 +280001,57 @@ async function publishDps2(params) {
|
|
|
279985
280001
|
gwId: deviceId
|
|
279986
280002
|
}
|
|
279987
280003
|
};
|
|
279988
|
-
const topic = `smart/mb/out/${
|
|
279989
|
-
const { pv = "2.2" } = dev;
|
|
279990
|
-
|
|
279991
|
-
|
|
279992
|
-
|
|
279993
|
-
|
|
279994
|
-
|
|
279995
|
-
|
|
279996
|
-
|
|
279997
|
-
|
|
279998
|
-
|
|
279999
|
-
|
|
280000
|
-
|
|
280001
|
-
|
|
280002
|
-
|
|
280003
|
-
|
|
280004
|
-
|
|
280005
|
-
|
|
280006
|
-
|
|
280007
|
-
|
|
280008
|
-
|
|
280009
|
-
|
|
280010
|
-
|
|
280011
|
-
|
|
280012
|
-
|
|
280013
|
-
|
|
280014
|
-
|
|
280015
|
-
|
|
280016
|
-
|
|
280017
|
-
|
|
280018
|
-
|
|
280019
|
-
|
|
280020
|
-
|
|
280021
|
-
|
|
280022
|
-
|
|
280023
|
-
|
|
280024
|
-
|
|
280025
|
-
|
|
280026
|
-
|
|
280027
|
-
|
|
280028
|
-
|
|
280004
|
+
const topic = `smart/mb/out/${dev.devId}`;
|
|
280005
|
+
const { pv = "2.2", localKey } = dev;
|
|
280006
|
+
if (localKey) {
|
|
280007
|
+
let data = null;
|
|
280008
|
+
console.log("--------pv", pv);
|
|
280009
|
+
switch (pv) {
|
|
280010
|
+
case "2.0":
|
|
280011
|
+
data = crypto_default.Encrypt20(message, dev.localKey, dev.gwId || dev.devId);
|
|
280012
|
+
console.log("---------data", data);
|
|
280013
|
+
break;
|
|
280014
|
+
case "2.2":
|
|
280015
|
+
if (dev.localKey) {
|
|
280016
|
+
data = crypto_default.Encrypt22(message, dev.localKey);
|
|
280017
|
+
} else {
|
|
280018
|
+
result = await publishDps({ deviceId, dps: _dps }, (err) => {
|
|
280019
|
+
reason = err;
|
|
280020
|
+
console.log("--------error", err);
|
|
280021
|
+
});
|
|
280022
|
+
}
|
|
280023
|
+
break;
|
|
280024
|
+
case "2.3":
|
|
280025
|
+
data = crypto_default.Encrypt23(message, dev.localKey);
|
|
280026
|
+
break;
|
|
280027
|
+
default:
|
|
280028
|
+
result = await publishDps(
|
|
280029
|
+
{ deviceId, dps: _atopDps },
|
|
280030
|
+
(err) => {
|
|
280031
|
+
reason = err;
|
|
280032
|
+
console.log("--------error", err);
|
|
280033
|
+
}
|
|
280034
|
+
);
|
|
280035
|
+
break;
|
|
280036
|
+
}
|
|
280037
|
+
if (data) {
|
|
280038
|
+
initMqttClient_default._client.publish(
|
|
280039
|
+
topic,
|
|
280040
|
+
data,
|
|
280041
|
+
{
|
|
280042
|
+
qos: 1,
|
|
280043
|
+
retain: true
|
|
280044
|
+
},
|
|
280045
|
+
(error, pocket) => {
|
|
280046
|
+
console.log("------publish", error, pocket);
|
|
280047
|
+
}
|
|
280048
|
+
);
|
|
280049
|
+
}
|
|
280050
|
+
} else {
|
|
280051
|
+
result = await publishDps({ deviceId, dps: _atopDps }, (err) => {
|
|
280052
|
+
reason = err;
|
|
280053
|
+
console.log("--------error", err);
|
|
280054
|
+
});
|
|
280029
280055
|
}
|
|
280030
280056
|
let code = 0, msg = import_TYUniCode3.TYUniPluginError.SUCCESS.des;
|
|
280031
280057
|
if (reason || !result) {
|
|
@@ -280115,17 +280141,33 @@ async function getProductInfo2(params) {
|
|
|
280115
280141
|
async function queryDps2(params) {
|
|
280116
280142
|
try {
|
|
280117
280143
|
const { deviceId, dpIds } = params;
|
|
280118
|
-
|
|
280144
|
+
let dev = cachedDevices2[deviceId];
|
|
280145
|
+
const { parentId, nodeId } = dev;
|
|
280146
|
+
const isSubDevice = parentId && nodeId;
|
|
280147
|
+
if (isSubDevice) {
|
|
280148
|
+
dev = cachedDevices2[parentId];
|
|
280149
|
+
if (!dev) {
|
|
280150
|
+
await getDeviceInfo2({ deviceId: parentId });
|
|
280151
|
+
dev = cachedDevices2[parentId];
|
|
280152
|
+
}
|
|
280153
|
+
}
|
|
280119
280154
|
console.log("--------queryDps", dpIds);
|
|
280120
|
-
const message = {
|
|
280155
|
+
const message = isSubDevice ? {
|
|
280156
|
+
protocol: 31,
|
|
280157
|
+
t: Number(`${(/* @__PURE__ */ new Date()).getTime()}`.substring(0, 10)),
|
|
280158
|
+
data: {
|
|
280159
|
+
cid: [nodeId],
|
|
280160
|
+
dpId: dpIds.map(Number)
|
|
280161
|
+
}
|
|
280162
|
+
} : {
|
|
280121
280163
|
protocol: 31,
|
|
280122
280164
|
t: Number(`${(/* @__PURE__ */ new Date()).getTime()}`.substring(0, 10)),
|
|
280123
280165
|
data: {
|
|
280124
280166
|
dpId: dpIds.map(Number)
|
|
280125
280167
|
}
|
|
280126
280168
|
};
|
|
280127
|
-
const topic = `smart/mb/out/${
|
|
280128
|
-
|
|
280169
|
+
const topic = `smart/mb/out/${dev.devId}`;
|
|
280170
|
+
let { pv = "2.2" } = dev;
|
|
280129
280171
|
let data = null;
|
|
280130
280172
|
switch (pv) {
|
|
280131
280173
|
case "2.0":
|
|
@@ -280324,7 +280366,7 @@ async function getDeviceListByDevIds(params) {
|
|
|
280324
280366
|
const list = await Promise.all(promises);
|
|
280325
280367
|
const result = list.map((item) => {
|
|
280326
280368
|
return item.data;
|
|
280327
|
-
});
|
|
280369
|
+
}).filter((item) => !!item);
|
|
280328
280370
|
return {
|
|
280329
280371
|
data: { deviceInfos: result },
|
|
280330
280372
|
errorCode: 0,
|
|
@@ -280617,7 +280659,7 @@ async function removeDevice(params) {
|
|
|
280617
280659
|
version: "3.0",
|
|
280618
280660
|
params: {
|
|
280619
280661
|
devId: deviceId,
|
|
280620
|
-
resetFactory: "
|
|
280662
|
+
resetFactory: "false"
|
|
280621
280663
|
}
|
|
280622
280664
|
});
|
|
280623
280665
|
return {
|
|
@@ -280720,18 +280762,61 @@ async function unSubscribeDeviceRemoved(params) {
|
|
|
280720
280762
|
}
|
|
280721
280763
|
async function sendMqttMessage(params) {
|
|
280722
280764
|
console.log("------------params", params);
|
|
280723
|
-
|
|
280724
|
-
|
|
280725
|
-
|
|
280726
|
-
|
|
280727
|
-
|
|
280728
|
-
|
|
280729
|
-
|
|
280730
|
-
|
|
280731
|
-
|
|
280732
|
-
|
|
280733
|
-
|
|
280734
|
-
|
|
280765
|
+
const { protocol, message: data, deviceId } = params;
|
|
280766
|
+
let dev = cachedDevices2[deviceId];
|
|
280767
|
+
const { parentId, nodeId } = dev;
|
|
280768
|
+
const message = {
|
|
280769
|
+
t: `${(/* @__PURE__ */ new Date()).getTime()}`.substring(0, 10),
|
|
280770
|
+
protocol,
|
|
280771
|
+
data
|
|
280772
|
+
};
|
|
280773
|
+
const topic = `smart/mb/out/${dev.devId}`;
|
|
280774
|
+
const { pv = "2.2", localKey } = dev;
|
|
280775
|
+
if (localKey) {
|
|
280776
|
+
let data2 = null;
|
|
280777
|
+
console.log("--------pv", pv);
|
|
280778
|
+
switch (pv) {
|
|
280779
|
+
case "2.0":
|
|
280780
|
+
data2 = crypto_default.Encrypt20(message, dev.localKey, dev.gwId || dev.devId);
|
|
280781
|
+
console.log("---------data", data2);
|
|
280782
|
+
break;
|
|
280783
|
+
case "2.2":
|
|
280784
|
+
if (dev.localKey) {
|
|
280785
|
+
data2 = crypto_default.Encrypt22(message, dev.localKey);
|
|
280786
|
+
}
|
|
280787
|
+
break;
|
|
280788
|
+
case "2.3":
|
|
280789
|
+
data2 = crypto_default.Encrypt23(message, dev.localKey);
|
|
280790
|
+
break;
|
|
280791
|
+
default:
|
|
280792
|
+
break;
|
|
280793
|
+
}
|
|
280794
|
+
if (data2) {
|
|
280795
|
+
initMqttClient_default._client.publish(
|
|
280796
|
+
topic,
|
|
280797
|
+
data2,
|
|
280798
|
+
{
|
|
280799
|
+
qos: 1,
|
|
280800
|
+
retain: true
|
|
280801
|
+
},
|
|
280802
|
+
(error, pocket) => {
|
|
280803
|
+
console.log("------publish", error, pocket);
|
|
280804
|
+
}
|
|
280805
|
+
);
|
|
280806
|
+
}
|
|
280807
|
+
try {
|
|
280808
|
+
return {
|
|
280809
|
+
data: null,
|
|
280810
|
+
errorCode: 0,
|
|
280811
|
+
errorMsg: import_TYUniCode3.TYUniPluginError.SUCCESS.des
|
|
280812
|
+
};
|
|
280813
|
+
} catch (error) {
|
|
280814
|
+
return {
|
|
280815
|
+
data: false,
|
|
280816
|
+
errorCode: import_TYUniCode3.TYUniPluginError.DEVICEKIT_GW_ID_INVALID.code,
|
|
280817
|
+
errorMsg: import_TYUniCode3.TYUniPluginError.DEVICEKIT_GW_ID_INVALID.des
|
|
280818
|
+
};
|
|
280819
|
+
}
|
|
280735
280820
|
}
|
|
280736
280821
|
}
|
|
280737
280822
|
async function syncDeviceInfo(params) {
|
|
@@ -280755,10 +280840,11 @@ async function syncDeviceInfo(params) {
|
|
|
280755
280840
|
async function resetFactory(params) {
|
|
280756
280841
|
const { deviceId } = params;
|
|
280757
280842
|
const { result } = await apiRequestByAtop({
|
|
280758
|
-
api: "tuya.device.
|
|
280759
|
-
version: "
|
|
280843
|
+
api: "tuya.m.device.reset",
|
|
280844
|
+
version: "3.0",
|
|
280760
280845
|
params: {
|
|
280761
|
-
devId: deviceId
|
|
280846
|
+
devId: deviceId,
|
|
280847
|
+
resetFactory: "true"
|
|
280762
280848
|
}
|
|
280763
280849
|
});
|
|
280764
280850
|
try {
|