@switchbot/homebridge-switchbot 1.8.2-beta.0 → 1.8.3-beta.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.
Files changed (105) hide show
  1. package/.eslintrc +1 -1
  2. package/.vscode/extensions.json +5 -0
  3. package/.vscode/settings.json +15 -0
  4. package/CHANGELOG.md +7 -0
  5. package/dist/devices/bots.d.ts +34 -35
  6. package/dist/devices/bots.d.ts.map +1 -1
  7. package/dist/devices/bots.js +242 -185
  8. package/dist/devices/bots.js.map +1 -1
  9. package/dist/devices/colorbulb.d.ts +50 -50
  10. package/dist/devices/colorbulb.d.ts.map +1 -1
  11. package/dist/devices/colorbulb.js +146 -132
  12. package/dist/devices/colorbulb.js.map +1 -1
  13. package/dist/devices/contact.d.ts +27 -29
  14. package/dist/devices/contact.d.ts.map +1 -1
  15. package/dist/devices/contact.js +139 -116
  16. package/dist/devices/contact.js.map +1 -1
  17. package/dist/devices/curtains.d.ts +29 -31
  18. package/dist/devices/curtains.d.ts.map +1 -1
  19. package/dist/devices/curtains.js +212 -177
  20. package/dist/devices/curtains.js.map +1 -1
  21. package/dist/devices/humidifiers.d.ts +33 -33
  22. package/dist/devices/humidifiers.d.ts.map +1 -1
  23. package/dist/devices/humidifiers.js +215 -190
  24. package/dist/devices/humidifiers.js.map +1 -1
  25. package/dist/devices/meters.d.ts +30 -31
  26. package/dist/devices/meters.d.ts.map +1 -1
  27. package/dist/devices/meters.js +125 -101
  28. package/dist/devices/meters.js.map +1 -1
  29. package/dist/devices/motion.d.ts +25 -26
  30. package/dist/devices/motion.d.ts.map +1 -1
  31. package/dist/devices/motion.js +121 -103
  32. package/dist/devices/motion.js.map +1 -1
  33. package/dist/devices/plugs.d.ts +23 -23
  34. package/dist/devices/plugs.d.ts.map +1 -1
  35. package/dist/devices/plugs.js +82 -64
  36. package/dist/devices/plugs.js.map +1 -1
  37. package/dist/index.d.ts +2 -2
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +22 -3
  40. package/dist/index.js.map +1 -1
  41. package/dist/irdevices/airconditioners.d.ts +6 -6
  42. package/dist/irdevices/airconditioners.d.ts.map +1 -1
  43. package/dist/irdevices/airconditioners.js +106 -80
  44. package/dist/irdevices/airconditioners.js.map +1 -1
  45. package/dist/irdevices/airpurifiers.d.ts +5 -5
  46. package/dist/irdevices/airpurifiers.d.ts.map +1 -1
  47. package/dist/irdevices/airpurifiers.js +57 -43
  48. package/dist/irdevices/airpurifiers.js.map +1 -1
  49. package/dist/irdevices/cameras.d.ts +5 -5
  50. package/dist/irdevices/cameras.d.ts.map +1 -1
  51. package/dist/irdevices/cameras.js +32 -28
  52. package/dist/irdevices/cameras.js.map +1 -1
  53. package/dist/irdevices/fans.d.ts +5 -5
  54. package/dist/irdevices/fans.d.ts.map +1 -1
  55. package/dist/irdevices/fans.js +46 -39
  56. package/dist/irdevices/fans.js.map +1 -1
  57. package/dist/irdevices/lights.d.ts +5 -5
  58. package/dist/irdevices/lights.d.ts.map +1 -1
  59. package/dist/irdevices/lights.js +38 -34
  60. package/dist/irdevices/lights.js.map +1 -1
  61. package/dist/irdevices/others.d.ts +5 -5
  62. package/dist/irdevices/others.d.ts.map +1 -1
  63. package/dist/irdevices/others.js +35 -30
  64. package/dist/irdevices/others.js.map +1 -1
  65. package/dist/irdevices/tvs.d.ts +5 -5
  66. package/dist/irdevices/tvs.d.ts.map +1 -1
  67. package/dist/irdevices/tvs.js +92 -77
  68. package/dist/irdevices/tvs.js.map +1 -1
  69. package/dist/irdevices/vacuumcleaners.d.ts +5 -5
  70. package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
  71. package/dist/irdevices/vacuumcleaners.js +32 -28
  72. package/dist/irdevices/vacuumcleaners.js.map +1 -1
  73. package/dist/irdevices/waterheaters.d.ts +5 -5
  74. package/dist/irdevices/waterheaters.d.ts.map +1 -1
  75. package/dist/irdevices/waterheaters.js +32 -28
  76. package/dist/irdevices/waterheaters.js.map +1 -1
  77. package/dist/platform.d.ts +13 -13
  78. package/dist/platform.d.ts.map +1 -1
  79. package/dist/platform.js +269 -184
  80. package/dist/platform.js.map +1 -1
  81. package/dist/settings.d.ts +2 -2
  82. package/dist/settings.d.ts.map +1 -1
  83. package/dist/settings.js +4 -4
  84. package/dist/settings.js.map +1 -1
  85. package/package.json +4 -3
  86. package/src/devices/bots.ts +928 -443
  87. package/src/devices/colorbulb.ts +474 -247
  88. package/src/devices/contact.ts +382 -209
  89. package/src/devices/curtains.ts +614 -322
  90. package/src/devices/humidifiers.ts +595 -324
  91. package/src/devices/meters.ts +332 -187
  92. package/src/devices/motion.ts +328 -185
  93. package/src/devices/plugs.ts +176 -108
  94. package/src/index.ts +5 -5
  95. package/src/irdevices/airconditioners.ts +361 -150
  96. package/src/irdevices/airpurifiers.ts +179 -81
  97. package/src/irdevices/cameras.ts +110 -52
  98. package/src/irdevices/fans.ts +175 -78
  99. package/src/irdevices/lights.ts +111 -58
  100. package/src/irdevices/others.ts +138 -63
  101. package/src/irdevices/tvs.ts +250 -125
  102. package/src/irdevices/vacuumcleaners.ts +113 -53
  103. package/src/irdevices/waterheaters.ts +116 -54
  104. package/src/platform.ts +797 -371
  105. package/src/settings.ts +18 -24
package/src/settings.ts CHANGED
@@ -1,23 +1,23 @@
1
- import { MacAddress, PlatformConfig } from 'homebridge';
1
+ import { MacAddress, PlatformConfig } from "homebridge";
2
2
  /**
3
3
  * This is the name of the platform that users will use to register the plugin in the Homebridge config.json
4
4
  */
5
- export const PLATFORM_NAME = 'SwitchBot';
5
+ export const PLATFORM_NAME = "SwitchBot";
6
6
 
7
7
  /**
8
8
  * This must match the name of your plugin as defined the package.json
9
9
  */
10
- export const PLUGIN_NAME = '@switchbot/homebridge-switchbot';
10
+ export const PLUGIN_NAME = "@switchbot/homebridge-switchbot";
11
11
 
12
12
  /**
13
13
  * This is the main url used to access SwitchBot API
14
14
  */
15
- export const AuthURL = 'https://api.switch-bot.com';
15
+ export const AuthURL = "https://api.switch-bot.com";
16
16
 
17
17
  /**
18
18
  * This is the main url used to access SwitchBot API
19
19
  */
20
- export const DeviceURL = 'https://api.switch-bot.com/v1.0/devices';
20
+ export const DeviceURL = "https://api.switch-bot.com/v1.0/devices";
21
21
 
22
22
  //Config
23
23
  export interface SwitchBotPlatformConfig extends PlatformConfig {
@@ -51,7 +51,7 @@ export interface devicesConfig extends device {
51
51
  motion?: motion;
52
52
  colorbulb?: colorbulb;
53
53
  plug?: Record<any, any>;
54
- ble?: string;
54
+ ble?: boolean;
55
55
  scanDuration?: number;
56
56
  hide_device?: boolean;
57
57
  offline?: boolean;
@@ -284,9 +284,9 @@ export type ad = {
284
284
 
285
285
  export type serviceData = {
286
286
  //Model of BLE SwitchBot Device
287
- model: string,
287
+ model: string;
288
288
  //Model Name of BLE SwitchBot Device
289
- modelName: string
289
+ modelName: string;
290
290
  //Mode for Bot either Press or Switch
291
291
  mode?: boolean;
292
292
  //Bot State
@@ -304,9 +304,9 @@ export type serviceData = {
304
304
  // Fahrenheit enabled for Meter
305
305
  fahrenheit: boolean;
306
306
  // Humidity level for Meter
307
- humidity?: number,
307
+ humidity?: number;
308
308
  //Motion Detected for Contact or Motion Sensors
309
- movement?: boolean,
309
+ movement?: boolean;
310
310
  //Motion ((lightLevel == 1) ? 'dark' : ((lightLevel == 2) ? 'bright' : 'unknown'))
311
311
  //Contact ((lightLevel == 0) ? 'dark' : 'bright')
312
312
  //Curtain (light sensor level (1-10))
@@ -326,18 +326,13 @@ export type temperature = {
326
326
  };
327
327
 
328
328
  export type switchbot = {
329
- discover: (
330
- arg0:
331
- {
332
- duration?: any;
333
- model: string;
334
- quick: boolean;
335
- id?: MacAddress;
336
- }
337
- ) => Promise<any>;
338
- wait: (
339
- arg0: number
340
- ) => any;
329
+ discover: (arg0: {
330
+ duration?: any;
331
+ model: string;
332
+ quick: boolean;
333
+ id?: MacAddress;
334
+ }) => Promise<any>;
335
+ wait: (arg0: number) => any;
341
336
  };
342
337
 
343
338
  export function rgb2hs(r, g, b) {
@@ -893,5 +888,4 @@ export function m2hs(m) {
893
888
  const input = Math.min(Math.max(Math.round(m), 140), 500);
894
889
  const toReturn = table[input];
895
890
  return [Math.round(toReturn[1]), Math.round(toReturn[0])];
896
-
897
- }
891
+ }