tsvesync 1.3.11 โ†’ 1.3.12

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
@@ -4,6 +4,9 @@ A TypeScript library for interacting with VeSync smart home devices. This librar
4
4
 
5
5
  ## ๐Ÿ†• Recent Updates
6
6
 
7
+ - **ESWD16 State Parity (v1.3.12)**: Bypass calls now reuse pyvesync-style trace IDs and mark the dimmer on after backlight tweaks, eliminating the lingering โ€œoffโ€ state in HomeKit.
8
+ - **ESWD16 Bypass Compatibility (v1.3.11)**: Migrated the dimmer switch to the modern bypass-v1 API so power, brightness, and indicator updates stay in sync with pyvesync.
9
+ - **ESL Bulb API Parity (v1.3.10)**: ESL100/ESL100CW/ESL100MC now mirror pyvesync `/SmartBulb/v1` and `/cloud/v2` payloads for brightness and colour control.
7
10
  - **Enhanced Authentication**: Now supports the new VeSync authentication flow (pyvesync PR #340) with automatic fallback to legacy authentication
8
11
  - **Regional API Support**: Automatic detection and routing for US (`smartapi.vesync.com`) and EU (`smartapi.vesync.eu`) endpoints
9
12
  - **International Account Support**: Full support for accounts worldwide including Australia, New Zealand, Japan, and all European countries
@@ -52,6 +52,7 @@ export declare function detectUserRegion(email: string): string;
52
52
  export declare function getCountryCodeFromRegion(region: string, email?: string): string;
53
53
  export declare function generateAppId(): string;
54
54
  export declare function generateTerminalId(): string;
55
+ export declare function generateTraceId(): string;
55
56
  export interface RequestBody {
56
57
  acceptLanguage?: string;
57
58
  accountID?: string;
@@ -104,6 +105,7 @@ export interface LoginResponse {
104
105
  }
105
106
  export declare class Helpers {
106
107
  static shouldRedact: boolean;
108
+ static generateTraceId(): string;
107
109
  /**
108
110
  * Calculate MD5 hash
109
111
  */
@@ -18,6 +18,7 @@ exports.detectUserRegion = detectUserRegion;
18
18
  exports.getCountryCodeFromRegion = getCountryCodeFromRegion;
19
19
  exports.generateAppId = generateAppId;
20
20
  exports.generateTerminalId = generateTerminalId;
21
+ exports.generateTraceId = generateTraceId;
21
22
  const axios_1 = __importDefault(require("axios"));
22
23
  const crypto_1 = __importDefault(require("crypto"));
23
24
  const logger_1 = require("./logger");
@@ -172,7 +173,15 @@ function generateTerminalId() {
172
173
  }
173
174
  return result;
174
175
  }
176
+ function generateTraceId() {
177
+ const timestamp = Math.floor(Date.now() / 1000);
178
+ const randomPart = Math.floor(Math.random() * 100000).toString().padStart(5, '0');
179
+ return `APP${exports.MOBILE_ID.slice(-5, -1)}${timestamp}-${randomPart}`;
180
+ }
175
181
  class Helpers {
182
+ static generateTraceId() {
183
+ return generateTraceId();
184
+ }
176
185
  /**
177
186
  * Calculate MD5 hash
178
187
  */
@@ -116,24 +116,25 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
116
116
  * Get dimmer switch details
117
117
  */
118
118
  async getDetails() {
119
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
119
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
120
120
  logger_1.logger.debug(`Getting details for device: ${this.deviceName}`);
121
- const [response, statusCode] = await this.callDimmerCommand('deviceDetail', {}, 'deviceDetail');
121
+ const [response, statusCode] = await this.callDimmerCommand('deviceDetail', {});
122
122
  const success = this.checkResponse([response, statusCode], 'getDetails');
123
- if (success && (response === null || response === void 0 ? void 0 : response.result)) {
124
- const result = response.result;
123
+ const resultWrapper = (_b = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.result) !== null && _b !== void 0 ? _b : response === null || response === void 0 ? void 0 : response.result;
124
+ if (success && resultWrapper) {
125
+ const result = resultWrapper;
125
126
  this.stateSnapshot = {
126
- activeTime: (_a = result.activeTime) !== null && _a !== void 0 ? _a : this.stateSnapshot.activeTime,
127
- connectionStatus: (_b = result.connectionStatus) !== null && _b !== void 0 ? _b : this.stateSnapshot.connectionStatus,
128
- brightness: Number((_c = result.brightness) !== null && _c !== void 0 ? _c : this.stateSnapshot.brightness),
129
- rgbStatus: (_d = result.rgbStatus) !== null && _d !== void 0 ? _d : this.stateSnapshot.rgbStatus,
130
- indicatorStatus: (_e = result.indicatorlightStatus) !== null && _e !== void 0 ? _e : this.stateSnapshot.indicatorStatus,
127
+ activeTime: (_c = result.activeTime) !== null && _c !== void 0 ? _c : this.stateSnapshot.activeTime,
128
+ connectionStatus: (_d = result.connectionStatus) !== null && _d !== void 0 ? _d : this.stateSnapshot.connectionStatus,
129
+ brightness: Number((_e = result.brightness) !== null && _e !== void 0 ? _e : this.stateSnapshot.brightness),
130
+ rgbStatus: (_f = result.rgbStatus) !== null && _f !== void 0 ? _f : this.stateSnapshot.rgbStatus,
131
+ indicatorStatus: (_g = result.indicatorlightStatus) !== null && _g !== void 0 ? _g : this.stateSnapshot.indicatorStatus,
131
132
  rgbValue: {
132
- red: Number((_g = (_f = result.rgbValue) === null || _f === void 0 ? void 0 : _f.red) !== null && _g !== void 0 ? _g : this.stateSnapshot.rgbValue.red),
133
- green: Number((_j = (_h = result.rgbValue) === null || _h === void 0 ? void 0 : _h.green) !== null && _j !== void 0 ? _j : this.stateSnapshot.rgbValue.green),
134
- blue: Number((_l = (_k = result.rgbValue) === null || _k === void 0 ? void 0 : _k.blue) !== null && _l !== void 0 ? _l : this.stateSnapshot.rgbValue.blue)
133
+ red: Number((_j = (_h = result.rgbValue) === null || _h === void 0 ? void 0 : _h.red) !== null && _j !== void 0 ? _j : this.stateSnapshot.rgbValue.red),
134
+ green: Number((_l = (_k = result.rgbValue) === null || _k === void 0 ? void 0 : _k.green) !== null && _l !== void 0 ? _l : this.stateSnapshot.rgbValue.green),
135
+ blue: Number((_o = (_m = result.rgbValue) === null || _m === void 0 ? void 0 : _m.blue) !== null && _o !== void 0 ? _o : this.stateSnapshot.rgbValue.blue)
135
136
  },
136
- deviceStatus: (_m = result.deviceStatus) !== null && _m !== void 0 ? _m : this.stateSnapshot.deviceStatus
137
+ deviceStatus: (_p = result.deviceStatus) !== null && _p !== void 0 ? _p : this.stateSnapshot.deviceStatus
137
138
  };
138
139
  this.details.active_time = this.stateSnapshot.activeTime;
139
140
  this.connectionStatus = this.stateSnapshot.connectionStatus;
@@ -184,12 +185,14 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
184
185
  logger_1.logger.debug(`Setting brightness to ${brightness} for device: ${this.deviceName}`);
185
186
  const value = Math.max(0, Math.min(100, Math.round(brightness)));
186
187
  const [response] = await this.callDimmerCommand('dimmerBrightnessCtl', {
187
- brightness: String(value)
188
- }, 'dimmerBrightnessCtl');
188
+ brightness: value
189
+ });
189
190
  if ((response === null || response === void 0 ? void 0 : response.code) === 0) {
190
191
  this.stateSnapshot.brightness = value;
191
192
  this.stateSnapshot.deviceStatus = 'on';
192
193
  this.deviceStatus = 'on';
194
+ this.stateSnapshot.connectionStatus = 'online';
195
+ this.connectionStatus = 'online';
193
196
  logger_1.logger.debug(`Successfully set brightness to ${value} for device: ${this.deviceName}`);
194
197
  return true;
195
198
  }
@@ -208,10 +211,14 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
208
211
  green: Math.round(green),
209
212
  blue: Math.round(blue)
210
213
  }
211
- }, 'dimmerRgbValueCtl');
214
+ });
212
215
  if ((response === null || response === void 0 ? void 0 : response.code) === 0) {
213
216
  this.stateSnapshot.rgbValue = { red: Math.round(red), green: Math.round(green), blue: Math.round(blue) };
214
217
  this.stateSnapshot.rgbStatus = 'on';
218
+ this.stateSnapshot.deviceStatus = 'on';
219
+ this.deviceStatus = 'on';
220
+ this.stateSnapshot.connectionStatus = 'online';
221
+ this.connectionStatus = 'online';
215
222
  logger_1.logger.debug(`Successfully set RGB color for device: ${this.deviceName}`);
216
223
  return true;
217
224
  }
@@ -225,9 +232,13 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
225
232
  logger_1.logger.debug(`Turning off RGB color for device: ${this.deviceName}`);
226
233
  const [response] = await this.callDimmerCommand('dimmerRgbValueCtl', {
227
234
  status: 'off'
228
- }, 'dimmerRgbValueCtl');
235
+ });
229
236
  if ((response === null || response === void 0 ? void 0 : response.code) === 0) {
230
237
  this.stateSnapshot.rgbStatus = 'off';
238
+ this.stateSnapshot.deviceStatus = 'on';
239
+ this.deviceStatus = 'on';
240
+ this.stateSnapshot.connectionStatus = 'online';
241
+ this.connectionStatus = 'online';
231
242
  logger_1.logger.debug(`Successfully turned off RGB color for device: ${this.deviceName}`);
232
243
  return true;
233
244
  }
@@ -241,9 +252,13 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
241
252
  logger_1.logger.debug(`Turning on RGB color for device: ${this.deviceName}`);
242
253
  const [response] = await this.callDimmerCommand('dimmerRgbValueCtl', {
243
254
  status: 'on'
244
- }, 'dimmerRgbValueCtl');
255
+ });
245
256
  if ((response === null || response === void 0 ? void 0 : response.code) === 0) {
246
257
  this.stateSnapshot.rgbStatus = 'on';
258
+ this.stateSnapshot.deviceStatus = 'on';
259
+ this.deviceStatus = 'on';
260
+ this.stateSnapshot.connectionStatus = 'online';
261
+ this.connectionStatus = 'online';
247
262
  logger_1.logger.debug(`Successfully turned on RGB color for device: ${this.deviceName}`);
248
263
  return true;
249
264
  }
@@ -280,10 +295,12 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
280
295
  async toggleSwitch(turnOn) {
281
296
  const [response] = await this.callDimmerCommand('dimmerPowerSwitchCtl', {
282
297
  status: turnOn ? 'on' : 'off'
283
- }, 'dimmerPowerSwitchCtl');
298
+ });
284
299
  if ((response === null || response === void 0 ? void 0 : response.code) === 0) {
285
300
  this.stateSnapshot.deviceStatus = turnOn ? 'on' : 'off';
286
301
  this.deviceStatus = this.stateSnapshot.deviceStatus;
302
+ this.stateSnapshot.connectionStatus = 'online';
303
+ this.connectionStatus = 'online';
287
304
  logger_1.logger.debug(`Successfully toggled device: ${this.deviceName} to ${this.deviceStatus}`);
288
305
  return true;
289
306
  }
@@ -293,9 +310,11 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
293
310
  async toggleIndicatorLight(turnOn) {
294
311
  const [response] = await this.callDimmerCommand('dimmerIndicatorLightCtl', {
295
312
  status: turnOn ? 'on' : 'off'
296
- }, 'dimmerIndicatorLightCtl');
313
+ });
297
314
  if ((response === null || response === void 0 ? void 0 : response.code) === 0) {
298
315
  this.stateSnapshot.indicatorStatus = turnOn ? 'on' : 'off';
316
+ this.stateSnapshot.connectionStatus = 'online';
317
+ this.connectionStatus = 'online';
299
318
  logger_1.logger.debug(`Successfully toggled indicator light for device: ${this.deviceName}`);
300
319
  return true;
301
320
  }
@@ -305,37 +324,30 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
305
324
  buildDimmerRequest(command, data = {}) {
306
325
  var _a, _b, _c, _d;
307
326
  const manager = this.manager;
327
+ const traceId = helpers_1.Helpers.generateTraceId();
308
328
  return {
309
329
  acceptLanguage: 'en',
310
330
  accountID: (_a = manager.accountId) !== null && _a !== void 0 ? _a : '',
311
331
  appVersion: helpers_1.APP_VERSION,
312
- phoneBrand: helpers_1.PHONE_BRAND,
313
- phoneOS: helpers_1.PHONE_OS,
314
332
  cid: this.cid,
315
333
  configModule: this.configModule,
316
334
  configModel: this.configModule,
317
335
  debugMode: false,
318
- traceId: Date.now().toString(),
336
+ deviceId: this.cid,
337
+ method: command,
338
+ phoneBrand: helpers_1.PHONE_BRAND,
339
+ phoneOS: helpers_1.PHONE_OS,
340
+ traceId,
319
341
  timeZone: (_b = manager.timeZone) !== null && _b !== void 0 ? _b : helpers_1.DEFAULT_TZ,
320
342
  token: (_c = manager.token) !== null && _c !== void 0 ? _c : '',
321
343
  userCountryCode: (_d = manager.countryCode) !== null && _d !== void 0 ? _d : helpers_1.DEFAULT_REGION,
322
344
  uuid: this.uuid,
323
- deviceId: this.cid,
324
- mobileId: helpers_1.MOBILE_ID,
325
- method: command,
326
- payload: {
327
- method: command,
328
- source: 'APP',
329
- data: {
330
- uuid: this.uuid,
331
- ...data
332
- }
333
- }
345
+ ...data
334
346
  };
335
347
  }
336
- async callDimmerCommand(command, data, endpoint) {
348
+ async callDimmerCommand(command, data) {
337
349
  const request = this.buildDimmerRequest(command, data);
338
- return await this.callApi(`/cloud/v1/deviceManaged/${endpoint}`, 'post', request, helpers_1.Helpers.reqHeaderBypass());
350
+ return await this.callApi(`/cloud/v1/deviceManaged/${command}`, 'post', request, helpers_1.Helpers.reqHeaderBypass());
339
351
  }
340
352
  }
341
353
  exports.VeSyncDimmerSwitch = VeSyncDimmerSwitch;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsvesync",
3
- "version": "1.3.11",
3
+ "version": "1.3.12",
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",
@@ -177,6 +177,12 @@ export function generateTerminalId(): string {
177
177
  return result;
178
178
  }
179
179
 
180
+ export function generateTraceId(): string {
181
+ const timestamp = Math.floor(Date.now() / 1000);
182
+ const randomPart = Math.floor(Math.random() * 100000).toString().padStart(5, '0');
183
+ return `APP${MOBILE_ID.slice(-5, -1)}${timestamp}-${randomPart}`;
184
+ }
185
+
180
186
  export interface RequestBody {
181
187
  acceptLanguage?: string;
182
188
  accountID?: string;
@@ -235,6 +241,10 @@ export interface LoginResponse {
235
241
  export class Helpers {
236
242
  static shouldRedact = true;
237
243
 
244
+ static generateTraceId(): string {
245
+ return generateTraceId();
246
+ }
247
+
238
248
  /**
239
249
  * Calculate MD5 hash
240
250
  */
@@ -4,9 +4,8 @@
4
4
 
5
5
  import { VeSyncSwitch } from './vesyncSwitch';
6
6
  import { VeSync } from './vesync';
7
- import { Helpers, APP_VERSION, PHONE_BRAND, PHONE_OS, DEFAULT_TZ, DEFAULT_REGION, MOBILE_ID } from './helpers';
7
+ import { Helpers, APP_VERSION, PHONE_BRAND, PHONE_OS, DEFAULT_TZ, DEFAULT_REGION } from './helpers';
8
8
  import { logger } from './logger';
9
- import { switchConfig } from './vesyncSwitch';
10
9
 
11
10
  interface DimmerState {
12
11
  activeTime: number;
@@ -161,11 +160,12 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
161
160
  */
162
161
  async getDetails(): Promise<Boolean> {
163
162
  logger.debug(`Getting details for device: ${this.deviceName}`);
164
- const [response, statusCode] = await this.callDimmerCommand('deviceDetail', {}, 'deviceDetail');
163
+ const [response, statusCode] = await this.callDimmerCommand('deviceDetail', {});
165
164
 
166
165
  const success = this.checkResponse([response, statusCode], 'getDetails');
167
- if (success && response?.result) {
168
- const result = response.result;
166
+ const resultWrapper = response?.result?.result ?? response?.result;
167
+ if (success && resultWrapper) {
168
+ const result = resultWrapper;
169
169
  this.stateSnapshot = {
170
170
  activeTime: result.activeTime ?? this.stateSnapshot.activeTime,
171
171
  connectionStatus: result.connectionStatus ?? this.stateSnapshot.connectionStatus,
@@ -239,13 +239,15 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
239
239
  logger.debug(`Setting brightness to ${brightness} for device: ${this.deviceName}`);
240
240
  const value = Math.max(0, Math.min(100, Math.round(brightness)));
241
241
  const [response] = await this.callDimmerCommand('dimmerBrightnessCtl', {
242
- brightness: String(value)
243
- }, 'dimmerBrightnessCtl');
242
+ brightness: value
243
+ });
244
244
 
245
245
  if (response?.code === 0) {
246
246
  this.stateSnapshot.brightness = value;
247
247
  this.stateSnapshot.deviceStatus = 'on';
248
248
  this.deviceStatus = 'on';
249
+ this.stateSnapshot.connectionStatus = 'online';
250
+ this.connectionStatus = 'online';
249
251
  logger.debug(`Successfully set brightness to ${value} for device: ${this.deviceName}`);
250
252
  return true;
251
253
  }
@@ -265,11 +267,15 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
265
267
  green: Math.round(green),
266
268
  blue: Math.round(blue)
267
269
  }
268
- }, 'dimmerRgbValueCtl');
270
+ });
269
271
 
270
272
  if (response?.code === 0) {
271
273
  this.stateSnapshot.rgbValue = { red: Math.round(red), green: Math.round(green), blue: Math.round(blue) };
272
274
  this.stateSnapshot.rgbStatus = 'on';
275
+ this.stateSnapshot.deviceStatus = 'on';
276
+ this.deviceStatus = 'on';
277
+ this.stateSnapshot.connectionStatus = 'online';
278
+ this.connectionStatus = 'online';
273
279
  logger.debug(`Successfully set RGB color for device: ${this.deviceName}`);
274
280
  return true;
275
281
  }
@@ -284,10 +290,14 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
284
290
  logger.debug(`Turning off RGB color for device: ${this.deviceName}`);
285
291
  const [response] = await this.callDimmerCommand('dimmerRgbValueCtl', {
286
292
  status: 'off'
287
- }, 'dimmerRgbValueCtl');
293
+ });
288
294
 
289
295
  if (response?.code === 0) {
290
296
  this.stateSnapshot.rgbStatus = 'off';
297
+ this.stateSnapshot.deviceStatus = 'on';
298
+ this.deviceStatus = 'on';
299
+ this.stateSnapshot.connectionStatus = 'online';
300
+ this.connectionStatus = 'online';
291
301
  logger.debug(`Successfully turned off RGB color for device: ${this.deviceName}`);
292
302
  return true;
293
303
  }
@@ -302,10 +312,14 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
302
312
  logger.debug(`Turning on RGB color for device: ${this.deviceName}`);
303
313
  const [response] = await this.callDimmerCommand('dimmerRgbValueCtl', {
304
314
  status: 'on'
305
- }, 'dimmerRgbValueCtl');
315
+ });
306
316
 
307
317
  if (response?.code === 0) {
308
318
  this.stateSnapshot.rgbStatus = 'on';
319
+ this.stateSnapshot.deviceStatus = 'on';
320
+ this.deviceStatus = 'on';
321
+ this.stateSnapshot.connectionStatus = 'online';
322
+ this.connectionStatus = 'online';
309
323
  logger.debug(`Successfully turned on RGB color for device: ${this.deviceName}`);
310
324
  return true;
311
325
  }
@@ -349,11 +363,13 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
349
363
  private async toggleSwitch(turnOn: boolean): Promise<boolean> {
350
364
  const [response] = await this.callDimmerCommand('dimmerPowerSwitchCtl', {
351
365
  status: turnOn ? 'on' : 'off'
352
- }, 'dimmerPowerSwitchCtl');
366
+ });
353
367
 
354
368
  if (response?.code === 0) {
355
369
  this.stateSnapshot.deviceStatus = turnOn ? 'on' : 'off';
356
370
  this.deviceStatus = this.stateSnapshot.deviceStatus;
371
+ this.stateSnapshot.connectionStatus = 'online';
372
+ this.connectionStatus = 'online';
357
373
  logger.debug(`Successfully toggled device: ${this.deviceName} to ${this.deviceStatus}`);
358
374
  return true;
359
375
  }
@@ -364,10 +380,12 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
364
380
  private async toggleIndicatorLight(turnOn: boolean): Promise<boolean> {
365
381
  const [response] = await this.callDimmerCommand('dimmerIndicatorLightCtl', {
366
382
  status: turnOn ? 'on' : 'off'
367
- }, 'dimmerIndicatorLightCtl');
383
+ });
368
384
 
369
385
  if (response?.code === 0) {
370
386
  this.stateSnapshot.indicatorStatus = turnOn ? 'on' : 'off';
387
+ this.stateSnapshot.connectionStatus = 'online';
388
+ this.connectionStatus = 'online';
371
389
  logger.debug(`Successfully toggled indicator light for device: ${this.deviceName}`);
372
390
  return true;
373
391
  }
@@ -376,40 +394,40 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
376
394
  }
377
395
 
378
396
  private buildDimmerRequest(command: string, data: Record<string, any> = {}): Record<string, any> {
379
- const manager = this.manager as unknown as { accountId?: string | null; token?: string | null; timeZone?: string; countryCode?: string | null; };
397
+ const manager = this.manager as unknown as {
398
+ accountId?: string | null;
399
+ token?: string | null;
400
+ timeZone?: string | null;
401
+ countryCode?: string | null;
402
+ };
403
+
404
+ const traceId = Helpers.generateTraceId();
405
+
380
406
  return {
381
407
  acceptLanguage: 'en',
382
408
  accountID: manager.accountId ?? '',
383
409
  appVersion: APP_VERSION,
384
- phoneBrand: PHONE_BRAND,
385
- phoneOS: PHONE_OS,
386
410
  cid: this.cid,
387
411
  configModule: this.configModule,
388
412
  configModel: this.configModule,
389
413
  debugMode: false,
390
- traceId: Date.now().toString(),
414
+ deviceId: this.cid,
415
+ method: command,
416
+ phoneBrand: PHONE_BRAND,
417
+ phoneOS: PHONE_OS,
418
+ traceId,
391
419
  timeZone: manager.timeZone ?? DEFAULT_TZ,
392
420
  token: manager.token ?? '',
393
421
  userCountryCode: manager.countryCode ?? DEFAULT_REGION,
394
422
  uuid: this.uuid,
395
- deviceId: this.cid,
396
- mobileId: MOBILE_ID,
397
- method: command,
398
- payload: {
399
- method: command,
400
- source: 'APP',
401
- data: {
402
- uuid: this.uuid,
403
- ...data
404
- }
405
- }
423
+ ...data
406
424
  };
407
425
  }
408
426
 
409
- private async callDimmerCommand(command: string, data: Record<string, any>, endpoint: string): Promise<[any, number]> {
427
+ private async callDimmerCommand(command: string, data: Record<string, any>): Promise<[any, number]> {
410
428
  const request = this.buildDimmerRequest(command, data);
411
429
  return await this.callApi(
412
- `/cloud/v1/deviceManaged/${endpoint}`,
430
+ `/cloud/v1/deviceManaged/${command}`,
413
431
  'post',
414
432
  request,
415
433
  Helpers.reqHeaderBypass()