@switchbot/homebridge-switchbot 1.4.0 → 1.4.1-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 (91) hide show
  1. package/dist/devices/bots.d.ts +1 -1
  2. package/dist/devices/bots.d.ts.map +1 -1
  3. package/dist/devices/bots.js +7 -16
  4. package/dist/devices/bots.js.map +1 -1
  5. package/dist/devices/colorbulb.d.ts +1 -1
  6. package/dist/devices/colorbulb.d.ts.map +1 -1
  7. package/dist/devices/colorbulb.js +8 -12
  8. package/dist/devices/colorbulb.js.map +1 -1
  9. package/dist/devices/contact.d.ts +1 -1
  10. package/dist/devices/contact.d.ts.map +1 -1
  11. package/dist/devices/contact.js +4 -14
  12. package/dist/devices/contact.js.map +1 -1
  13. package/dist/devices/curtains.d.ts +1 -1
  14. package/dist/devices/curtains.d.ts.map +1 -1
  15. package/dist/devices/curtains.js +7 -16
  16. package/dist/devices/curtains.js.map +1 -1
  17. package/dist/devices/humidifiers.d.ts +1 -1
  18. package/dist/devices/humidifiers.d.ts.map +1 -1
  19. package/dist/devices/humidifiers.js +9 -19
  20. package/dist/devices/humidifiers.js.map +1 -1
  21. package/dist/devices/indoorcam.d.ts +1 -1
  22. package/dist/devices/indoorcam.d.ts.map +1 -1
  23. package/dist/devices/indoorcam.js +5 -5
  24. package/dist/devices/indoorcam.js.map +1 -1
  25. package/dist/devices/meters.d.ts +1 -1
  26. package/dist/devices/meters.d.ts.map +1 -1
  27. package/dist/devices/meters.js +10 -16
  28. package/dist/devices/meters.js.map +1 -1
  29. package/dist/devices/motion.d.ts +1 -1
  30. package/dist/devices/motion.d.ts.map +1 -1
  31. package/dist/devices/motion.js +4 -9
  32. package/dist/devices/motion.js.map +1 -1
  33. package/dist/devices/plugs.d.ts +1 -1
  34. package/dist/devices/plugs.d.ts.map +1 -1
  35. package/dist/devices/plugs.js +4 -4
  36. package/dist/devices/plugs.js.map +1 -1
  37. package/dist/irdevices/airconditioners.d.ts +1 -1
  38. package/dist/irdevices/airconditioners.d.ts.map +1 -1
  39. package/dist/irdevices/airconditioners.js +3 -8
  40. package/dist/irdevices/airconditioners.js.map +1 -1
  41. package/dist/irdevices/airpurifiers.d.ts +1 -1
  42. package/dist/irdevices/airpurifiers.d.ts.map +1 -1
  43. package/dist/irdevices/airpurifiers.js +3 -6
  44. package/dist/irdevices/airpurifiers.js.map +1 -1
  45. package/dist/irdevices/cameras.d.ts +1 -1
  46. package/dist/irdevices/cameras.d.ts.map +1 -1
  47. package/dist/irdevices/cameras.js +3 -3
  48. package/dist/irdevices/cameras.js.map +1 -1
  49. package/dist/irdevices/fans.d.ts +1 -1
  50. package/dist/irdevices/fans.d.ts.map +1 -1
  51. package/dist/irdevices/fans.js +3 -5
  52. package/dist/irdevices/fans.js.map +1 -1
  53. package/dist/irdevices/lights.d.ts +1 -1
  54. package/dist/irdevices/lights.d.ts.map +1 -1
  55. package/dist/irdevices/lights.js +3 -3
  56. package/dist/irdevices/lights.js.map +1 -1
  57. package/dist/irdevices/others.d.ts +1 -1
  58. package/dist/irdevices/others.d.ts.map +1 -1
  59. package/dist/irdevices/others.js +3 -3
  60. package/dist/irdevices/others.js.map +1 -1
  61. package/dist/irdevices/tvs.d.ts +1 -1
  62. package/dist/irdevices/tvs.d.ts.map +1 -1
  63. package/dist/irdevices/tvs.js +3 -4
  64. package/dist/irdevices/tvs.js.map +1 -1
  65. package/dist/irdevices/vacuumcleaners.d.ts +1 -1
  66. package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
  67. package/dist/irdevices/vacuumcleaners.js +3 -3
  68. package/dist/irdevices/vacuumcleaners.js.map +1 -1
  69. package/dist/irdevices/waterheaters.d.ts +1 -1
  70. package/dist/irdevices/waterheaters.d.ts.map +1 -1
  71. package/dist/irdevices/waterheaters.js +3 -3
  72. package/dist/irdevices/waterheaters.js.map +1 -1
  73. package/package.json +66 -66
  74. package/src/devices/bots.ts +8 -16
  75. package/src/devices/colorbulb.ts +9 -13
  76. package/src/devices/contact.ts +5 -15
  77. package/src/devices/curtains.ts +8 -17
  78. package/src/devices/humidifiers.ts +10 -20
  79. package/src/devices/indoorcam.ts +6 -6
  80. package/src/devices/meters.ts +11 -17
  81. package/src/devices/motion.ts +5 -10
  82. package/src/devices/plugs.ts +5 -5
  83. package/src/irdevices/airconditioners.ts +4 -9
  84. package/src/irdevices/airpurifiers.ts +4 -7
  85. package/src/irdevices/cameras.ts +4 -4
  86. package/src/irdevices/fans.ts +4 -6
  87. package/src/irdevices/lights.ts +4 -4
  88. package/src/irdevices/others.ts +4 -4
  89. package/src/irdevices/tvs.ts +4 -5
  90. package/src/irdevices/vacuumcleaners.ts +4 -4
  91. package/src/irdevices/waterheaters.ts +4 -4
@@ -1,6 +1,6 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { SwitchBotPlatform } from '../platform';
3
- import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
3
+ import { CharacteristicValue, HAPStatus, PlatformAccessory, Service } from 'homebridge';
4
4
  import { DeviceURL, irdevice, deviceStatusResponse, irDevicesConfig, payload } from '../settings';
5
5
 
6
6
  /**
@@ -252,7 +252,7 @@ export class Fan {
252
252
  this.platform.log.error(`Fan: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
253
253
  + ` Error: ${JSON.stringify(e)}`);
254
254
  }
255
- this.apiError(e);
255
+ this.apiError();
256
256
  }
257
257
  }
258
258
 
@@ -285,9 +285,7 @@ export class Fan {
285
285
  }
286
286
  }
287
287
 
288
- public apiError(e: any) {
289
- this.service.updateCharacteristic(this.platform.Characteristic.Active, e);
290
- this.service.updateCharacteristic(this.platform.Characteristic.RotationSpeed, e);
291
- this.service.updateCharacteristic(this.platform.Characteristic.SwingMode, e);
288
+ public apiError() {
289
+ throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
292
290
  }
293
291
  }
@@ -1,7 +1,7 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { SwitchBotPlatform } from '../platform';
3
3
  import { irDevicesConfig, DeviceURL, irdevice, payload } from '../settings';
4
- import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
4
+ import { CharacteristicValue, HAPStatus, PlatformAccessory, Service } from 'homebridge';
5
5
 
6
6
  /**
7
7
  * Platform Accessory
@@ -163,7 +163,7 @@ export class Light {
163
163
  this.platform.log.error(`Light: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
164
164
  + ` Error: ${JSON.stringify(e)}`);
165
165
  }
166
- this.apiError(e);
166
+ this.apiError();
167
167
  }
168
168
  }
169
169
 
@@ -197,7 +197,7 @@ export class Light {
197
197
  }
198
198
  }
199
199
 
200
- public apiError(e: any) {
201
- this.service.updateCharacteristic(this.platform.Characteristic.On, e);
200
+ public apiError() {
201
+ throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
202
202
  }
203
203
  }
@@ -1,7 +1,7 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { SwitchBotPlatform } from '../platform';
3
3
  import { irDevicesConfig, DeviceURL, irdevice, payload } from '../settings';
4
- import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
4
+ import { CharacteristicValue, HAPStatus, PlatformAccessory, Service } from 'homebridge';
5
5
 
6
6
  /**
7
7
  * Platform Accessory
@@ -151,7 +151,7 @@ export class Others {
151
151
  this.platform.log.error(`Other: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
152
152
  + ` Error: ${JSON.stringify(e)}`);
153
153
  }
154
- this.apiError(e);
154
+ this.apiError();
155
155
  }
156
156
  }
157
157
 
@@ -184,7 +184,7 @@ export class Others {
184
184
  }
185
185
  }
186
186
 
187
- public apiError(e: any) {
188
- this.service?.updateCharacteristic(this.platform.Characteristic.Active, e);
187
+ public apiError() {
188
+ throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
189
189
  }
190
190
  }
@@ -1,6 +1,6 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { SwitchBotPlatform } from '../platform';
3
- import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
3
+ import { CharacteristicValue, HAPStatus, PlatformAccessory, Service } from 'homebridge';
4
4
  import { DeviceURL, irdevice, deviceStatusResponse, irDevicesConfig, payload } from '../settings';
5
5
 
6
6
  /**
@@ -367,7 +367,7 @@ export class TV {
367
367
  this.platform.log.error(`${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
368
368
  + ` Error: ${JSON.stringify(e)}`);
369
369
  }
370
- this.apiError(e);
370
+ this.apiError();
371
371
  }
372
372
  }
373
373
 
@@ -402,8 +402,7 @@ export class TV {
402
402
  }
403
403
  }
404
404
 
405
- public apiError(e: any) {
406
- this.service.updateCharacteristic(this.platform.Characteristic.Active, e);
407
- this.service.updateCharacteristic(this.platform.Characteristic.ActiveIdentifier, e);
405
+ public apiError() {
406
+ throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
408
407
  }
409
408
  }
@@ -1,7 +1,7 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { SwitchBotPlatform } from '../platform';
3
3
  import { irDevicesConfig, DeviceURL, irdevice, payload } from '../settings';
4
- import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
4
+ import { CharacteristicValue, HAPStatus, PlatformAccessory, Service } from 'homebridge';
5
5
 
6
6
  /**
7
7
  * Platform Accessory
@@ -130,7 +130,7 @@ export class VacuumCleaner {
130
130
  this.platform.log.error(`Vacuum Cleaner: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
131
131
  + ` Error: ${JSON.stringify(e)}`);
132
132
  }
133
- this.apiError(e);
133
+ this.apiError();
134
134
  }
135
135
  }
136
136
 
@@ -163,7 +163,7 @@ export class VacuumCleaner {
163
163
  }
164
164
  }
165
165
 
166
- public apiError(e: any) {
167
- this.service.updateCharacteristic(this.platform.Characteristic.On, e);
166
+ public apiError() {
167
+ throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
168
168
  }
169
169
  }
@@ -1,7 +1,7 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { SwitchBotPlatform } from '../platform';
3
3
  import { irDevicesConfig, DeviceURL, irdevice, payload } from '../settings';
4
- import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
4
+ import { CharacteristicValue, HAPStatus, PlatformAccessory, Service } from 'homebridge';
5
5
 
6
6
  /**
7
7
  * Platform Accessory
@@ -144,7 +144,7 @@ export class WaterHeater {
144
144
  this.platform.log.error(`Water Heater: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
145
145
  + ` Error: ${JSON.stringify(e)}`);
146
146
  }
147
- this.apiError(e);
147
+ this.apiError();
148
148
  }
149
149
  }
150
150
 
@@ -177,7 +177,7 @@ export class WaterHeater {
177
177
  }
178
178
  }
179
179
 
180
- public apiError(e: any) {
181
- this.service.updateCharacteristic(this.platform.Characteristic.Active, e);
180
+ public apiError() {
181
+ throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
182
182
  }
183
183
  }