@switchbot/homebridge-switchbot 1.7.1-beta.1 → 1.7.1-beta.10

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 (97) hide show
  1. package/CHANGELOG.md +7 -2
  2. package/config.schema.json +46 -33
  3. package/dist/devices/bots.d.ts +4 -2
  4. package/dist/devices/bots.d.ts.map +1 -1
  5. package/dist/devices/bots.js +40 -40
  6. package/dist/devices/bots.js.map +1 -1
  7. package/dist/devices/colorbulb.d.ts +6 -1
  8. package/dist/devices/colorbulb.d.ts.map +1 -1
  9. package/dist/devices/colorbulb.js +18 -11
  10. package/dist/devices/colorbulb.js.map +1 -1
  11. package/dist/devices/contact.d.ts +6 -7
  12. package/dist/devices/contact.d.ts.map +1 -1
  13. package/dist/devices/contact.js +69 -107
  14. package/dist/devices/contact.js.map +1 -1
  15. package/dist/devices/curtains.d.ts +10 -3
  16. package/dist/devices/curtains.d.ts.map +1 -1
  17. package/dist/devices/curtains.js +52 -34
  18. package/dist/devices/curtains.js.map +1 -1
  19. package/dist/devices/humidifiers.d.ts +8 -2
  20. package/dist/devices/humidifiers.d.ts.map +1 -1
  21. package/dist/devices/humidifiers.js +28 -35
  22. package/dist/devices/humidifiers.js.map +1 -1
  23. package/dist/devices/meters.d.ts +14 -12
  24. package/dist/devices/meters.d.ts.map +1 -1
  25. package/dist/devices/meters.js +63 -103
  26. package/dist/devices/meters.js.map +1 -1
  27. package/dist/devices/motion.d.ts +5 -6
  28. package/dist/devices/motion.d.ts.map +1 -1
  29. package/dist/devices/motion.js +61 -90
  30. package/dist/devices/motion.js.map +1 -1
  31. package/dist/devices/plugs.d.ts +3 -1
  32. package/dist/devices/plugs.d.ts.map +1 -1
  33. package/dist/devices/plugs.js +8 -1
  34. package/dist/devices/plugs.js.map +1 -1
  35. package/dist/irdevices/airconditioners.d.ts +1 -0
  36. package/dist/irdevices/airconditioners.d.ts.map +1 -1
  37. package/dist/irdevices/airconditioners.js +6 -0
  38. package/dist/irdevices/airconditioners.js.map +1 -1
  39. package/dist/irdevices/airpurifiers.d.ts +1 -0
  40. package/dist/irdevices/airpurifiers.d.ts.map +1 -1
  41. package/dist/irdevices/airpurifiers.js +6 -0
  42. package/dist/irdevices/airpurifiers.js.map +1 -1
  43. package/dist/irdevices/cameras.d.ts +1 -0
  44. package/dist/irdevices/cameras.d.ts.map +1 -1
  45. package/dist/irdevices/cameras.js +6 -0
  46. package/dist/irdevices/cameras.js.map +1 -1
  47. package/dist/irdevices/fans.d.ts +1 -0
  48. package/dist/irdevices/fans.d.ts.map +1 -1
  49. package/dist/irdevices/fans.js +6 -0
  50. package/dist/irdevices/fans.js.map +1 -1
  51. package/dist/irdevices/lights.d.ts +1 -0
  52. package/dist/irdevices/lights.d.ts.map +1 -1
  53. package/dist/irdevices/lights.js +6 -0
  54. package/dist/irdevices/lights.js.map +1 -1
  55. package/dist/irdevices/others.d.ts +1 -0
  56. package/dist/irdevices/others.d.ts.map +1 -1
  57. package/dist/irdevices/others.js +6 -0
  58. package/dist/irdevices/others.js.map +1 -1
  59. package/dist/irdevices/tvs.d.ts +1 -0
  60. package/dist/irdevices/tvs.d.ts.map +1 -1
  61. package/dist/irdevices/tvs.js +6 -0
  62. package/dist/irdevices/tvs.js.map +1 -1
  63. package/dist/irdevices/vacuumcleaners.d.ts +1 -0
  64. package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
  65. package/dist/irdevices/vacuumcleaners.js +6 -0
  66. package/dist/irdevices/vacuumcleaners.js.map +1 -1
  67. package/dist/irdevices/waterheaters.d.ts +1 -0
  68. package/dist/irdevices/waterheaters.d.ts.map +1 -1
  69. package/dist/irdevices/waterheaters.js +6 -0
  70. package/dist/irdevices/waterheaters.js.map +1 -1
  71. package/dist/platform.d.ts +2 -1
  72. package/dist/platform.d.ts.map +1 -1
  73. package/dist/platform.js +14 -1
  74. package/dist/platform.js.map +1 -1
  75. package/dist/settings.d.ts +6 -0
  76. package/dist/settings.d.ts.map +1 -1
  77. package/dist/settings.js.map +1 -1
  78. package/package.json +5 -5
  79. package/src/devices/bots.ts +43 -44
  80. package/src/devices/colorbulb.ts +24 -14
  81. package/src/devices/contact.ts +72 -108
  82. package/src/devices/curtains.ts +60 -36
  83. package/src/devices/humidifiers.ts +36 -36
  84. package/src/devices/meters.ts +79 -113
  85. package/src/devices/motion.ts +66 -91
  86. package/src/devices/plugs.ts +11 -2
  87. package/src/irdevices/airconditioners.ts +7 -0
  88. package/src/irdevices/airpurifiers.ts +7 -0
  89. package/src/irdevices/cameras.ts +7 -0
  90. package/src/irdevices/fans.ts +7 -0
  91. package/src/irdevices/lights.ts +7 -0
  92. package/src/irdevices/others.ts +7 -0
  93. package/src/irdevices/tvs.ts +7 -0
  94. package/src/irdevices/vacuumcleaners.ts +7 -0
  95. package/src/irdevices/waterheaters.ts +7 -0
  96. package/src/platform.ts +14 -1
  97. package/src/settings.ts +6 -0
@@ -50,6 +50,7 @@ export class AirConditioner {
50
50
  ) {
51
51
  // default placeholders
52
52
  this.logs();
53
+ this.config(device);
53
54
  if (this.Active === undefined) {
54
55
  this.Active = this.platform.Characteristic.Active.INACTIVE;
55
56
  } else {
@@ -166,6 +167,12 @@ export class AirConditioner {
166
167
  .onSet(this.RotationSpeedSet.bind(this));
167
168
  }
168
169
 
170
+ config(device: irdevice & irDevicesConfig) {
171
+ if (device.irair !== undefined) {
172
+ this.warnLog(`Air Conditioner: ${this.accessory.displayName} Config: ${JSON.stringify(device.irair)}`);
173
+ }
174
+ }
175
+
169
176
  logs() {
170
177
  if (this.platform.debugMode) {
171
178
  this.deviceLogging = this.accessory.context.logging = 'debug';
@@ -45,6 +45,7 @@ export class AirPurifier {
45
45
  ) {
46
46
  // default placeholders
47
47
  this.logs();
48
+ this.config(device);
48
49
  if (this.Active === undefined) {
49
50
  this.Active = this.platform.Characteristic.Active.INACTIVE;
50
51
  } else {
@@ -87,6 +88,12 @@ export class AirPurifier {
87
88
  this.service.getCharacteristic(this.platform.Characteristic.TargetAirPurifierState).onSet(this.TargetAirPurifierStateSet.bind(this));
88
89
  }
89
90
 
91
+ config(device: irdevice & irDevicesConfig) {
92
+ if (device.irpur !== undefined) {
93
+ this.warnLog(`Air Purifier: ${this.accessory.displayName} Config: ${JSON.stringify(device.irpur)}`);
94
+ }
95
+ }
96
+
90
97
  logs() {
91
98
  if (this.platform.debugMode) {
92
99
  this.deviceLogging = this.accessory.context.logging = 'debug';
@@ -26,6 +26,7 @@ export class Camera {
26
26
  ) {
27
27
  // default placeholders
28
28
  this.logs();
29
+ this.config(device);
29
30
  if (this.On === undefined) {
30
31
  this.On = false;
31
32
  } else {
@@ -57,6 +58,12 @@ export class Camera {
57
58
  this.service.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this));
58
59
  }
59
60
 
61
+ config(device: irdevice & irDevicesConfig) {
62
+ if (device.ircam !== undefined && (this.deviceLogging === 'debug' || this.deviceLogging === 'standard')) {
63
+ this.warnLog(`Camera: ${this.accessory.displayName} Config: ${JSON.stringify(device.ircam)}`);
64
+ }
65
+ }
66
+
60
67
  logs() {
61
68
  if (this.platform.debugMode) {
62
69
  this.deviceLogging = this.accessory.context.logging = 'debug';
@@ -36,6 +36,7 @@ export class Fan {
36
36
  ) {
37
37
  // default placeholders
38
38
  this.logs();
39
+ this.config(device);
39
40
  if (this.Active === undefined) {
40
41
  this.Active = this.platform.Characteristic.Active.INACTIVE;
41
42
  } else {
@@ -116,6 +117,12 @@ export class Fan {
116
117
  }
117
118
  }
118
119
 
120
+ config(device: irdevice & irDevicesConfig) {
121
+ if (device.irfan !== undefined && (this.deviceLogging === 'debug' || this.deviceLogging === 'standard')) {
122
+ this.warnLog(`Fan: ${this.accessory.displayName} Config: ${JSON.stringify(device.irfan)}`);
123
+ }
124
+ }
125
+
119
126
  logs() {
120
127
  if (this.platform.debugMode) {
121
128
  this.deviceLogging = this.accessory.context.logging = 'debug';
@@ -26,6 +26,7 @@ export class Light {
26
26
  ) {
27
27
  // default placeholders
28
28
  this.logs();
29
+ this.config(device);
29
30
  if (this.On === undefined) {
30
31
  this.On = false;
31
32
  } else {
@@ -72,6 +73,12 @@ export class Light {
72
73
  });*/
73
74
  }
74
75
 
76
+ config(device: irdevice & irDevicesConfig) {
77
+ if (device.irlight !== undefined) {
78
+ this.warnLog(`Light: ${this.accessory.displayName} Config: ${JSON.stringify(device.irlight)}`);
79
+ }
80
+ }
81
+
75
82
  logs() {
76
83
  if (this.platform.debugMode) {
77
84
  this.deviceLogging = this.accessory.context.logging = 'debug';
@@ -28,6 +28,7 @@ export class Others {
28
28
  // default placeholders
29
29
  this.logs();
30
30
  this.deviceType();
31
+ this.config(device);
31
32
  if (this.Active === undefined) {
32
33
  this.Active = this.platform.Characteristic.Active.INACTIVE;
33
34
  } else {
@@ -76,6 +77,12 @@ export class Others {
76
77
  }
77
78
  }
78
79
 
80
+ config(device: irdevice & irDevicesConfig) {
81
+ if (device.other !== undefined) {
82
+ this.warnLog(`Other: ${this.accessory.displayName} Config: ${JSON.stringify(device.other)}`);
83
+ }
84
+ }
85
+
79
86
  logs() {
80
87
  if (this.platform.debugMode) {
81
88
  this.deviceLogging = this.accessory.context.logging = 'debug';
@@ -31,6 +31,7 @@ export class TV {
31
31
  ) {
32
32
  // default placeholders
33
33
  this.logs();
34
+ this.config(device);
34
35
  if (this.Active === undefined) {
35
36
  this.Active = this.platform.Characteristic.Active.INACTIVE;
36
37
  } else {
@@ -128,6 +129,12 @@ export class TV {
128
129
  .onSet(this.VolumeSelectorSet.bind(this));
129
130
  }
130
131
 
132
+ config(device: irdevice & irDevicesConfig) {
133
+ if (device.irtv !== undefined) {
134
+ this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(device.irtv)}`);
135
+ }
136
+ }
137
+
131
138
  logs() {
132
139
  if (this.platform.debugMode) {
133
140
  this.deviceLogging = this.accessory.context.logging = 'debug';
@@ -26,6 +26,7 @@ export class VacuumCleaner {
26
26
  ) {
27
27
  // default placeholders
28
28
  this.logs();
29
+ this.config(device);
29
30
  if (this.On === undefined) {
30
31
  this.On = false;
31
32
  } else {
@@ -57,6 +58,12 @@ export class VacuumCleaner {
57
58
  this.service.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this));
58
59
  }
59
60
 
61
+ config(device: irdevice & irDevicesConfig) {
62
+ if (device.irvc !== undefined) {
63
+ this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Config: ${JSON.stringify(device.irvc)}`);
64
+ }
65
+ }
66
+
60
67
  logs() {
61
68
  if (this.platform.debugMode) {
62
69
  this.deviceLogging = this.accessory.context.logging = 'debug';
@@ -26,6 +26,7 @@ export class WaterHeater {
26
26
  ) {
27
27
  // default placeholders
28
28
  this.logs();
29
+ this.config(device);
29
30
  if (this.Active === undefined) {
30
31
  this.Active = this.platform.Characteristic.Active.INACTIVE;
31
32
  } else {
@@ -66,6 +67,12 @@ export class WaterHeater {
66
67
  this.service.getCharacteristic(this.platform.Characteristic.Active).onSet(this.ActiveSet.bind(this));
67
68
  }
68
69
 
70
+ config(device: irdevice & irDevicesConfig) {
71
+ if (device.irwh !== undefined) {
72
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Config: ${JSON.stringify(device.irwh)}`);
73
+ }
74
+ }
75
+
69
76
  logs() {
70
77
  if (this.platform.debugMode) {
71
78
  this.deviceLogging = this.accessory.context.logging = 'debug';
package/src/platform.ts CHANGED
@@ -192,8 +192,21 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
192
192
  }
193
193
  }
194
194
 
195
+ connectBLE() {
196
+ let Switchbot: new () => any;
197
+ let switchbot: any;
198
+ try {
199
+ Switchbot = require('node-switchbot');
200
+ switchbot = new Switchbot();
201
+ } catch (e) {
202
+ switchbot = false;
203
+ this.errorLog(`Was 'node-switchbot' found: ${switchbot}`);
204
+ }
205
+ return switchbot;
206
+ }
207
+
195
208
  /**
196
- * this method discovers the Locations
209
+ * this method discovers devices
197
210
  */
198
211
  async discoverDevices() {
199
212
  try {
package/src/settings.ts CHANGED
@@ -50,6 +50,7 @@ export interface devicesConfig extends device {
50
50
  contact?: contact;
51
51
  motion?: motion;
52
52
  colorbulb?: colorbulb;
53
+ plug?: undefined;
53
54
  ble?: string;
54
55
  scanDuration?: number;
55
56
  hide_device?: boolean;
@@ -107,6 +108,11 @@ export interface irDevicesConfig extends irdevice {
107
108
  logging?: string;
108
109
  irfan?: irfan;
109
110
  irair?: irair;
111
+ irpur?: undefined;
112
+ ircam?: undefined;
113
+ irlight?: undefined;
114
+ irvc?: undefined;
115
+ irwh?: undefined;
110
116
  irtv?: irtv;
111
117
  other?: other;
112
118
  hide_device?: boolean;