@switchbot/homebridge-switchbot 0.1.2-beta.35 → 0.1.2-beta.36

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 (61) hide show
  1. package/dist/devices/bots.js +2 -2
  2. package/dist/devices/bots.js.map +1 -1
  3. package/dist/devices/bulb.js +1 -1
  4. package/dist/devices/bulb.js.map +1 -1
  5. package/dist/devices/contact.d.ts.map +1 -1
  6. package/dist/devices/contact.js +3 -2
  7. package/dist/devices/contact.js.map +1 -1
  8. package/dist/devices/curtains.js +1 -1
  9. package/dist/devices/curtains.js.map +1 -1
  10. package/dist/devices/humidifiers.d.ts.map +1 -1
  11. package/dist/devices/humidifiers.js +3 -2
  12. package/dist/devices/humidifiers.js.map +1 -1
  13. package/dist/devices/indoorcam.js +1 -1
  14. package/dist/devices/indoorcam.js.map +1 -1
  15. package/dist/devices/meters.d.ts.map +1 -1
  16. package/dist/devices/meters.js +5 -3
  17. package/dist/devices/meters.js.map +1 -1
  18. package/dist/devices/motion.js +1 -1
  19. package/dist/devices/motion.js.map +1 -1
  20. package/dist/irdevices/airconditioners.js +1 -1
  21. package/dist/irdevices/airconditioners.js.map +1 -1
  22. package/dist/irdevices/airpurifiers.js +1 -1
  23. package/dist/irdevices/airpurifiers.js.map +1 -1
  24. package/dist/irdevices/cameras.js +1 -1
  25. package/dist/irdevices/cameras.js.map +1 -1
  26. package/dist/irdevices/fans.js +1 -1
  27. package/dist/irdevices/fans.js.map +1 -1
  28. package/dist/irdevices/lights.js +1 -1
  29. package/dist/irdevices/lights.js.map +1 -1
  30. package/dist/irdevices/others.d.ts.map +1 -1
  31. package/dist/irdevices/others.js +1 -1
  32. package/dist/irdevices/others.js.map +1 -1
  33. package/dist/irdevices/tvs.d.ts.map +1 -1
  34. package/dist/irdevices/tvs.js +3 -2
  35. package/dist/irdevices/tvs.js.map +1 -1
  36. package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
  37. package/dist/irdevices/vacuumcleaners.js +2 -3
  38. package/dist/irdevices/vacuumcleaners.js.map +1 -1
  39. package/dist/irdevices/waterheaters.js +2 -2
  40. package/dist/irdevices/waterheaters.js.map +1 -1
  41. package/dist/platform.js +17 -17
  42. package/dist/platform.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/devices/bots.ts +2 -2
  45. package/src/devices/bulb.ts +1 -1
  46. package/src/devices/contact.ts +4 -2
  47. package/src/devices/curtains.ts +1 -1
  48. package/src/devices/humidifiers.ts +8 -6
  49. package/src/devices/indoorcam.ts +1 -1
  50. package/src/devices/meters.ts +7 -3
  51. package/src/devices/motion.ts +1 -1
  52. package/src/irdevices/airconditioners.ts +1 -1
  53. package/src/irdevices/airpurifiers.ts +1 -1
  54. package/src/irdevices/cameras.ts +1 -1
  55. package/src/irdevices/fans.ts +1 -1
  56. package/src/irdevices/lights.ts +1 -1
  57. package/src/irdevices/others.ts +2 -4
  58. package/src/irdevices/tvs.ts +4 -2
  59. package/src/irdevices/vacuumcleaners.ts +2 -6
  60. package/src/irdevices/waterheaters.ts +2 -2
  61. package/src/platform.ts +17 -17
@@ -29,7 +29,7 @@ export class Light {
29
29
  // you can create multiple services for each accessory
30
30
  (this.service =
31
31
  accessory.getService(this.platform.Service.Lightbulb) ||
32
- accessory.addService(this.platform.Service.Lightbulb)), `${device.deviceName} ${device.remoteType}`;
32
+ accessory.addService(this.platform.Service.Lightbulb)), `${accessory.displayName} Light Bulb`;
33
33
 
34
34
  // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
35
35
  // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
@@ -29,10 +29,8 @@ export class Others {
29
29
  // you can create multiple services for each accessory
30
30
  this.service = accessory.getService(this.platform.Service.Fanv2);
31
31
  if (!this.service && this.platform.config.options?.other?.deviceType === 'Fan') {
32
- this.service = accessory.addService(
33
- this.platform.Service.Fanv2,
34
- `${device.deviceName} ${device.remoteType} Fan`,
35
- );
32
+ this.service = accessory.addService(this.platform.Service.Fanv2, `${accessory.displayName} Fan`);
33
+
36
34
  this.service.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
37
35
 
38
36
  this.service.getCharacteristic(this.platform.Characteristic.Active).onSet(this.ActiveSet.bind(this));
@@ -53,7 +53,7 @@ export class TV {
53
53
  // you can create multiple services for each accessory
54
54
  (this.service =
55
55
  accessory.getService(this.platform.Service.Television) ||
56
- accessory.addService(this.platform.Service.Television)), `${device.deviceName} ${device.remoteType}`;
56
+ accessory.addService(this.platform.Service.Television)), `${accessory.displayName} TV`;
57
57
 
58
58
  // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
59
59
  // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
@@ -86,7 +86,9 @@ export class TV {
86
86
  // create a new Television Speaker service
87
87
  (this.speakerService =
88
88
  accessory.getService(this.platform.Service.TelevisionSpeaker) ||
89
- accessory.addService(this.platform.Service.TelevisionSpeaker)), `${device.deviceName} ${device.remoteType} Speaker`;
89
+ accessory.addService(this.platform.Service.TelevisionSpeaker)), `${accessory.displayName} Speaker`;
90
+
91
+ this.speakerService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Speaker`);
90
92
 
91
93
  this.speakerService
92
94
  .setCharacteristic(this.platform.Characteristic.Active, this.platform.Characteristic.Active.ACTIVE)
@@ -29,8 +29,7 @@ export class VacuumCleaner {
29
29
  // you can create multiple services for each accessory
30
30
  (this.service =
31
31
  accessory.getService(this.platform.Service.Switch) ||
32
- accessory.addService(this.platform.Service.Switch)),
33
- `${device.deviceName} ${device.remoteType}`;
32
+ accessory.addService(this.platform.Service.Switch)), `${accessory.displayName} Vacuum`;
34
33
 
35
34
  // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
36
35
  // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
@@ -38,10 +37,7 @@ export class VacuumCleaner {
38
37
 
39
38
  // set the service name, this is what is displayed as the default name on the Home app
40
39
  // in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
41
- this.service.setCharacteristic(
42
- this.platform.Characteristic.Name,
43
- `${device.deviceName} ${device.remoteType}`,
44
- );
40
+ this.service.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
45
41
 
46
42
  // handle on / off events using the On characteristic
47
43
  this.service.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this));
@@ -28,8 +28,8 @@ export class WaterHeater {
28
28
  // get the Television service if it exists, otherwise create a new Television service
29
29
  // you can create multiple services for each accessory
30
30
  (this.service =
31
- accessory.getService(this.platform.Service.Valve) || accessory.addService(this.platform.Service.Valve)),
32
- `${device.deviceName} ${device.remoteType}`;
31
+ accessory.getService(this.platform.Service.Valve) ||
32
+ accessory.addService(this.platform.Service.Valve)), `${accessory.displayName} Water Heater`;
33
33
 
34
34
  // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
35
35
  // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
package/src/platform.ts CHANGED
@@ -363,7 +363,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
363
363
  this.log.info(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
364
364
 
365
365
  // create a new accessory
366
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.deviceType}`, uuid);
366
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
367
367
 
368
368
  // store a copy of the device object in the `accessory.context`
369
369
  // the `context` property can be used to store any data about the accessory you may need
@@ -419,7 +419,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
419
419
  this.log.error('You must set your Bot to Press or Switch Mode');
420
420
  }
421
421
  // create a new accessory
422
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.deviceType}`, uuid);
422
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
423
423
 
424
424
  // store a copy of the device object in the `accessory.context`
425
425
  // the `context` property can be used to store any data about the accessory you may need
@@ -473,7 +473,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
473
473
  this.log.info(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
474
474
 
475
475
  // create a new accessory
476
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.deviceType}`, uuid);
476
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
477
477
 
478
478
  // store a copy of the device object in the `accessory.context`
479
479
  // the `context` property can be used to store any data about the accessory you may need
@@ -525,7 +525,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
525
525
  this.log.info(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
526
526
 
527
527
  // create a new accessory
528
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.deviceType}`, uuid);
528
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
529
529
 
530
530
  // store a copy of the device object in the `accessory.context`
531
531
  // the `context` property can be used to store any data about the accessory you may need
@@ -576,7 +576,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
576
576
  this.log.info(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
577
577
 
578
578
  // create a new accessory
579
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.deviceType}`, uuid);
579
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
580
580
 
581
581
  // store a copy of the device object in the `accessory.context`
582
582
  // the `context` property can be used to store any data about the accessory you may need
@@ -638,7 +638,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
638
638
  }
639
639
 
640
640
  // create a new accessory
641
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.deviceType}`, uuid);
641
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
642
642
 
643
643
  // store a copy of the device object in the `accessory.context`
644
644
  // the `context` property can be used to store any data about the accessory you may need
@@ -699,7 +699,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
699
699
  this.log.info(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
700
700
 
701
701
  // create a new accessory
702
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.deviceType}`, uuid);
702
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
703
703
 
704
704
  // store a copy of the device object in the `accessory.context`
705
705
  // the `context` property can be used to store any data about the accessory you may need
@@ -752,7 +752,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
752
752
  this.log.info(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
753
753
 
754
754
  // create a new accessory
755
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.deviceType}`, uuid);
755
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
756
756
 
757
757
  // store a copy of the device object in the `accessory.context`
758
758
  // the `context` property can be used to store any data about the accessory you may need
@@ -800,7 +800,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
800
800
  this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
801
801
 
802
802
  // create a new accessory
803
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.remoteType}`, uuid);
803
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
804
804
 
805
805
  // store a copy of the device object in the `accessory.context`
806
806
  // the `context` property can be used to store any data about the accessory you may need
@@ -858,7 +858,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
858
858
  this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
859
859
 
860
860
  // create a new accessory
861
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.remoteType}`, uuid);
861
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
862
862
 
863
863
  // store a copy of the device object in the `accessory.context`
864
864
  // the `context` property can be used to store any data about the accessory you may need
@@ -911,7 +911,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
911
911
  this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
912
912
 
913
913
  // create a new accessory
914
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.remoteType}`, uuid);
914
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
915
915
 
916
916
  // store a copy of the device object in the `accessory.context`
917
917
  // the `context` property can be used to store any data about the accessory you may need
@@ -964,7 +964,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
964
964
  this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
965
965
 
966
966
  // create a new accessory
967
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.remoteType}`, uuid);
967
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
968
968
 
969
969
  // store a copy of the device object in the `accessory.context`
970
970
  // the `context` property can be used to store any data about the accessory you may need
@@ -1017,7 +1017,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1017
1017
  this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
1018
1018
 
1019
1019
  // create a new accessory
1020
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.remoteType}`, uuid);
1020
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
1021
1021
 
1022
1022
  // store a copy of the device object in the `accessory.context`
1023
1023
  // the `context` property can be used to store any data about the accessory you may need
@@ -1070,7 +1070,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1070
1070
  this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
1071
1071
 
1072
1072
  // create a new accessory
1073
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.remoteType}`, uuid);
1073
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
1074
1074
 
1075
1075
  // store a copy of the device object in the `accessory.context`
1076
1076
  // the `context` property can be used to store any data about the accessory you may need
@@ -1123,7 +1123,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1123
1123
  this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
1124
1124
 
1125
1125
  // create a new accessory
1126
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.remoteType}`, uuid);
1126
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
1127
1127
 
1128
1128
  // store a copy of the device object in the `accessory.context`
1129
1129
  // the `context` property can be used to store any data about the accessory you may need
@@ -1176,7 +1176,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1176
1176
  this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
1177
1177
 
1178
1178
  // create a new accessory
1179
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.remoteType}`, uuid);
1179
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
1180
1180
 
1181
1181
  // store a copy of the device object in the `accessory.context`
1182
1182
  // the `context` property can be used to store any data about the accessory you may need
@@ -1229,7 +1229,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
1229
1229
  this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
1230
1230
 
1231
1231
  // create a new accessory
1232
- const accessory = new this.api.platformAccessory(`${device.deviceName} ${device.remoteType}`, uuid);
1232
+ const accessory = new this.api.platformAccessory(device.deviceName, uuid);
1233
1233
 
1234
1234
  // store a copy of the device object in the `accessory.context`
1235
1235
  // the `context` property can be used to store any data about the accessory you may need