tsvesync 1.0.71 → 1.0.73

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.
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VeSyncHumid200S = void 0;
4
+ const humidifier_1 = require("./humidifier");
5
+ const helpers_1 = require("../helpers");
6
+ const logger_1 = require("../logger");
7
+ /**
8
+ * VeSync Humid200S Humidifier Class
9
+ * Implementation based on PyVeSync's VeSyncHumid200S class
10
+ * For Classic200S models
11
+ */
12
+ class VeSyncHumid200S extends humidifier_1.VeSyncHumidifier {
13
+ constructor(details, manager) {
14
+ super(details, manager);
15
+ this.modes = ['auto', 'manual', 'sleep'];
16
+ this.features = ['humidity', 'mist', 'display', 'timer', 'auto_mode'];
17
+ this.mistLevels = [1, 2, 3];
18
+ this.humidityRange = { min: 30, max: 80 };
19
+ // Update config for Humid200S
20
+ this.config = {
21
+ module: 'VeSyncHumid200S',
22
+ features: ['display', 'humidity', 'mist', 'timer', 'auto_mode'],
23
+ levels: [1, 2, 3]
24
+ };
25
+ logger_1.logger.debug(`Initialized VeSyncHumid200S device: ${this.deviceName}`);
26
+ }
27
+ /**
28
+ * Get device details
29
+ */
30
+ async getDetails() {
31
+ var _a, _b, _c, _d;
32
+ logger_1.logger.debug(`Getting details for device: ${this.deviceName}`);
33
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
34
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
35
+ cid: this.cid,
36
+ configModule: this.configModule,
37
+ payload: {
38
+ data: {},
39
+ method: 'getHumidifierStatus',
40
+ source: 'APP'
41
+ }
42
+ }, helpers_1.Helpers.reqHeaderBypass());
43
+ const success = this.checkResponse([response, status], 'getDetails');
44
+ if (success && ((_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.result)) {
45
+ const result = response.result.result;
46
+ // Update device status based on enabled field
47
+ this.deviceStatus = result.enabled ? 'on' : 'off';
48
+ this.details = {
49
+ mode: result.mode || '',
50
+ humidity: result.humidity || 0,
51
+ target_humidity: ((_b = result.configuration) === null || _b === void 0 ? void 0 : _b.auto_target_humidity) || result.target_humidity || 0,
52
+ mist_level: result.mist_level || 0,
53
+ water_lacks: result.water_lacks || false,
54
+ humidity_high: result.humidity_high || false,
55
+ water_tank_lifted: result.water_tank_lifted || false,
56
+ display: result.display || false,
57
+ automatic_stop: result.automatic_stop_reach_target || false,
58
+ automatic_stop_configured: ((_c = result.configuration) === null || _c === void 0 ? void 0 : _c.automatic_stop) || false,
59
+ auto_target_humidity: ((_d = result.configuration) === null || _d === void 0 ? void 0 : _d.auto_target_humidity) || 0,
60
+ configuration: result.configuration || {}
61
+ };
62
+ logger_1.logger.debug(`Successfully got details for device: ${this.deviceName}`);
63
+ }
64
+ return success;
65
+ }
66
+ /**
67
+ * Set display
68
+ * Override to use setIndicatorLightSwitch method
69
+ */
70
+ async setDisplay(enabled) {
71
+ logger_1.logger.info(`Setting display to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
72
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
73
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
74
+ cid: this.cid,
75
+ configModule: this.configModule,
76
+ payload: {
77
+ data: {
78
+ enabled: enabled
79
+ },
80
+ method: 'setIndicatorLightSwitch',
81
+ source: 'APP'
82
+ }
83
+ }, helpers_1.Helpers.reqHeaderBypass());
84
+ const success = this.checkResponse([response, status], 'setDisplay');
85
+ if (success) {
86
+ this.details.display = enabled;
87
+ // Get latest state and log it
88
+ await this.getDetails();
89
+ logger_1.logger.debug(`Device state after display change: ${JSON.stringify(this.details)}`);
90
+ }
91
+ else {
92
+ logger_1.logger.error(`Failed to set display to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
93
+ }
94
+ return success;
95
+ }
96
+ /**
97
+ * Set mist level
98
+ */
99
+ async setMistLevel(level) {
100
+ if (!this.mistLevels.includes(level)) {
101
+ const error = `Invalid mist level: ${level}. Must be one of: ${this.mistLevels.join(', ')}`;
102
+ logger_1.logger.error(`${error} for device: ${this.deviceName}`);
103
+ throw new Error(error);
104
+ }
105
+ logger_1.logger.info(`Setting mist level to ${level} for device: ${this.deviceName}`);
106
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
107
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
108
+ cid: this.cid,
109
+ configModule: this.configModule,
110
+ payload: {
111
+ data: {
112
+ level: level
113
+ },
114
+ method: 'setMistLevel', // Use setMistLevel for Classic200S
115
+ source: 'APP'
116
+ }
117
+ }, helpers_1.Helpers.reqHeaderBypass());
118
+ const success = this.checkResponse([response, status], 'setMistLevel');
119
+ if (success) {
120
+ this.details.mist_level = level;
121
+ // Get latest state and log it
122
+ await this.getDetails();
123
+ logger_1.logger.debug(`Device state after mist level change: ${JSON.stringify(this.details)}`);
124
+ }
125
+ else {
126
+ logger_1.logger.error(`Failed to set mist level to ${level} for device: ${this.deviceName}`);
127
+ }
128
+ return success;
129
+ }
130
+ /**
131
+ * Get current humidity
132
+ * Provides access to the current humidity reading
133
+ */
134
+ get currentHumidity() {
135
+ return this.details.humidity || 0;
136
+ }
137
+ /**
138
+ * Get target humidity
139
+ */
140
+ get targetHumidity() {
141
+ return this.details.target_humidity || 0;
142
+ }
143
+ /**
144
+ * Get water lacks status
145
+ */
146
+ get waterLacks() {
147
+ return this.details.water_lacks || false;
148
+ }
149
+ /**
150
+ * Get water tank lifted status
151
+ */
152
+ get waterTankLifted() {
153
+ return this.details.water_tank_lifted || false;
154
+ }
155
+ /**
156
+ * Return JSON details for humidifier
157
+ * Override to include current humidity and target humidity
158
+ */
159
+ displayJSON() {
160
+ var _a, _b;
161
+ const baseInfo = JSON.parse(super.displayJSON());
162
+ // Add current humidity from details
163
+ baseInfo['Humidity'] = ((_a = this.details.humidity) === null || _a === void 0 ? void 0 : _a.toString()) || '0';
164
+ // Add target humidity from configuration
165
+ baseInfo['Target Humidity'] = ((_b = this.details.target_humidity) === null || _b === void 0 ? void 0 : _b.toString()) || '0';
166
+ return JSON.stringify(baseInfo, null, 4);
167
+ }
168
+ }
169
+ exports.VeSyncHumid200S = VeSyncHumid200S;
@@ -6,4 +6,7 @@ export { VeSyncTowerFan } from './towerFan';
6
6
  export { VeSyncHumidifier } from './humidifier';
7
7
  export { VeSyncWarmHumidifier } from './warmHumidifier';
8
8
  export { VeSyncHumid200300S } from './humid200300S';
9
+ export { VeSyncSuperior6000S } from './superior6000S';
10
+ export { VeSyncHumid1000S } from './humid1000S';
11
+ export { VeSyncHumid200S } from './humid200S';
9
12
  export declare const fanModules: Record<string, new (details: Record<string, any>, manager: VeSync) => VeSyncFan>;
@@ -1,11 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fanModules = exports.VeSyncHumid200300S = exports.VeSyncWarmHumidifier = exports.VeSyncHumidifier = exports.VeSyncTowerFan = exports.VeSyncAirBaseV2 = exports.VeSyncAirBypass = void 0;
3
+ exports.fanModules = exports.VeSyncHumid200S = exports.VeSyncHumid1000S = exports.VeSyncSuperior6000S = exports.VeSyncHumid200300S = exports.VeSyncWarmHumidifier = exports.VeSyncHumidifier = exports.VeSyncTowerFan = exports.VeSyncAirBaseV2 = exports.VeSyncAirBypass = void 0;
4
4
  const airBypass_1 = require("./airBypass");
5
5
  const airBaseV2_1 = require("./airBaseV2");
6
6
  const towerFan_1 = require("./towerFan");
7
7
  const humidifier_1 = require("./humidifier");
8
8
  const humid200300S_1 = require("./humid200300S");
9
+ const superior6000S_1 = require("./superior6000S");
10
+ const humid1000S_1 = require("./humid1000S");
11
+ const humid200S_1 = require("./humid200S");
9
12
  // Re-export all classes
10
13
  var airBypass_2 = require("./airBypass");
11
14
  Object.defineProperty(exports, "VeSyncAirBypass", { enumerable: true, get: function () { return airBypass_2.VeSyncAirBypass; } });
@@ -19,6 +22,12 @@ var warmHumidifier_1 = require("./warmHumidifier");
19
22
  Object.defineProperty(exports, "VeSyncWarmHumidifier", { enumerable: true, get: function () { return warmHumidifier_1.VeSyncWarmHumidifier; } });
20
23
  var humid200300S_2 = require("./humid200300S");
21
24
  Object.defineProperty(exports, "VeSyncHumid200300S", { enumerable: true, get: function () { return humid200300S_2.VeSyncHumid200300S; } });
25
+ var superior6000S_2 = require("./superior6000S");
26
+ Object.defineProperty(exports, "VeSyncSuperior6000S", { enumerable: true, get: function () { return superior6000S_2.VeSyncSuperior6000S; } });
27
+ var humid1000S_2 = require("./humid1000S");
28
+ Object.defineProperty(exports, "VeSyncHumid1000S", { enumerable: true, get: function () { return humid1000S_2.VeSyncHumid1000S; } });
29
+ var humid200S_2 = require("./humid200S");
30
+ Object.defineProperty(exports, "VeSyncHumid200S", { enumerable: true, get: function () { return humid200S_2.VeSyncHumid200S; } });
22
31
  // Export fan modules dictionary
23
32
  exports.fanModules = {
24
33
  // Core Series
@@ -64,7 +73,7 @@ exports.fanModules = {
64
73
  'LTF-F422S-WUS': towerFan_1.VeSyncTowerFan,
65
74
  // Classic Series
66
75
  'Classic300S': humidifier_1.VeSyncHumidifier,
67
- 'Classic200S': humidifier_1.VeSyncHumidifier,
76
+ 'Classic200S': humid200S_1.VeSyncHumid200S,
68
77
  // Dual Series
69
78
  'Dual200S': humidifier_1.VeSyncHumidifier,
70
79
  // LUH Series
@@ -84,11 +93,11 @@ exports.fanModules = {
84
93
  'LUH-O451S-WUSR': humid200300S_1.VeSyncHumid200300S,
85
94
  'LUH-O601S-WUS': humid200300S_1.VeSyncHumid200300S,
86
95
  'LUH-O601S-KUS': humid200300S_1.VeSyncHumid200300S,
87
- 'LUH-M101S-WUS': humid200300S_1.VeSyncHumid200300S,
88
- 'LUH-M101S-WEUR': humid200300S_1.VeSyncHumid200300S,
89
- // LEH Series
90
- 'LEH-S601S-WUS': humid200300S_1.VeSyncHumid200300S,
91
- 'LEH-S601S-WUSR': humid200300S_1.VeSyncHumid200300S,
96
+ 'LUH-M101S-WUS': humid1000S_1.VeSyncHumid1000S,
97
+ 'LUH-M101S-WEUR': humid1000S_1.VeSyncHumid1000S,
98
+ // LEH Series - Superior 6000S
99
+ 'LEH-S601S-WUS': superior6000S_1.VeSyncSuperior6000S,
100
+ 'LEH-S601S-WUSR': superior6000S_1.VeSyncSuperior6000S,
92
101
  // LV Series
93
102
  'LV-PUR131S': airBypass_1.VeSyncAirBypass,
94
103
  'LV-RH131S': airBypass_1.VeSyncAirBypass
@@ -0,0 +1,150 @@
1
+ import { VeSyncFan } from '../vesyncFan';
2
+ import { VeSync } from '../vesync';
3
+ /**
4
+ * VeSync Superior 6000S Humidifier Class
5
+ * Implementation based on PyVeSync's VeSyncSuperior6000S class
6
+ */
7
+ export declare class VeSyncSuperior6000S extends VeSyncFan {
8
+ protected readonly modes: readonly ["auto", "manual", "sleep", "humidity"];
9
+ protected readonly mistLevels: number[];
10
+ protected readonly humidityRange: {
11
+ min: number;
12
+ max: number;
13
+ };
14
+ protected readonly _apiModes: string[];
15
+ details: {
16
+ mode: string;
17
+ speed?: number;
18
+ filter_life?: number;
19
+ screen_status?: 'on' | 'off';
20
+ child_lock?: boolean;
21
+ humidity: number;
22
+ target_humidity: number;
23
+ mist_level: number;
24
+ mist_virtual_level: number;
25
+ water_lacks: boolean;
26
+ water_tank_lifted: boolean;
27
+ display: boolean;
28
+ filter_life_percentage: number;
29
+ temperature: number;
30
+ drying_mode: {
31
+ autoDryingSwitch?: number;
32
+ dryingState?: number;
33
+ dryingLevel?: number;
34
+ dryingRemain?: number;
35
+ };
36
+ configuration: Record<string, any>;
37
+ connection_status: string | null;
38
+ };
39
+ constructor(details: Record<string, any>, manager: VeSync);
40
+ /**
41
+ * Build API dictionary for humidifier
42
+ */
43
+ protected buildApiDict(method: string): [Record<string, any>, Record<string, any>];
44
+ /**
45
+ * Get device details
46
+ */
47
+ getDetails(): Promise<Boolean>;
48
+ /**
49
+ * Turn device on
50
+ */
51
+ turnOn(): Promise<boolean>;
52
+ /**
53
+ * Turn device off
54
+ */
55
+ turnOff(): Promise<boolean>;
56
+ /**
57
+ * Toggle device power
58
+ */
59
+ toggleSwitch(enabled: boolean): Promise<boolean>;
60
+ /**
61
+ * Set mist level
62
+ */
63
+ setMistLevel(level: number): Promise<boolean>;
64
+ /**
65
+ * Change fan speed - Implemented to satisfy interface but redirects to setMistLevel
66
+ */
67
+ changeFanSpeed(speed: number): Promise<boolean>;
68
+ /**
69
+ * Set device mode
70
+ */
71
+ setMode(mode: string): Promise<boolean>;
72
+ /**
73
+ * Set target humidity
74
+ */
75
+ setHumidity(humidity: number): Promise<boolean>;
76
+ /**
77
+ * Set display status
78
+ */
79
+ setDisplay(enabled: boolean): Promise<boolean>;
80
+ /**
81
+ * Set drying mode enabled
82
+ */
83
+ setDryingModeEnabled(enabled: boolean): Promise<boolean>;
84
+ /**
85
+ * Turn on display
86
+ */
87
+ turnOnDisplay(): Promise<boolean>;
88
+ /**
89
+ * Turn off display
90
+ */
91
+ turnOffDisplay(): Promise<boolean>;
92
+ /**
93
+ * Set auto mode
94
+ */
95
+ setAutoMode(): Promise<boolean>;
96
+ /**
97
+ * Set manual mode
98
+ */
99
+ setManualMode(): Promise<boolean>;
100
+ /**
101
+ * Get current humidity
102
+ * Provides access to the current humidity reading
103
+ */
104
+ get currentHumidity(): number;
105
+ /**
106
+ * Get target humidity
107
+ * Provides access to the target humidity setting
108
+ */
109
+ get targetHumidity(): number;
110
+ /**
111
+ * Get current temperature
112
+ * Provides access to the current temperature reading
113
+ */
114
+ get temperature(): number;
115
+ /**
116
+ * Check if water tank is empty
117
+ * Returns true if water tank is empty and needs to be refilled
118
+ */
119
+ get waterLacks(): boolean;
120
+ /**
121
+ * Check if water tank is lifted
122
+ * Returns true if water tank is lifted/removed from the device
123
+ */
124
+ get waterTankLifted(): boolean;
125
+ /**
126
+ * Get filter life percentage
127
+ * Returns the percentage of filter life remaining
128
+ */
129
+ get filterLifePercentage(): number;
130
+ /**
131
+ * Check if drying mode is enabled
132
+ * Returns true if drying mode is enabled
133
+ */
134
+ get dryingModeEnabled(): boolean;
135
+ /**
136
+ * Get drying mode state
137
+ * Returns 'on' if drying mode is active, 'off' if inactive, null if unknown
138
+ */
139
+ get dryingModeState(): string | null;
140
+ /**
141
+ * Get drying mode level
142
+ * Returns 'low' if level is 1, 'high' if level is 2, null if unknown
143
+ */
144
+ get dryingModeLevel(): string | null;
145
+ /**
146
+ * Get drying mode seconds remaining
147
+ * Returns the number of seconds remaining in drying mode
148
+ */
149
+ get dryingModeSecondsRemaining(): number;
150
+ }