tsvesync 1.0.36 → 1.0.37

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.
package/README.md CHANGED
@@ -121,6 +121,10 @@ A TypeScript library for interacting with VeSync smart home devices. This librar
121
121
  - Power monitoring
122
122
  - Energy usage tracking (daily/weekly/monthly/yearly)
123
123
  - Voltage monitoring
124
+ - 10A Outlet (ESW10-USA)
125
+ - Power monitoring
126
+ - Energy usage tracking (daily/weekly/monthly/yearly)
127
+ - Voltage monitoring
124
128
  - 7A Outlet (wifi-switch-1.3)
125
129
  - Energy usage tracking (daily/weekly/monthly/yearly)
126
130
 
@@ -0,0 +1,156 @@
1
+ get_monthly_energy:
2
+ headers:
3
+ accept-language: en
4
+ accountId: sample_id
5
+ appVersion: 2.8.6
6
+ content-type: application/json
7
+ tk: sample_tk
8
+ tz: America/New_York
9
+ json_object:
10
+ acceptLanguage: en
11
+ accountID: sample_id
12
+ appVersion: 2.8.6
13
+ method: energymonth
14
+ mobileId: '1234567890123456'
15
+ phoneBrand: SM N9005
16
+ phoneOS: Android
17
+ timeZone: America/New_York
18
+ token: sample_tk
19
+ traceId: TRACE_ID
20
+ uuid: ESW10-USA-UUID
21
+ method: post
22
+ url: /15a/v1/device/energymonth
23
+ get_weekly_energy:
24
+ headers:
25
+ accept-language: en
26
+ accountId: sample_id
27
+ appVersion: 2.8.6
28
+ content-type: application/json
29
+ tk: sample_tk
30
+ tz: America/New_York
31
+ json_object:
32
+ acceptLanguage: en
33
+ accountID: sample_id
34
+ appVersion: 2.8.6
35
+ method: energyweek
36
+ mobileId: '1234567890123456'
37
+ phoneBrand: SM N9005
38
+ phoneOS: Android
39
+ timeZone: America/New_York
40
+ token: sample_tk
41
+ traceId: TRACE_ID
42
+ uuid: ESW10-USA-UUID
43
+ method: post
44
+ url: /15a/v1/device/energyweek
45
+ get_yearly_energy:
46
+ headers:
47
+ accept-language: en
48
+ accountId: sample_id
49
+ appVersion: 2.8.6
50
+ content-type: application/json
51
+ tk: sample_tk
52
+ tz: America/New_York
53
+ json_object:
54
+ acceptLanguage: en
55
+ accountID: sample_id
56
+ appVersion: 2.8.6
57
+ method: energyyear
58
+ mobileId: '1234567890123456'
59
+ phoneBrand: SM N9005
60
+ phoneOS: Android
61
+ timeZone: America/New_York
62
+ token: sample_tk
63
+ traceId: TRACE_ID
64
+ uuid: ESW10-USA-UUID
65
+ method: post
66
+ url: /15a/v1/device/energyyear
67
+ turn_off:
68
+ headers:
69
+ accept-language: en
70
+ accountId: sample_id
71
+ appVersion: 2.8.6
72
+ content-type: application/json
73
+ tk: sample_tk
74
+ tz: America/New_York
75
+ json_object:
76
+ acceptLanguage: en
77
+ accountID: sample_id
78
+ status: 'off'
79
+ timeZone: America/New_York
80
+ token: sample_tk
81
+ uuid: ESW10-USA-UUID
82
+ method: put
83
+ url: /15a/v1/device/devicestatus
84
+ turn_off_nightlight:
85
+ headers:
86
+ accept-language: en
87
+ accountId: sample_id
88
+ appVersion: 2.8.6
89
+ content-type: application/json
90
+ tk: sample_tk
91
+ tz: America/New_York
92
+ json_object:
93
+ acceptLanguage: en
94
+ accountID: sample_id
95
+ mode: manual
96
+ timeZone: America/New_York
97
+ token: sample_tk
98
+ uuid: ESW10-USA-UUID
99
+ method: put
100
+ url: /15a/v1/device/nightlightstatus
101
+ turn_on:
102
+ headers:
103
+ accept-language: en
104
+ accountId: sample_id
105
+ appVersion: 2.8.6
106
+ content-type: application/json
107
+ tk: sample_tk
108
+ tz: America/New_York
109
+ json_object:
110
+ acceptLanguage: en
111
+ accountID: sample_id
112
+ status: 'on'
113
+ timeZone: America/New_York
114
+ token: sample_tk
115
+ uuid: ESW10-USA-UUID
116
+ method: put
117
+ url: /15a/v1/device/devicestatus
118
+ turn_on_nightlight:
119
+ headers:
120
+ accept-language: en
121
+ accountId: sample_id
122
+ appVersion: 2.8.6
123
+ content-type: application/json
124
+ tk: sample_tk
125
+ tz: America/New_York
126
+ json_object:
127
+ acceptLanguage: en
128
+ accountID: sample_id
129
+ mode: auto
130
+ timeZone: America/New_York
131
+ token: sample_tk
132
+ uuid: ESW10-USA-UUID
133
+ method: put
134
+ url: /15a/v1/device/nightlightstatus
135
+ update:
136
+ headers:
137
+ accept-language: en
138
+ accountId: sample_id
139
+ appVersion: 2.8.6
140
+ content-type: application/json
141
+ tk: sample_tk
142
+ tz: America/New_York
143
+ json_object:
144
+ acceptLanguage: en
145
+ accountID: sample_id
146
+ appVersion: 2.8.6
147
+ method: devicedetail
148
+ mobileId: '1234567890123456'
149
+ phoneBrand: SM N9005
150
+ phoneOS: Android
151
+ timeZone: America/New_York
152
+ token: sample_tk
153
+ traceId: TRACE_ID
154
+ uuid: ESW10-USA-UUID
155
+ method: post
156
+ url: /15a/v1/device/devicedetail
@@ -52,6 +52,7 @@ function objectFactory(details, manager) {
52
52
  'wifi-switch': 'outlets',
53
53
  'ESW03': 'outlets',
54
54
  'ESW01': 'outlets',
55
+ 'ESW10': 'outlets',
55
56
  'ESW15': 'outlets',
56
57
  'ESO': 'outlets',
57
58
  // Switches
@@ -21,6 +21,10 @@ exports.outletConfig = {
21
21
  module: 'VeSyncOutlet10A',
22
22
  features: ['energy']
23
23
  },
24
+ 'ESW10-USA': {
25
+ module: 'VeSyncOutlet10A',
26
+ features: ['energy']
27
+ },
24
28
  'ESW15-USA': {
25
29
  module: 'VeSyncOutlet15A',
26
30
  features: ['energy', 'nightlight']
@@ -60,7 +64,7 @@ class VeSyncOutlet extends vesyncBaseDevice_1.VeSyncBaseDevice {
60
64
  else if (this.deviceType.startsWith('ESW15')) {
61
65
  url = '/15a/v1/device/devicedetail';
62
66
  }
63
- else if (this.deviceType.startsWith('ESW03') || this.deviceType.startsWith('ESW01')) {
67
+ else if (this.deviceType.startsWith('ESW03') || this.deviceType.startsWith('ESW01') || this.deviceType.startsWith('ESW10')) {
64
68
  url = '/10a/v1/device/devicedetail';
65
69
  }
66
70
  else {
@@ -147,7 +151,7 @@ class VeSyncOutlet extends vesyncBaseDevice_1.VeSyncBaseDevice {
147
151
  else if (this.deviceType.startsWith('ESW15')) {
148
152
  url = '/15a/v1/device/energy';
149
153
  }
150
- else if (this.deviceType.startsWith('ESW03') || this.deviceType.startsWith('ESW01')) {
154
+ else if (this.deviceType.startsWith('ESW03') || this.deviceType.startsWith('ESW01') || this.deviceType.startsWith('ESW10')) {
151
155
  url = '/10a/v1/device/energy';
152
156
  }
153
157
  else {
@@ -233,7 +237,7 @@ class VeSyncOutlet extends vesyncBaseDevice_1.VeSyncBaseDevice {
233
237
  else if (this.deviceType.startsWith('ESW15') || this.deviceType.startsWith('ESO15')) {
234
238
  return '15a/v1/device';
235
239
  }
236
- else if (this.deviceType.startsWith('ESW03') || this.deviceType.startsWith('ESW01')) {
240
+ else if (this.deviceType.startsWith('ESW03') || this.deviceType.startsWith('ESW01') || this.deviceType.startsWith('ESW10')) {
237
241
  return '10a/v1/device';
238
242
  }
239
243
  return 'v1/device';
@@ -242,6 +242,7 @@ exports.outletModules = {
242
242
  'wifi-switch-1.3': VeSyncOutlet7A,
243
243
  'ESW03-USA': VeSyncOutlet10A,
244
244
  'ESW01-EU': VeSyncOutlet10A,
245
+ 'ESW10-USA': VeSyncOutlet10A,
245
246
  'ESW15-USA': VeSyncOutlet15A,
246
247
  'ESO15-TB': VeSyncOutdoorPlug
247
248
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsvesync",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
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
@@ -67,6 +67,7 @@ function objectFactory(details: Record<string, any>, manager: VeSync): [string,
67
67
  'wifi-switch': 'outlets',
68
68
  'ESW03': 'outlets',
69
69
  'ESW01': 'outlets',
70
+ 'ESW10': 'outlets',
70
71
  'ESW15': 'outlets',
71
72
  'ESO': 'outlets',
72
73
  // Switches
@@ -28,6 +28,10 @@ export const outletConfig: OutletConfig = {
28
28
  module: 'VeSyncOutlet10A',
29
29
  features: ['energy']
30
30
  },
31
+ 'ESW10-USA': {
32
+ module: 'VeSyncOutlet10A',
33
+ features: ['energy']
34
+ },
31
35
  'ESW15-USA': {
32
36
  module: 'VeSyncOutlet15A',
33
37
  features: ['energy', 'nightlight']
@@ -71,7 +75,7 @@ export abstract class VeSyncOutlet extends VeSyncBaseDevice {
71
75
  url = '/outdoorsocket15a/v1/device/devicedetail';
72
76
  } else if (this.deviceType.startsWith('ESW15')) {
73
77
  url = '/15a/v1/device/devicedetail';
74
- } else if (this.deviceType.startsWith('ESW03') || this.deviceType.startsWith('ESW01')) {
78
+ } else if (this.deviceType.startsWith('ESW03') || this.deviceType.startsWith('ESW01') || this.deviceType.startsWith('ESW10')) {
75
79
  url = '/10a/v1/device/devicedetail';
76
80
  } else {
77
81
  url = '/v1/device/devicedetail';
@@ -168,7 +172,7 @@ export abstract class VeSyncOutlet extends VeSyncBaseDevice {
168
172
  url = '/outdoorsocket15a/v1/device/energy';
169
173
  } else if (this.deviceType.startsWith('ESW15')) {
170
174
  url = '/15a/v1/device/energy';
171
- } else if (this.deviceType.startsWith('ESW03') || this.deviceType.startsWith('ESW01')) {
175
+ } else if (this.deviceType.startsWith('ESW03') || this.deviceType.startsWith('ESW01') || this.deviceType.startsWith('ESW10')) {
172
176
  url = '/10a/v1/device/energy';
173
177
  } else {
174
178
  url = '/v1/device/energy';
@@ -261,7 +265,7 @@ export abstract class VeSyncOutlet extends VeSyncBaseDevice {
261
265
  return `v1/device/${this.deviceType}-${this.cid}`;
262
266
  } else if (this.deviceType.startsWith('ESW15') || this.deviceType.startsWith('ESO15')) {
263
267
  return '15a/v1/device';
264
- } else if (this.deviceType.startsWith('ESW03') || this.deviceType.startsWith('ESW01')) {
268
+ } else if (this.deviceType.startsWith('ESW03') || this.deviceType.startsWith('ESW01') || this.deviceType.startsWith('ESW10')) {
265
269
  return '10a/v1/device';
266
270
  }
267
271
  return 'v1/device';
@@ -325,6 +325,7 @@ export const outletModules: Record<string, new (details: Record<string, any>, ma
325
325
  'wifi-switch-1.3': VeSyncOutlet7A,
326
326
  'ESW03-USA': VeSyncOutlet10A,
327
327
  'ESW01-EU': VeSyncOutlet10A,
328
+ 'ESW10-USA': VeSyncOutlet10A,
328
329
  'ESW15-USA': VeSyncOutlet15A,
329
330
  'ESO15-TB': VeSyncOutdoorPlug
330
331
  };