@switchbot/homebridge-switchbot 1.1.1-beta.9 → 1.2.1-beta.2

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 (73) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/README.md +67 -28
  3. package/config.schema.json +46 -43
  4. package/dist/devices/bots.d.ts +1 -1
  5. package/dist/devices/bots.d.ts.map +1 -1
  6. package/dist/devices/bots.js +22 -22
  7. package/dist/devices/bots.js.map +1 -1
  8. package/dist/devices/colorbulb.d.ts +7 -3
  9. package/dist/devices/colorbulb.d.ts.map +1 -1
  10. package/dist/devices/colorbulb.js +112 -29
  11. package/dist/devices/colorbulb.js.map +1 -1
  12. package/dist/devices/curtains.d.ts +5 -5
  13. package/dist/devices/curtains.d.ts.map +1 -1
  14. package/dist/devices/curtains.js +10 -7
  15. package/dist/devices/curtains.js.map +1 -1
  16. package/dist/devices/humidifiers.d.ts.map +1 -1
  17. package/dist/devices/humidifiers.js +0 -1
  18. package/dist/devices/humidifiers.js.map +1 -1
  19. package/dist/devices/indoorcam.d.ts.map +1 -1
  20. package/dist/devices/indoorcam.js +0 -1
  21. package/dist/devices/indoorcam.js.map +1 -1
  22. package/dist/devices/plugs.d.ts.map +1 -1
  23. package/dist/devices/plugs.js +0 -1
  24. package/dist/devices/plugs.js.map +1 -1
  25. package/dist/irdevices/airconditioners.d.ts.map +1 -1
  26. package/dist/irdevices/airconditioners.js +0 -1
  27. package/dist/irdevices/airconditioners.js.map +1 -1
  28. package/dist/irdevices/airpurifiers.d.ts.map +1 -1
  29. package/dist/irdevices/airpurifiers.js +0 -1
  30. package/dist/irdevices/airpurifiers.js.map +1 -1
  31. package/dist/irdevices/cameras.d.ts.map +1 -1
  32. package/dist/irdevices/cameras.js +0 -1
  33. package/dist/irdevices/cameras.js.map +1 -1
  34. package/dist/irdevices/fans.d.ts.map +1 -1
  35. package/dist/irdevices/fans.js +0 -1
  36. package/dist/irdevices/fans.js.map +1 -1
  37. package/dist/irdevices/lights.d.ts.map +1 -1
  38. package/dist/irdevices/lights.js +0 -1
  39. package/dist/irdevices/lights.js.map +1 -1
  40. package/dist/irdevices/others.d.ts.map +1 -1
  41. package/dist/irdevices/others.js +0 -1
  42. package/dist/irdevices/others.js.map +1 -1
  43. package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
  44. package/dist/irdevices/vacuumcleaners.js +2 -3
  45. package/dist/irdevices/vacuumcleaners.js.map +1 -1
  46. package/dist/irdevices/waterheaters.d.ts.map +1 -1
  47. package/dist/irdevices/waterheaters.js +0 -1
  48. package/dist/irdevices/waterheaters.js.map +1 -1
  49. package/dist/platform.d.ts.map +1 -1
  50. package/dist/platform.js +34 -25
  51. package/dist/platform.js.map +1 -1
  52. package/dist/settings.d.ts +4 -0
  53. package/dist/settings.d.ts.map +1 -1
  54. package/dist/settings.js +557 -1
  55. package/dist/settings.js.map +1 -1
  56. package/package.json +10 -12
  57. package/src/devices/bots.ts +24 -23
  58. package/src/devices/colorbulb.ts +130 -29
  59. package/src/devices/curtains.ts +17 -12
  60. package/src/devices/humidifiers.ts +0 -1
  61. package/src/devices/indoorcam.ts +0 -1
  62. package/src/devices/plugs.ts +0 -1
  63. package/src/irdevices/airconditioners.ts +0 -1
  64. package/src/irdevices/airpurifiers.ts +0 -1
  65. package/src/irdevices/cameras.ts +0 -1
  66. package/src/irdevices/fans.ts +0 -1
  67. package/src/irdevices/lights.ts +0 -1
  68. package/src/irdevices/others.ts +0 -1
  69. package/src/irdevices/vacuumcleaners.ts +2 -3
  70. package/src/irdevices/waterheaters.ts +0 -1
  71. package/src/platform.ts +34 -25
  72. package/src/settings.ts +557 -1
  73. package/src/colorbulb.json +0 -22
package/src/platform.ts CHANGED
@@ -121,34 +121,37 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
121
121
  this.config.options = this.config.options || {};
122
122
  this.config.options.debug;
123
123
 
124
- // Device Config
125
- if (this.config.options.devices) {
126
- for (const deviceConfig of this.config.options.devices) {
127
- if (!deviceConfig.hide_device) {
128
- if (!deviceConfig.deviceId) {
129
- this.log.error('The devices config section is missing the *Device ID* in the config, Check Your Conifg.');
130
- }
131
- if (!deviceConfig.configDeviceType) {
132
- this.log.error('The devices config section is missing the *Device Type* in the config, Check Your Conifg.');
133
- }
134
- if (deviceConfig.bot) {
135
- if (!deviceConfig.bot?.mode) {
136
- this.log.error('You must set your Bot to Press or Switch Mode');
124
+ if (this.config.options) {
125
+
126
+ // Device Config
127
+ if (this.config.options.devices) {
128
+ for (const deviceConfig of this.config.options.devices) {
129
+ if (!deviceConfig.hide_device) {
130
+ if (!deviceConfig.deviceId) {
131
+ throw new Error('The devices config section is missing the *Device ID* in the config, Check Your Conifg.');
132
+ }
133
+ if (!deviceConfig.configDeviceType && deviceConfig.ble) {
134
+ throw new Error('The devices config section is missing the *Device Type* in the config, Check Your Conifg.');
135
+ }
136
+ if (deviceConfig.bot) {
137
+ if (!deviceConfig.bot?.mode) {
138
+ this.log.error('You must set your Bot to Press or Switch Mode');
139
+ }
137
140
  }
138
141
  }
139
142
  }
140
143
  }
141
- }
142
144
 
143
- // IR Device Config
144
- if (this.config.options.irdevices) {
145
- for (const irDeviceConfig of this.config.options.irdevices) {
146
- if (!irDeviceConfig.hide_device) {
147
- if (!irDeviceConfig.configRemoteType) {
148
- this.log.error('The devices config section is missing the *Device Type* in the config, Check Your Conifg.');
149
- }
150
- if (!irDeviceConfig.deviceId) {
151
- this.log.error('The devices config section is missing the *Device ID* in the config, Check Your Conifg.');
145
+ // IR Device Config
146
+ if (this.config.options.irdevices) {
147
+ for (const irDeviceConfig of this.config.options.irdevices) {
148
+ if (!irDeviceConfig.hide_device) {
149
+ if (!irDeviceConfig.deviceId) {
150
+ this.log.error('The devices config section is missing the *Device ID* in the config, Check Your Conifg.');
151
+ }
152
+ if (!irDeviceConfig.deviceId && !irDeviceConfig.configRemoteType) {
153
+ this.log.error('The devices config section is missing the *Device Type* in the config, Check Your Conifg.');
154
+ }
152
155
  }
153
156
  }
154
157
  }
@@ -385,12 +388,18 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
385
388
  }
386
389
 
387
390
  private registerDevice(device: device & devicesConfig) {
388
- if (!device.hide_device && device.enableCloudService) {
391
+ if (!device.hide_device && device.enableCloudService && device.ble) {
392
+ this.registeringDevice = true;
393
+ this.device(`Device: ${device.deviceName} Both OpenAPI and BLE Connections Enabled`);
394
+ } else if (!device.hide_device && device.deviceId && device.configDeviceType && device.configDeviceName && !device.enableCloudService) {
389
395
  this.registeringDevice = true;
390
- } else if (!device.hide_device && device.deviceId && device.configDeviceType && device.configDeviceName) {
396
+ this.device(`Device: ${device.deviceName} BLE Connection Enabled`);
397
+ } else if (!device.hide_device && device.enableCloudService && !device.ble) {
391
398
  this.registeringDevice = true;
399
+ this.device(`Device: ${device.deviceName} OpenAPI Connection Enabled`);
392
400
  } else {
393
401
  this.registeringDevice = false;
402
+ this.device(`Device: ${device.deviceName} Neither OpenAPI and BLE Enabled`);
394
403
  }
395
404
  return this.registeringDevice;
396
405
  }
package/src/settings.ts CHANGED
@@ -315,4 +315,560 @@ export type switchbot = {
315
315
  wait: (
316
316
  arg0: number
317
317
  ) => any;
318
- };
318
+ };
319
+
320
+ export function rgb2hs(r, g, b) {
321
+ /*
322
+ Credit:
323
+ https://github.com/WickyNilliams/pure-color
324
+ */
325
+ r = parseInt(r);
326
+ g = parseInt(g);
327
+ b = parseInt(b);
328
+ const min = Math.min(r, g, b);
329
+ const max = Math.max(r, g, b);
330
+ const delta = max - min;
331
+ let h;
332
+ let s;
333
+ if (max === 0) {
334
+ s = 0;
335
+ } else {
336
+ s = (delta / max) * 100;
337
+ }
338
+ if (max === min) {
339
+ h = 0;
340
+ } else if (r === max) {
341
+ h = (g - b) / delta;
342
+ } else if (g === max) {
343
+ h = 2 + (b - r) / delta;
344
+ } else if (b === max) {
345
+ h = 4 + (r - g) / delta;
346
+ }
347
+ h = Math.min(h * 60, 360);
348
+
349
+ if (h < 0) {
350
+ h += 360;
351
+ }
352
+ return [Math.round(h), Math.round(s)];
353
+ }
354
+
355
+ export function hs2rgb(h, s) {
356
+ /*
357
+ Credit:
358
+ https://github.com/WickyNilliams/pure-color
359
+ */
360
+ h = parseInt(h) / 60;
361
+ s = parseInt(s) / 100;
362
+ const f = h - Math.floor(h);
363
+ const p = 255 * (1 - s);
364
+ const q = 255 * (1 - s * f);
365
+ const t = 255 * (1 - s * (1 - f));
366
+ let rgb;
367
+ switch (Math.floor(h) % 6) {
368
+ case 0:
369
+ rgb = [255, t, p];
370
+ break;
371
+ case 1:
372
+ rgb = [q, 255, p];
373
+ break;
374
+ case 2:
375
+ rgb = [p, 255, t];
376
+ break;
377
+ case 3:
378
+ rgb = [p, q, 255];
379
+ break;
380
+ case 4:
381
+ rgb = [t, p, 255];
382
+ break;
383
+ case 5:
384
+ rgb = [255, p, q];
385
+ break;
386
+ }
387
+ if (rgb[0] === 255) {
388
+ rgb[1] *= 0.8;
389
+ rgb[2] *= 0.8;
390
+ if (rgb[1] <= 25 && rgb[2] <= 25) {
391
+ rgb[1] = 0;
392
+ rgb[2] = 0;
393
+ }
394
+ }
395
+ return [Math.round(rgb[0]), Math.round(rgb[1]), Math.round(rgb[2])];
396
+ }
397
+
398
+ export function k2rgb(k) {
399
+ // Set kelvin to nearest 100, between 2000 and 7100
400
+ k = Math.round(k / 100) * 100;
401
+ k = Math.max(Math.min(k, 7100), 2000);
402
+
403
+ // k should now appear in our table of kelvin to rgb
404
+ const values = {
405
+ 2000: [255, 141, 11],
406
+ 2100: [255, 146, 29],
407
+ 2200: [255, 147, 44],
408
+ 2300: [255, 152, 54],
409
+ 2400: [255, 157, 63],
410
+ 2500: [255, 166, 69],
411
+ 2600: [255, 170, 77],
412
+ 2700: [255, 174, 84],
413
+ 2800: [255, 173, 94],
414
+ 2900: [255, 177, 101],
415
+ 3000: [255, 180, 107],
416
+ 3100: [255, 189, 111],
417
+ 3200: [255, 187, 120],
418
+ 3300: [255, 195, 124],
419
+ 3400: [255, 198, 130],
420
+ 3500: [255, 201, 135],
421
+ 3600: [255, 203, 141],
422
+ 3700: [255, 206, 146],
423
+ 3800: [255, 204, 153],
424
+ 3900: [255, 206, 159],
425
+ 4000: [255, 213, 161],
426
+ 4100: [255, 215, 166],
427
+ 4200: [255, 217, 171],
428
+ 4300: [255, 219, 175],
429
+ 4400: [255, 221, 180],
430
+ 4500: [255, 223, 184],
431
+ 4600: [255, 225, 188],
432
+ 4700: [255, 226, 192],
433
+ 4800: [255, 228, 196],
434
+ 4900: [255, 229, 200],
435
+ 5000: [255, 231, 204],
436
+ 5100: [255, 230, 210],
437
+ 5200: [255, 234, 211],
438
+ 5300: [255, 235, 215],
439
+ 5400: [255, 237, 218],
440
+ 5500: [255, 236, 224],
441
+ 5700: [255, 240, 228],
442
+ 5800: [255, 241, 231],
443
+ 5900: [255, 243, 234],
444
+ 6000: [255, 244, 237],
445
+ 6100: [255, 245, 240],
446
+ 6200: [255, 246, 243],
447
+ 6300: [255, 247, 247],
448
+ 6400: [255, 248, 251],
449
+ 6500: [255, 249, 253],
450
+ 6600: [254, 249, 255],
451
+ 6700: [252, 247, 255],
452
+ 6800: [249, 246, 255],
453
+ 6900: [247, 245, 255],
454
+ 7000: [245, 243, 255],
455
+ 7100: [243, 242, 255],
456
+ };
457
+
458
+ // Return the value
459
+ return values[k];
460
+ }
461
+
462
+ export function m2hs(m) {
463
+ /*
464
+ Credit:
465
+ https://github.com/homebridge/HAP-NodeJS
466
+ */
467
+ const table = {
468
+ 100: [19, 222.1],
469
+ 101: [18.7, 222.2],
470
+ 102: [18.4, 222.3],
471
+ 103: [18.2, 222.3],
472
+ 104: [17.9, 222.4],
473
+ 105: [17.6, 222.5],
474
+ 106: [17.3, 222.7],
475
+ 107: [17, 222.8],
476
+ 108: [16.7, 222.9],
477
+ 109: [16.4, 223],
478
+ 110: [16.1, 223.2],
479
+ 111: [15.8, 223.3],
480
+ 112: [15.4, 223.4],
481
+ 113: [15.2, 223.6],
482
+ 114: [14.9, 223.8],
483
+ 115: [14.7, 223.9],
484
+ 116: [14.3, 224.1],
485
+ 117: [14.1, 224.2],
486
+ 118: [13.8, 224.4],
487
+ 119: [13.5, 224.6],
488
+ 120: [13.2, 224.8],
489
+ 121: [12.9, 225],
490
+ 122: [12.5, 225.3],
491
+ 123: [12.2, 225.6],
492
+ 124: [11.8, 225.9],
493
+ 125: [11.4, 226.3],
494
+ 126: [11.1, 226.7],
495
+ 127: [10.7, 227.1],
496
+ 128: [10.3, 227.6],
497
+ 129: [9.9, 228],
498
+ 130: [9.6, 228.5],
499
+ 131: [9.3, 229.1],
500
+ 132: [8.9, 229.6],
501
+ 133: [8.5, 230.2],
502
+ 134: [8.2, 230.9],
503
+ 135: [7.8, 231.6],
504
+ 136: [7.5, 232.5],
505
+ 137: [7.1, 233.5],
506
+ 138: [6.7, 234.6],
507
+ 139: [6.3, 235.8],
508
+ 140: [6, 237.1],
509
+ 141: [5.6, 238.9],
510
+ 142: [5.2, 240.9],
511
+ 143: [5, 242.9],
512
+ 144: [4.8, 244.9],
513
+ 145: [4.6, 246.9],
514
+ 146: [4.4, 249.3],
515
+ 147: [4.3, 251.9],
516
+ 148: [4.1, 254.9],
517
+ 149: [3.9, 258],
518
+ 150: [3.7, 261.8],
519
+ 151: [3.4, 265.9],
520
+ 152: [3.2, 271],
521
+ 153: [3, 276.4],
522
+ 154: [2.8, 283.6],
523
+ 155: [2.6, 290.4],
524
+ 156: [2.3, 295.3],
525
+ 157: [2.1, 300],
526
+ 158: [1.9, 300],
527
+ 159: [1.6, 300],
528
+ 160: [1.4, 195.8],
529
+ 161: [1.2, 84.3],
530
+ 162: [1.3, 58.2],
531
+ 163: [1.5, 55.9],
532
+ 164: [1.7, 53.2],
533
+ 165: [1.9, 50.2],
534
+ 166: [2.1, 47.1],
535
+ 167: [2.4, 44.5],
536
+ 168: [2.6, 42.6],
537
+ 169: [2.9, 40.9],
538
+ 170: [3.1, 39.5],
539
+ 171: [3.4, 38.3],
540
+ 172: [3.7, 37.3],
541
+ 173: [3.9, 36.5],
542
+ 174: [4.2, 35.7],
543
+ 175: [4.4, 35.1],
544
+ 176: [4.6, 34.5],
545
+ 177: [4.9, 34],
546
+ 178: [5.1, 33.5],
547
+ 179: [5.3, 33],
548
+ 180: [5.6, 32.7],
549
+ 181: [5.8, 32.3],
550
+ 182: [6, 32],
551
+ 183: [6.3, 31.7],
552
+ 184: [6.5, 31.4],
553
+ 185: [6.7, 31.2],
554
+ 186: [7, 30.9],
555
+ 187: [7.2, 30.7],
556
+ 188: [7.4, 30.5],
557
+ 189: [7.6, 30.3],
558
+ 190: [7.9, 30.1],
559
+ 191: [8.1, 29.9],
560
+ 192: [8.4, 29.7],
561
+ 193: [8.6, 29.6],
562
+ 194: [8.9, 29.5],
563
+ 195: [9.1, 29.3],
564
+ 196: [9.4, 29.2],
565
+ 197: [9.6, 29.1],
566
+ 198: [9.8, 29],
567
+ 199: [10, 28.9],
568
+ 200: [10.2, 28.7],
569
+ 201: [10.5, 28.7],
570
+ 202: [10.7, 28.6],
571
+ 203: [11, 28.5],
572
+ 204: [11.2, 28.4],
573
+ 205: [11.4, 28.3],
574
+ 206: [11.6, 28.3],
575
+ 207: [11.8, 28.2],
576
+ 208: [12.1, 28.1],
577
+ 209: [12.3, 28.1],
578
+ 210: [12.5, 28],
579
+ 211: [12.7, 28],
580
+ 212: [12.9, 27.9],
581
+ 213: [13.2, 27.8],
582
+ 214: [13.4, 27.8],
583
+ 215: [13.6, 27.7],
584
+ 216: [13.8, 27.7],
585
+ 217: [14, 27.7],
586
+ 218: [14.3, 27.6],
587
+ 219: [14.5, 27.6],
588
+ 220: [14.7, 27.5],
589
+ 221: [14.9, 27.5],
590
+ 222: [15.1, 27.5],
591
+ 223: [15.3, 27.4],
592
+ 224: [15.5, 27.4],
593
+ 225: [15.8, 27.4],
594
+ 226: [16, 27.3],
595
+ 227: [16.2, 27.3],
596
+ 228: [16.4, 27.3],
597
+ 229: [16.6, 27.3],
598
+ 230: [16.8, 27.2],
599
+ 231: [17, 27.2],
600
+ 232: [17.2, 27.2],
601
+ 233: [17.4, 27.2],
602
+ 234: [17.6, 27.2],
603
+ 235: [17.8, 27.1],
604
+ 236: [18, 27.1],
605
+ 237: [18.2, 27.1],
606
+ 238: [18.4, 27.1],
607
+ 239: [18.7, 27.1],
608
+ 240: [18.8, 27],
609
+ 241: [19, 27],
610
+ 242: [19.2, 27],
611
+ 243: [19.4, 27],
612
+ 244: [19.6, 27],
613
+ 245: [19.8, 27],
614
+ 246: [20, 27],
615
+ 247: [20.3, 26.9],
616
+ 248: [20.5, 26.9],
617
+ 249: [20.6, 26.9],
618
+ 250: [20.8, 26.9],
619
+ 251: [21, 26.9],
620
+ 252: [21.3, 26.9],
621
+ 253: [21.5, 26.9],
622
+ 254: [21.6, 26.9],
623
+ 255: [21.8, 26.8],
624
+ 256: [22, 26.8],
625
+ 257: [22.2, 26.8],
626
+ 258: [22.4, 26.8],
627
+ 259: [22.6, 26.8],
628
+ 260: [22.8, 26.8],
629
+ 261: [23, 26.8],
630
+ 262: [23.2, 26.8],
631
+ 263: [23.4, 26.8],
632
+ 264: [23.6, 26.8],
633
+ 265: [23.8, 26.8],
634
+ 266: [24, 26.8],
635
+ 267: [24.1, 26.8],
636
+ 268: [24.3, 26.8],
637
+ 269: [24.5, 26.8],
638
+ 270: [24.7, 26.8],
639
+ 271: [24.8, 26.8],
640
+ 272: [25.1, 26.7],
641
+ 273: [25.3, 26.7],
642
+ 274: [25.4, 26.7],
643
+ 275: [25.6, 26.7],
644
+ 276: [25.8, 26.7],
645
+ 277: [26, 26.7],
646
+ 278: [26.1, 26.7],
647
+ 279: [26.3, 26.7],
648
+ 280: [26.5, 26.7],
649
+ 281: [26.7, 26.7],
650
+ 282: [26.9, 26.7],
651
+ 283: [27.1, 26.7],
652
+ 284: [27.3, 26.7],
653
+ 285: [27.5, 26.7],
654
+ 286: [27.7, 26.7],
655
+ 287: [27.8, 26.7],
656
+ 288: [28, 26.7],
657
+ 289: [28.2, 26.7],
658
+ 290: [28.4, 26.7],
659
+ 291: [28.6, 26.7],
660
+ 292: [28.8, 26.7],
661
+ 293: [28.9, 26.7],
662
+ 294: [29.1, 26.7],
663
+ 295: [29.3, 26.7],
664
+ 296: [29.5, 26.7],
665
+ 297: [29.6, 26.7],
666
+ 298: [29.8, 26.7],
667
+ 299: [30, 26.7],
668
+ 300: [30.2, 26.7],
669
+ 301: [30.4, 26.7],
670
+ 302: [30.5, 26.7],
671
+ 303: [30.7, 26.7],
672
+ 304: [30.9, 26.7],
673
+ 305: [31.1, 26.7],
674
+ 306: [31.2, 26.7],
675
+ 307: [31.4, 26.7],
676
+ 308: [31.6, 26.7],
677
+ 309: [31.8, 26.8],
678
+ 310: [31.9, 26.8],
679
+ 311: [32.1, 26.8],
680
+ 312: [32.3, 26.8],
681
+ 313: [32.5, 26.8],
682
+ 314: [32.6, 26.8],
683
+ 315: [32.8, 26.8],
684
+ 316: [33, 26.8],
685
+ 317: [33.2, 26.8],
686
+ 318: [33.3, 26.8],
687
+ 319: [33.5, 26.8],
688
+ 320: [33.7, 26.8],
689
+ 321: [33.8, 26.8],
690
+ 322: [34, 26.8],
691
+ 323: [34.2, 26.8],
692
+ 324: [34.4, 26.8],
693
+ 325: [34.5, 26.8],
694
+ 326: [34.7, 26.8],
695
+ 327: [34.9, 26.8],
696
+ 328: [35.1, 26.8],
697
+ 329: [35.2, 26.8],
698
+ 330: [35.4, 26.8],
699
+ 331: [35.5, 26.8],
700
+ 332: [35.7, 26.8],
701
+ 333: [35.9, 26.8],
702
+ 334: [36.1, 26.8],
703
+ 335: [36.3, 26.9],
704
+ 336: [36.5, 26.9],
705
+ 337: [36.7, 26.9],
706
+ 338: [36.9, 26.9],
707
+ 339: [37.1, 26.9],
708
+ 340: [37.2, 26.9],
709
+ 341: [37.4, 26.9],
710
+ 342: [37.5, 26.9],
711
+ 343: [37.7, 26.9],
712
+ 344: [37.9, 26.9],
713
+ 345: [38.1, 26.9],
714
+ 346: [38.3, 26.9],
715
+ 347: [38.5, 26.9],
716
+ 348: [38.7, 26.9],
717
+ 349: [38.9, 26.9],
718
+ 350: [39, 26.9],
719
+ 351: [39.2, 26.9],
720
+ 352: [39.3, 27],
721
+ 353: [39.5, 27],
722
+ 354: [39.7, 27],
723
+ 355: [39.9, 27],
724
+ 356: [40.1, 27],
725
+ 357: [40.2, 27],
726
+ 358: [40.4, 27],
727
+ 359: [40.6, 27],
728
+ 360: [40.8, 27],
729
+ 361: [40.9, 27],
730
+ 362: [41.1, 27],
731
+ 363: [41.2, 27],
732
+ 364: [41.4, 27],
733
+ 365: [41.6, 27],
734
+ 366: [41.8, 27],
735
+ 367: [42, 27],
736
+ 368: [42.1, 27.1],
737
+ 369: [42.3, 27.1],
738
+ 370: [42.4, 27.1],
739
+ 371: [42.6, 27.1],
740
+ 372: [42.8, 27.1],
741
+ 373: [43, 27.1],
742
+ 374: [43.1, 27.1],
743
+ 375: [43.2, 27.1],
744
+ 376: [43.4, 27.1],
745
+ 377: [43.6, 27.1],
746
+ 378: [43.8, 27.1],
747
+ 379: [43.9, 27.1],
748
+ 380: [44.1, 27.1],
749
+ 381: [44.3, 27.2],
750
+ 382: [44.4, 27.2],
751
+ 383: [44.6, 27.2],
752
+ 384: [44.7, 27.2],
753
+ 385: [44.9, 27.2],
754
+ 386: [45.1, 27.2],
755
+ 387: [45.3, 27.2],
756
+ 388: [45.5, 27.2],
757
+ 389: [45.6, 27.2],
758
+ 390: [45.8, 27.2],
759
+ 391: [46, 27.2],
760
+ 392: [46.2, 27.2],
761
+ 393: [46.4, 27.3],
762
+ 394: [46.5, 27.3],
763
+ 395: [46.7, 27.3],
764
+ 396: [46.9, 27.3],
765
+ 397: [47.1, 27.3],
766
+ 398: [47.2, 27.3],
767
+ 399: [47.4, 27.3],
768
+ 400: [47.6, 27.3],
769
+ 401: [47.7, 27.3],
770
+ 402: [47.9, 27.3],
771
+ 403: [48.1, 27.3],
772
+ 404: [48.3, 27.3],
773
+ 405: [48.5, 27.4],
774
+ 406: [48.7, 27.4],
775
+ 407: [48.8, 27.4],
776
+ 408: [49, 27.4],
777
+ 409: [49.2, 27.4],
778
+ 410: [49.4, 27.4],
779
+ 411: [49.6, 27.4],
780
+ 412: [49.7, 27.4],
781
+ 413: [49.9, 27.4],
782
+ 414: [50.1, 27.4],
783
+ 415: [50.2, 27.4],
784
+ 416: [50.4, 27.4],
785
+ 417: [50.6, 27.5],
786
+ 418: [50.7, 27.5],
787
+ 419: [50.9, 27.5],
788
+ 420: [51.1, 27.5],
789
+ 421: [51.2, 27.5],
790
+ 422: [51.4, 27.5],
791
+ 423: [51.6, 27.5],
792
+ 424: [51.7, 27.5],
793
+ 425: [51.9, 27.5],
794
+ 426: [52.1, 27.5],
795
+ 427: [51.2, 27.6],
796
+ 428: [52.4, 27.6],
797
+ 429: [52.5, 27.6],
798
+ 430: [52.7, 27.6],
799
+ 431: [52.9, 27.6],
800
+ 432: [53.1, 27.6],
801
+ 433: [53.2, 27.6],
802
+ 434: [53.4, 27.6],
803
+ 435: [53.6, 27.6],
804
+ 436: [53.7, 27.6],
805
+ 437: [53.9, 27.6],
806
+ 438: [54.1, 27.7],
807
+ 439: [54.2, 27.7],
808
+ 440: [54.3, 27.7],
809
+ 441: [54.5, 27.7],
810
+ 442: [54.7, 27.7],
811
+ 443: [54.8, 27.7],
812
+ 444: [55, 27.7],
813
+ 445: [55.2, 27.7],
814
+ 446: [55.3, 27.7],
815
+ 447: [55.5, 27.7],
816
+ 448: [55.7, 27.7],
817
+ 449: [55.8, 27.8],
818
+ 450: [56, 27.8],
819
+ 451: [56.2, 27.8],
820
+ 452: [56.3, 27.8],
821
+ 453: [56.5, 27.8],
822
+ 454: [56.7, 27.8],
823
+ 455: [56.8, 27.8],
824
+ 456: [57, 27.8],
825
+ 457: [57.2, 27.8],
826
+ 458: [57.3, 27.9],
827
+ 459: [57.4, 27.9],
828
+ 460: [57.6, 27.9],
829
+ 461: [57.8, 27.9],
830
+ 462: [57.9, 27.9],
831
+ 463: [58.1, 27.9],
832
+ 464: [58.3, 27.9],
833
+ 465: [58.4, 27.9],
834
+ 466: [58.6, 27.9],
835
+ 467: [58.8, 27.9],
836
+ 468: [59, 28],
837
+ 469: [59.1, 28],
838
+ 470: [59.2, 28],
839
+ 471: [59.4, 28],
840
+ 472: [59.6, 28],
841
+ 473: [59.7, 28],
842
+ 474: [60, 28],
843
+ 475: [60.1, 28],
844
+ 476: [60.2, 28],
845
+ 477: [60.4, 28],
846
+ 478: [60.6, 28.1],
847
+ 479: [60.7, 28.1],
848
+ 480: [60.9, 28.1],
849
+ 481: [60.1, 28.1],
850
+ 482: [60.3, 28.1],
851
+ 483: [61.4, 28.1],
852
+ 484: [61.5, 28.1],
853
+ 485: [61.7, 28.1],
854
+ 486: [61.9, 28.1],
855
+ 487: [62, 28.2],
856
+ 488: [62.2, 28.2],
857
+ 489: [62.3, 28.2],
858
+ 490: [62.5, 28.2],
859
+ 491: [62.7, 28.2],
860
+ 492: [62.8, 28.2],
861
+ 493: [63, 28.2],
862
+ 494: [63.2, 28.2],
863
+ 495: [63.3, 28.2],
864
+ 496: [63.4, 28.2],
865
+ 497: [63.6, 28.2],
866
+ 498: [63.8, 28.3],
867
+ 499: [63.9, 28.3],
868
+ 500: [64.1, 28.3],
869
+ };
870
+ const input = Math.min(Math.max(Math.round(m), 140), 500);
871
+ const toReturn = table[input];
872
+ return [Math.round(toReturn[1]), Math.round(toReturn[0])];
873
+
874
+ }
@@ -1,22 +0,0 @@
1
- [
2
- {
3
- "deviceId": "56F90426AD3D",
4
- "deviceName": "Color Bulb DD5A",
5
- "deviceType": "Color Bulb",
6
- "enableCloudService": true,
7
- "hubDeviceId": "000000000000"
8
- },
9
- {
10
- "statusCode": 100,
11
- "body": {
12
- "deviceId": "56F90426AD3D",
13
- "deviceType": "Color Bulb",
14
- "hubDeviceId": "84F70353DD5A",
15
- "power": "on",
16
- "brightness": 100,
17
- "color": "0:0:0",
18
- "colorTemperature": 6500
19
- },
20
- "message": "success"
21
- }
22
- ]