tsvesync 1.0.105 → 1.0.107

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.
@@ -564,13 +564,17 @@ class VeSync {
564
564
  this.countryCode = countryCode;
565
565
  this.enabled = true;
566
566
  this.apiBaseUrl = (0, helpers_1.getApiBaseUrl)(); // Track the API endpoint being used
567
- // Set region based on country code if we got one
567
+ // DO NOT change the region/endpoint after successful authentication!
568
+ // The endpoint that successfully authenticated is the one we must continue using.
569
+ // Tokens are endpoint-specific and won't work if we switch endpoints.
570
+ // This is especially important for AU/NZ users who may authenticate via EU endpoint
571
+ // but have AU/NZ country codes.
572
+ // Log a warning if the country code doesn't match the successful region
568
573
  if (countryCode) {
569
- const detectedRegion = (0, helpers_1.getRegionFromCountryCode)(countryCode);
570
- if (detectedRegion !== this._region) {
571
- logger_1.logger.debug(`Updating region from ${this._region} to ${detectedRegion} based on country code: ${countryCode}`);
572
- this._region = detectedRegion;
573
- (0, helpers_1.setCurrentRegion)(detectedRegion);
574
+ const expectedRegion = (0, helpers_1.getRegionFromCountryCode)(countryCode);
575
+ if (expectedRegion !== this._region) {
576
+ logger_1.logger.warn(`Note: Account authenticated with ${this._region} endpoint despite country code ${countryCode} typically using ${expectedRegion}`);
577
+ logger_1.logger.warn(`This is normal for accounts created through different regional apps`);
574
578
  }
575
579
  }
576
580
  logger_1.logger.debug('Authentication successful!', {
@@ -32,57 +32,57 @@ exports.fanConfig = {
32
32
  // LAP Series
33
33
  'LAP-C201S-AUSR': {
34
34
  module: 'VeSyncAirBypass',
35
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
35
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
36
36
  levels: [1, 2, 3]
37
37
  },
38
38
  'LAP-C202S-WUSR': {
39
39
  module: 'VeSyncAirBypass',
40
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
40
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
41
41
  levels: [1, 2, 3]
42
42
  },
43
43
  'LAP-C301S-WJP': {
44
44
  module: 'VeSyncAirBypass',
45
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
45
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
46
46
  levels: [1, 2, 3, 4]
47
47
  },
48
48
  'LAP-C302S-WUSB': {
49
49
  module: 'VeSyncAirBypass',
50
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
50
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
51
51
  levels: [1, 2, 3, 4]
52
52
  },
53
53
  'LAP-C301S-WAAA': {
54
54
  module: 'VeSyncAirBypass',
55
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
55
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
56
56
  levels: [1, 2, 3, 4]
57
57
  },
58
58
  'LAP-C401S-WJP': {
59
59
  module: 'VeSyncAirBypass',
60
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
60
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
61
61
  levels: [1, 2, 3, 4]
62
62
  },
63
63
  'LAP-C401S-WUSR': {
64
64
  module: 'VeSyncAirBypass',
65
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
65
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
66
66
  levels: [1, 2, 3, 4]
67
67
  },
68
68
  'LAP-C401S-WAAA': {
69
69
  module: 'VeSyncAirBypass',
70
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
70
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
71
71
  levels: [1, 2, 3, 4]
72
72
  },
73
73
  'LAP-C601S-WUS': {
74
74
  module: 'VeSyncAirBypass',
75
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
75
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
76
76
  levels: [1, 2, 3, 4]
77
77
  },
78
78
  'LAP-C601S-WUSR': {
79
79
  module: 'VeSyncAirBypass',
80
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
80
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
81
81
  levels: [1, 2, 3, 4]
82
82
  },
83
83
  'LAP-C601S-WEU': {
84
84
  module: 'VeSyncAirBypass',
85
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
85
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
86
86
  levels: [1, 2, 3, 4]
87
87
  },
88
88
  'LAP-V102S-AASR': {
@@ -295,7 +295,7 @@ exports.fanConfig = {
295
295
  },
296
296
  'LV-RH131S': {
297
297
  module: 'VeSyncAir131',
298
- features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'filter_life'],
298
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'filter_life'],
299
299
  levels: [1, 2, 3]
300
300
  }
301
301
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsvesync",
3
- "version": "1.0.105",
3
+ "version": "1.0.107",
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",
package/src/lib/vesync.ts CHANGED
@@ -693,13 +693,18 @@ export class VeSync {
693
693
  this.enabled = true;
694
694
  this.apiBaseUrl = getApiBaseUrl(); // Track the API endpoint being used
695
695
 
696
- // Set region based on country code if we got one
696
+ // DO NOT change the region/endpoint after successful authentication!
697
+ // The endpoint that successfully authenticated is the one we must continue using.
698
+ // Tokens are endpoint-specific and won't work if we switch endpoints.
699
+ // This is especially important for AU/NZ users who may authenticate via EU endpoint
700
+ // but have AU/NZ country codes.
701
+
702
+ // Log a warning if the country code doesn't match the successful region
697
703
  if (countryCode) {
698
- const detectedRegion = getRegionFromCountryCode(countryCode);
699
- if (detectedRegion !== this._region) {
700
- logger.debug(`Updating region from ${this._region} to ${detectedRegion} based on country code: ${countryCode}`);
701
- this._region = detectedRegion;
702
- setCurrentRegion(detectedRegion);
704
+ const expectedRegion = getRegionFromCountryCode(countryCode);
705
+ if (expectedRegion !== this._region) {
706
+ logger.warn(`Note: Account authenticated with ${this._region} endpoint despite country code ${countryCode} typically using ${expectedRegion}`);
707
+ logger.warn(`This is normal for accounts created through different regional apps`);
703
708
  }
704
709
  }
705
710
 
@@ -41,57 +41,57 @@ export const fanConfig: FanConfig = {
41
41
  // LAP Series
42
42
  'LAP-C201S-AUSR': {
43
43
  module: 'VeSyncAirBypass',
44
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
44
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
45
45
  levels: [1, 2, 3]
46
46
  },
47
47
  'LAP-C202S-WUSR': {
48
48
  module: 'VeSyncAirBypass',
49
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
49
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
50
50
  levels: [1, 2, 3]
51
51
  },
52
52
  'LAP-C301S-WJP': {
53
53
  module: 'VeSyncAirBypass',
54
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
54
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
55
55
  levels: [1, 2, 3, 4]
56
56
  },
57
57
  'LAP-C302S-WUSB': {
58
58
  module: 'VeSyncAirBypass',
59
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
59
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
60
60
  levels: [1, 2, 3, 4]
61
61
  },
62
62
  'LAP-C301S-WAAA': {
63
63
  module: 'VeSyncAirBypass',
64
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
64
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
65
65
  levels: [1, 2, 3, 4]
66
66
  },
67
67
  'LAP-C401S-WJP': {
68
68
  module: 'VeSyncAirBypass',
69
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
69
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
70
70
  levels: [1, 2, 3, 4]
71
71
  },
72
72
  'LAP-C401S-WUSR': {
73
73
  module: 'VeSyncAirBypass',
74
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
74
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
75
75
  levels: [1, 2, 3, 4]
76
76
  },
77
77
  'LAP-C401S-WAAA': {
78
78
  module: 'VeSyncAirBypass',
79
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
79
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
80
80
  levels: [1, 2, 3, 4]
81
81
  },
82
82
  'LAP-C601S-WUS': {
83
83
  module: 'VeSyncAirBypass',
84
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
84
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
85
85
  levels: [1, 2, 3, 4]
86
86
  },
87
87
  'LAP-C601S-WUSR': {
88
88
  module: 'VeSyncAirBypass',
89
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
89
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
90
90
  levels: [1, 2, 3, 4]
91
91
  },
92
92
  'LAP-C601S-WEU': {
93
93
  module: 'VeSyncAirBypass',
94
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
94
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
95
95
  levels: [1, 2, 3, 4]
96
96
  },
97
97
  'LAP-V102S-AASR': {
@@ -310,7 +310,7 @@ export const fanConfig: FanConfig = {
310
310
  },
311
311
  'LV-RH131S': {
312
312
  module: 'VeSyncAir131',
313
- features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'filter_life'],
313
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'filter_life'],
314
314
  levels: [1, 2, 3]
315
315
  }
316
316
  };