@switchbot/homebridge-switchbot 2.2.0-beta.2 → 2.2.0-beta.3

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 (79) hide show
  1. package/dist/device/bot.d.ts +3 -1
  2. package/dist/device/bot.d.ts.map +1 -1
  3. package/dist/device/bot.js +3 -3
  4. package/dist/device/bot.js.map +1 -1
  5. package/dist/device/colorbulb.js +79 -77
  6. package/dist/device/colorbulb.js.map +1 -1
  7. package/dist/device/contact.d.ts +3 -1
  8. package/dist/device/contact.d.ts.map +1 -1
  9. package/dist/device/contact.js +3 -3
  10. package/dist/device/contact.js.map +1 -1
  11. package/dist/device/curtain.js +2 -2
  12. package/dist/device/curtain.js.map +1 -1
  13. package/dist/device/humidifier.js +2 -2
  14. package/dist/device/humidifier.js.map +1 -1
  15. package/dist/device/lock.d.ts +8 -1
  16. package/dist/device/lock.d.ts.map +1 -1
  17. package/dist/device/lock.js +83 -0
  18. package/dist/device/lock.js.map +1 -1
  19. package/dist/device/meter.js +2 -2
  20. package/dist/device/meter.js.map +1 -1
  21. package/dist/device/meterplus.js +2 -2
  22. package/dist/device/meterplus.js.map +1 -1
  23. package/dist/device/motion.d.ts +3 -1
  24. package/dist/device/motion.d.ts.map +1 -1
  25. package/dist/device/motion.js +3 -3
  26. package/dist/device/motion.js.map +1 -1
  27. package/dist/device/plug.js +2 -2
  28. package/dist/device/plug.js.map +1 -1
  29. package/dist/device/striplight.js +2 -2
  30. package/dist/device/striplight.js.map +1 -1
  31. package/dist/irdevice/airconditioner.d.ts +1 -4
  32. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  33. package/dist/irdevice/airconditioner.js +16 -28
  34. package/dist/irdevice/airconditioner.js.map +1 -1
  35. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  36. package/dist/irdevice/airpurifier.js +4 -5
  37. package/dist/irdevice/airpurifier.js.map +1 -1
  38. package/dist/irdevice/camera.d.ts.map +1 -1
  39. package/dist/irdevice/camera.js +2 -3
  40. package/dist/irdevice/camera.js.map +1 -1
  41. package/dist/irdevice/fan.d.ts.map +1 -1
  42. package/dist/irdevice/fan.js +11 -10
  43. package/dist/irdevice/fan.js.map +1 -1
  44. package/dist/irdevice/light.d.ts.map +1 -1
  45. package/dist/irdevice/light.js +2 -3
  46. package/dist/irdevice/light.js.map +1 -1
  47. package/dist/irdevice/other.d.ts.map +1 -1
  48. package/dist/irdevice/other.js +1 -1
  49. package/dist/irdevice/other.js.map +1 -1
  50. package/dist/irdevice/tv.d.ts.map +1 -1
  51. package/dist/irdevice/tv.js +11 -12
  52. package/dist/irdevice/tv.js.map +1 -1
  53. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  54. package/dist/irdevice/vacuumcleaner.js +2 -3
  55. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  56. package/dist/irdevice/waterheater.d.ts.map +1 -1
  57. package/dist/irdevice/waterheater.js +2 -3
  58. package/dist/irdevice/waterheater.js.map +1 -1
  59. package/package.json +1 -1
  60. package/src/device/bot.ts +3 -3
  61. package/src/device/colorbulb.ts +74 -74
  62. package/src/device/contact.ts +3 -3
  63. package/src/device/curtain.ts +2 -2
  64. package/src/device/humidifier.ts +2 -2
  65. package/src/device/lock.ts +92 -1
  66. package/src/device/meter.ts +2 -2
  67. package/src/device/meterplus.ts +2 -2
  68. package/src/device/motion.ts +3 -3
  69. package/src/device/plug.ts +2 -2
  70. package/src/device/striplight.ts +2 -2
  71. package/src/irdevice/airconditioner.ts +20 -37
  72. package/src/irdevice/airpurifier.ts +4 -5
  73. package/src/irdevice/camera.ts +3 -4
  74. package/src/irdevice/fan.ts +11 -10
  75. package/src/irdevice/light.ts +2 -3
  76. package/src/irdevice/other.ts +1 -1
  77. package/src/irdevice/tv.ts +11 -12
  78. package/src/irdevice/vacuumcleaner.ts +2 -3
  79. package/src/irdevice/waterheater.ts +2 -3
@@ -70,7 +70,6 @@ export class Light {
70
70
  * they are updated, so we are only updating the accessory state after calling the above.
71
71
  */
72
72
  this.On = value;
73
- this.accessory.context.On = this.On;
74
73
  }
75
74
 
76
75
  /**
@@ -84,7 +83,7 @@ export class Light {
84
83
  * Light - "command" "channelSub" "default" = previous channel
85
84
  */
86
85
  async pushLightOnChanges(): Promise<void> {
87
- if (this.On) {
86
+ if (this.On || this.allowPushOn) {
88
87
  const commandType: string = await this.commandType();
89
88
  const command: string = await this.commandOn();
90
89
  const body = superStringify({
@@ -97,7 +96,7 @@ export class Light {
97
96
  }
98
97
 
99
98
  async pushLightOffChanges(): Promise<void> {
100
- if (!this.On) {
99
+ if (!this.On || this.allowPushOff) {
101
100
  const commandType: string = await this.commandType();
102
101
  const command: string = await this.commandOff();
103
102
  const body = superStringify({
@@ -78,7 +78,6 @@ export class Others {
78
78
  * they are updated, so we are only updating the accessory state after calling the above.
79
79
  */
80
80
  this.Active = value;
81
- this.accessory.context.Active = this.Active;
82
81
  }
83
82
 
84
83
  /**
@@ -182,6 +181,7 @@ export class Others {
182
181
  if (this.Active === undefined) {
183
182
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
184
183
  } else {
184
+ this.accessory.context.Active = this.Active;
185
185
  this.fanService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
186
186
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
187
187
  }
@@ -202,8 +202,6 @@ export class TV {
202
202
 
203
203
  async ActiveSet(value: CharacteristicValue): Promise<void> {
204
204
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${value}`);
205
- this.Active = value;
206
- this.accessory.context.Active = this.Active;
207
205
  if (!this.device.irtv?.disable_power) {
208
206
  if (value === this.platform.Characteristic.Active.INACTIVE) {
209
207
  await this.pushTvOffChanges();
@@ -215,7 +213,6 @@ export class TV {
215
213
  * they are updated, so we are only updating the accessory state after calling the above.
216
214
  */
217
215
  this.Active = value;
218
- this.accessory.context.Active = this.Active;
219
216
  }
220
217
  }
221
218
 
@@ -230,7 +227,7 @@ export class TV {
230
227
  * TV "command" "channelSub" "default" previous channel
231
228
  */
232
229
  async pushTvOnChanges(): Promise<void> {
233
- if (this.Active !== 1) {
230
+ if (this.Active === this.platform.Characteristic.Active.INACTIVE || this.allowPushOn) {
234
231
  const commandType: string = await this.commandType();
235
232
  const command: string = await this.commandOn();
236
233
  const body = superStringify({
@@ -243,14 +240,16 @@ export class TV {
243
240
  }
244
241
 
245
242
  async pushTvOffChanges(): Promise<void> {
246
- const commandType: string = await this.commandType();
247
- const command: string = await this.commandOff();
248
- const body = superStringify({
249
- 'command': command,
250
- 'parameter': 'default',
251
- 'commandType': commandType,
252
- });
253
- await this.pushTVChanges(body);
243
+ if (this.Active === this.platform.Characteristic.Active.ACTIVE || this.allowPushOn) {
244
+ const commandType: string = await this.commandType();
245
+ const command: string = await this.commandOff();
246
+ const body = superStringify({
247
+ 'command': command,
248
+ 'parameter': 'default',
249
+ 'commandType': commandType,
250
+ });
251
+ await this.pushTVChanges(body);
252
+ }
254
253
  }
255
254
 
256
255
  async pushOkChanges(): Promise<void> {
@@ -70,7 +70,6 @@ export class VacuumCleaner {
70
70
  * they are updated, so we are only updating the accessory state after calling the above.
71
71
  */
72
72
  this.On = value;
73
- this.accessory.context.On = this.On;
74
73
  }
75
74
 
76
75
  /**
@@ -80,7 +79,7 @@ export class VacuumCleaner {
80
79
  * Vacuum Cleaner "command" "turnOn" "default" set to ON state
81
80
  */
82
81
  async pushOnChanges(): Promise<void> {
83
- if (this.On) {
82
+ if (this.On || this.allowPushOn) {
84
83
  const commandType: string = await this.commandType();
85
84
  const command: string = await this.commandOn();
86
85
  const body = superStringify({
@@ -93,7 +92,7 @@ export class VacuumCleaner {
93
92
  }
94
93
 
95
94
  async pushOffChanges(): Promise<void> {
96
- if (!this.On) {
95
+ if (!this.On || this.allowPushOff) {
97
96
  const commandType: string = await this.commandType();
98
97
  const command: string = await this.commandOff();
99
98
  const body = superStringify({
@@ -76,7 +76,6 @@ export class WaterHeater {
76
76
  * they are updated, so we are only updating the accessory state after calling the above.
77
77
  */
78
78
  this.Active = value;
79
- this.accessory.context.Active = this.Active;
80
79
  }
81
80
 
82
81
  /**
@@ -86,7 +85,7 @@ export class WaterHeater {
86
85
  * WaterHeater "command" "turnOn" "default" set to ON state
87
86
  */
88
87
  async pushWaterHeaterOnChanges(): Promise<void> {
89
- if (this.Active !== 1) {
88
+ if (this.Active === this.platform.Characteristic.Active.INACTIVE || this.allowPushOn) {
90
89
  const commandType: string = await this.commandType();
91
90
  const command: string = await this.commandOn();
92
91
  const body = superStringify({
@@ -99,7 +98,7 @@ export class WaterHeater {
99
98
  }
100
99
 
101
100
  async pushWaterHeaterOffChanges(): Promise<void> {
102
- if (this.Active !== 0) {
101
+ if (this.Active === this.platform.Characteristic.Active.ACTIVE || this.allowPushOff) {
103
102
  const commandType: string = await this.commandType();
104
103
  const command: string = await this.commandOff();
105
104
  const body = superStringify({