tsvesync 1.0.14 → 1.0.15
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/lib/vesyncOutlet.js +21 -2
- package/package.json +1 -1
- package/src/lib/vesyncOutlet.ts +21 -3
package/dist/lib/vesyncOutlet.js
CHANGED
|
@@ -46,8 +46,27 @@ class VeSyncOutlet extends vesyncBaseDevice_1.VeSyncBaseDevice {
|
|
|
46
46
|
*/
|
|
47
47
|
async getDetails() {
|
|
48
48
|
logger_1.logger.debug(`[${this.deviceName}] Getting outlet details`);
|
|
49
|
-
const
|
|
50
|
-
|
|
49
|
+
const body = {
|
|
50
|
+
...helpers_1.Helpers.reqBody(this.manager, 'devicedetail'),
|
|
51
|
+
uuid: this.uuid
|
|
52
|
+
};
|
|
53
|
+
let url;
|
|
54
|
+
if (this.deviceType === 'wifi-switch-1.3') {
|
|
55
|
+
url = `/v1/device/${this.deviceType}-${this.cid}/detail`;
|
|
56
|
+
}
|
|
57
|
+
else if (this.deviceType.startsWith('ESO15')) {
|
|
58
|
+
url = '/outdoorsocket15a/v1/device/devicedetail';
|
|
59
|
+
}
|
|
60
|
+
else if (this.deviceType.startsWith('ESW15')) {
|
|
61
|
+
url = '/15a/v1/device/devicedetail';
|
|
62
|
+
}
|
|
63
|
+
else if (this.deviceType.startsWith('ESW03') || this.deviceType.startsWith('ESW01')) {
|
|
64
|
+
url = '/10a/v1/device/devicedetail';
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
url = '/v1/device/devicedetail';
|
|
68
|
+
}
|
|
69
|
+
const [response] = await helpers_1.Helpers.callApi(url, this.deviceType === 'wifi-switch-1.3' ? 'get' : 'post', this.deviceType === 'wifi-switch-1.3' ? null : body, helpers_1.Helpers.reqHeaders(this.manager));
|
|
51
70
|
if ((response === null || response === void 0 ? void 0 : response.code) === 0) {
|
|
52
71
|
this.details = response.result;
|
|
53
72
|
this.deviceStatus = response.result.deviceStatus;
|
package/package.json
CHANGED
package/src/lib/vesyncOutlet.ts
CHANGED
|
@@ -58,11 +58,29 @@ export abstract class VeSyncOutlet extends VeSyncBaseDevice {
|
|
|
58
58
|
*/
|
|
59
59
|
async getDetails(): Promise<void> {
|
|
60
60
|
logger.debug(`[${this.deviceName}] Getting outlet details`);
|
|
61
|
-
|
|
61
|
+
|
|
62
|
+
const body = {
|
|
63
|
+
...Helpers.reqBody(this.manager, 'devicedetail'),
|
|
64
|
+
uuid: this.uuid
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
let url: string;
|
|
68
|
+
if (this.deviceType === 'wifi-switch-1.3') {
|
|
69
|
+
url = `/v1/device/${this.deviceType}-${this.cid}/detail`;
|
|
70
|
+
} else if (this.deviceType.startsWith('ESO15')) {
|
|
71
|
+
url = '/outdoorsocket15a/v1/device/devicedetail';
|
|
72
|
+
} else if (this.deviceType.startsWith('ESW15')) {
|
|
73
|
+
url = '/15a/v1/device/devicedetail';
|
|
74
|
+
} else if (this.deviceType.startsWith('ESW03') || this.deviceType.startsWith('ESW01')) {
|
|
75
|
+
url = '/10a/v1/device/devicedetail';
|
|
76
|
+
} else {
|
|
77
|
+
url = '/v1/device/devicedetail';
|
|
78
|
+
}
|
|
79
|
+
|
|
62
80
|
const [response] = await Helpers.callApi(
|
|
63
81
|
url,
|
|
64
|
-
'get',
|
|
65
|
-
null,
|
|
82
|
+
this.deviceType === 'wifi-switch-1.3' ? 'get' : 'post',
|
|
83
|
+
this.deviceType === 'wifi-switch-1.3' ? null : body,
|
|
66
84
|
Helpers.reqHeaders(this.manager)
|
|
67
85
|
);
|
|
68
86
|
|