@switchbot/homebridge-switchbot 1.8.2 → 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 (104) hide show
  1. package/.eslintrc +1 -1
  2. package/.vscode/extensions.json +5 -0
  3. package/.vscode/settings.json +15 -0
  4. package/dist/devices/bots.d.ts +34 -35
  5. package/dist/devices/bots.d.ts.map +1 -1
  6. package/dist/devices/bots.js +241 -184
  7. package/dist/devices/bots.js.map +1 -1
  8. package/dist/devices/colorbulb.d.ts +50 -50
  9. package/dist/devices/colorbulb.d.ts.map +1 -1
  10. package/dist/devices/colorbulb.js +145 -131
  11. package/dist/devices/colorbulb.js.map +1 -1
  12. package/dist/devices/contact.d.ts +27 -29
  13. package/dist/devices/contact.d.ts.map +1 -1
  14. package/dist/devices/contact.js +138 -115
  15. package/dist/devices/contact.js.map +1 -1
  16. package/dist/devices/curtains.d.ts +29 -31
  17. package/dist/devices/curtains.d.ts.map +1 -1
  18. package/dist/devices/curtains.js +211 -176
  19. package/dist/devices/curtains.js.map +1 -1
  20. package/dist/devices/humidifiers.d.ts +33 -33
  21. package/dist/devices/humidifiers.d.ts.map +1 -1
  22. package/dist/devices/humidifiers.js +214 -189
  23. package/dist/devices/humidifiers.js.map +1 -1
  24. package/dist/devices/meters.d.ts +30 -31
  25. package/dist/devices/meters.d.ts.map +1 -1
  26. package/dist/devices/meters.js +124 -100
  27. package/dist/devices/meters.js.map +1 -1
  28. package/dist/devices/motion.d.ts +25 -26
  29. package/dist/devices/motion.d.ts.map +1 -1
  30. package/dist/devices/motion.js +120 -102
  31. package/dist/devices/motion.js.map +1 -1
  32. package/dist/devices/plugs.d.ts +23 -23
  33. package/dist/devices/plugs.d.ts.map +1 -1
  34. package/dist/devices/plugs.js +81 -63
  35. package/dist/devices/plugs.js.map +1 -1
  36. package/dist/index.d.ts +2 -2
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +22 -3
  39. package/dist/index.js.map +1 -1
  40. package/dist/irdevices/airconditioners.d.ts +6 -6
  41. package/dist/irdevices/airconditioners.d.ts.map +1 -1
  42. package/dist/irdevices/airconditioners.js +105 -79
  43. package/dist/irdevices/airconditioners.js.map +1 -1
  44. package/dist/irdevices/airpurifiers.d.ts +5 -5
  45. package/dist/irdevices/airpurifiers.d.ts.map +1 -1
  46. package/dist/irdevices/airpurifiers.js +56 -42
  47. package/dist/irdevices/airpurifiers.js.map +1 -1
  48. package/dist/irdevices/cameras.d.ts +5 -5
  49. package/dist/irdevices/cameras.d.ts.map +1 -1
  50. package/dist/irdevices/cameras.js +31 -27
  51. package/dist/irdevices/cameras.js.map +1 -1
  52. package/dist/irdevices/fans.d.ts +5 -5
  53. package/dist/irdevices/fans.d.ts.map +1 -1
  54. package/dist/irdevices/fans.js +45 -38
  55. package/dist/irdevices/fans.js.map +1 -1
  56. package/dist/irdevices/lights.d.ts +5 -5
  57. package/dist/irdevices/lights.d.ts.map +1 -1
  58. package/dist/irdevices/lights.js +37 -33
  59. package/dist/irdevices/lights.js.map +1 -1
  60. package/dist/irdevices/others.d.ts +5 -5
  61. package/dist/irdevices/others.d.ts.map +1 -1
  62. package/dist/irdevices/others.js +34 -29
  63. package/dist/irdevices/others.js.map +1 -1
  64. package/dist/irdevices/tvs.d.ts +5 -5
  65. package/dist/irdevices/tvs.d.ts.map +1 -1
  66. package/dist/irdevices/tvs.js +91 -76
  67. package/dist/irdevices/tvs.js.map +1 -1
  68. package/dist/irdevices/vacuumcleaners.d.ts +5 -5
  69. package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
  70. package/dist/irdevices/vacuumcleaners.js +31 -27
  71. package/dist/irdevices/vacuumcleaners.js.map +1 -1
  72. package/dist/irdevices/waterheaters.d.ts +5 -5
  73. package/dist/irdevices/waterheaters.d.ts.map +1 -1
  74. package/dist/irdevices/waterheaters.js +31 -27
  75. package/dist/irdevices/waterheaters.js.map +1 -1
  76. package/dist/platform.d.ts +12 -12
  77. package/dist/platform.d.ts.map +1 -1
  78. package/dist/platform.js +241 -172
  79. package/dist/platform.js.map +1 -1
  80. package/dist/settings.d.ts +1 -1
  81. package/dist/settings.d.ts.map +1 -1
  82. package/dist/settings.js +4 -4
  83. package/dist/settings.js.map +1 -1
  84. package/package.json +72 -71
  85. package/src/devices/bots.ts +927 -442
  86. package/src/devices/colorbulb.ts +473 -246
  87. package/src/devices/contact.ts +381 -208
  88. package/src/devices/curtains.ts +613 -321
  89. package/src/devices/humidifiers.ts +594 -323
  90. package/src/devices/meters.ts +331 -186
  91. package/src/devices/motion.ts +327 -184
  92. package/src/devices/plugs.ts +175 -107
  93. package/src/index.ts +5 -5
  94. package/src/irdevices/airconditioners.ts +360 -149
  95. package/src/irdevices/airpurifiers.ts +178 -80
  96. package/src/irdevices/cameras.ts +109 -51
  97. package/src/irdevices/fans.ts +174 -77
  98. package/src/irdevices/lights.ts +110 -57
  99. package/src/irdevices/others.ts +137 -62
  100. package/src/irdevices/tvs.ts +249 -124
  101. package/src/irdevices/vacuumcleaners.ts +112 -52
  102. package/src/irdevices/waterheaters.ts +115 -53
  103. package/src/platform.ts +768 -357
  104. package/src/settings.ts +17 -23
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 {
@@ -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
+ }