@switchbot/homebridge-switchbot 4.1.1-beta.0 → 4.1.1-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.
- package/CHANGELOG.md +14 -0
- package/config.schema.json +2 -2
- package/dist/device/blindtilt.js +104 -104
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.js +86 -86
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.js +98 -98
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.js +140 -140
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.js +47 -47
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +95 -93
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +13 -13
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +46 -46
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.js +96 -96
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.js +46 -46
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +85 -87
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.js +44 -44
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.js +119 -119
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.js +75 -75
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.js +44 -44
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.js +42 -42
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/meterpro.js +42 -42
- package/dist/device/meterpro.js.map +1 -1
- package/dist/device/motion.js +44 -44
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +60 -60
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.js +74 -74
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +54 -56
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/irdevice/airconditioner.js +31 -31
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.js +10 -10
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.js +9 -9
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.js +11 -11
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.js +11 -11
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/irdevice/light.js +9 -9
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.js +93 -93
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.js +33 -33
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +9 -9
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.js +9 -9
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.js +228 -228
- package/dist/platform.js.map +1 -1
- package/docs/functions/default.html +1 -1
- package/package.json +9 -9
- package/src/device/blindtilt.ts +104 -104
- package/src/device/bot.ts +86 -86
- package/src/device/ceilinglight.ts +98 -98
- package/src/device/colorbulb.ts +140 -140
- package/src/device/contact.ts +47 -47
- package/src/device/curtain.ts +95 -93
- package/src/device/device.ts +46 -46
- package/src/device/fan.ts +96 -96
- package/src/device/hub.ts +46 -46
- package/src/device/humidifier.ts +85 -87
- package/src/device/iosensor.ts +44 -44
- package/src/device/lightstrip.ts +119 -119
- package/src/device/lock.ts +75 -75
- package/src/device/meter.ts +44 -44
- package/src/device/meterplus.ts +42 -42
- package/src/device/meterpro.ts +42 -42
- package/src/device/motion.ts +44 -44
- package/src/device/plug.ts +62 -62
- package/src/device/robotvacuumcleaner.ts +74 -74
- package/src/device/waterdetector.ts +54 -55
- package/src/irdevice/airconditioner.ts +31 -31
- package/src/irdevice/airpurifier.ts +10 -10
- package/src/irdevice/camera.ts +9 -9
- package/src/irdevice/fan.ts +11 -11
- package/src/irdevice/irdevice.ts +11 -11
- package/src/irdevice/light.ts +9 -9
- package/src/irdevice/other.ts +93 -93
- package/src/irdevice/tv.ts +33 -33
- package/src/irdevice/vacuumcleaner.ts +9 -9
- package/src/irdevice/waterheater.ts +9 -9
- package/src/platform.ts +228 -228
package/src/irdevice/tv.ts
CHANGED
|
@@ -107,7 +107,7 @@ export class TV extends irdeviceBase {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
async VolumeSelectorSet(value: CharacteristicValue): Promise<void> {
|
|
110
|
-
|
|
110
|
+
this.debugLog(`VolumeSelector: ${value}`)
|
|
111
111
|
if (value === this.hap.Characteristic.VolumeSelector.INCREMENT) {
|
|
112
112
|
this.pushVolumeUpChanges()
|
|
113
113
|
} else {
|
|
@@ -118,61 +118,61 @@ export class TV extends irdeviceBase {
|
|
|
118
118
|
async RemoteKeySet(value: CharacteristicValue): Promise<void> {
|
|
119
119
|
switch (value) {
|
|
120
120
|
case this.hap.Characteristic.RemoteKey.REWIND: {
|
|
121
|
-
|
|
121
|
+
this.debugLog('Set Remote Key Pressed: REWIND')
|
|
122
122
|
break
|
|
123
123
|
}
|
|
124
124
|
case this.hap.Characteristic.RemoteKey.FAST_FORWARD: {
|
|
125
|
-
|
|
125
|
+
this.debugLog('Set Remote Key Pressed: FAST_FORWARD')
|
|
126
126
|
break
|
|
127
127
|
}
|
|
128
128
|
case this.hap.Characteristic.RemoteKey.NEXT_TRACK: {
|
|
129
|
-
|
|
129
|
+
this.debugLog('Set Remote Key Pressed: NEXT_TRACK')
|
|
130
130
|
break
|
|
131
131
|
}
|
|
132
132
|
case this.hap.Characteristic.RemoteKey.PREVIOUS_TRACK: {
|
|
133
|
-
|
|
133
|
+
this.debugLog('Set Remote Key Pressed: PREVIOUS_TRACK')
|
|
134
134
|
break
|
|
135
135
|
}
|
|
136
136
|
case this.hap.Characteristic.RemoteKey.ARROW_UP: {
|
|
137
|
-
|
|
137
|
+
this.debugLog('Set Remote Key Pressed: ARROW_UP')
|
|
138
138
|
// this.pushUpChanges();
|
|
139
139
|
break
|
|
140
140
|
}
|
|
141
141
|
case this.hap.Characteristic.RemoteKey.ARROW_DOWN: {
|
|
142
|
-
|
|
142
|
+
this.debugLog('Set Remote Key Pressed: ARROW_DOWN')
|
|
143
143
|
// this.pushDownChanges();
|
|
144
144
|
break
|
|
145
145
|
}
|
|
146
146
|
case this.hap.Characteristic.RemoteKey.ARROW_LEFT: {
|
|
147
|
-
|
|
147
|
+
this.debugLog('Set Remote Key Pressed: ARROW_LEFT')
|
|
148
148
|
// this.pushLeftChanges();
|
|
149
149
|
break
|
|
150
150
|
}
|
|
151
151
|
case this.hap.Characteristic.RemoteKey.ARROW_RIGHT: {
|
|
152
|
-
|
|
152
|
+
this.debugLog('Set Remote Key Pressed: ARROW_RIGHT')
|
|
153
153
|
// this.pushRightChanges();
|
|
154
154
|
break
|
|
155
155
|
}
|
|
156
156
|
case this.hap.Characteristic.RemoteKey.SELECT: {
|
|
157
|
-
|
|
157
|
+
this.debugLog('Set Remote Key Pressed: SELECT')
|
|
158
158
|
// this.pushOkChanges();
|
|
159
159
|
break
|
|
160
160
|
}
|
|
161
161
|
case this.hap.Characteristic.RemoteKey.BACK: {
|
|
162
|
-
|
|
162
|
+
this.debugLog('Set Remote Key Pressed: BACK')
|
|
163
163
|
// this.pushBackChanges();
|
|
164
164
|
break
|
|
165
165
|
}
|
|
166
166
|
case this.hap.Characteristic.RemoteKey.EXIT: {
|
|
167
|
-
|
|
167
|
+
this.debugLog('Set Remote Key Pressed: EXIT')
|
|
168
168
|
break
|
|
169
169
|
}
|
|
170
170
|
case this.hap.Characteristic.RemoteKey.PLAY_PAUSE: {
|
|
171
|
-
|
|
171
|
+
this.debugLog('Set Remote Key Pressed: PLAY_PAUSE')
|
|
172
172
|
break
|
|
173
173
|
}
|
|
174
174
|
case this.hap.Characteristic.RemoteKey.INFORMATION: {
|
|
175
|
-
|
|
175
|
+
this.debugLog('Set Remote Key Pressed: INFORMATION')
|
|
176
176
|
// this.pushMenuChanges();
|
|
177
177
|
break
|
|
178
178
|
}
|
|
@@ -180,12 +180,12 @@ export class TV extends irdeviceBase {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
async ActiveIdentifierSet(value: CharacteristicValue): Promise<void> {
|
|
183
|
-
|
|
183
|
+
this.debugLog(`ActiveIdentifier: ${value}`)
|
|
184
184
|
this.Television.ActiveIdentifier = value
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|
|
188
|
-
|
|
188
|
+
this.debugLog(`Active (value): ${value}`)
|
|
189
189
|
|
|
190
190
|
this.Television.Active = value
|
|
191
191
|
if (this.Television.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
@@ -206,7 +206,7 @@ export class TV extends irdeviceBase {
|
|
|
206
206
|
* TV "command" "channelSub" "default" previous channel
|
|
207
207
|
*/
|
|
208
208
|
async pushTvOnChanges(): Promise<void> {
|
|
209
|
-
|
|
209
|
+
this.debugLog(`pushTvOnChanges Active: ${this.Television.Active}, disablePushOn: ${this.disablePushOn}`)
|
|
210
210
|
if (this.Television.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
211
211
|
const commandType: string = await this.commandType()
|
|
212
212
|
const command: string = await this.commandOn()
|
|
@@ -220,7 +220,7 @@ export class TV extends irdeviceBase {
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
async pushTvOffChanges(): Promise<void> {
|
|
223
|
-
|
|
223
|
+
this.debugLog(`pushTvOffChanges Active: ${this.Television.Active}, disablePushOff: ${this.disablePushOff}`)
|
|
224
224
|
if (this.Television.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
|
|
225
225
|
const commandType: string = await this.commandType()
|
|
226
226
|
const command: string = await this.commandOff()
|
|
@@ -234,7 +234,7 @@ export class TV extends irdeviceBase {
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
async pushOkChanges(): Promise<void> {
|
|
237
|
-
|
|
237
|
+
this.debugLog(`pushOkChanges disablePushDetail: ${this.disablePushDetail}`)
|
|
238
238
|
if (!this.disablePushDetail) {
|
|
239
239
|
const bodyChange: bodyChange = {
|
|
240
240
|
command: 'Ok',
|
|
@@ -246,7 +246,7 @@ export class TV extends irdeviceBase {
|
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
async pushBackChanges(): Promise<void> {
|
|
249
|
-
|
|
249
|
+
this.debugLog(`pushBackChanges disablePushDetail: ${this.disablePushDetail}`)
|
|
250
250
|
if (!this.disablePushDetail) {
|
|
251
251
|
const bodyChange: bodyChange = {
|
|
252
252
|
command: 'Back',
|
|
@@ -258,7 +258,7 @@ export class TV extends irdeviceBase {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
async pushMenuChanges(): Promise<void> {
|
|
261
|
-
|
|
261
|
+
this.debugLog(`pushMenuChanges disablePushDetail: ${this.disablePushDetail}`)
|
|
262
262
|
if (!this.disablePushDetail) {
|
|
263
263
|
const bodyChange: bodyChange = {
|
|
264
264
|
command: 'Menu',
|
|
@@ -270,7 +270,7 @@ export class TV extends irdeviceBase {
|
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
async pushUpChanges(): Promise<void> {
|
|
273
|
-
|
|
273
|
+
this.debugLog(`pushUpChanges disablePushDetail: ${this.disablePushDetail}`)
|
|
274
274
|
if (!this.disablePushDetail) {
|
|
275
275
|
const bodyChange: bodyChange = {
|
|
276
276
|
command: 'Up',
|
|
@@ -282,7 +282,7 @@ export class TV extends irdeviceBase {
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
async pushDownChanges(): Promise<void> {
|
|
285
|
-
|
|
285
|
+
this.debugLog(`pushDownChanges disablePushDetail: ${this.disablePushDetail}`)
|
|
286
286
|
if (!this.disablePushDetail) {
|
|
287
287
|
const bodyChange: bodyChange = {
|
|
288
288
|
command: 'Down',
|
|
@@ -294,7 +294,7 @@ export class TV extends irdeviceBase {
|
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
async pushRightChanges(): Promise<void> {
|
|
297
|
-
|
|
297
|
+
this.debugLog(`pushRightChanges disablePushDetail: ${this.disablePushDetail}`)
|
|
298
298
|
if (!this.disablePushDetail) {
|
|
299
299
|
const bodyChange: bodyChange = {
|
|
300
300
|
command: 'Right',
|
|
@@ -306,7 +306,7 @@ export class TV extends irdeviceBase {
|
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
async pushLeftChanges(): Promise<void> {
|
|
309
|
-
|
|
309
|
+
this.debugLog(`pushLeftChanges disablePushDetail: ${this.disablePushDetail}`)
|
|
310
310
|
if (!this.disablePushDetail) {
|
|
311
311
|
const bodyChange: bodyChange = {
|
|
312
312
|
command: 'Left',
|
|
@@ -318,7 +318,7 @@ export class TV extends irdeviceBase {
|
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
async pushVolumeUpChanges(): Promise<void> {
|
|
321
|
-
|
|
321
|
+
this.debugLog(`pushVolumeUpChanges disablePushDetail: ${this.disablePushDetail}`)
|
|
322
322
|
if (!this.disablePushDetail) {
|
|
323
323
|
const bodyChange: bodyChange = {
|
|
324
324
|
command: 'volumeAdd',
|
|
@@ -330,7 +330,7 @@ export class TV extends irdeviceBase {
|
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
async pushVolumeDownChanges(): Promise<void> {
|
|
333
|
-
|
|
333
|
+
this.debugLog(`pushVolumeDownChanges disablePushDetail: ${this.disablePushDetail}`)
|
|
334
334
|
if (!this.disablePushDetail) {
|
|
335
335
|
const bodyChange: bodyChange = {
|
|
336
336
|
command: 'volumeSub',
|
|
@@ -342,12 +342,12 @@ export class TV extends irdeviceBase {
|
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
async pushTVChanges(bodyChange: any): Promise<void> {
|
|
345
|
-
|
|
345
|
+
this.debugLog('pushTVChanges')
|
|
346
346
|
if (this.device.connectionType === 'OpenAPI') {
|
|
347
|
-
|
|
347
|
+
this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
|
|
348
348
|
try {
|
|
349
|
-
const
|
|
350
|
-
const deviceStatus: any =
|
|
349
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
350
|
+
const deviceStatus: any = response.body
|
|
351
351
|
await this.pushStatusCodes(deviceStatus)
|
|
352
352
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
353
353
|
await this.successfulPushChange(deviceStatus, bodyChange)
|
|
@@ -360,12 +360,12 @@ export class TV extends irdeviceBase {
|
|
|
360
360
|
await this.pushChangeError(e)
|
|
361
361
|
}
|
|
362
362
|
} else {
|
|
363
|
-
|
|
363
|
+
this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
368
|
-
|
|
368
|
+
this.debugLog('updateHomeKitCharacteristics')
|
|
369
369
|
// Active
|
|
370
370
|
await this.updateCharacteristic(this.Television.Service, this.hap.Characteristic.Active, this.Television.Active, 'Active')
|
|
371
371
|
// ActiveIdentifier
|
|
@@ -47,7 +47,7 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
async OnSet(value: CharacteristicValue): Promise<void> {
|
|
50
|
-
|
|
50
|
+
this.debugLog(`On: ${value}`)
|
|
51
51
|
|
|
52
52
|
// Set the requested state
|
|
53
53
|
this.Switch.On = value
|
|
@@ -65,7 +65,7 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
65
65
|
* Vacuum Cleaner "command" "turnOn" "default" set to ON state
|
|
66
66
|
*/
|
|
67
67
|
async pushOnChanges(): Promise<void> {
|
|
68
|
-
|
|
68
|
+
this.debugLog(`pushOnChanges On: ${this.Switch.On}, disablePushOn: ${this.disablePushOn}`)
|
|
69
69
|
if (this.Switch.On && !this.disablePushOn) {
|
|
70
70
|
const commandType: string = await this.commandType()
|
|
71
71
|
const command: string = await this.commandOn()
|
|
@@ -79,7 +79,7 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
async pushOffChanges(): Promise<void> {
|
|
82
|
-
|
|
82
|
+
this.debugLog(`pushOffChanges On: ${this.Switch.On}, disablePushOff: ${this.disablePushOff}`)
|
|
83
83
|
if (!this.Switch.On && !this.disablePushOff) {
|
|
84
84
|
const commandType: string = await this.commandType()
|
|
85
85
|
const command: string = await this.commandOff()
|
|
@@ -93,12 +93,12 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
96
|
-
|
|
96
|
+
this.debugLog('pushChanges')
|
|
97
97
|
if (this.device.connectionType === 'OpenAPI') {
|
|
98
|
-
|
|
98
|
+
this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
|
|
99
99
|
try {
|
|
100
|
-
const
|
|
101
|
-
const deviceStatus: any =
|
|
100
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
101
|
+
const deviceStatus: any = response.body
|
|
102
102
|
await this.pushStatusCodes(deviceStatus)
|
|
103
103
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
104
104
|
await this.successfulPushChange(deviceStatus, bodyChange)
|
|
@@ -111,12 +111,12 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
111
111
|
await this.pushChangeError(e)
|
|
112
112
|
}
|
|
113
113
|
} else {
|
|
114
|
-
|
|
114
|
+
this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
119
|
-
|
|
119
|
+
this.debugLog('updateHomeKitCharacteristics')
|
|
120
120
|
// On
|
|
121
121
|
await this.updateCharacteristic(this.Switch.Service, this.hap.Characteristic.On, this.Switch.On, 'On')
|
|
122
122
|
}
|
|
@@ -47,7 +47,7 @@ export class WaterHeater extends irdeviceBase {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|
|
50
|
-
|
|
50
|
+
this.debugLog(`Active: ${value}`)
|
|
51
51
|
|
|
52
52
|
this.Valve.Active = value
|
|
53
53
|
if (this.Valve.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
@@ -66,7 +66,7 @@ export class WaterHeater extends irdeviceBase {
|
|
|
66
66
|
* WaterHeater "command" "turnOn" "default" set to ON state
|
|
67
67
|
*/
|
|
68
68
|
async pushWaterHeaterOnChanges(): Promise<void> {
|
|
69
|
-
|
|
69
|
+
this.debugLog(`pushWaterHeaterOnChanges Active: ${this.Valve.Active}, disablePushOn: ${this.disablePushOn}`)
|
|
70
70
|
if (this.Valve.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
71
71
|
const commandType: string = await this.commandType()
|
|
72
72
|
const command: string = await this.commandOn()
|
|
@@ -80,7 +80,7 @@ export class WaterHeater extends irdeviceBase {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
async pushWaterHeaterOffChanges(): Promise<void> {
|
|
83
|
-
|
|
83
|
+
this.debugLog(`pushWaterHeaterOffChanges Active: ${this.Valve.Active}, disablePushOff: ${this.disablePushOff}`)
|
|
84
84
|
if (this.Valve.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
|
|
85
85
|
const commandType: string = await this.commandType()
|
|
86
86
|
const command: string = await this.commandOff()
|
|
@@ -94,12 +94,12 @@ export class WaterHeater extends irdeviceBase {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
97
|
-
|
|
97
|
+
this.debugLog('pushChanges')
|
|
98
98
|
if (this.device.connectionType === 'OpenAPI') {
|
|
99
|
-
|
|
99
|
+
this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
|
|
100
100
|
try {
|
|
101
|
-
const
|
|
102
|
-
const deviceStatus: any =
|
|
101
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
102
|
+
const deviceStatus: any = response.body
|
|
103
103
|
await this.pushStatusCodes(deviceStatus)
|
|
104
104
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
105
105
|
await this.successfulPushChange(deviceStatus, bodyChange)
|
|
@@ -112,12 +112,12 @@ export class WaterHeater extends irdeviceBase {
|
|
|
112
112
|
await this.pushChangeError(e)
|
|
113
113
|
}
|
|
114
114
|
} else {
|
|
115
|
-
|
|
115
|
+
this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
120
|
-
|
|
120
|
+
this.debugLog('updateHomeKitCharacteristics')
|
|
121
121
|
// Active
|
|
122
122
|
await this.updateCharacteristic(this.Valve.Service, this.hap.Characteristic.Active, this.Valve.Active, 'Active')
|
|
123
123
|
}
|