tsvesync 1.0.62 → 1.0.64

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.
@@ -209,12 +209,11 @@ class VeSyncAirBypass extends vesyncFan_1.VeSyncFan {
209
209
  * Change fan speed
210
210
  */
211
211
  async changeFanSpeed(speed) {
212
- var _a;
213
- const speeds = (_a = this.config.levels) !== null && _a !== void 0 ? _a : [];
214
- if (!speeds.includes(speed)) {
215
- logger_1.logger.error(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')} for device: ${this.deviceName}`);
216
- return false;
217
- }
212
+ // const speeds = this.config.levels ?? [];
213
+ // if (!speeds.includes(speed)) {
214
+ // logger.error(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')} for device: ${this.deviceName}`);
215
+ // return false;
216
+ // }
218
217
  logger_1.logger.info(`Changing fan speed to ${speed} for device: ${this.deviceName}`);
219
218
  const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
220
219
  ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
@@ -660,12 +659,15 @@ class VeSyncHumidifier extends vesyncFan_1.VeSyncFan {
660
659
  data: {
661
660
  mode
662
661
  },
663
- method: 'setHumidifierMode',
662
+ method: 'setHumidityMode',
664
663
  source: 'APP'
665
664
  }
666
665
  }, helpers_1.Helpers.reqHeaderBypass());
667
666
  const success = this.checkResponse([response, status], 'setMode');
668
- if (!success) {
667
+ if (success) {
668
+ this.details.mode = mode;
669
+ }
670
+ else {
669
671
  logger_1.logger.error(`Failed to set mode to ${mode} for device: ${this.deviceName}`);
670
672
  }
671
673
  return success;
@@ -930,7 +932,7 @@ class VeSyncWarmHumidifier extends VeSyncHumidifier {
930
932
  data: {
931
933
  mode
932
934
  },
933
- method: 'setHumidifierMode',
935
+ method: 'setHumidityMode',
934
936
  source: 'APP'
935
937
  }
936
938
  }, helpers_1.Helpers.reqHeaderBypass());
@@ -1062,13 +1064,10 @@ class VeSyncAirBaseV2 extends VeSyncAirBypass {
1062
1064
  }
1063
1065
  buildConfigDict(configDict) {
1064
1066
  if (configDict) {
1065
- // Only merge non-critical configuration fields
1066
- const { module, features, levels, ...otherConfig } = configDict;
1067
1067
  this.config = {
1068
- ...this.config, // Keep base config (including module, features, levels)
1069
- ...otherConfig // Only merge other configuration fields
1068
+ ...this.config, // Preserve existing config
1069
+ ...configDict // Merge in new config
1070
1070
  };
1071
- logger_1.logger.debug(`Updated configuration for device: ${this.deviceName}, preserved base config fields`);
1072
1071
  }
1073
1072
  }
1074
1073
  get mode() {
@@ -1214,12 +1213,11 @@ class VeSyncAirBaseV2 extends VeSyncAirBypass {
1214
1213
  * Change fan speed
1215
1214
  */
1216
1215
  async changeFanSpeed(speed) {
1217
- var _a;
1218
- const speeds = (_a = this.config.levels) !== null && _a !== void 0 ? _a : [];
1219
- if (!speeds.includes(speed)) {
1220
- logger_1.logger.error(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')} for device: ${this.deviceName}`);
1221
- return false;
1222
- }
1216
+ // const speeds = this.config.levels ?? [];
1217
+ // if (!speeds.includes(speed)) {
1218
+ // logger.error(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')} for device: ${this.deviceName}`);
1219
+ // return false;
1220
+ // }
1223
1221
  logger_1.logger.info(`Changing fan speed to ${speed} for device: ${this.deviceName}`);
1224
1222
  const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
1225
1223
  ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
@@ -1622,12 +1620,11 @@ class VeSyncTowerFan extends VeSyncAirBaseV2 {
1622
1620
  * Change fan speed
1623
1621
  */
1624
1622
  async changeFanSpeed(speed) {
1625
- var _a;
1626
- const speeds = (_a = this.config.levels) !== null && _a !== void 0 ? _a : [];
1627
- if (!speeds.includes(speed)) {
1628
- logger_1.logger.error(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')} for device: ${this.deviceName}`);
1629
- return false;
1630
- }
1623
+ // const speeds = this.config.levels ?? [];
1624
+ // if (!speeds.includes(speed)) {
1625
+ // logger.debug(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')}`);
1626
+ // return false;
1627
+ // }
1631
1628
  const [head, body] = this.buildApiDict('setLevel');
1632
1629
  body.payload.data = {
1633
1630
  levelIdx: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsvesync",
3
- "version": "1.0.62",
3
+ "version": "1.0.64",
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",
@@ -257,11 +257,11 @@ export class VeSyncAirBypass extends VeSyncFan {
257
257
  * Change fan speed
258
258
  */
259
259
  async changeFanSpeed(speed: number): Promise<boolean> {
260
- const speeds = this.config.levels ?? [];
261
- if (!speeds.includes(speed)) {
262
- logger.error(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')} for device: ${this.deviceName}`);
263
- return false;
264
- }
260
+ // const speeds = this.config.levels ?? [];
261
+ // if (!speeds.includes(speed)) {
262
+ // logger.error(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')} for device: ${this.deviceName}`);
263
+ // return false;
264
+ // }
265
265
 
266
266
  logger.info(`Changing fan speed to ${speed} for device: ${this.deviceName}`);
267
267
  const [response, status] = await this.callApi(
@@ -803,7 +803,7 @@ export class VeSyncHumidifier extends VeSyncFan {
803
803
  data: {
804
804
  mode
805
805
  },
806
- method: 'setHumidifierMode',
806
+ method: 'setHumidityMode',
807
807
  source: 'APP'
808
808
  }
809
809
  },
@@ -811,7 +811,9 @@ export class VeSyncHumidifier extends VeSyncFan {
811
811
  );
812
812
 
813
813
  const success = this.checkResponse([response, status], 'setMode');
814
- if (!success) {
814
+ if (success) {
815
+ this.details.mode = mode;
816
+ } else {
815
817
  logger.error(`Failed to set mode to ${mode} for device: ${this.deviceName}`);
816
818
  }
817
819
  return success;
@@ -1135,7 +1137,7 @@ export class VeSyncWarmHumidifier extends VeSyncHumidifier {
1135
1137
  data: {
1136
1138
  mode
1137
1139
  },
1138
- method: 'setHumidifierMode',
1140
+ method: 'setHumidityMode',
1139
1141
  source: 'APP'
1140
1142
  }
1141
1143
  },
@@ -1291,13 +1293,10 @@ export class VeSyncAirBaseV2 extends VeSyncAirBypass {
1291
1293
 
1292
1294
  protected buildConfigDict(configDict: Record<string, any>): void {
1293
1295
  if (configDict) {
1294
- // Only merge non-critical configuration fields
1295
- const { module, features, levels, ...otherConfig } = configDict;
1296
1296
  this.config = {
1297
- ...this.config, // Keep base config (including module, features, levels)
1298
- ...otherConfig // Only merge other configuration fields
1297
+ ...this.config, // Preserve existing config
1298
+ ...configDict // Merge in new config
1299
1299
  };
1300
- logger.debug(`Updated configuration for device: ${this.deviceName}, preserved base config fields`);
1301
1300
  }
1302
1301
  }
1303
1302
 
@@ -1472,11 +1471,11 @@ export class VeSyncAirBaseV2 extends VeSyncAirBypass {
1472
1471
  * Change fan speed
1473
1472
  */
1474
1473
  async changeFanSpeed(speed: number): Promise<boolean> {
1475
- const speeds = this.config.levels ?? [];
1476
- if (!speeds.includes(speed)) {
1477
- logger.error(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')} for device: ${this.deviceName}`);
1478
- return false;
1479
- }
1474
+ // const speeds = this.config.levels ?? [];
1475
+ // if (!speeds.includes(speed)) {
1476
+ // logger.error(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')} for device: ${this.deviceName}`);
1477
+ // return false;
1478
+ // }
1480
1479
 
1481
1480
  logger.info(`Changing fan speed to ${speed} for device: ${this.deviceName}`);
1482
1481
  const [response, status] = await this.callApi(
@@ -2001,11 +2000,11 @@ export class VeSyncTowerFan extends VeSyncAirBaseV2 {
2001
2000
  * Change fan speed
2002
2001
  */
2003
2002
  async changeFanSpeed(speed: number): Promise<boolean> {
2004
- const speeds = this.config.levels ?? [];
2005
- if (!speeds.includes(speed)) {
2006
- logger.error(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')} for device: ${this.deviceName}`);
2007
- return false;
2008
- }
2003
+ // const speeds = this.config.levels ?? [];
2004
+ // if (!speeds.includes(speed)) {
2005
+ // logger.debug(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')}`);
2006
+ // return false;
2007
+ // }
2009
2008
 
2010
2009
  const [head, body] = this.buildApiDict('setLevel');
2011
2010
  body.payload.data = {