@switchbot/homebridge-switchbot 1.2.1-beta.6 → 1.2.4-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 (43) hide show
  1. package/.github/workflows/nodejs.yml +1 -1
  2. package/CHANGELOG.md +19 -2
  3. package/config.schema.json +1 -1
  4. package/dist/devices/bots.d.ts +1 -0
  5. package/dist/devices/bots.d.ts.map +1 -1
  6. package/dist/devices/bots.js +24 -7
  7. package/dist/devices/bots.js.map +1 -1
  8. package/dist/devices/contact.d.ts +1 -0
  9. package/dist/devices/contact.d.ts.map +1 -1
  10. package/dist/devices/contact.js +22 -5
  11. package/dist/devices/contact.js.map +1 -1
  12. package/dist/devices/curtains.d.ts +1 -0
  13. package/dist/devices/curtains.d.ts.map +1 -1
  14. package/dist/devices/curtains.js +21 -4
  15. package/dist/devices/curtains.js.map +1 -1
  16. package/dist/devices/humidifiers.d.ts +1 -0
  17. package/dist/devices/humidifiers.d.ts.map +1 -1
  18. package/dist/devices/humidifiers.js +20 -3
  19. package/dist/devices/humidifiers.js.map +1 -1
  20. package/dist/devices/meters.d.ts +1 -0
  21. package/dist/devices/meters.d.ts.map +1 -1
  22. package/dist/devices/meters.js +33 -8
  23. package/dist/devices/meters.js.map +1 -1
  24. package/dist/devices/motion.d.ts +1 -0
  25. package/dist/devices/motion.d.ts.map +1 -1
  26. package/dist/devices/motion.js +20 -3
  27. package/dist/devices/motion.js.map +1 -1
  28. package/dist/devices/plugs.d.ts +0 -1
  29. package/dist/devices/plugs.d.ts.map +1 -1
  30. package/dist/devices/plugs.js +0 -10
  31. package/dist/devices/plugs.js.map +1 -1
  32. package/dist/platform.d.ts.map +1 -1
  33. package/dist/platform.js +6 -0
  34. package/dist/platform.js.map +1 -1
  35. package/package.json +2 -2
  36. package/src/devices/bots.ts +24 -7
  37. package/src/devices/contact.ts +22 -5
  38. package/src/devices/curtains.ts +21 -4
  39. package/src/devices/humidifiers.ts +20 -3
  40. package/src/devices/meters.ts +31 -8
  41. package/src/devices/motion.ts +20 -3
  42. package/src/devices/plugs.ts +0 -11
  43. package/src/platform.ts +6 -0
@@ -12,7 +12,6 @@ export class Plug {
12
12
 
13
13
  // Characteristic Values
14
14
  On!: CharacteristicValue;
15
- OutletInUse!: CharacteristicValue;
16
15
 
17
16
  // OpenAPI Others
18
17
  deviceStatus!: deviceStatusResponse;
@@ -32,7 +31,6 @@ export class Plug {
32
31
  ) {
33
32
  // default placeholders
34
33
  this.On = false;
35
- this.OutletInUse = true;
36
34
 
37
35
  // this is subject we use to track when we need to POST changes to the SwitchBot API
38
36
  this.doPlugUpdate = new Subject();
@@ -68,8 +66,6 @@ export class Plug {
68
66
  // create handlers for required characteristics
69
67
  this.service.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this));
70
68
 
71
- this.service.setCharacteristic(this.platform.Characteristic.OutletInUse, this.OutletInUse || true);
72
-
73
69
  // Update Homekit
74
70
  this.updateHomeKitCharacteristics();
75
71
 
@@ -173,17 +169,10 @@ export class Plug {
173
169
  this.service.updateCharacteristic(this.platform.Characteristic.On, this.On);
174
170
  this.platform.device(`Plug: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
175
171
  }
176
- if (this.OutletInUse === undefined) {
177
- this.platform.debug(`Plug: ${this.accessory.displayName} OutletInUse: ${this.OutletInUse}`);
178
- } else {
179
- this.service.updateCharacteristic(this.platform.Characteristic.OutletInUse, this.OutletInUse);
180
- this.platform.device(`Plug: ${this.accessory.displayName} updateCharacteristic OutletInUse: ${this.OutletInUse}`);
181
- }
182
172
  }
183
173
 
184
174
  public apiError(e: any) {
185
175
  this.service.updateCharacteristic(this.platform.Characteristic.On, e);
186
- this.service.updateCharacteristic(this.platform.Characteristic.OutletInUse, e);
187
176
  }
188
177
 
189
178
  private statusCode(push: AxiosResponse<{ statusCode: number; }>) {
package/src/platform.ts CHANGED
@@ -192,6 +192,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
192
192
  const devices = deviceLists.map((v: any) => v);
193
193
  for (const device of devices) {
194
194
  if (device.deviceType) {
195
+ if (device.configDeviceName) {
196
+ device.deviceName = device.configDeviceName;
197
+ }
195
198
  this.createDevice(device);
196
199
  }
197
200
  }
@@ -209,6 +212,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
209
212
  this.debug(`SwitchBot Devices: ${JSON.stringify(devices)}`);
210
213
  for (const device of devices) {
211
214
  if (device.deviceType) {
215
+ if (device.configDeviceName) {
216
+ device.deviceName = device.configDeviceName;
217
+ }
212
218
  this.createDevice(device);
213
219
  }
214
220
  }