@switchbot/homebridge-switchbot 2.8.0-beta.1 → 2.8.0-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 (129) hide show
  1. package/dist/device/blindtilt.d.ts +1 -0
  2. package/dist/device/blindtilt.d.ts.map +1 -1
  3. package/dist/device/blindtilt.js +9 -6
  4. package/dist/device/blindtilt.js.map +1 -1
  5. package/dist/device/bot.d.ts +1 -0
  6. package/dist/device/bot.d.ts.map +1 -1
  7. package/dist/device/bot.js +8 -5
  8. package/dist/device/bot.js.map +1 -1
  9. package/dist/device/ceilinglight.d.ts +1 -0
  10. package/dist/device/ceilinglight.d.ts.map +1 -1
  11. package/dist/device/ceilinglight.js +12 -9
  12. package/dist/device/ceilinglight.js.map +1 -1
  13. package/dist/device/colorbulb.d.ts +1 -0
  14. package/dist/device/colorbulb.d.ts.map +1 -1
  15. package/dist/device/colorbulb.js +8 -5
  16. package/dist/device/colorbulb.js.map +1 -1
  17. package/dist/device/contact.d.ts +2 -0
  18. package/dist/device/contact.d.ts.map +1 -1
  19. package/dist/device/contact.js +45 -34
  20. package/dist/device/contact.js.map +1 -1
  21. package/dist/device/curtain.d.ts +2 -0
  22. package/dist/device/curtain.d.ts.map +1 -1
  23. package/dist/device/curtain.js +31 -36
  24. package/dist/device/curtain.js.map +1 -1
  25. package/dist/device/hub.d.ts +3 -1
  26. package/dist/device/hub.d.ts.map +1 -1
  27. package/dist/device/hub.js +29 -4
  28. package/dist/device/hub.js.map +1 -1
  29. package/dist/device/humidifier.d.ts.map +1 -1
  30. package/dist/device/humidifier.js +9 -6
  31. package/dist/device/humidifier.js.map +1 -1
  32. package/dist/device/iosensor.d.ts +1 -0
  33. package/dist/device/iosensor.d.ts.map +1 -1
  34. package/dist/device/iosensor.js +10 -6
  35. package/dist/device/iosensor.js.map +1 -1
  36. package/dist/device/lightstrip.d.ts +1 -0
  37. package/dist/device/lightstrip.d.ts.map +1 -1
  38. package/dist/device/lightstrip.js +9 -6
  39. package/dist/device/lightstrip.js.map +1 -1
  40. package/dist/device/lock.d.ts +2 -0
  41. package/dist/device/lock.d.ts.map +1 -1
  42. package/dist/device/lock.js +11 -6
  43. package/dist/device/lock.js.map +1 -1
  44. package/dist/device/meter.d.ts +2 -0
  45. package/dist/device/meter.d.ts.map +1 -1
  46. package/dist/device/meter.js +12 -8
  47. package/dist/device/meter.js.map +1 -1
  48. package/dist/device/meterplus.d.ts +4 -3
  49. package/dist/device/meterplus.d.ts.map +1 -1
  50. package/dist/device/meterplus.js +56 -54
  51. package/dist/device/meterplus.js.map +1 -1
  52. package/dist/device/motion.d.ts +2 -0
  53. package/dist/device/motion.d.ts.map +1 -1
  54. package/dist/device/motion.js +46 -31
  55. package/dist/device/motion.js.map +1 -1
  56. package/dist/device/plug.d.ts +1 -0
  57. package/dist/device/plug.d.ts.map +1 -1
  58. package/dist/device/plug.js +9 -6
  59. package/dist/device/plug.js.map +1 -1
  60. package/dist/device/robotvacuumcleaner.d.ts +1 -0
  61. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  62. package/dist/device/robotvacuumcleaner.js +26 -2
  63. package/dist/device/robotvacuumcleaner.js.map +1 -1
  64. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  65. package/dist/irdevice/airconditioner.js +7 -5
  66. package/dist/irdevice/airconditioner.js.map +1 -1
  67. package/dist/irdevice/airpurifier.d.ts +1 -1
  68. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  69. package/dist/irdevice/airpurifier.js +3 -3
  70. package/dist/irdevice/airpurifier.js.map +1 -1
  71. package/dist/irdevice/camera.d.ts +1 -1
  72. package/dist/irdevice/camera.d.ts.map +1 -1
  73. package/dist/irdevice/camera.js +3 -3
  74. package/dist/irdevice/camera.js.map +1 -1
  75. package/dist/irdevice/fan.d.ts +2 -2
  76. package/dist/irdevice/fan.d.ts.map +1 -1
  77. package/dist/irdevice/fan.js +3 -3
  78. package/dist/irdevice/fan.js.map +1 -1
  79. package/dist/irdevice/light.d.ts +1 -1
  80. package/dist/irdevice/light.d.ts.map +1 -1
  81. package/dist/irdevice/light.js +3 -3
  82. package/dist/irdevice/light.js.map +1 -1
  83. package/dist/irdevice/other.d.ts +1 -1
  84. package/dist/irdevice/other.d.ts.map +1 -1
  85. package/dist/irdevice/other.js +3 -3
  86. package/dist/irdevice/other.js.map +1 -1
  87. package/dist/irdevice/tv.d.ts +2 -2
  88. package/dist/irdevice/tv.d.ts.map +1 -1
  89. package/dist/irdevice/tv.js +3 -3
  90. package/dist/irdevice/tv.js.map +1 -1
  91. package/dist/irdevice/vacuumcleaner.d.ts +1 -1
  92. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  93. package/dist/irdevice/vacuumcleaner.js +3 -3
  94. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  95. package/dist/irdevice/waterheater.d.ts +1 -1
  96. package/dist/irdevice/waterheater.d.ts.map +1 -1
  97. package/dist/irdevice/waterheater.js +3 -3
  98. package/dist/irdevice/waterheater.js.map +1 -1
  99. package/dist/platform.d.ts.map +1 -1
  100. package/dist/platform.js +3 -2
  101. package/dist/platform.js.map +1 -1
  102. package/package.json +3 -3
  103. package/src/device/blindtilt.ts +8 -6
  104. package/src/device/bot.ts +8 -5
  105. package/src/device/ceilinglight.ts +12 -6
  106. package/src/device/colorbulb.ts +10 -5
  107. package/src/device/contact.ts +44 -30
  108. package/src/device/curtain.ts +30 -33
  109. package/src/device/hub.ts +30 -4
  110. package/src/device/humidifier.ts +8 -5
  111. package/src/device/iosensor.ts +9 -5
  112. package/src/device/lightstrip.ts +10 -5
  113. package/src/device/lock.ts +12 -5
  114. package/src/device/meter.ts +12 -7
  115. package/src/device/meterplus.ts +60 -53
  116. package/src/device/motion.ts +45 -27
  117. package/src/device/plug.ts +8 -5
  118. package/src/device/robotvacuumcleaner.ts +29 -2
  119. package/src/irdevice/airconditioner.ts +7 -5
  120. package/src/irdevice/airpurifier.ts +5 -5
  121. package/src/irdevice/camera.ts +5 -5
  122. package/src/irdevice/fan.ts +5 -5
  123. package/src/irdevice/light.ts +5 -5
  124. package/src/irdevice/other.ts +5 -5
  125. package/src/irdevice/tv.ts +5 -5
  126. package/src/irdevice/vacuumcleaner.ts +5 -5
  127. package/src/irdevice/waterheater.ts +5 -5
  128. package/src/platform.ts +3 -2
  129. package/src/settings.ts +1 -1
@@ -1,7 +1,7 @@
1
+ import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
1
2
  import { request } from 'undici';
2
3
  import { SwitchBotPlatform } from '../platform';
3
- import { irDevicesConfig, irdevice, Devices } from '../settings';
4
- import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
4
+ import { Devices, irDevicesConfig, irdevice } from '../settings';
5
5
 
6
6
  /**
7
7
  * Platform Accessory
@@ -29,10 +29,10 @@ export class Others {
29
29
  // default placeholders
30
30
  this.logs(device);
31
31
  this.deviceType(device);
32
- this.config(device);
33
32
  this.context();
34
33
  this.disablePushOnChanges({ device });
35
34
  this.disablePushOffChanges({ device });
35
+ this.config(device);
36
36
 
37
37
  // set accessory information
38
38
  accessory
@@ -135,7 +135,7 @@ export class Others {
135
135
  async pushChanges(bodyChange: any): Promise<void> {
136
136
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
137
137
  if (this.device.connectionType === 'OpenAPI') {
138
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
138
+ this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
139
139
  try {
140
140
  const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
141
141
  body: bodyChange,
@@ -329,7 +329,7 @@ export class Others {
329
329
  config['disablePushOff'] = device.disablePushOff;
330
330
  }
331
331
  if (Object.entries(config).length !== 0) {
332
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
332
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
333
333
  }
334
334
  }
335
335
 
@@ -1,7 +1,7 @@
1
+ import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
1
2
  import { request } from 'undici';
2
3
  import { SwitchBotPlatform } from '../platform';
3
- import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
4
- import { irdevice, irDevicesConfig, Devices } from '../settings';
4
+ import { Devices, irDevicesConfig, irdevice } from '../settings';
5
5
 
6
6
  /**
7
7
  * Platform Accessory
@@ -33,11 +33,11 @@ export class TV {
33
33
  ) {
34
34
  // default placeholders
35
35
  this.logs(device);
36
- this.config(device);
37
36
  this.context();
38
37
  this.disablePushOnChanges({ device });
39
38
  this.disablePushOffChanges({ device });
40
39
  this.disablePushDetailChanges({ device });
40
+ this.config(device);
41
41
 
42
42
  // set accessory information
43
43
  accessory
@@ -368,7 +368,7 @@ export class TV {
368
368
  async pushTVChanges(bodyChange: any): Promise<void> {
369
369
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushTVChanges`);
370
370
  if (this.device.connectionType === 'OpenAPI') {
371
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
371
+ this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
372
372
  try {
373
373
  const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
374
374
  body: bodyChange,
@@ -574,7 +574,7 @@ export class TV {
574
574
  config['disablePushDetail'] = device.disablePushDetail;
575
575
  }
576
576
  if (Object.entries(config).length !== 0) {
577
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
577
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
578
578
  }
579
579
  }
580
580
 
@@ -1,7 +1,7 @@
1
+ import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
1
2
  import { request } from 'undici';
2
3
  import { SwitchBotPlatform } from '../platform';
3
- import { irDevicesConfig, irdevice, Devices } from '../settings';
4
- import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
4
+ import { Devices, irDevicesConfig, irdevice } from '../settings';
5
5
 
6
6
  /**
7
7
  * Platform Accessory
@@ -27,10 +27,10 @@ export class VacuumCleaner {
27
27
  ) {
28
28
  // default placeholders
29
29
  this.logs(device);
30
- this.config(device);
31
30
  this.context();
32
31
  this.disablePushOnChanges({ device });
33
32
  this.disablePushOffChanges({ device });
33
+ this.config(device);
34
34
 
35
35
  // set accessory information
36
36
  accessory
@@ -112,7 +112,7 @@ export class VacuumCleaner {
112
112
  async pushChanges(bodyChange: any): Promise<void> {
113
113
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
114
114
  if (this.device.connectionType === 'OpenAPI') {
115
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
115
+ this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
116
116
  try {
117
117
  const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
118
118
  body: bodyChange,
@@ -294,7 +294,7 @@ export class VacuumCleaner {
294
294
  config['disablePushOff'] = device.disablePushOff;
295
295
  }
296
296
  if (Object.entries(config).length !== 0) {
297
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
297
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
298
298
  }
299
299
  }
300
300
 
@@ -1,7 +1,7 @@
1
+ import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
1
2
  import { request } from 'undici';
2
3
  import { SwitchBotPlatform } from '../platform';
3
- import { irDevicesConfig, irdevice, Devices } from '../settings';
4
- import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
4
+ import { Devices, irDevicesConfig, irdevice } from '../settings';
5
5
 
6
6
  /**
7
7
  * Platform Accessory
@@ -27,10 +27,10 @@ export class WaterHeater {
27
27
  ) {
28
28
  // default placeholders
29
29
  this.logs({ device });
30
- this.config({ device });
31
30
  this.context();
32
31
  this.disablePushOnChanges({ device });
33
32
  this.disablePushOffChanges({ device });
33
+ this.config({ device });
34
34
 
35
35
  // set accessory information
36
36
  accessory
@@ -121,7 +121,7 @@ export class WaterHeater {
121
121
  async pushChanges(bodyChange: any): Promise<void> {
122
122
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
123
123
  if (this.device.connectionType === 'OpenAPI') {
124
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
124
+ this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
125
125
  try {
126
126
  const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
127
127
  body: bodyChange,
@@ -303,7 +303,7 @@ export class WaterHeater {
303
303
  config['disablePushOff'] = device.disablePushOff;
304
304
  }
305
305
  if (Object.entries(config).length !== 0) {
306
- this.infoLog({ log: [`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`] });
306
+ this.debugWarnLog({ log: [`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`] });
307
307
  }
308
308
  }
309
309
 
package/src/platform.ts CHANGED
@@ -138,7 +138,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
138
138
  platformConfig['pushRate'] = this.config.options.pushRate;
139
139
  }
140
140
  if (Object.entries(platformConfig).length !== 0) {
141
- this.infoLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
141
+ this.debugWarnLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
142
142
  }
143
143
 
144
144
  if (this.config.options) {
@@ -245,7 +245,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
245
245
  } else {
246
246
  // eslint-disable-next-line no-useless-escape, max-len
247
247
  this.warnLog(
248
- 'This plugin has been updated to use OpenAPI v1.1, config is set with openToken, "openToken" config has been moved to the "token" config, please restart Homebridge.',
248
+ 'This plugin has been updated to use OpenAPI v1.1, config is set with openToken, '
249
+ + '"openToken" config has been moved to the "token" config, please restart Homebridge.',
249
250
  );
250
251
  }
251
252
 
package/src/settings.ts CHANGED
@@ -286,7 +286,7 @@ export type deviceStatus = {
286
286
  childLock?: boolean; //determines if a Humidifier's safety lock is on or not. (Used by the following deviceTypes: Humidifier)
287
287
  sound?: boolean; //determines if a Humidifier is muted or not. (Used by the following deviceTypes: Humidifier)
288
288
  lackWater?: boolean; //determines if the water tank is empty or not. (Used by the following deviceTypes: Humidifier)
289
- version?: number; //the version of the device. (Used by the following deviceTypes: Blind Tilt)
289
+ version?: number; //the version of the device. (Used by the following deviceTypes: Blind Tilt, Meter, MeterPlus, IOSensor)
290
290
  direction?: string; //the opening direction of a Blind Tilt device. (Used by the following deviceTypes: Blind Tilt)
291
291
  runStatus?: string; //'static' when not moving. (Used by the following deviceTypes: Blind Tilt)
292
292
  mode?: number; //available for devices. the fan mode. (Used by the following deviceTypes: Smart Fan)