tsvesync 1.6.1 → 1.7.0

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.
@@ -1,165 +1,209 @@
1
- change_fan_speed:
2
- headers:
3
- Content-Type: application/json; charset=UTF-8
4
- User-Agent: okhttp/3.12.1
1
+ # Tower fan request contracts, aligned with pyvesync devices/vesyncfan.py.
2
+ # Authentication headers and metadata are supplied by Helpers at runtime.
3
+ update:
4
+ method: post
5
+ url: /cloud/v2/deviceManaged/bypassV2
5
6
  json_object:
6
- acceptLanguage: en
7
- accountID: sample_id
8
- appVersion: 2.8.6
7
+ method: bypassV2
9
8
  cid: LTF-F422_WJP-CID
10
- configModel: ConfigModule
11
9
  configModule: ConfigModule
12
- debugMode: false
13
- deviceId: LTF-F422_WJP-CID
14
- deviceRegion: US
10
+ payload:
11
+ method: getTowerFanStatus
12
+ source: APP
13
+ data: {}
14
+ turn_on:
15
+ method: post
16
+ url: /cloud/v2/deviceManaged/bypassV2
17
+ json_object:
15
18
  method: bypassV2
19
+ cid: LTF-F422_WJP-CID
20
+ configModule: ConfigModule
16
21
  payload:
22
+ method: setSwitch
23
+ source: APP
24
+ data:
25
+ powerSwitch: 1
26
+ switchIdx: 0
27
+ turn_off:
28
+ method: post
29
+ url: /cloud/v2/deviceManaged/bypassV2
30
+ json_object:
31
+ method: bypassV2
32
+ cid: LTF-F422_WJP-CID
33
+ configModule: ConfigModule
34
+ payload:
35
+ method: setSwitch
36
+ source: APP
37
+ data:
38
+ powerSwitch: 0
39
+ switchIdx: 0
40
+ change_fan_speed:
41
+ method: post
42
+ url: /cloud/v2/deviceManaged/bypassV2
43
+ json_object:
44
+ method: bypassV2
45
+ cid: LTF-F422_WJP-CID
46
+ configModule: ConfigModule
47
+ payload:
48
+ method: setLevel
49
+ source: APP
17
50
  data:
18
51
  levelIdx: 0
19
52
  levelType: wind
20
53
  manualSpeedLevel: 3
21
- method: setLevel
22
- source: APP
23
- phoneBrand: SM N9005
24
- phoneOS: Android
25
- timeZone: America/New_York
26
- token: sample_tk
27
- traceId: TRACE_ID
54
+ manual_mode:
28
55
  method: post
29
56
  url: /cloud/v2/deviceManaged/bypassV2
30
- manual_mode:
31
- headers:
32
- Content-Type: application/json; charset=UTF-8
33
- User-Agent: okhttp/3.12.1
34
57
  json_object:
35
- acceptLanguage: en
36
- accountID: sample_id
37
- appVersion: 2.8.6
58
+ method: bypassV2
38
59
  cid: LTF-F422_WJP-CID
39
- configModel: ConfigModule
40
60
  configModule: ConfigModule
41
- debugMode: false
42
- deviceId: LTF-F422_WJP-CID
43
- deviceRegion: US
44
- method: bypassV2
45
61
  payload:
62
+ method: setTowerFanMode
63
+ source: APP
46
64
  data:
47
65
  workMode: normal
66
+ auto_mode:
67
+ method: post
68
+ url: /cloud/v2/deviceManaged/bypassV2
69
+ json_object:
70
+ method: bypassV2
71
+ cid: LTF-F422_WJP-CID
72
+ configModule: ConfigModule
73
+ payload:
48
74
  method: setTowerFanMode
49
75
  source: APP
50
- phoneBrand: SM N9005
51
- phoneOS: Android
52
- timeZone: America/New_York
53
- token: sample_tk
54
- traceId: TRACE_ID
76
+ data:
77
+ workMode: auto
78
+ sleep_mode:
55
79
  method: post
56
80
  url: /cloud/v2/deviceManaged/bypassV2
57
- sleep_mode:
58
- headers:
59
- Content-Type: application/json; charset=UTF-8
60
- User-Agent: okhttp/3.12.1
61
81
  json_object:
62
- acceptLanguage: en
63
- accountID: sample_id
64
- appVersion: 2.8.6
82
+ method: bypassV2
65
83
  cid: LTF-F422_WJP-CID
66
- configModel: ConfigModule
67
84
  configModule: ConfigModule
68
- debugMode: false
69
- deviceId: LTF-F422_WJP-CID
70
- deviceRegion: US
71
- method: bypassV2
72
85
  payload:
86
+ method: setTowerFanMode
87
+ source: APP
73
88
  data:
74
89
  workMode: advancedSleep
90
+ turbo_mode:
91
+ method: post
92
+ url: /cloud/v2/deviceManaged/bypassV2
93
+ json_object:
94
+ method: bypassV2
95
+ cid: LTF-F422_WJP-CID
96
+ configModule: ConfigModule
97
+ payload:
75
98
  method: setTowerFanMode
76
99
  source: APP
77
- phoneBrand: SM N9005
78
- phoneOS: Android
79
- timeZone: America/New_York
80
- token: sample_tk
81
- traceId: TRACE_ID
100
+ data:
101
+ workMode: turbo
102
+ oscillation_on:
82
103
  method: post
83
104
  url: /cloud/v2/deviceManaged/bypassV2
84
- turn_off:
85
- headers:
86
- Content-Type: application/json; charset=UTF-8
87
- User-Agent: okhttp/3.12.1
88
105
  json_object:
89
- acceptLanguage: en
90
- accountID: sample_id
91
- appVersion: 2.8.6
106
+ method: bypassV2
92
107
  cid: LTF-F422_WJP-CID
93
- configModel: ConfigModule
94
108
  configModule: ConfigModule
95
- debugMode: false
96
- deviceId: LTF-F422_WJP-CID
97
- deviceRegion: US
109
+ payload:
110
+ method: setOscillationSwitch
111
+ source: APP
112
+ data:
113
+ oscillationSwitch: 1
114
+ oscillation_off:
115
+ method: post
116
+ url: /cloud/v2/deviceManaged/bypassV2
117
+ json_object:
98
118
  method: bypassV2
119
+ cid: LTF-F422_WJP-CID
120
+ configModule: ConfigModule
99
121
  payload:
122
+ method: setOscillationSwitch
123
+ source: APP
100
124
  data:
101
- powerSwitch: 0
102
- switchIdx: 0
103
- method: setSwitch
125
+ oscillationSwitch: 0
126
+ display_on:
127
+ method: post
128
+ url: /cloud/v2/deviceManaged/bypassV2
129
+ json_object:
130
+ method: bypassV2
131
+ cid: LTF-F422_WJP-CID
132
+ configModule: ConfigModule
133
+ payload:
134
+ method: setDisplay
104
135
  source: APP
105
- phoneBrand: SM N9005
106
- phoneOS: Android
107
- timeZone: America/New_York
108
- token: sample_tk
109
- traceId: TRACE_ID
136
+ data:
137
+ screenSwitch: 1
138
+ display_off:
110
139
  method: post
111
140
  url: /cloud/v2/deviceManaged/bypassV2
112
- turn_on:
113
- headers:
114
- Content-Type: application/json; charset=UTF-8
115
- User-Agent: okhttp/3.12.1
116
141
  json_object:
117
- acceptLanguage: en
118
- accountID: sample_id
119
- appVersion: 2.8.6
142
+ method: bypassV2
120
143
  cid: LTF-F422_WJP-CID
121
- configModel: ConfigModule
122
144
  configModule: ConfigModule
123
- debugMode: false
124
- deviceId: LTF-F422_WJP-CID
125
- deviceRegion: US
145
+ payload:
146
+ method: setDisplay
147
+ source: APP
148
+ data:
149
+ screenSwitch: 0
150
+ mute_on:
151
+ method: post
152
+ url: /cloud/v2/deviceManaged/bypassV2
153
+ json_object:
126
154
  method: bypassV2
155
+ cid: LTF-F422_WJP-CID
156
+ configModule: ConfigModule
127
157
  payload:
158
+ method: setMuteSwitch
159
+ source: APP
128
160
  data:
129
- powerSwitch: 1
130
- switchIdx: 0
131
- method: setSwitch
161
+ muteSwitch: 1
162
+ mute_off:
163
+ method: post
164
+ url: /cloud/v2/deviceManaged/bypassV2
165
+ json_object:
166
+ method: bypassV2
167
+ cid: LTF-F422_WJP-CID
168
+ configModule: ConfigModule
169
+ payload:
170
+ method: setMuteSwitch
132
171
  source: APP
133
- phoneBrand: SM N9005
134
- phoneOS: Android
135
- timeZone: America/New_York
136
- token: sample_tk
137
- traceId: TRACE_ID
172
+ data:
173
+ muteSwitch: 0
174
+ set_timer:
138
175
  method: post
139
176
  url: /cloud/v2/deviceManaged/bypassV2
140
- update:
141
- headers:
142
- Content-Type: application/json; charset=UTF-8
143
- User-Agent: okhttp/3.12.1
144
177
  json_object:
145
- acceptLanguage: en
146
- accountID: sample_id
147
- appVersion: 2.8.6
178
+ method: bypassV2
148
179
  cid: LTF-F422_WJP-CID
149
- configModel: ConfigModule
150
180
  configModule: ConfigModule
151
- debugMode: false
152
- deviceId: LTF-F422_WJP-CID
153
- deviceRegion: US
181
+ payload:
182
+ method: setTimer
183
+ source: APP
184
+ data:
185
+ action: 'off'
186
+ total: 3600
187
+ get_timer:
188
+ method: post
189
+ url: /cloud/v2/deviceManaged/bypassV2
190
+ json_object:
154
191
  method: bypassV2
192
+ cid: LTF-F422_WJP-CID
193
+ configModule: ConfigModule
155
194
  payload:
156
- data: {}
157
- method: getTowerFanStatus
195
+ method: getTimer
158
196
  source: APP
159
- phoneBrand: SM N9005
160
- phoneOS: Android
161
- timeZone: America/New_York
162
- token: sample_tk
163
- traceId: TRACE_ID
197
+ data: {}
198
+ clear_timer:
164
199
  method: post
165
200
  url: /cloud/v2/deviceManaged/bypassV2
201
+ json_object:
202
+ method: bypassV2
203
+ cid: LTF-F422_WJP-CID
204
+ configModule: ConfigModule
205
+ payload:
206
+ method: clearTimer
207
+ source: APP
208
+ data:
209
+ id: 1
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { VeSyncAirBypass } from './lib/vesyncFanImpl';
3
3
  export { VeSyncOutlet7A, VeSyncOutlet10A, VeSyncOutlet15A, VeSyncOutdoorPlug } from './lib/vesyncOutletImpl';
4
4
  export { VeSyncBulb } from './lib/vesyncBulb';
5
5
  export { VeSyncWallSwitch, VeSyncDimmerSwitch } from './lib/vesyncSwitchImpl';
6
+ export { VeSyncTowerFan } from './lib/fans/towerFan';
6
7
  export { VeSyncBaseDevice } from './lib/vesyncBaseDevice';
7
8
  export { Helpers, setApiBaseUrl } from './lib/helpers';
8
9
  export { CREDENTIAL_ERROR_CODES, CROSS_REGION_ERROR_CODES, isCredentialError, isCrossRegionError } from './lib/constants';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decodeJwtTimestamps = exports.isCrossRegionError = exports.isCredentialError = exports.CROSS_REGION_ERROR_CODES = exports.CREDENTIAL_ERROR_CODES = exports.setApiBaseUrl = exports.Helpers = exports.VeSyncBaseDevice = exports.VeSyncDimmerSwitch = exports.VeSyncWallSwitch = exports.VeSyncBulb = exports.VeSyncOutdoorPlug = exports.VeSyncOutlet15A = exports.VeSyncOutlet10A = exports.VeSyncOutlet7A = exports.VeSyncAirBypass = exports.VeSync = void 0;
3
+ exports.decodeJwtTimestamps = exports.isCrossRegionError = exports.isCredentialError = exports.CROSS_REGION_ERROR_CODES = exports.CREDENTIAL_ERROR_CODES = exports.setApiBaseUrl = exports.Helpers = exports.VeSyncBaseDevice = exports.VeSyncTowerFan = exports.VeSyncDimmerSwitch = exports.VeSyncWallSwitch = exports.VeSyncBulb = exports.VeSyncOutdoorPlug = exports.VeSyncOutlet15A = exports.VeSyncOutlet10A = exports.VeSyncOutlet7A = exports.VeSyncAirBypass = exports.VeSync = void 0;
4
4
  // Export main VeSync manager class
5
5
  var vesync_1 = require("./lib/vesync");
6
6
  Object.defineProperty(exports, "VeSync", { enumerable: true, get: function () { return vesync_1.VeSync; } });
@@ -17,6 +17,9 @@ Object.defineProperty(exports, "VeSyncBulb", { enumerable: true, get: function (
17
17
  var vesyncSwitchImpl_1 = require("./lib/vesyncSwitchImpl");
18
18
  Object.defineProperty(exports, "VeSyncWallSwitch", { enumerable: true, get: function () { return vesyncSwitchImpl_1.VeSyncWallSwitch; } });
19
19
  Object.defineProperty(exports, "VeSyncDimmerSwitch", { enumerable: true, get: function () { return vesyncSwitchImpl_1.VeSyncDimmerSwitch; } });
20
+ // Tower fan API
21
+ var towerFan_1 = require("./lib/fans/towerFan");
22
+ Object.defineProperty(exports, "VeSyncTowerFan", { enumerable: true, get: function () { return towerFan_1.VeSyncTowerFan; } });
20
23
  // Export base device class
21
24
  var vesyncBaseDevice_1 = require("./lib/vesyncBaseDevice");
22
25
  Object.defineProperty(exports, "VeSyncBaseDevice", { enumerable: true, get: function () { return vesyncBaseDevice_1.VeSyncBaseDevice; } });
@@ -71,6 +71,7 @@ exports.fanModules = {
71
71
  // LTF Series
72
72
  'LTF-F422S-KEU': towerFan_1.VeSyncTowerFan,
73
73
  'LTF-F422S-WUSR': towerFan_1.VeSyncTowerFan,
74
+ 'LTF-F422S-WJP': towerFan_1.VeSyncTowerFan,
74
75
  'LTF-F422_WJP': towerFan_1.VeSyncTowerFan,
75
76
  'LTF-F422S-WUS': towerFan_1.VeSyncTowerFan,
76
77
  // Classic Series
@@ -1,105 +1,53 @@
1
1
  import { VeSyncAirBaseV2 } from './airBaseV2';
2
2
  import { VeSync } from '../vesync';
3
- /**
4
- * VeSync Tower Fan Implementation
5
- */
3
+ /** LTF-F422S tower fans use different commands from bypassV2 purifiers. */
6
4
  export declare class VeSyncTowerFan extends VeSyncAirBaseV2 {
7
- protected readonly towerModes: readonly ["normal", "advancedSleep", "off"];
5
+ protected readonly towerModes: readonly ["normal", "auto", "advancedSleep", "turbo", "off"];
6
+ private timerId?;
7
+ private timerDeadline?;
8
8
  constructor(details: Record<string, any>, manager: VeSync);
9
- /**
10
- * Get device details
11
- */
12
- getDetails(): Promise<Boolean>;
13
- /**
14
- * Toggle device power
15
- */
9
+ /** A successful cloud envelope can still contain a rejected device command. */
10
+ protected checkResponse(response: [any, number], method: string): boolean;
11
+ private request;
12
+ getDetails(): Promise<boolean>;
16
13
  toggleSwitch(toggle: boolean): Promise<boolean>;
17
- /**
18
- * Turn device on
19
- */
20
14
  turnOn(): Promise<boolean>;
21
- /**
22
- * Turn device off
23
- */
24
15
  turnOff(): Promise<boolean>;
25
- /**
26
- * Set tower fan mode
27
- */
28
16
  mode_toggle(mode: string): Promise<boolean>;
29
- /**
30
- * Change fan speed
31
- */
32
- changeFanSpeed(speed: number): Promise<boolean>;
33
- /**
34
- * Set normal mode
35
- */
17
+ setMode(mode: string): Promise<boolean>;
36
18
  normal_mode(): Promise<boolean>;
37
- /**
38
- * Set manual mode - adapter to set mode to normal
39
- */
40
19
  manual_mode(): Promise<boolean>;
41
- /**
42
- * Set advanced sleep mode
43
- */
44
20
  advanced_sleep_mode(): Promise<boolean>;
45
- /**
46
- * Set sleep mode - adapter for advanced sleep mode
47
- */
48
21
  sleep_mode(): Promise<boolean>;
49
- /**
50
- * Override setMode to handle tower fan specific modes
51
- */
52
- setMode(mode: string): Promise<boolean>;
53
- /**
54
- * Get current speed
55
- */
22
+ changeFanSpeed(speed: number): Promise<boolean>;
23
+ setOscillation(toggle: boolean): Promise<boolean>;
24
+ setOscillationOn(): Promise<boolean>;
25
+ setOscillationOff(): Promise<boolean>;
26
+ setDisplay(enabled: boolean): Promise<boolean>;
27
+ setMute(enabled: boolean): Promise<boolean>;
28
+ /** Public timer duration remains hours, like the other tsvesync devices. */
29
+ setTimer(hours: number, action?: string): Promise<boolean>;
30
+ getTimer(): Promise<boolean>;
31
+ clearTimer(): Promise<boolean>;
32
+ private updateTimerState;
33
+ get timerRemaining(): number;
34
+ get mode(): string;
35
+ set mode(value: string);
56
36
  get speed(): number;
57
- /**
58
- * Get display status
59
- */
37
+ set speed(value: number);
60
38
  get displayState(): boolean;
61
- /**
62
- * Get oscillation status
63
- */
39
+ get displayEnabled(): boolean;
40
+ get screenStatus(): 'on' | 'off';
64
41
  get oscillationState(): boolean;
65
- /**
66
- * Get mute status
67
- */
42
+ get oscillationEnabled(): boolean;
68
43
  get muteState(): boolean;
69
- /**
70
- * Get temperature (in tenths of a degree)
71
- */
44
+ /** Raw API temperature is Fahrenheit times ten, retained for compatibility. */
72
45
  get temperature(): number;
73
- /**
74
- * Get humidity percentage
75
- */
46
+ get temperatureCelsius(): number | undefined;
76
47
  get humidity(): number;
77
- /**
78
- * Get thermal comfort level
79
- */
80
48
  get thermalComfort(): number;
81
- /**
82
- * Get sleep preferences
83
- */
84
49
  get sleepPreference(): Record<string, any>;
85
- /**
86
- * Get schedule count
87
- */
88
50
  get scheduleCount(): number;
89
- /**
90
- * Get error code
91
- */
92
51
  get errorCode(): number;
93
- /**
94
- * Turn oscillation on
95
- */
96
- setOscillationOn(): Promise<boolean>;
97
- /**
98
- * Turn oscillation off
99
- */
100
- setOscillationOff(): Promise<boolean>;
101
- /**
102
- * Display device info
103
- */
104
52
  display(): void;
105
53
  }