tsvesync 1.0.11

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.
Files changed (138) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +227 -0
  3. package/api/vesync/VeSync.yaml +33 -0
  4. package/api/vesyncbulb/ESL100.yaml +74 -0
  5. package/api/vesyncbulb/ESL100CW.yaml +123 -0
  6. package/api/vesyncbulb/ESL100MC.yaml +169 -0
  7. package/api/vesyncbulb/XYD0001.yaml +193 -0
  8. package/api/vesyncfan/Classic200S.yaml +280 -0
  9. package/api/vesyncfan/Classic300S.yaml +278 -0
  10. package/api/vesyncfan/Core200S.yaml +256 -0
  11. package/api/vesyncfan/Core300S.yaml +281 -0
  12. package/api/vesyncfan/Core400S.yaml +281 -0
  13. package/api/vesyncfan/Core600S.yaml +281 -0
  14. package/api/vesyncfan/Dual200S.yaml +278 -0
  15. package/api/vesyncfan/LAP-C201S-AUSR.yaml +256 -0
  16. package/api/vesyncfan/LAP-C202S-WUSR.yaml +256 -0
  17. package/api/vesyncfan/LAP-C301S-WAAA.yaml +281 -0
  18. package/api/vesyncfan/LAP-C301S-WJP.yaml +281 -0
  19. package/api/vesyncfan/LAP-C302S-WUSB.yaml +281 -0
  20. package/api/vesyncfan/LAP-C401S-WAAA.yaml +281 -0
  21. package/api/vesyncfan/LAP-C401S-WJP.yaml +281 -0
  22. package/api/vesyncfan/LAP-C401S-WUSR.yaml +281 -0
  23. package/api/vesyncfan/LAP-C601S-WEU.yaml +281 -0
  24. package/api/vesyncfan/LAP-C601S-WUS.yaml +281 -0
  25. package/api/vesyncfan/LAP-C601S-WUSR.yaml +281 -0
  26. package/api/vesyncfan/LAP-EL551S-AEUR.yaml +167 -0
  27. package/api/vesyncfan/LAP-EL551S-AUS.yaml +167 -0
  28. package/api/vesyncfan/LAP-EL551S-WEU.yaml +167 -0
  29. package/api/vesyncfan/LAP-EL551S-WUS.yaml +167 -0
  30. package/api/vesyncfan/LAP-V102S-AASR.yaml +167 -0
  31. package/api/vesyncfan/LAP-V102S-AUSR.yaml +167 -0
  32. package/api/vesyncfan/LAP-V102S-WEU.yaml +167 -0
  33. package/api/vesyncfan/LAP-V102S-WJP.yaml +167 -0
  34. package/api/vesyncfan/LAP-V102S-WUS.yaml +167 -0
  35. package/api/vesyncfan/LAP-V201-AUSR.yaml +167 -0
  36. package/api/vesyncfan/LAP-V201S-AASR.yaml +167 -0
  37. package/api/vesyncfan/LAP-V201S-AEUR.yaml +167 -0
  38. package/api/vesyncfan/LAP-V201S-AUSR.yaml +167 -0
  39. package/api/vesyncfan/LAP-V201S-WEU.yaml +167 -0
  40. package/api/vesyncfan/LAP-V201S-WJP.yaml +167 -0
  41. package/api/vesyncfan/LAP-V201S-WUS.yaml +167 -0
  42. package/api/vesyncfan/LEH-S601S-WUS.yaml +303 -0
  43. package/api/vesyncfan/LEH-S601S-WUSR.yaml +82 -0
  44. package/api/vesyncfan/LTF-F422S-KEU.yaml +165 -0
  45. package/api/vesyncfan/LTF-F422S-WUS.yaml +165 -0
  46. package/api/vesyncfan/LTF-F422S-WUSR.yaml +167 -0
  47. package/api/vesyncfan/LTF-F422_WJP.yaml +165 -0
  48. package/api/vesyncfan/LUH-A601S-AUSW.yaml +82 -0
  49. package/api/vesyncfan/LUH-A601S-WUSB.yaml +305 -0
  50. package/api/vesyncfan/LUH-A602S-WEU.yaml +305 -0
  51. package/api/vesyncfan/LUH-A602S-WEUR.yaml +305 -0
  52. package/api/vesyncfan/LUH-A602S-WJP.yaml +305 -0
  53. package/api/vesyncfan/LUH-A602S-WUS.yaml +305 -0
  54. package/api/vesyncfan/LUH-A602S-WUSC.yaml +305 -0
  55. package/api/vesyncfan/LUH-A602S-WUSR.yaml +305 -0
  56. package/api/vesyncfan/LUH-D301S-WEU.yaml +305 -0
  57. package/api/vesyncfan/LUH-D301S-WJP.yaml +305 -0
  58. package/api/vesyncfan/LUH-D301S-WUSR.yaml +305 -0
  59. package/api/vesyncfan/LUH-M101S-WUS.yaml +278 -0
  60. package/api/vesyncfan/LUH-O451S-WEU.yaml +278 -0
  61. package/api/vesyncfan/LUH-O451S-WUS.yaml +278 -0
  62. package/api/vesyncfan/LUH-O451S-WUSR.yaml +305 -0
  63. package/api/vesyncfan/LUH-O601S-KUS.yaml +305 -0
  64. package/api/vesyncfan/LUH-O601S-WUS.yaml +305 -0
  65. package/api/vesyncfan/LV-PUR131S.yaml +108 -0
  66. package/api/vesyncfan/LV-RH131S.yaml +108 -0
  67. package/api/vesyncoutlet/ESO15-TB.yaml +124 -0
  68. package/api/vesyncoutlet/ESW01-EU.yaml +122 -0
  69. package/api/vesyncoutlet/ESW03-USA.yaml +122 -0
  70. package/api/vesyncoutlet/ESW15-USA.yaml +156 -0
  71. package/api/vesyncoutlet/wifi-switch-1.3.yaml +60 -0
  72. package/api/vesyncswitch/ESWD16.yaml +128 -0
  73. package/api/vesyncswitch/ESWL01.yaml +56 -0
  74. package/api/vesyncswitch/ESWL03.yaml +56 -0
  75. package/dist/lib/helpers.d.ts +87 -0
  76. package/dist/lib/helpers.js +222 -0
  77. package/dist/lib/helpers.js.map +1 -0
  78. package/dist/lib/vesync.d.ts +47 -0
  79. package/dist/lib/vesync.js +309 -0
  80. package/dist/lib/vesync.js.map +1 -0
  81. package/dist/lib/vesyncBaseDevice.d.ts +68 -0
  82. package/dist/lib/vesyncBaseDevice.js +116 -0
  83. package/dist/lib/vesyncBaseDevice.js.map +1 -0
  84. package/dist/lib/vesyncBulb.d.ts +0 -0
  85. package/dist/lib/vesyncBulb.js +2 -0
  86. package/dist/lib/vesyncBulb.js.map +1 -0
  87. package/dist/lib/vesyncFan.d.ts +92 -0
  88. package/dist/lib/vesyncFan.js +265 -0
  89. package/dist/lib/vesyncFan.js.map +1 -0
  90. package/dist/lib/vesyncKitchen.d.ts +0 -0
  91. package/dist/lib/vesyncKitchen.js +2 -0
  92. package/dist/lib/vesyncKitchen.js.map +1 -0
  93. package/dist/lib/vesyncOutlet.d.ts +0 -0
  94. package/dist/lib/vesyncOutlet.js +2 -0
  95. package/dist/lib/vesyncOutlet.js.map +1 -0
  96. package/dist/lib/vesyncSwitch.d.ts +0 -0
  97. package/dist/lib/vesyncSwitch.js +2 -0
  98. package/dist/lib/vesyncSwitch.js.map +1 -0
  99. package/dist/src/lib/helpers.d.ts +88 -0
  100. package/dist/src/lib/helpers.js +244 -0
  101. package/dist/src/lib/vesync.d.ts +89 -0
  102. package/dist/src/lib/vesync.js +430 -0
  103. package/dist/src/lib/vesyncBaseDevice.d.ts +43 -0
  104. package/dist/src/lib/vesyncBaseDevice.js +87 -0
  105. package/dist/src/lib/vesyncBulb.d.ts +79 -0
  106. package/dist/src/lib/vesyncBulb.js +198 -0
  107. package/dist/src/lib/vesyncBulbImpl.d.ts +38 -0
  108. package/dist/src/lib/vesyncBulbImpl.js +161 -0
  109. package/dist/src/lib/vesyncFan.d.ts +80 -0
  110. package/dist/src/lib/vesyncFan.js +406 -0
  111. package/dist/src/lib/vesyncFanImpl.d.ts +137 -0
  112. package/dist/src/lib/vesyncFanImpl.js +643 -0
  113. package/dist/src/lib/vesyncOutlet.d.ts +53 -0
  114. package/dist/src/lib/vesyncOutlet.js +98 -0
  115. package/dist/src/lib/vesyncOutletImpl.d.ts +70 -0
  116. package/dist/src/lib/vesyncOutletImpl.js +206 -0
  117. package/dist/src/lib/vesyncSwitch.d.ts +169 -0
  118. package/dist/src/lib/vesyncSwitch.js +414 -0
  119. package/dist/src/lib/vesyncSwitchImpl.d.ts +82 -0
  120. package/dist/src/lib/vesyncSwitchImpl.js +290 -0
  121. package/dist/test/testFeatures.d.ts +4 -0
  122. package/dist/test/testFeatures.js +394 -0
  123. package/dist/test/testService.d.ts +62 -0
  124. package/dist/test/testService.js +540 -0
  125. package/dist/test/testSpecial.d.ts +5 -0
  126. package/dist/test/testSpecial.js +227 -0
  127. package/package.json +53 -0
  128. package/src/lib/helpers.ts +290 -0
  129. package/src/lib/vesync.ts +530 -0
  130. package/src/lib/vesyncBaseDevice.ts +114 -0
  131. package/src/lib/vesyncBulb.ts +252 -0
  132. package/src/lib/vesyncBulbImpl.ts +215 -0
  133. package/src/lib/vesyncFan.ts +447 -0
  134. package/src/lib/vesyncFanImpl.ts +848 -0
  135. package/src/lib/vesyncOutlet.ts +148 -0
  136. package/src/lib/vesyncOutletImpl.ts +284 -0
  137. package/src/lib/vesyncSwitch.ts +546 -0
  138. package/src/lib/vesyncSwitchImpl.ts +408 -0
@@ -0,0 +1,406 @@
1
+ "use strict";
2
+ /**
3
+ * VeSync Fan Classes
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.VeSyncFan = exports.fanConfig = void 0;
7
+ const vesyncBaseDevice_1 = require("./vesyncBaseDevice");
8
+ // Fan configuration
9
+ exports.fanConfig = {
10
+ // Core Series
11
+ 'Core200S': {
12
+ module: 'VeSyncAirBypass',
13
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
14
+ },
15
+ 'Core300S': {
16
+ module: 'VeSyncAirBypass',
17
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
18
+ },
19
+ 'Core400S': {
20
+ module: 'VeSyncAirBypass',
21
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
22
+ },
23
+ 'Core600S': {
24
+ module: 'VeSyncAirBypass',
25
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
26
+ },
27
+ // LAP Series
28
+ 'LAP-C201S-AUSR': {
29
+ module: 'VeSyncAirBypass',
30
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
31
+ },
32
+ 'LAP-C202S-WUSR': {
33
+ module: 'VeSyncAirBypass',
34
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
35
+ },
36
+ 'LAP-C301S-WJP': {
37
+ module: 'VeSyncAirBypass',
38
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
39
+ },
40
+ 'LAP-C302S-WUSB': {
41
+ module: 'VeSyncAirBypass',
42
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
43
+ },
44
+ 'LAP-C301S-WAAA': {
45
+ module: 'VeSyncAirBypass',
46
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
47
+ },
48
+ 'LAP-C401S-WJP': {
49
+ module: 'VeSyncAirBypass',
50
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
51
+ },
52
+ 'LAP-C401S-WUSR': {
53
+ module: 'VeSyncAirBypass',
54
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
55
+ },
56
+ 'LAP-C401S-WAAA': {
57
+ module: 'VeSyncAirBypass',
58
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
59
+ },
60
+ 'LAP-C601S-WUS': {
61
+ module: 'VeSyncAirBypass',
62
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
63
+ },
64
+ 'LAP-C601S-WUSR': {
65
+ module: 'VeSyncAirBypass',
66
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
67
+ },
68
+ 'LAP-C601S-WEU': {
69
+ module: 'VeSyncAirBypass',
70
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
71
+ },
72
+ 'LAP-V102S-AASR': {
73
+ module: 'VeSyncAirBypass',
74
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
75
+ },
76
+ 'LAP-V102S-WUS': {
77
+ module: 'VeSyncAirBypass',
78
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
79
+ },
80
+ 'LAP-V102S-WEU': {
81
+ module: 'VeSyncAirBypass',
82
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
83
+ },
84
+ 'LAP-V102S-AUSR': {
85
+ module: 'VeSyncAirBypass',
86
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
87
+ },
88
+ 'LAP-V102S-WJP': {
89
+ module: 'VeSyncAirBypass',
90
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
91
+ },
92
+ 'LAP-V201S-AASR': {
93
+ module: 'VeSyncAirBypass',
94
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
95
+ },
96
+ 'LAP-V201S-WJP': {
97
+ module: 'VeSyncAirBypass',
98
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
99
+ },
100
+ 'LAP-V201S-WEU': {
101
+ module: 'VeSyncAirBypass',
102
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
103
+ },
104
+ 'LAP-V201S-WUS': {
105
+ module: 'VeSyncAirBypass',
106
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
107
+ },
108
+ 'LAP-V201-AUSR': {
109
+ module: 'VeSyncAirBypass',
110
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
111
+ },
112
+ 'LAP-V201S-AUSR': {
113
+ module: 'VeSyncAirBypass',
114
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
115
+ },
116
+ 'LAP-V201S-AEUR': {
117
+ module: 'VeSyncAirBypass',
118
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
119
+ },
120
+ 'LAP-EL551S-AUS': {
121
+ module: 'VeSyncAirBypass',
122
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
123
+ },
124
+ 'LAP-EL551S-AEUR': {
125
+ module: 'VeSyncAirBypass',
126
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
127
+ },
128
+ 'LAP-EL551S-WEU': {
129
+ module: 'VeSyncAirBypass',
130
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
131
+ },
132
+ 'LAP-EL551S-WUS': {
133
+ module: 'VeSyncAirBypass',
134
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
135
+ },
136
+ // LTF Series
137
+ 'LTF-F422S-KEU': {
138
+ module: 'VeSyncAirBypass',
139
+ features: ['display', 'child_lock', 'night_light', 'timer']
140
+ },
141
+ 'LTF-F422S-WUSR': {
142
+ module: 'VeSyncAirBypass',
143
+ features: ['display', 'child_lock', 'night_light', 'timer']
144
+ },
145
+ 'LTF-F422_WJP': {
146
+ module: 'VeSyncAirBypass',
147
+ features: ['display', 'child_lock', 'night_light', 'timer']
148
+ },
149
+ 'LTF-F422S-WUS': {
150
+ module: 'VeSyncAirBypass',
151
+ features: ['display', 'child_lock', 'night_light', 'timer']
152
+ },
153
+ // Classic Series
154
+ 'Classic300S': {
155
+ module: 'VeSyncHumidifier',
156
+ features: ['display', 'humidity', 'mist', 'timer', 'auto_mode']
157
+ },
158
+ 'Classic200S': {
159
+ module: 'VeSyncHumidifier',
160
+ features: ['display', 'humidity', 'mist', 'timer', 'auto_mode']
161
+ },
162
+ // Dual Series
163
+ 'Dual200S': {
164
+ module: 'VeSyncHumidifier',
165
+ features: ['display', 'humidity', 'mist', 'timer', 'auto_mode']
166
+ },
167
+ // LUH Series
168
+ 'LUH-A601S-WUSB': {
169
+ module: 'VeSyncWarmHumidifier',
170
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
171
+ },
172
+ 'LUH-A601S-AUSW': {
173
+ module: 'VeSyncWarmHumidifier',
174
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
175
+ },
176
+ 'LUH-D301S-WUSR': {
177
+ module: 'VeSyncWarmHumidifier',
178
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
179
+ },
180
+ 'LUH-D301S-WJP': {
181
+ module: 'VeSyncWarmHumidifier',
182
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
183
+ },
184
+ 'LUH-D301S-WEU': {
185
+ module: 'VeSyncWarmHumidifier',
186
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
187
+ },
188
+ 'LUH-A602S-WUSR': {
189
+ module: 'VeSyncWarmHumidifier',
190
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
191
+ },
192
+ 'LUH-A602S-WUS': {
193
+ module: 'VeSyncWarmHumidifier',
194
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
195
+ },
196
+ 'LUH-A602S-WEUR': {
197
+ module: 'VeSyncWarmHumidifier',
198
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
199
+ },
200
+ 'LUH-A602S-WEU': {
201
+ module: 'VeSyncWarmHumidifier',
202
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
203
+ },
204
+ 'LUH-A602S-WJP': {
205
+ module: 'VeSyncWarmHumidifier',
206
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
207
+ },
208
+ 'LUH-A602S-WUSC': {
209
+ module: 'VeSyncWarmHumidifier',
210
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
211
+ },
212
+ 'LUH-O451S-WEU': {
213
+ module: 'VeSyncWarmHumidifier',
214
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
215
+ },
216
+ 'LUH-O451S-WUS': {
217
+ module: 'VeSyncWarmHumidifier',
218
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
219
+ },
220
+ 'LUH-O451S-WUSR': {
221
+ module: 'VeSyncWarmHumidifier',
222
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
223
+ },
224
+ 'LUH-O601S-WUS': {
225
+ module: 'VeSyncWarmHumidifier',
226
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
227
+ },
228
+ 'LUH-O601S-KUS': {
229
+ module: 'VeSyncWarmHumidifier',
230
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
231
+ },
232
+ 'LUH-M101S-WUS': {
233
+ module: 'VeSyncWarmHumidifier',
234
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
235
+ },
236
+ // LEH Series
237
+ 'LEH-S601S-WUS': {
238
+ module: 'VeSyncWarmHumidifier',
239
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode', 'drying']
240
+ },
241
+ 'LEH-S601S-WUSR': {
242
+ module: 'VeSyncWarmHumidifier',
243
+ features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode', 'drying']
244
+ },
245
+ // LV Series
246
+ 'LV-PUR131S': {
247
+ module: 'VeSyncAirBypass',
248
+ features: ['air_quality', 'display', 'child_lock', 'night_light', 'timer']
249
+ },
250
+ 'LV-RH131S': {
251
+ module: 'VeSyncAirBypass',
252
+ features: ['display', 'child_lock', 'night_light', 'timer']
253
+ }
254
+ };
255
+ /**
256
+ * Base class for VeSync Fans
257
+ */
258
+ class VeSyncFan extends vesyncBaseDevice_1.VeSyncBaseDevice {
259
+ constructor(details, manager) {
260
+ super(details, manager);
261
+ this.details = {};
262
+ this.mode_dict = {};
263
+ this.speed_dict = {};
264
+ this.features = [];
265
+ this.details = details;
266
+ this.features = exports.fanConfig[this.deviceType]?.features || [];
267
+ }
268
+ /**
269
+ * Check if feature is supported
270
+ */
271
+ hasFeature(feature) {
272
+ return this.features.includes(feature);
273
+ }
274
+ /**
275
+ * Get current mode
276
+ */
277
+ get mode() {
278
+ return this.details.mode ?? '';
279
+ }
280
+ /**
281
+ * Get current speed
282
+ */
283
+ get speed() {
284
+ return this.details.speed ?? 0;
285
+ }
286
+ /**
287
+ * Get filter life percentage
288
+ */
289
+ get filterLife() {
290
+ return this.details.filter_life ?? 0;
291
+ }
292
+ /**
293
+ * Get screen status
294
+ */
295
+ get screenStatus() {
296
+ return this.details.screen_status ?? '';
297
+ }
298
+ /**
299
+ * Get child lock status
300
+ */
301
+ get childLock() {
302
+ return this.details.child_lock ?? '';
303
+ }
304
+ /**
305
+ * Get air quality (if supported)
306
+ */
307
+ get airQuality() {
308
+ return this.details.air_quality ?? '';
309
+ }
310
+ /**
311
+ * Get humidity level (if supported)
312
+ */
313
+ get humidity() {
314
+ return this.details.humidity ?? 0;
315
+ }
316
+ /**
317
+ * Get mist level (if supported)
318
+ */
319
+ get mistLevel() {
320
+ return this.details.mist_level ?? 0;
321
+ }
322
+ /**
323
+ * Get warm level (if supported)
324
+ */
325
+ get warmLevel() {
326
+ return this.details.warm_level ?? 0;
327
+ }
328
+ /**
329
+ * Get timer status
330
+ */
331
+ get timer() {
332
+ return this.details.timer ?? 0;
333
+ }
334
+ /**
335
+ * Return formatted device info to stdout
336
+ */
337
+ display() {
338
+ super.display();
339
+ const info = [
340
+ ['Mode: ', this.mode],
341
+ ['Speed: ', this.speed],
342
+ ['Filter Life: ', this.filterLife, '%']
343
+ ];
344
+ if (this.hasFeature('display')) {
345
+ info.push(['Screen Status: ', this.screenStatus]);
346
+ }
347
+ if (this.hasFeature('child_lock')) {
348
+ info.push(['Child Lock: ', this.childLock]);
349
+ }
350
+ if (this.hasFeature('air_quality')) {
351
+ info.push(['Air Quality: ', this.airQuality]);
352
+ }
353
+ if (this.hasFeature('humidity')) {
354
+ info.push(['Humidity: ', this.humidity, '%']);
355
+ }
356
+ if (this.hasFeature('mist')) {
357
+ info.push(['Mist Level: ', this.mistLevel]);
358
+ }
359
+ if (this.hasFeature('warm')) {
360
+ info.push(['Warm Level: ', this.warmLevel]);
361
+ }
362
+ if (this.hasFeature('timer')) {
363
+ info.push(['Timer: ', this.timer, 'hours']);
364
+ }
365
+ for (const [key, value, unit = ''] of info) {
366
+ console.log(`${key.toString().padEnd(30, '.')} ${value}${unit}`);
367
+ }
368
+ }
369
+ /**
370
+ * Return JSON details for fan
371
+ */
372
+ displayJSON() {
373
+ const baseInfo = JSON.parse(super.displayJSON());
374
+ const details = {
375
+ 'Mode': this.mode,
376
+ 'Speed': this.speed.toString(),
377
+ 'Filter Life': this.filterLife.toString()
378
+ };
379
+ if (this.hasFeature('display')) {
380
+ details['Screen Status'] = this.screenStatus;
381
+ }
382
+ if (this.hasFeature('child_lock')) {
383
+ details['Child Lock'] = this.childLock;
384
+ }
385
+ if (this.hasFeature('air_quality')) {
386
+ details['Air Quality'] = this.airQuality;
387
+ }
388
+ if (this.hasFeature('humidity')) {
389
+ details['Humidity'] = this.humidity.toString();
390
+ }
391
+ if (this.hasFeature('mist')) {
392
+ details['Mist Level'] = this.mistLevel.toString();
393
+ }
394
+ if (this.hasFeature('warm')) {
395
+ details['Warm Level'] = this.warmLevel.toString();
396
+ }
397
+ if (this.hasFeature('timer')) {
398
+ details['Timer'] = this.timer.toString();
399
+ }
400
+ return JSON.stringify({
401
+ ...baseInfo,
402
+ ...details
403
+ }, null, 4);
404
+ }
405
+ }
406
+ exports.VeSyncFan = VeSyncFan;
@@ -0,0 +1,137 @@
1
+ /**
2
+ * VeSync Fan Implementations
3
+ */
4
+ import { VeSyncFan } from './vesyncFan';
5
+ import { VeSync } from './vesync';
6
+ /**
7
+ * VeSync Air Purifier with Bypass
8
+ */
9
+ export declare class VeSyncAirBypass extends VeSyncFan {
10
+ protected readonly modes: readonly ["auto", "manual", "sleep"];
11
+ protected readonly speeds: number[];
12
+ protected readonly displayModes: readonly ["on", "off"];
13
+ protected readonly childLockModes: readonly ["on", "off"];
14
+ constructor(details: Record<string, any>, manager: VeSync);
15
+ /**
16
+ * Get device details
17
+ */
18
+ getDetails(): Promise<void>;
19
+ /**
20
+ * Turn device on
21
+ */
22
+ turnOn(): Promise<boolean>;
23
+ /**
24
+ * Turn device off
25
+ */
26
+ turnOff(): Promise<boolean>;
27
+ /**
28
+ * Change fan speed
29
+ */
30
+ changeFanSpeed(speed: number): Promise<boolean>;
31
+ /**
32
+ * Set device mode
33
+ */
34
+ setMode(mode: string): Promise<boolean>;
35
+ /**
36
+ * Set display status
37
+ */
38
+ setDisplay(enabled: boolean): Promise<boolean>;
39
+ /**
40
+ * Set child lock
41
+ */
42
+ setChildLock(enabled: boolean): Promise<boolean>;
43
+ /**
44
+ * Set timer
45
+ */
46
+ setTimer(hours: number): Promise<boolean>;
47
+ /**
48
+ * Clear timer
49
+ */
50
+ clearTimer(): Promise<boolean>;
51
+ /**
52
+ * Turn automatic stop on
53
+ */
54
+ automaticStopOn(): Promise<boolean>;
55
+ /**
56
+ * Turn automatic stop off
57
+ */
58
+ automaticStopOff(): Promise<boolean>;
59
+ }
60
+ /**
61
+ * VeSync Humidifier Base Class
62
+ */
63
+ export declare class VeSyncHumidifier extends VeSyncFan {
64
+ protected readonly modes: readonly ["auto", "manual", "sleep"];
65
+ protected readonly speeds: number[];
66
+ protected readonly displayModes: readonly ["on", "off"];
67
+ protected readonly mistLevels: number[];
68
+ protected readonly humidityRange: {
69
+ min: number;
70
+ max: number;
71
+ };
72
+ constructor(details: Record<string, any>, manager: VeSync);
73
+ /**
74
+ * Get device details
75
+ */
76
+ getDetails(): Promise<void>;
77
+ /**
78
+ * Turn device on
79
+ */
80
+ turnOn(): Promise<boolean>;
81
+ /**
82
+ * Turn device off
83
+ */
84
+ turnOff(): Promise<boolean>;
85
+ /**
86
+ * Change fan speed
87
+ */
88
+ changeFanSpeed(speed: number): Promise<boolean>;
89
+ /**
90
+ * Set device mode
91
+ */
92
+ setMode(mode: string): Promise<boolean>;
93
+ /**
94
+ * Set mist level
95
+ */
96
+ setMistLevel(level: number): Promise<boolean>;
97
+ /**
98
+ * Set target humidity
99
+ */
100
+ setHumidity(humidity: number): Promise<boolean>;
101
+ /**
102
+ * Set display status
103
+ */
104
+ setDisplay(enabled: boolean): Promise<boolean>;
105
+ /**
106
+ * Set timer
107
+ */
108
+ setTimer(hours: number): Promise<boolean>;
109
+ /**
110
+ * Clear timer
111
+ */
112
+ clearTimer(): Promise<boolean>;
113
+ /**
114
+ * Turn automatic stop on
115
+ */
116
+ automaticStopOn(): Promise<boolean>;
117
+ /**
118
+ * Turn automatic stop off
119
+ */
120
+ automaticStopOff(): Promise<boolean>;
121
+ }
122
+ /**
123
+ * VeSync Warm Humidifier Class
124
+ */
125
+ export declare class VeSyncWarmHumidifier extends VeSyncHumidifier {
126
+ protected readonly warmLevels: number[];
127
+ constructor(details: Record<string, any>, manager: VeSync);
128
+ /**
129
+ * Set warm mist level
130
+ */
131
+ setWarmLevel(level: number): Promise<boolean>;
132
+ /**
133
+ * Set drying mode enabled
134
+ */
135
+ setDryingModeEnabled(enabled: boolean): Promise<boolean>;
136
+ }
137
+ export declare const fanModules: Record<string, new (details: Record<string, any>, manager: VeSync) => VeSyncFan>;