@switchbot/homebridge-switchbot 3.5.0-beta.4 → 3.5.0-beta.41

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 (168) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/config.schema.json +120 -17
  3. package/dist/device/blindtilt.d.ts +21 -94
  4. package/dist/device/blindtilt.d.ts.map +1 -1
  5. package/dist/device/blindtilt.js +351 -757
  6. package/dist/device/blindtilt.js.map +1 -1
  7. package/dist/device/bot.d.ts +25 -71
  8. package/dist/device/bot.d.ts.map +1 -1
  9. package/dist/device/bot.js +587 -761
  10. package/dist/device/bot.js.map +1 -1
  11. package/dist/device/ceilinglight.d.ts +13 -67
  12. package/dist/device/ceilinglight.d.ts.map +1 -1
  13. package/dist/device/ceilinglight.js +213 -588
  14. package/dist/device/ceilinglight.js.map +1 -1
  15. package/dist/device/colorbulb.d.ts +13 -74
  16. package/dist/device/colorbulb.d.ts.map +1 -1
  17. package/dist/device/colorbulb.js +255 -634
  18. package/dist/device/colorbulb.js.map +1 -1
  19. package/dist/device/contact.d.ts +14 -65
  20. package/dist/device/contact.d.ts.map +1 -1
  21. package/dist/device/contact.js +208 -532
  22. package/dist/device/contact.js.map +1 -1
  23. package/dist/device/curtain.d.ts +17 -86
  24. package/dist/device/curtain.d.ts.map +1 -1
  25. package/dist/device/curtain.js +339 -787
  26. package/dist/device/curtain.js.map +1 -1
  27. package/dist/device/device.d.ts +59 -0
  28. package/dist/device/device.d.ts.map +1 -0
  29. package/dist/device/device.js +671 -0
  30. package/dist/device/device.js.map +1 -0
  31. package/dist/device/fan.d.ts +51 -0
  32. package/dist/device/fan.d.ts.map +1 -0
  33. package/dist/device/fan.js +504 -0
  34. package/dist/device/fan.js.map +1 -0
  35. package/dist/device/hub.d.ts +15 -59
  36. package/dist/device/hub.d.ts.map +1 -1
  37. package/dist/device/hub.js +246 -597
  38. package/dist/device/hub.js.map +1 -1
  39. package/dist/device/humidifier.d.ts +10 -65
  40. package/dist/device/humidifier.d.ts.map +1 -1
  41. package/dist/device/humidifier.js +211 -572
  42. package/dist/device/humidifier.js.map +1 -1
  43. package/dist/device/iosensor.d.ts +11 -64
  44. package/dist/device/iosensor.d.ts.map +1 -1
  45. package/dist/device/iosensor.js +178 -585
  46. package/dist/device/iosensor.js.map +1 -1
  47. package/dist/device/lightstrip.d.ts +10 -68
  48. package/dist/device/lightstrip.d.ts.map +1 -1
  49. package/dist/device/lightstrip.js +256 -569
  50. package/dist/device/lightstrip.js.map +1 -1
  51. package/dist/device/lock.d.ts +15 -62
  52. package/dist/device/lock.d.ts.map +1 -1
  53. package/dist/device/lock.js +214 -543
  54. package/dist/device/lock.js.map +1 -1
  55. package/dist/device/meter.d.ts +13 -63
  56. package/dist/device/meter.d.ts.map +1 -1
  57. package/dist/device/meter.js +174 -578
  58. package/dist/device/meter.js.map +1 -1
  59. package/dist/device/meterplus.d.ts +13 -64
  60. package/dist/device/meterplus.d.ts.map +1 -1
  61. package/dist/device/meterplus.js +163 -578
  62. package/dist/device/meterplus.js.map +1 -1
  63. package/dist/device/motion.d.ts +13 -69
  64. package/dist/device/motion.d.ts.map +1 -1
  65. package/dist/device/motion.js +141 -520
  66. package/dist/device/motion.js.map +1 -1
  67. package/dist/device/plug.d.ts +9 -57
  68. package/dist/device/plug.d.ts.map +1 -1
  69. package/dist/device/plug.js +86 -453
  70. package/dist/device/plug.js.map +1 -1
  71. package/dist/device/robotvacuumcleaner.d.ts +11 -62
  72. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  73. package/dist/device/robotvacuumcleaner.js +144 -452
  74. package/dist/device/robotvacuumcleaner.js.map +1 -1
  75. package/dist/device/waterdetector.d.ts +9 -70
  76. package/dist/device/waterdetector.d.ts.map +1 -1
  77. package/dist/device/waterdetector.js +125 -665
  78. package/dist/device/waterdetector.js.map +1 -1
  79. package/dist/homebridge-ui/public/index.html +2 -2
  80. package/dist/index.js +1 -1
  81. package/dist/irdevice/airconditioner.d.ts +8 -48
  82. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  83. package/dist/irdevice/airconditioner.js +309 -419
  84. package/dist/irdevice/airconditioner.js.map +1 -1
  85. package/dist/irdevice/airpurifier.d.ts +7 -38
  86. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  87. package/dist/irdevice/airpurifier.js +72 -304
  88. package/dist/irdevice/airpurifier.js.map +1 -1
  89. package/dist/irdevice/camera.d.ts +6 -35
  90. package/dist/irdevice/camera.d.ts.map +1 -1
  91. package/dist/irdevice/camera.js +34 -278
  92. package/dist/irdevice/camera.js.map +1 -1
  93. package/dist/irdevice/fan.d.ts +6 -39
  94. package/dist/irdevice/fan.d.ts.map +1 -1
  95. package/dist/irdevice/fan.js +67 -311
  96. package/dist/irdevice/fan.js.map +1 -1
  97. package/dist/irdevice/irdevice.d.ts +40 -0
  98. package/dist/irdevice/irdevice.d.ts.map +1 -0
  99. package/dist/irdevice/irdevice.js +512 -0
  100. package/dist/irdevice/irdevice.js.map +1 -0
  101. package/dist/irdevice/light.d.ts +6 -34
  102. package/dist/irdevice/light.d.ts.map +1 -1
  103. package/dist/irdevice/light.js +23 -272
  104. package/dist/irdevice/light.js.map +1 -1
  105. package/dist/irdevice/other.d.ts +18 -47
  106. package/dist/irdevice/other.d.ts.map +1 -1
  107. package/dist/irdevice/other.js +352 -546
  108. package/dist/irdevice/other.js.map +1 -1
  109. package/dist/irdevice/tv.d.ts +7 -39
  110. package/dist/irdevice/tv.d.ts.map +1 -1
  111. package/dist/irdevice/tv.js +82 -321
  112. package/dist/irdevice/tv.js.map +1 -1
  113. package/dist/irdevice/vacuumcleaner.d.ts +6 -35
  114. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  115. package/dist/irdevice/vacuumcleaner.js +41 -284
  116. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  117. package/dist/irdevice/waterheater.d.ts +6 -35
  118. package/dist/irdevice/waterheater.d.ts.map +1 -1
  119. package/dist/irdevice/waterheater.js +42 -287
  120. package/dist/irdevice/waterheater.js.map +1 -1
  121. package/dist/platform.d.ts +14 -1
  122. package/dist/platform.d.ts.map +1 -1
  123. package/dist/platform.js +343 -198
  124. package/dist/platform.js.map +1 -1
  125. package/dist/settings.d.ts +41 -11
  126. package/dist/settings.d.ts.map +1 -1
  127. package/dist/settings.js +0 -552
  128. package/dist/settings.js.map +1 -1
  129. package/dist/utils.d.ts +77 -0
  130. package/dist/utils.d.ts.map +1 -1
  131. package/dist/utils.js +638 -1
  132. package/dist/utils.js.map +1 -1
  133. package/package.json +16 -15
  134. package/src/custom.d.ts +2 -1
  135. package/src/device/blindtilt.ts +377 -783
  136. package/src/device/bot.ts +620 -845
  137. package/src/device/ceilinglight.ts +226 -608
  138. package/src/device/colorbulb.ts +268 -657
  139. package/src/device/contact.ts +233 -554
  140. package/src/device/curtain.ts +359 -811
  141. package/src/device/device.ts +699 -0
  142. package/src/device/fan.ts +553 -0
  143. package/src/device/hub.ts +273 -625
  144. package/src/device/humidifier.ts +241 -619
  145. package/src/device/iosensor.ts +204 -611
  146. package/src/device/lightstrip.ts +277 -597
  147. package/src/device/lock.ts +251 -583
  148. package/src/device/meter.ts +199 -601
  149. package/src/device/meterplus.ts +188 -603
  150. package/src/device/motion.ts +160 -542
  151. package/src/device/plug.ts +96 -481
  152. package/src/device/robotvacuumcleaner.ts +165 -478
  153. package/src/device/waterdetector.ts +142 -689
  154. package/src/homebridge-ui/public/index.html +2 -2
  155. package/src/index.ts +1 -1
  156. package/src/irdevice/airconditioner.ts +330 -446
  157. package/src/irdevice/airpurifier.ts +89 -321
  158. package/src/irdevice/camera.ts +42 -293
  159. package/src/irdevice/fan.ts +78 -327
  160. package/src/irdevice/irdevice.ts +528 -0
  161. package/src/irdevice/light.ts +32 -287
  162. package/src/irdevice/other.ts +396 -615
  163. package/src/irdevice/tv.ts +100 -339
  164. package/src/irdevice/vacuumcleaner.ts +49 -305
  165. package/src/irdevice/waterheater.ts +50 -310
  166. package/src/platform.ts +353 -206
  167. package/src/settings.ts +57 -566
  168. package/src/utils.ts +642 -1
@@ -1,72 +1,48 @@
1
+ /* Copyright(C) 2021-2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
2
+ *
3
+ * waterheater.ts: @switchbot/homebridge-switchbot.
4
+ */
1
5
  import { request } from 'undici';
6
+ import { irdeviceBase } from './irdevice.js';
2
7
  import { Devices } from '../settings.js';
3
8
  /**
4
9
  * Platform Accessory
5
10
  * An instance of this class is created for each accessory your platform registers
6
11
  * Each accessory may expose multiple services of different service types.
7
12
  */
8
- export class WaterHeater {
13
+ export class WaterHeater extends irdeviceBase {
9
14
  platform;
10
- accessory;
11
- device;
12
- api;
13
- log;
14
- config;
15
- hap;
16
15
  // Services
17
- valveService;
18
- // Characteristic Values
19
- Active;
20
- FirmwareRevision;
21
- // Config
22
- deviceLogging;
23
- disablePushOn;
24
- disablePushOff;
16
+ Valve;
25
17
  constructor(platform, accessory, device) {
18
+ super(platform, accessory, device);
26
19
  this.platform = platform;
27
- this.accessory = accessory;
28
- this.device = device;
29
- this.api = this.platform.api;
30
- this.log = this.platform.log;
31
- this.config = this.platform.config;
32
- this.hap = this.api.hap;
33
- // default placeholders
34
- this.deviceLogs(device);
35
- this.deviceContext();
36
- this.disablePushOnChanges(device);
37
- this.disablePushOffChanges(device);
38
- this.deviceConfig(device);
39
- // set accessory information
40
- accessory
41
- .getService(this.hap.Service.AccessoryInformation)
42
- .setCharacteristic(this.hap.Characteristic.Manufacturer, 'SwitchBot')
43
- .setCharacteristic(this.hap.Characteristic.Model, device.remoteType)
44
- .setCharacteristic(this.hap.Characteristic.SerialNumber, device.deviceId)
45
- .setCharacteristic(this.hap.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
20
+ // Initialize Valve property
21
+ this.Valve = {
22
+ Service: accessory.getService(this.hap.Service.Valve),
23
+ Active: accessory.context.Active || this.hap.Characteristic.Active.INACTIVE,
24
+ };
46
25
  // get the Television service if it exists, otherwise create a new Television service
47
26
  // you can create multiple services for each accessory
48
- const valveService = `${accessory.displayName} ${device.remoteType}`;
49
- (this.valveService = accessory.getService(this.hap.Service.Valve)
50
- || accessory.addService(this.hap.Service.Valve)), valveService;
51
- this.valveService.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
52
- if (!this.valveService.testCharacteristic(this.hap.Characteristic.ConfiguredName)) {
53
- this.valveService.addCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.displayName);
54
- }
27
+ const ValveService = `${accessory.displayName} ${device.remoteType}`;
28
+ (this.Valve.Service = accessory.getService(this.hap.Service.Valve)
29
+ || accessory.addService(this.hap.Service.Valve)), ValveService;
30
+ this.Valve.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
55
31
  // set sleep discovery characteristic
56
- this.valveService.setCharacteristic(this.hap.Characteristic.ValveType, this.hap.Characteristic.ValveType.GENERIC_VALVE);
32
+ this.Valve.Service.setCharacteristic(this.hap.Characteristic.ValveType, this.hap.Characteristic.ValveType.GENERIC_VALVE);
57
33
  // handle on / off events using the Active characteristic
58
- this.valveService.getCharacteristic(this.hap.Characteristic.Active).onSet(this.ActiveSet.bind(this));
34
+ this.Valve.Service.getCharacteristic(this.hap.Characteristic.Active).onSet(this.ActiveSet.bind(this));
59
35
  }
60
36
  async ActiveSet(value) {
61
37
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${value}`);
62
- this.Active = value;
63
- if (this.Active === this.hap.Characteristic.Active.ACTIVE) {
38
+ this.Valve.Active = value;
39
+ if (this.Valve.Active === this.hap.Characteristic.Active.ACTIVE) {
64
40
  await this.pushWaterHeaterOnChanges();
65
- this.valveService.setCharacteristic(this.hap.Characteristic.InUse, this.hap.Characteristic.InUse.IN_USE);
41
+ this.Valve.Service.setCharacteristic(this.hap.Characteristic.InUse, this.hap.Characteristic.InUse.IN_USE);
66
42
  }
67
43
  else {
68
44
  await this.pushWaterHeaterOffChanges();
69
- this.valveService.setCharacteristic(this.hap.Characteristic.InUse, this.hap.Characteristic.InUse.NOT_IN_USE);
45
+ this.Valve.Service.setCharacteristic(this.hap.Characteristic.InUse, this.hap.Characteristic.InUse.NOT_IN_USE);
70
46
  }
71
47
  }
72
48
  /**
@@ -76,9 +52,9 @@ export class WaterHeater {
76
52
  * WaterHeater "command" "turnOn" "default" set to ON state
77
53
  */
78
54
  async pushWaterHeaterOnChanges() {
79
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushWaterHeaterOnChanges Active: ${this.Active},` +
80
- ` disablePushOn: ${this.disablePushOn}`);
81
- if (this.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
55
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushWaterHeaterOnChanges Active: ${this.Valve.Active},`
56
+ + ` disablePushOn: ${this.disablePushOn}`);
57
+ if (this.Valve.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
82
58
  const commandType = await this.commandType();
83
59
  const command = await this.commandOn();
84
60
  const bodyChange = JSON.stringify({
@@ -90,9 +66,9 @@ export class WaterHeater {
90
66
  }
91
67
  }
92
68
  async pushWaterHeaterOffChanges() {
93
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushWaterHeaterOffChanges Active: ${this.Active},` +
94
- ` disablePushOff: ${this.disablePushOff}`);
95
- if (this.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
69
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushWaterHeaterOffChanges Active: ${this.Valve.Active},`
70
+ + ` disablePushOff: ${this.disablePushOff}`);
71
+ if (this.Valve.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
96
72
  const commandType = await this.commandType();
97
73
  const command = await this.commandOff();
98
74
  const bodyChange = JSON.stringify({
@@ -118,8 +94,10 @@ export class WaterHeater {
118
94
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
119
95
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
120
96
  if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
121
- this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
97
+ this.debugSuccessLog(`${this.device.remoteType}: ${this.accessory.displayName} `
122
98
  + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
99
+ this.successLog(`${this.device.remoteType}: ${this.accessory.displayName}`
100
+ + ` request to SwitchBot API, body: ${JSON.stringify(bodyChange)} sent successfully`);
123
101
  this.updateHomeKitCharacteristics();
124
102
  }
125
103
  else {
@@ -129,251 +107,28 @@ export class WaterHeater {
129
107
  }
130
108
  catch (e) {
131
109
  this.apiError(e);
132
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with ${this.device.connectionType}` +
133
- ` Connection, Error Message: ${JSON.stringify(e.message)}`);
110
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with ${this.device.connectionType}`
111
+ + ` Connection, Error Message: ${JSON.stringify(e.message)}`);
134
112
  }
135
113
  }
136
114
  else {
137
- this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName}` +
138
- ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
115
+ this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
116
+ + ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
139
117
  }
140
118
  }
141
119
  async updateHomeKitCharacteristics() {
142
120
  // Active
143
- if (this.Active === undefined) {
144
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
121
+ if (this.Valve.Active === undefined) {
122
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Valve.Active}`);
145
123
  }
146
124
  else {
147
- this.accessory.context.Active = this.Active;
148
- this.valveService?.updateCharacteristic(this.hap.Characteristic.Active, this.Active);
149
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
150
- }
151
- }
152
- async disablePushOnChanges(device) {
153
- if (device.disablePushOn === undefined) {
154
- this.disablePushOn = false;
155
- }
156
- else {
157
- this.disablePushOn = device.disablePushOn;
158
- }
159
- }
160
- async disablePushOffChanges(device) {
161
- if (device.disablePushOff === undefined) {
162
- this.disablePushOff = false;
163
- }
164
- else {
165
- this.disablePushOff = device.disablePushOff;
166
- }
167
- }
168
- async commandType() {
169
- let commandType;
170
- if (this.device.customize) {
171
- commandType = 'customize';
172
- }
173
- else {
174
- commandType = 'command';
175
- }
176
- return commandType;
177
- }
178
- async commandOn() {
179
- let command;
180
- if (this.device.customize && this.device.customOn) {
181
- command = this.device.customOn;
182
- }
183
- else {
184
- command = 'turnOn';
185
- }
186
- return command;
187
- }
188
- async commandOff() {
189
- let command;
190
- if (this.device.customize && this.device.customOff) {
191
- command = this.device.customOff;
192
- }
193
- else {
194
- command = 'turnOff';
195
- }
196
- return command;
197
- }
198
- async statusCode(statusCode) {
199
- switch (statusCode) {
200
- case 151:
201
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command not supported by this deviceType, statusCode: ${statusCode}`);
202
- break;
203
- case 152:
204
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device not found, statusCode: ${statusCode}`);
205
- break;
206
- case 160:
207
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command is not supported, statusCode: ${statusCode}`);
208
- break;
209
- case 161:
210
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device is offline, statusCode: ${statusCode}`);
211
- break;
212
- case 171:
213
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Hub Device is offline, statusCode: ${statusCode}. ` +
214
- `Hub: ${this.device.hubDeviceId}`);
215
- break;
216
- case 190:
217
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,` +
218
- ` Or command format is invalid, statusCode: ${statusCode}`);
219
- break;
220
- case 100:
221
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Command successfully sent, statusCode: ${statusCode}`);
222
- break;
223
- case 200:
224
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Request successful, statusCode: ${statusCode}`);
225
- break;
226
- case 400:
227
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Bad Request, The client has issued an invalid request. `
228
- + `This is commonly used to specify validation errors in a request payload, statusCode: ${statusCode}`);
229
- break;
230
- case 401:
231
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unauthorized, Authorization for the API is required, `
232
- + `but the request has not been authenticated, statusCode: ${statusCode}`);
233
- break;
234
- case 403:
235
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Forbidden, The request has been authenticated but does not `
236
- + `have appropriate permissions, or a requested resource is not found, statusCode: ${statusCode}`);
237
- break;
238
- case 404:
239
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Not Found, Specifies the requested path does not exist, `
240
- + `statusCode: ${statusCode}`);
241
- break;
242
- case 406:
243
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Not Acceptable, The client has requested a MIME type via `
244
- + `the Accept header for a value not supported by the server, statusCode: ${statusCode}`);
245
- break;
246
- case 415:
247
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unsupported Media Type, The client has defined a contentType `
248
- + `header that is not supported by the server, statusCode: ${statusCode}`);
249
- break;
250
- case 422:
251
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unprocessable Entity, The client has made a valid request, but `
252
- + `the server cannot process it. This is often used for APIs for which certain limits have been exceeded, statusCode: ${statusCode}`);
253
- break;
254
- case 429:
255
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Too Many Requests, The client has exceeded the number of `
256
- + `requests allowed for a given time window, statusCode: ${statusCode}`);
257
- break;
258
- case 500:
259
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Internal Server Error, An unexpected error on the SmartThings `
260
- + `servers has occurred. These errors should be rare, statusCode: ${statusCode}`);
261
- break;
262
- default:
263
- this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Unknown statusCode: ` +
264
- `${statusCode}, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug`);
125
+ this.accessory.context.Active = this.Valve.Active;
126
+ this.Valve.Service?.updateCharacteristic(this.hap.Characteristic.Active, this.Valve.Active);
127
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Valve.Active}`);
265
128
  }
266
129
  }
267
130
  async apiError({ e }) {
268
- this.valveService.updateCharacteristic(this.hap.Characteristic.Active, e);
269
- }
270
- async deviceContext() {
271
- if (this.Active === undefined) {
272
- this.Active = this.hap.Characteristic.Active.INACTIVE;
273
- }
274
- else {
275
- this.Active = this.accessory.context.Active;
276
- }
277
- if (this.FirmwareRevision === undefined) {
278
- this.FirmwareRevision = this.platform.version;
279
- this.accessory.context.FirmwareRevision = this.FirmwareRevision;
280
- }
281
- }
282
- async deviceConfig(device) {
283
- let config = {};
284
- if (device.irwh) {
285
- config = device.irwh;
286
- }
287
- if (device.logging !== undefined) {
288
- config['logging'] = device.logging;
289
- }
290
- if (device.connectionType !== undefined) {
291
- config['connectionType'] = device.connectionType;
292
- }
293
- if (device.external !== undefined) {
294
- config['external'] = device.external;
295
- }
296
- if (device.customOn !== undefined) {
297
- config['customOn'] = device.customOn;
298
- }
299
- if (device.customOff !== undefined) {
300
- config['customOff'] = device.customOff;
301
- }
302
- if (device.customize !== undefined) {
303
- config['customize'] = device.customize;
304
- }
305
- if (device.disablePushOn !== undefined) {
306
- config['disablePushOn'] = device.disablePushOn;
307
- }
308
- if (device.disablePushOff !== undefined) {
309
- config['disablePushOff'] = device.disablePushOff;
310
- }
311
- if (Object.entries(config).length !== 0) {
312
- this.debugWarnLog({ log: [`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`] });
313
- }
314
- }
315
- async deviceLogs(device) {
316
- if (this.platform.debugMode) {
317
- this.deviceLogging = this.accessory.context.logging = 'debugMode';
318
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
319
- }
320
- else if (device.logging) {
321
- this.deviceLogging = this.accessory.context.logging = device.logging;
322
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
323
- }
324
- else if (this.platform.config.options?.logging) {
325
- this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
326
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
327
- }
328
- else {
329
- this.deviceLogging = this.accessory.context.logging = 'standard';
330
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
331
- }
332
- }
333
- /**
334
- * Logging for Device
335
- */
336
- infoLog(...log) {
337
- if (this.enablingDeviceLogging()) {
338
- this.platform.log.info(String(...log));
339
- }
340
- }
341
- warnLog(...log) {
342
- if (this.enablingDeviceLogging()) {
343
- this.platform.log.warn(String(...log));
344
- }
345
- }
346
- debugWarnLog(...log) {
347
- if (this.enablingDeviceLogging()) {
348
- if (this.deviceLogging?.includes('debug')) {
349
- this.platform.log.warn('[DEBUG]', String(...log));
350
- }
351
- }
352
- }
353
- errorLog(...log) {
354
- if (this.enablingDeviceLogging()) {
355
- this.platform.log.error(String(...log));
356
- }
357
- }
358
- debugErrorLog(...log) {
359
- if (this.enablingDeviceLogging()) {
360
- if (this.deviceLogging?.includes('debug')) {
361
- this.platform.log.error('[DEBUG]', String(...log));
362
- }
363
- }
364
- }
365
- debugLog(...log) {
366
- if (this.enablingDeviceLogging()) {
367
- if (this.deviceLogging === 'debug') {
368
- this.platform.log.info('[DEBUG]', String(...log));
369
- }
370
- else {
371
- this.platform.log.debug(String(...log));
372
- }
373
- }
374
- }
375
- enablingDeviceLogging() {
376
- return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
131
+ this.Valve.Service.updateCharacteristic(this.hap.Characteristic.Active, e);
377
132
  }
378
133
  }
379
134
  //# sourceMappingURL=waterheater.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"waterheater.js","sourceRoot":"","sources":["../../src/irdevice/waterheater.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAsD,MAAM,gBAAgB,CAAC;AAE7F;;;;GAIG;AACH,MAAM,OAAO,WAAW;IAkBH;IACT;IACD;IAnBO,GAAG,CAAM;IACT,GAAG,CAAU;IACb,MAAM,CAA2B;IAC9B,GAAG,CAAM;IAC5B,WAAW;IACX,YAAY,CAAW;IAEvB,wBAAwB;IACxB,MAAM,CAAuB;IAC7B,gBAAgB,CAAuB;IAEvC,SAAS;IACT,aAAa,CAAU;IACvB,aAAa,CAAW;IACxB,cAAc,CAAW;IAEzB,YACmB,QAA2B,EACpC,SAA4B,EAC7B,MAAkC;QAFxB,aAAQ,GAAR,QAAQ,CAAmB;QACpC,cAAS,GAAT,SAAS,CAAmB;QAC7B,WAAM,GAAN,MAAM,CAA4B;QAEzC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC7B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QACnC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;QACxB,uBAAuB;QACvB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACxB,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,YA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CAAC,EAAc;QAC9B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC7E,CAAC;CACF"}
@@ -1,8 +1,11 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { API, DynamicPlatformPlugin, Logging, PlatformAccessory } from 'homebridge';
3
4
  import { device, SwitchBotPlatformConfig, devicesConfig, irDevicesConfig } from './settings.js';
4
5
  import * as http from 'http';
6
+ import { Dispatcher } from 'undici';
5
7
  import { MqttClient } from 'mqtt';
8
+ import { UrlObject } from 'url';
6
9
  /**
7
10
  * HomebridgePlatform
8
11
  * This class is the main constructor for your plugin, this is where you should
@@ -15,6 +18,8 @@ export declare class SwitchBotPlatform implements DynamicPlatformPlugin {
15
18
  version: string;
16
19
  Logging?: string;
17
20
  debugMode: boolean;
21
+ maxRetries: number;
22
+ delayBetweenRetries: number;
18
23
  platformConfig: SwitchBotPlatformConfig['options'];
19
24
  platformLogging: SwitchBotPlatformConfig['logging'];
20
25
  config: SwitchBotPlatformConfig;
@@ -80,9 +85,10 @@ export declare class SwitchBotPlatform implements DynamicPlatformPlugin {
80
85
  private createColorBulb;
81
86
  private createCeilingLight;
82
87
  private createStripLight;
88
+ private createFan;
83
89
  private createRobotVacuumCleaner;
84
90
  private createTV;
85
- private createFan;
91
+ private createIRFan;
86
92
  private createLight;
87
93
  private createAirConditioner;
88
94
  private createAirPurifier;
@@ -98,6 +104,12 @@ export declare class SwitchBotPlatform implements DynamicPlatformPlugin {
98
104
  externalAccessory(accessory: PlatformAccessory): Promise<void>;
99
105
  unregisterPlatformAccessories(existingAccessory: PlatformAccessory): void;
100
106
  statusCode(statusCode: number): Promise<void>;
107
+ retryRequest(deviceMaxRetries: number, deviceDelayBetweenRetries: number, url: string | URL | UrlObject, options?: {
108
+ dispatcher?: Dispatcher;
109
+ } & Omit<Dispatcher.RequestOptions, 'origin' | 'path' | 'method'> & Partial<Pick<Dispatcher.RequestOptions, 'method'>>): Promise<{
110
+ body: any;
111
+ statusCode: number;
112
+ }>;
101
113
  connectBLE(): Promise<any>;
102
114
  getVersion(): Promise<void>;
103
115
  platformConfigOptions(): Promise<void>;
@@ -106,6 +118,7 @@ export declare class SwitchBotPlatform implements DynamicPlatformPlugin {
106
118
  * If device level logging is turned on, log to log.warn
107
119
  * Otherwise send debug logs to log.debug
108
120
  */
121
+ successLog(...log: any[]): void;
109
122
  infoLog(...log: any[]): void;
110
123
  warnLog(...log: any[]): void;
111
124
  debugWarnLog(...log: any[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,GAAG,EAAE,qBAAqB,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpF,OAAO,EAAwC,MAAM,EAAE,uBAAuB,EAAE,aAAa,EAAE,eAAe,EAAW,MAAM,eAAe,CAAC;AA2B/I,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAUlC;;;;GAIG;AACH,qBAAa,iBAAkB,YAAW,qBAAqB;IACtD,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACxC,SAAgB,GAAG,EAAE,GAAG,CAAC;IACzB,SAAgB,GAAG,EAAE,OAAO,CAAC;IAE7B,OAAO,EAAG,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAG,OAAO,CAAC;IACpB,cAAc,EAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IACpD,eAAe,EAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IACrD,MAAM,EAAG,uBAAuB,CAAC;IAEjC,oBAAoB,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAQ;IAChD,UAAU,EAAE,UAAU,GAAG,IAAI,CAAQ;I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