tsvesync 1.0.29 → 1.0.31

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.
@@ -189,7 +189,7 @@ class Helpers {
189
189
  }
190
190
  return [responseData, error.response.status];
191
191
  }
192
- logger_1.logger.error('API call failed:', error.message);
192
+ logger_1.logger.error('API call failed:', error.code, error.message);
193
193
  return [null, 0];
194
194
  }
195
195
  }
@@ -52,7 +52,7 @@ class VeSyncOutlet extends vesyncBaseDevice_1.VeSyncBaseDevice {
52
52
  };
53
53
  let url;
54
54
  if (this.deviceType === 'wifi-switch-1.3') {
55
- url = `/v1/device/wifi-switch-1.3-${this.cid}/detail`;
55
+ url = '/v1/device/' + this.cid + '/detail';
56
56
  }
57
57
  else if (this.deviceType.startsWith('ESO15')) {
58
58
  url = '/outdoorsocket15a/v1/device/devicedetail';
@@ -66,14 +66,14 @@ class VeSyncOutlet extends vesyncBaseDevice_1.VeSyncBaseDevice {
66
66
  else {
67
67
  url = '/v1/device/devicedetail';
68
68
  }
69
- const [response, statusCode] = await this.callApi(url, this.deviceType === 'wifi-switch-1.3' ? 'get' : 'post', this.deviceType === 'wifi-switch-1.3' ? null : body, helpers_1.Helpers.reqHeaders(this.manager));
69
+ const [response, statusCode] = await this.callApi(url, this.deviceType === 'wifi-switch-1.3' ? 'get' : 'post', body, helpers_1.Helpers.reqHeaders(this.manager));
70
70
  if (!response) {
71
71
  logger_1.logger.debug(`[${this.deviceName}] No response received from API`);
72
72
  return false;
73
73
  }
74
74
  // Handle error responses
75
75
  if (response.error) {
76
- logger_1.logger.debug(`[${this.deviceName}] Failed to get outlet details: ${JSON.stringify(response)}`);
76
+ logger_1.logger.error(`[${this.deviceName}] Failed to get outlet details for ${url}: ${JSON.stringify(response)}`);
77
77
  return false;
78
78
  }
79
79
  // Handle successful responses
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsvesync",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "A TypeScript library for interacting with VeSync smart home devices",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -233,7 +233,7 @@ export class Helpers {
233
233
  }
234
234
  return [responseData, error.response.status];
235
235
  }
236
- logger.error('API call failed:', error.message);
236
+ logger.error('API call failed:', error.code, error.message);
237
237
  return [null, 0];
238
238
  }
239
239
  }
@@ -66,7 +66,7 @@ export abstract class VeSyncOutlet extends VeSyncBaseDevice {
66
66
 
67
67
  let url: string;
68
68
  if (this.deviceType === 'wifi-switch-1.3') {
69
- url = `/v1/device/wifi-switch-1.3-${this.cid}/detail`;
69
+ url = '/v1/device/' + this.cid + '/detail';
70
70
  } else if (this.deviceType.startsWith('ESO15')) {
71
71
  url = '/outdoorsocket15a/v1/device/devicedetail';
72
72
  } else if (this.deviceType.startsWith('ESW15')) {
@@ -80,7 +80,7 @@ export abstract class VeSyncOutlet extends VeSyncBaseDevice {
80
80
  const [response, statusCode] = await this.callApi(
81
81
  url,
82
82
  this.deviceType === 'wifi-switch-1.3' ? 'get' : 'post',
83
- this.deviceType === 'wifi-switch-1.3' ? null : body,
83
+ body,
84
84
  Helpers.reqHeaders(this.manager)
85
85
  );
86
86
 
@@ -91,7 +91,7 @@ export abstract class VeSyncOutlet extends VeSyncBaseDevice {
91
91
 
92
92
  // Handle error responses
93
93
  if (response.error) {
94
- logger.debug(`[${this.deviceName}] Failed to get outlet details: ${JSON.stringify(response)}`);
94
+ logger.error(`[${this.deviceName}] Failed to get outlet details for ${url}: ${JSON.stringify(response)}`);
95
95
  return false;
96
96
  }
97
97