@switchbot/homebridge-switchbot 1.8.3-beta.0 → 1.9.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/settings.json +1 -1
  3. package/CHANGELOG.md +8 -0
  4. package/config.schema.json +9 -0
  5. package/dist/devices/bots.d.ts +37 -34
  6. package/dist/devices/bots.d.ts.map +1 -1
  7. package/dist/devices/bots.js +196 -243
  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 +131 -145
  12. package/dist/devices/colorbulb.js.map +1 -1
  13. package/dist/devices/contact.d.ts +29 -27
  14. package/dist/devices/contact.d.ts.map +1 -1
  15. package/dist/devices/contact.js +115 -138
  16. package/dist/devices/contact.js.map +1 -1
  17. package/dist/devices/curtains.d.ts +31 -29
  18. package/dist/devices/curtains.d.ts.map +1 -1
  19. package/dist/devices/curtains.js +176 -211
  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 +189 -214
  24. package/dist/devices/humidifiers.js.map +1 -1
  25. package/dist/devices/meters.d.ts +31 -30
  26. package/dist/devices/meters.d.ts.map +1 -1
  27. package/dist/devices/meters.js +100 -124
  28. package/dist/devices/meters.js.map +1 -1
  29. package/dist/devices/motion.d.ts +26 -25
  30. package/dist/devices/motion.d.ts.map +1 -1
  31. package/dist/devices/motion.js +102 -120
  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 +63 -81
  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 +3 -22
  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 +79 -105
  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 +42 -56
  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 +27 -31
  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 +38 -45
  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 +33 -37
  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 +29 -34
  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 +76 -91
  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 +27 -31
  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 +27 -31
  76. package/dist/irdevices/waterheaters.js.map +1 -1
  77. package/dist/platform.d.ts +12 -12
  78. package/dist/platform.d.ts.map +1 -1
  79. package/dist/platform.js +172 -241
  80. package/dist/platform.js.map +1 -1
  81. package/dist/settings.d.ts +2 -1
  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 +71 -72
  86. package/src/devices/bots.ts +455 -929
  87. package/src/devices/colorbulb.ts +246 -473
  88. package/src/devices/contact.ts +208 -381
  89. package/src/devices/curtains.ts +321 -613
  90. package/src/devices/humidifiers.ts +323 -594
  91. package/src/devices/meters.ts +186 -331
  92. package/src/devices/motion.ts +184 -327
  93. package/src/devices/plugs.ts +107 -175
  94. package/src/index.ts +5 -5
  95. package/src/irdevices/airconditioners.ts +149 -360
  96. package/src/irdevices/airpurifiers.ts +80 -178
  97. package/src/irdevices/cameras.ts +51 -109
  98. package/src/irdevices/fans.ts +77 -174
  99. package/src/irdevices/lights.ts +57 -110
  100. package/src/irdevices/others.ts +62 -137
  101. package/src/irdevices/tvs.ts +124 -249
  102. package/src/irdevices/vacuumcleaners.ts +52 -112
  103. package/src/irdevices/waterheaters.ts +53 -115
  104. package/src/platform.ts +357 -768
  105. package/src/settings.ts +24 -17
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 {
@@ -66,6 +66,7 @@ export type bot = {
66
66
  mode?: string;
67
67
  deviceType?: string;
68
68
  doublePress?: number;
69
+ allowPush?: boolean
69
70
  };
70
71
 
71
72
  export type humidifier = {
@@ -284,9 +285,9 @@ export type ad = {
284
285
 
285
286
  export type serviceData = {
286
287
  //Model of BLE SwitchBot Device
287
- model: string;
288
+ model: string,
288
289
  //Model Name of BLE SwitchBot Device
289
- modelName: string;
290
+ modelName: string
290
291
  //Mode for Bot either Press or Switch
291
292
  mode?: boolean;
292
293
  //Bot State
@@ -304,9 +305,9 @@ export type serviceData = {
304
305
  // Fahrenheit enabled for Meter
305
306
  fahrenheit: boolean;
306
307
  // Humidity level for Meter
307
- humidity?: number;
308
+ humidity?: number,
308
309
  //Motion Detected for Contact or Motion Sensors
309
- movement?: boolean;
310
+ movement?: boolean,
310
311
  //Motion ((lightLevel == 1) ? 'dark' : ((lightLevel == 2) ? 'bright' : 'unknown'))
311
312
  //Contact ((lightLevel == 0) ? 'dark' : 'bright')
312
313
  //Curtain (light sensor level (1-10))
@@ -326,13 +327,18 @@ export type temperature = {
326
327
  };
327
328
 
328
329
  export type switchbot = {
329
- discover: (arg0: {
330
- duration?: any;
331
- model: string;
332
- quick: boolean;
333
- id?: MacAddress;
334
- }) => Promise<any>;
335
- wait: (arg0: number) => any;
330
+ discover: (
331
+ arg0:
332
+ {
333
+ duration?: any;
334
+ model: string;
335
+ quick: boolean;
336
+ id?: MacAddress;
337
+ }
338
+ ) => Promise<any>;
339
+ wait: (
340
+ arg0: number
341
+ ) => any;
336
342
  };
337
343
 
338
344
  export function rgb2hs(r, g, b) {
@@ -888,4 +894,5 @@ export function m2hs(m) {
888
894
  const input = Math.min(Math.max(Math.round(m), 140), 500);
889
895
  const toReturn = table[input];
890
896
  return [Math.round(toReturn[1]), Math.round(toReturn[0])];
891
- }
897
+
898
+ }