@switchbot/homebridge-switchbot 4.1.1-beta.2 → 4.1.1-beta.4
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/dist/device/blindtilt.js +103 -103
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.js +84 -84
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.js +97 -97
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.js +139 -139
- 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 +91 -89
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +12 -12
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +42 -42
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.js +95 -95
- 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.js +84 -84
- 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 +118 -118
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.js +74 -74
- 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 +59 -59
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.js +73 -73
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.js +44 -44
- 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 +55 -55
- 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/package.json +9 -9
- package/src/device/blindtilt.ts +103 -103
- package/src/device/bot.ts +84 -84
- package/src/device/ceilinglight.ts +97 -97
- package/src/device/colorbulb.ts +139 -139
- package/src/device/contact.ts +47 -47
- package/src/device/curtain.ts +91 -89
- package/src/device/device.ts +42 -42
- package/src/device/fan.ts +95 -95
- package/src/device/hub.ts +46 -46
- package/src/device/humidifier.ts +84 -84
- package/src/device/iosensor.ts +44 -44
- package/src/device/lightstrip.ts +118 -118
- package/src/device/lock.ts +74 -74
- 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 +61 -61
- package/src/device/robotvacuumcleaner.ts +73 -73
- package/src/device/waterdetector.ts +44 -44
- 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 +55 -55
- 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/device/colorbulb.ts
CHANGED
|
@@ -184,7 +184,7 @@ export class ColorBulb extends deviceBase {
|
|
|
184
184
|
await this.pushChanges()
|
|
185
185
|
} catch (e: any) {
|
|
186
186
|
await this.apiError(e)
|
|
187
|
-
|
|
187
|
+
this.errorLog(`failed pushChanges with ${device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`)
|
|
188
188
|
}
|
|
189
189
|
this.colorBulbUpdateInProgress = false
|
|
190
190
|
})
|
|
@@ -194,60 +194,60 @@ export class ColorBulb extends deviceBase {
|
|
|
194
194
|
* Parse the device status from the SwitchBotBLE API
|
|
195
195
|
*/
|
|
196
196
|
async BLEparseStatus(): Promise<void> {
|
|
197
|
-
|
|
197
|
+
this.debugLog('BLEparseStatus')
|
|
198
198
|
// On
|
|
199
199
|
this.LightBulb.On = this.serviceData.power
|
|
200
|
-
|
|
200
|
+
this.debugLog(`On: ${this.LightBulb.On}`)
|
|
201
201
|
// Brightness
|
|
202
202
|
this.LightBulb.Brightness = this.serviceData.brightness
|
|
203
|
-
|
|
203
|
+
this.debugLog(`Brightness: ${this.LightBulb.Brightness}`)
|
|
204
204
|
// Color, Hue & Brightness
|
|
205
|
-
|
|
205
|
+
this.debugLog(`red: ${this.serviceData.red}, green: ${this.serviceData.green}, blue: ${this.serviceData.blue}`)
|
|
206
206
|
const [hue, saturation] = rgb2hs(this.serviceData.red, this.serviceData.green, this.serviceData.blue)
|
|
207
|
-
|
|
207
|
+
this.debugLog(`hs: ${JSON.stringify(rgb2hs(this.serviceData.red, this.serviceData.green, this.serviceData.blue))}`)
|
|
208
208
|
// Hue
|
|
209
209
|
this.LightBulb.Hue = hue
|
|
210
|
-
|
|
210
|
+
this.debugLog(`Hue: ${this.LightBulb.Hue}`)
|
|
211
211
|
// Saturation
|
|
212
212
|
this.LightBulb.Saturation = saturation
|
|
213
|
-
|
|
213
|
+
this.debugLog(`Saturation: ${this.LightBulb.Saturation}`)
|
|
214
214
|
// ColorTemperature
|
|
215
215
|
const miredColorTemperature = Math.round(1000000 / this.serviceData.color_temperature)
|
|
216
216
|
this.LightBulb.ColorTemperature = Math.max(Math.min(miredColorTemperature, 500), 140)
|
|
217
|
-
|
|
217
|
+
this.debugLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`)
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
/**
|
|
221
221
|
* Parse the device status from the SwitchBot OpenAPI
|
|
222
222
|
*/
|
|
223
223
|
async openAPIparseStatus(): Promise<void> {
|
|
224
|
-
|
|
224
|
+
this.debugLog('openAPIparseStatus')
|
|
225
225
|
// On
|
|
226
226
|
this.LightBulb.On = this.deviceStatus.power === 'on'
|
|
227
|
-
|
|
227
|
+
this.debugLog(`On: ${this.LightBulb.On}`)
|
|
228
228
|
// Brightness
|
|
229
229
|
this.LightBulb.Brightness = this.deviceStatus.brightness
|
|
230
|
-
|
|
230
|
+
this.debugLog(`Brightness: ${this.LightBulb.Brightness}`)
|
|
231
231
|
// Color, Hue & Brightness
|
|
232
|
-
|
|
232
|
+
this.debugLog(`color: ${JSON.stringify(this.deviceStatus.color)}`)
|
|
233
233
|
const [red, green, blue] = this.deviceStatus.color.split(':')
|
|
234
|
-
|
|
234
|
+
this.debugLog(`red: ${JSON.stringify(red)}, green: ${JSON.stringify(green)}, blue: ${JSON.stringify(blue)}`)
|
|
235
235
|
const [hue, saturation] = rgb2hs(red, green, blue)
|
|
236
|
-
|
|
236
|
+
this.debugLog(`hs: ${JSON.stringify(rgb2hs(red, green, blue))}`)
|
|
237
237
|
// Hue
|
|
238
238
|
this.LightBulb.Hue = hue
|
|
239
|
-
|
|
239
|
+
this.debugLog(`Hue: ${this.LightBulb.Hue}`)
|
|
240
240
|
// Saturation
|
|
241
241
|
this.LightBulb.Saturation = saturation
|
|
242
|
-
|
|
242
|
+
this.debugLog(`Saturation: ${this.LightBulb.Saturation}`)
|
|
243
243
|
// ColorTemperature
|
|
244
244
|
const miredColorTemperature = Math.round(1000000 / this.deviceStatus.colorTemperature)
|
|
245
245
|
this.LightBulb.ColorTemperature = Math.max(Math.min(miredColorTemperature, 500), 140)
|
|
246
|
-
|
|
246
|
+
this.debugLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`)
|
|
247
247
|
// Firmware Version
|
|
248
248
|
if (this.deviceStatus.version) {
|
|
249
249
|
const version = this.deviceStatus.version.toString()
|
|
250
|
-
|
|
250
|
+
this.debugLog(`Firmware Version: ${version.replace(/^V|-.*$/g, '')}`)
|
|
251
251
|
const deviceVersion = version.replace(/^V|-.*$/g, '') ?? '0.0.0'
|
|
252
252
|
this.accessory
|
|
253
253
|
.getService(this.hap.Service.AccessoryInformation)!
|
|
@@ -256,35 +256,35 @@ export class ColorBulb extends deviceBase {
|
|
|
256
256
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
257
257
|
.updateValue(deviceVersion)
|
|
258
258
|
this.accessory.context.version = deviceVersion
|
|
259
|
-
|
|
259
|
+
this.debugSuccessLog(`version: ${this.accessory.context.version}`)
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
async parseStatusWebhook(): Promise<void> {
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
this.debugLog('parseStatusWebhook')
|
|
265
|
+
this.debugLog(`(powerState, brightness, color, colorTemperature) = Webhook:(${this.webhookContext.powerState}, ${this.webhookContext.brightness}, ${this.webhookContext.color}, ${this.webhookContext.colorTemperature}), current:(${this.LightBulb.On}, ${this.LightBulb.Brightness}, ${this.LightBulb.Hue}, ${this.LightBulb.Saturation}, ${this.LightBulb.ColorTemperature})`)
|
|
266
266
|
// On
|
|
267
267
|
this.LightBulb.On = this.webhookContext.powerState === 'ON'
|
|
268
|
-
|
|
268
|
+
this.debugLog(`On: ${this.LightBulb.On}`)
|
|
269
269
|
// Brightness
|
|
270
270
|
this.LightBulb.Brightness = this.webhookContext.brightness
|
|
271
|
-
|
|
271
|
+
this.debugLog(`Brightness: ${this.LightBulb.Brightness}`)
|
|
272
272
|
// Color, Hue & Brightness
|
|
273
|
-
|
|
273
|
+
this.debugLog(`color: ${JSON.stringify(this.webhookContext.color)}`)
|
|
274
274
|
const [red, green, blue] = this.webhookContext.color.split(':')
|
|
275
|
-
|
|
275
|
+
this.debugLog(`red: ${JSON.stringify(red)}, green: ${JSON.stringify(green)}, blue: ${JSON.stringify(blue)}`)
|
|
276
276
|
const [hue, saturation] = rgb2hs(red, green, blue)
|
|
277
|
-
|
|
277
|
+
this.debugLog(`hs: ${JSON.stringify(rgb2hs(red, green, blue))}`)
|
|
278
278
|
// Hue
|
|
279
279
|
this.LightBulb.Hue = hue
|
|
280
|
-
|
|
280
|
+
this.debugLog(`Hue: ${this.LightBulb.Hue}`)
|
|
281
281
|
// Saturation
|
|
282
282
|
this.LightBulb.Saturation = saturation
|
|
283
|
-
|
|
283
|
+
this.debugLog(`Saturation: ${this.LightBulb.Saturation}`)
|
|
284
284
|
// ColorTemperature
|
|
285
285
|
const miredColorTemperature = Math.round(1000000 / this.webhookContext.colorTemperature)
|
|
286
286
|
this.LightBulb.ColorTemperature = Math.max(Math.min(miredColorTemperature, 500), 140)
|
|
287
|
-
|
|
287
|
+
this.debugLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`)
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
/**
|
|
@@ -292,19 +292,19 @@ export class ColorBulb extends deviceBase {
|
|
|
292
292
|
*/
|
|
293
293
|
async refreshStatus(): Promise<void> {
|
|
294
294
|
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
295
|
-
|
|
295
|
+
this.errorLog(`refreshStatus enableCloudService: ${this.device.enableCloudService}`)
|
|
296
296
|
} else if (this.BLE) {
|
|
297
297
|
await this.BLERefreshStatus()
|
|
298
298
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
299
299
|
await this.openAPIRefreshStatus()
|
|
300
300
|
} else {
|
|
301
301
|
await this.offlineOff()
|
|
302
|
-
|
|
302
|
+
this.debugWarnLog(`Connection Type: ${this.device.connectionType}, refreshStatus will not happen.`)
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
async BLERefreshStatus(): Promise<void> {
|
|
307
|
-
|
|
307
|
+
this.debugLog('BLERefreshStatus')
|
|
308
308
|
const switchBotBLE = await this.switchbotBLE()
|
|
309
309
|
if (switchBotBLE === undefined) {
|
|
310
310
|
await this.BLERefreshConnection(switchBotBLE)
|
|
@@ -319,7 +319,7 @@ export class ColorBulb extends deviceBase {
|
|
|
319
319
|
await this.BLEparseStatus()
|
|
320
320
|
await this.updateHomeKitCharacteristics()
|
|
321
321
|
} else {
|
|
322
|
-
|
|
322
|
+
this.errorLog(`failed to get serviceData, serviceData: ${JSON.stringify(serviceData)}`)
|
|
323
323
|
await this.BLERefreshConnection(switchBotBLE)
|
|
324
324
|
}
|
|
325
325
|
})()
|
|
@@ -327,67 +327,67 @@ export class ColorBulb extends deviceBase {
|
|
|
327
327
|
}
|
|
328
328
|
|
|
329
329
|
async registerPlatformBLE(): Promise<void> {
|
|
330
|
-
|
|
330
|
+
this.debugLog('registerPlatformBLE')
|
|
331
331
|
if (this.config.options?.BLE) {
|
|
332
|
-
|
|
332
|
+
this.debugLog('is listening to Platform BLE.')
|
|
333
333
|
try {
|
|
334
334
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
|
335
335
|
this.device.bleMac = formattedDeviceId
|
|
336
|
-
|
|
336
|
+
this.debugLog(`bleMac: ${this.device.bleMac}`)
|
|
337
337
|
this.platform.bleEventHandler[this.device.bleMac] = async (context: colorBulbServiceData) => {
|
|
338
338
|
try {
|
|
339
|
-
|
|
339
|
+
this.debugLog(`received BLE: ${JSON.stringify(context)}`)
|
|
340
340
|
this.serviceData = context
|
|
341
341
|
await this.BLEparseStatus()
|
|
342
342
|
await this.updateHomeKitCharacteristics()
|
|
343
343
|
} catch (e: any) {
|
|
344
|
-
|
|
344
|
+
this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
} catch (error) {
|
|
348
|
-
|
|
348
|
+
this.errorLog(`failed to format device ID as MAC, Error: ${error}`)
|
|
349
349
|
}
|
|
350
350
|
} else {
|
|
351
|
-
|
|
351
|
+
this.debugLog('is not listening to Platform BLE')
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
|
|
355
355
|
async openAPIRefreshStatus(): Promise<void> {
|
|
356
|
-
|
|
356
|
+
this.debugLog('openAPIRefreshStatus')
|
|
357
357
|
try {
|
|
358
|
-
const
|
|
359
|
-
const deviceStatus: any =
|
|
360
|
-
|
|
358
|
+
const response = await this.deviceRefreshStatus()
|
|
359
|
+
const deviceStatus: any = response.body
|
|
360
|
+
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
361
361
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
362
|
-
|
|
362
|
+
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
363
363
|
this.deviceStatus = deviceStatus.body
|
|
364
364
|
await this.openAPIparseStatus()
|
|
365
365
|
await this.updateHomeKitCharacteristics()
|
|
366
366
|
} else {
|
|
367
|
-
|
|
368
|
-
|
|
367
|
+
this.debugWarnLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
368
|
+
this.debugWarnLog(deviceStatus)
|
|
369
369
|
}
|
|
370
370
|
} catch (e: any) {
|
|
371
371
|
await this.apiError(e)
|
|
372
|
-
|
|
372
|
+
this.errorLog(`failed openAPIRefreshStatus with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`)
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
async registerWebhook() {
|
|
377
377
|
if (this.device.webhook) {
|
|
378
|
-
|
|
378
|
+
this.debugLog('is listening webhook.')
|
|
379
379
|
this.platform.webhookEventHandler[this.device.deviceId] = async (context: colorBulbWebhookContext) => {
|
|
380
380
|
try {
|
|
381
|
-
|
|
381
|
+
this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
|
|
382
382
|
this.webhookContext = context
|
|
383
383
|
await this.parseStatusWebhook()
|
|
384
384
|
await this.updateHomeKitCharacteristics()
|
|
385
385
|
} catch (e: any) {
|
|
386
|
-
|
|
386
|
+
this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e.message ?? e}`)
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
} else {
|
|
390
|
-
|
|
390
|
+
this.debugLog('is not listening webhook.')
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
|
|
@@ -404,40 +404,40 @@ export class ColorBulb extends deviceBase {
|
|
|
404
404
|
*/
|
|
405
405
|
async pushChanges(): Promise<void> {
|
|
406
406
|
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
407
|
-
|
|
407
|
+
this.errorLog(`pushChanges enableCloudService: ${this.device.enableCloudService}`)
|
|
408
408
|
} else if (this.BLE) {
|
|
409
409
|
await this.BLEpushChanges()
|
|
410
410
|
if (this.LightBulb.On) {
|
|
411
411
|
// Push Brightness Update
|
|
412
|
-
|
|
412
|
+
this.debugLog(`Brightness: ${this.LightBulb.Brightness}`)
|
|
413
413
|
await this.BLEpushBrightnessChanges()
|
|
414
414
|
// Push ColorTemperature Update
|
|
415
|
-
|
|
415
|
+
this.debugLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`)
|
|
416
416
|
await this.BLEpushColorTemperatureChanges()
|
|
417
417
|
// Push Hue & Saturation Update
|
|
418
|
-
|
|
418
|
+
this.debugLog(`Hue: ${this.LightBulb.Hue}, Saturation: ${this.LightBulb.Saturation}`)
|
|
419
419
|
await this.BLEpushRGBChanges()
|
|
420
420
|
} else {
|
|
421
|
-
|
|
421
|
+
this.debugLog('BLE (Brightness), (ColorTemperature), (Hue), & (Saturation) changes will not happen, as the device is OFF.')
|
|
422
422
|
}
|
|
423
423
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
424
424
|
await this.openAPIpushChanges()
|
|
425
425
|
if (this.LightBulb.On) {
|
|
426
426
|
// Push Brightness Update
|
|
427
|
-
|
|
427
|
+
this.debugLog(`Brightness: ${this.LightBulb.Brightness}`)
|
|
428
428
|
await this.pushBrightnessChanges()
|
|
429
429
|
// Push ColorTemperature Update
|
|
430
|
-
|
|
430
|
+
this.debugLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`)
|
|
431
431
|
await this.pushColorTemperatureChanges()
|
|
432
432
|
// Push Hue & Saturation Update
|
|
433
|
-
|
|
433
|
+
this.debugLog(`Hue: ${this.LightBulb.Hue}, Saturation: ${this.LightBulb.Saturation}`)
|
|
434
434
|
await this.pushHueSaturationChanges()
|
|
435
435
|
} else {
|
|
436
|
-
|
|
436
|
+
this.debugLog('openAPI (Brightness), (ColorTemperature), (Hue), & (Saturation) changes will not happen, as the device is OFF.')
|
|
437
437
|
}
|
|
438
438
|
} else {
|
|
439
439
|
await this.offlineOff()
|
|
440
|
-
|
|
440
|
+
this.debugWarnLog(`Connection Type: ${this.device.connectionType}, pushChanges will not happen.`)
|
|
441
441
|
}
|
|
442
442
|
// Refresh the status from the API
|
|
443
443
|
interval(15000)
|
|
@@ -449,19 +449,19 @@ export class ColorBulb extends deviceBase {
|
|
|
449
449
|
}
|
|
450
450
|
|
|
451
451
|
async BLEpushChanges(): Promise<void> {
|
|
452
|
-
|
|
452
|
+
this.debugLog('BLEpushChanges')
|
|
453
453
|
if (this.LightBulb.On !== this.accessory.context.On) {
|
|
454
|
-
|
|
454
|
+
this.debugLog(`BLEpushChanges On: ${this.LightBulb.On}, OnCached: ${this.accessory.context.On}`)
|
|
455
455
|
const switchBotBLE = await this.platform.connectBLE(this.accessory, this.device)
|
|
456
456
|
try {
|
|
457
457
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
|
458
458
|
this.device.bleMac = formattedDeviceId
|
|
459
|
-
|
|
459
|
+
this.debugLog(`bleMac: ${this.device.bleMac}`)
|
|
460
460
|
if (switchBotBLE !== false) {
|
|
461
461
|
switchBotBLE
|
|
462
462
|
.discover({ model: this.device.bleModel, id: this.device.bleMac })
|
|
463
463
|
.then(async (device_list: WoBulb[]) => {
|
|
464
|
-
|
|
464
|
+
this.infoLog(`On: ${this.LightBulb.On}`)
|
|
465
465
|
return await this.retryBLE({
|
|
466
466
|
max: await this.maxRetryBLE(),
|
|
467
467
|
fn: async () => {
|
|
@@ -474,65 +474,65 @@ export class ColorBulb extends deviceBase {
|
|
|
474
474
|
})
|
|
475
475
|
})
|
|
476
476
|
.then(async () => {
|
|
477
|
-
|
|
477
|
+
this.successLog(`On: ${this.LightBulb.On} sent over SwitchBot BLE, sent successfully`)
|
|
478
478
|
await this.updateHomeKitCharacteristics()
|
|
479
479
|
})
|
|
480
480
|
.catch(async (e: any) => {
|
|
481
481
|
await this.apiError(e)
|
|
482
|
-
|
|
482
|
+
this.errorLog(`failed BLEpushChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`)
|
|
483
483
|
await this.BLEPushConnection()
|
|
484
484
|
})
|
|
485
485
|
} else {
|
|
486
|
-
|
|
486
|
+
this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(switchBotBLE)}`)
|
|
487
487
|
await this.BLEPushConnection()
|
|
488
488
|
}
|
|
489
489
|
} catch (error) {
|
|
490
|
-
|
|
490
|
+
this.errorLog(`failed to format device ID as MAC, Error: ${error}`)
|
|
491
491
|
}
|
|
492
492
|
} else {
|
|
493
|
-
|
|
493
|
+
this.debugLog(`No changes (BLEpushChanges), On: ${this.LightBulb.On}, OnCached: ${this.accessory.context.On}`)
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
496
|
|
|
497
497
|
async BLEpushBrightnessChanges(): Promise<void> {
|
|
498
|
-
|
|
498
|
+
this.debugLog('BLEpushBrightnessChanges')
|
|
499
499
|
if (this.LightBulb.Brightness !== this.accessory.context.Brightness) {
|
|
500
500
|
const switchBotBLE = await this.platform.connectBLE(this.accessory, this.device)
|
|
501
501
|
try {
|
|
502
502
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
|
503
503
|
this.device.bleMac = formattedDeviceId
|
|
504
|
-
|
|
504
|
+
this.debugLog(`bleMac: ${this.device.bleMac}`)
|
|
505
505
|
if (switchBotBLE !== false) {
|
|
506
506
|
switchBotBLE
|
|
507
507
|
.discover({ model: this.device.bleModel, id: this.device.bleMac })
|
|
508
508
|
.then(async (device_list: SwitchbotDevice[]) => {
|
|
509
509
|
const deviceList = device_list as unknown as WoBulb[]
|
|
510
|
-
|
|
510
|
+
this.infoLog(`Target Brightness: ${this.LightBulb.Brightness}`)
|
|
511
511
|
return await deviceList[0].setBrightness(Number(this.LightBulb.Brightness))
|
|
512
512
|
})
|
|
513
513
|
.then(async () => {
|
|
514
|
-
|
|
514
|
+
this.successLog(`Brightness: ${this.LightBulb.Brightness} sent over SwitchBot BLE, sent successfully`)
|
|
515
515
|
await this.updateHomeKitCharacteristics()
|
|
516
516
|
})
|
|
517
517
|
.catch(async (e: any) => {
|
|
518
518
|
await this.apiError(e)
|
|
519
|
-
|
|
519
|
+
this.errorLog(`failed BLEpushChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`)
|
|
520
520
|
await this.BLEPushConnection()
|
|
521
521
|
})
|
|
522
522
|
} else {
|
|
523
|
-
|
|
523
|
+
this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(switchBotBLE)}`)
|
|
524
524
|
await this.BLEPushConnection()
|
|
525
525
|
}
|
|
526
526
|
} catch (error) {
|
|
527
|
-
|
|
527
|
+
this.errorLog(`failed to format device ID as MAC, Error: ${error}`)
|
|
528
528
|
}
|
|
529
529
|
} else {
|
|
530
|
-
|
|
530
|
+
this.debugLog(`No changes (BLEpushBrightnessChanges), Brightness: ${this.LightBulb.Brightness}, BrightnessCached: ${this.accessory.context.Brightness}`)
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
533
|
|
|
534
534
|
async BLEpushColorTemperatureChanges(): Promise<void> {
|
|
535
|
-
|
|
535
|
+
this.debugLog('BLEpushColorTemperatureChanges')
|
|
536
536
|
if (this.LightBulb.ColorTemperature !== this.accessory.context.ColorTemperature) {
|
|
537
537
|
const kelvin = Math.round(1000000 / Number(this.LightBulb.ColorTemperature))
|
|
538
538
|
this.accessory.context.kelvin = kelvin
|
|
@@ -540,78 +540,78 @@ export class ColorBulb extends deviceBase {
|
|
|
540
540
|
try {
|
|
541
541
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
|
542
542
|
this.device.bleMac = formattedDeviceId
|
|
543
|
-
|
|
543
|
+
this.debugLog(`bleMac: ${this.device.bleMac}`)
|
|
544
544
|
if (switchBotBLE !== false) {
|
|
545
545
|
switchBotBLE
|
|
546
546
|
.discover({ model: this.device.bleModel, id: this.device.bleMac })
|
|
547
547
|
.then(async (device_list: SwitchbotDevice[]) => {
|
|
548
548
|
const deviceList = device_list as unknown as WoBulb[]
|
|
549
|
-
|
|
549
|
+
this.infoLog(`ColorTemperature: ${this.LightBulb.ColorTemperature}`)
|
|
550
550
|
return await deviceList[0].setColorTemperature(kelvin)
|
|
551
551
|
})
|
|
552
552
|
.then(async () => {
|
|
553
|
-
|
|
553
|
+
this.successLog(`ColorTemperature: ${this.LightBulb.ColorTemperature} sent over SwitchBot BLE, sent successfully`)
|
|
554
554
|
await this.updateHomeKitCharacteristics()
|
|
555
555
|
})
|
|
556
556
|
.catch(async (e: any) => {
|
|
557
557
|
await this.apiError(e)
|
|
558
|
-
|
|
558
|
+
this.errorLog(`failed BLEpushRGBChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`)
|
|
559
559
|
await this.BLEPushConnection()
|
|
560
560
|
})
|
|
561
561
|
} else {
|
|
562
|
-
|
|
562
|
+
this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(switchBotBLE)}`)
|
|
563
563
|
await this.BLEPushConnection()
|
|
564
564
|
}
|
|
565
565
|
} catch (error) {
|
|
566
|
-
|
|
566
|
+
this.errorLog(`failed to format device ID as MAC, Error: ${error}`)
|
|
567
567
|
}
|
|
568
568
|
} else {
|
|
569
|
-
|
|
569
|
+
this.debugLog(`No changes (BLEpushColorTemperatureChanges), ColorTemperature: ${this.LightBulb.ColorTemperature}, ColorTemperatureCached: ${this.accessory.context.ColorTemperature}`)
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
572
|
|
|
573
573
|
async BLEpushRGBChanges(): Promise<void> {
|
|
574
|
-
|
|
574
|
+
this.debugLog('BLEpushRGBChanges')
|
|
575
575
|
if ((this.LightBulb.Hue !== this.accessory.context.Hue) || (this.LightBulb.Saturation !== this.accessory.context.Saturation)) {
|
|
576
|
-
|
|
576
|
+
this.debugLog(`Hue: ${JSON.stringify(this.LightBulb.Hue)}, Saturation: ${JSON.stringify(this.LightBulb.Saturation)}`)
|
|
577
577
|
const [red, green, blue] = hs2rgb(this.LightBulb.Hue, this.LightBulb.Saturation)
|
|
578
|
-
|
|
578
|
+
this.debugLog(`rgb: ${JSON.stringify([red, green, blue])}`)
|
|
579
579
|
const switchBotBLE = await this.platform.connectBLE(this.accessory, this.device)
|
|
580
580
|
try {
|
|
581
581
|
const formattedDeviceId = formatDeviceIdAsMac(this.device.deviceId)
|
|
582
582
|
this.device.bleMac = formattedDeviceId
|
|
583
|
-
|
|
583
|
+
this.debugLog(`bleMac: ${this.device.bleMac}`)
|
|
584
584
|
if (switchBotBLE !== false) {
|
|
585
585
|
switchBotBLE
|
|
586
586
|
.discover({ model: this.device.bleModel, id: this.device.bleMac })
|
|
587
587
|
.then(async (device_list: SwitchbotDevice[]) => {
|
|
588
588
|
const deviceList = device_list as unknown as WoBulb[]
|
|
589
|
-
|
|
589
|
+
this.infoLog(`RGB: ${(this.LightBulb.Brightness, red, green, blue)}`)
|
|
590
590
|
return await deviceList[0].setRGB(Number(this.LightBulb.Brightness), red, green, blue)
|
|
591
591
|
})
|
|
592
592
|
.then(async () => {
|
|
593
|
-
|
|
593
|
+
this.successLog(`RGB: ${(this.LightBulb.Brightness, red, green, blue)} sent over SwitchBot BLE, sent successfully`)
|
|
594
594
|
await this.updateHomeKitCharacteristics()
|
|
595
595
|
})
|
|
596
596
|
.catch(async (e: any) => {
|
|
597
597
|
await this.apiError(e)
|
|
598
|
-
|
|
598
|
+
this.errorLog(`failed BLEpushRGBChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`)
|
|
599
599
|
await this.BLEPushConnection()
|
|
600
600
|
})
|
|
601
601
|
} else {
|
|
602
|
-
|
|
602
|
+
this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(switchBotBLE)}`)
|
|
603
603
|
await this.BLEPushConnection()
|
|
604
604
|
}
|
|
605
605
|
} catch (error) {
|
|
606
|
-
|
|
606
|
+
this.errorLog(`failed to format device ID as MAC, Error: ${error}`)
|
|
607
607
|
}
|
|
608
608
|
} else {
|
|
609
|
-
|
|
609
|
+
this.debugLog(`No changes (BLEpushRGBChanges), Hue: ${this.LightBulb.Hue}, HueCached: ${this.accessory.context.Hue}, Saturation: ${this.LightBulb.Saturation}, SaturationCached: ${this.accessory.context.Saturation}`)
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
612
|
|
|
613
613
|
async openAPIpushChanges(): Promise<void> {
|
|
614
|
-
|
|
614
|
+
this.debugLog('openAPIpushChanges')
|
|
615
615
|
if (this.LightBulb.On !== this.accessory.context.On) {
|
|
616
616
|
const command = this.LightBulb.On ? 'turnOn' : 'turnOff'
|
|
617
617
|
const bodyChange: bodyChange = {
|
|
@@ -619,59 +619,59 @@ export class ColorBulb extends deviceBase {
|
|
|
619
619
|
parameter: 'default',
|
|
620
620
|
commandType: 'command',
|
|
621
621
|
}
|
|
622
|
-
|
|
622
|
+
this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
623
623
|
try {
|
|
624
|
-
const
|
|
625
|
-
const deviceStatus: any =
|
|
626
|
-
|
|
624
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
625
|
+
const deviceStatus: any = response.body
|
|
626
|
+
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
627
627
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
628
|
-
|
|
628
|
+
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
629
629
|
await this.updateHomeKitCharacteristics()
|
|
630
630
|
} else {
|
|
631
631
|
await this.statusCode(deviceStatus.statusCode)
|
|
632
632
|
}
|
|
633
633
|
} catch (e: any) {
|
|
634
634
|
await this.apiError(e)
|
|
635
|
-
|
|
635
|
+
this.errorLog(`failed openAPIpushChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`)
|
|
636
636
|
}
|
|
637
637
|
} else {
|
|
638
|
-
|
|
638
|
+
this.debugLog(`No changes (openAPIpushChanges), On: ${this.LightBulb.On}, OnCached: ${this.accessory.context.On}`)
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
641
|
|
|
642
642
|
async pushHueSaturationChanges(): Promise<void> {
|
|
643
|
-
|
|
643
|
+
this.debugLog('pushHueSaturationChanges')
|
|
644
644
|
if ((this.LightBulb.Hue !== this.accessory.context.Hue) || (this.LightBulb.Saturation !== this.accessory.context.Saturation)) {
|
|
645
|
-
|
|
645
|
+
this.debugLog(`Hue: ${JSON.stringify(this.LightBulb.Hue)}, Saturation: ${JSON.stringify(this.LightBulb.Saturation)}`)
|
|
646
646
|
const [red, green, blue] = hs2rgb(this.LightBulb.Hue, this.LightBulb.Saturation)
|
|
647
|
-
|
|
647
|
+
this.debugLog(`rgb: ${JSON.stringify([red, green, blue])}`)
|
|
648
648
|
const bodyChange: bodyChange = {
|
|
649
649
|
command: 'setColor',
|
|
650
650
|
parameter: `${red}:${green}:${blue}`,
|
|
651
651
|
commandType: 'command',
|
|
652
652
|
}
|
|
653
|
-
|
|
653
|
+
this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
654
654
|
try {
|
|
655
|
-
const
|
|
656
|
-
const deviceStatus: any =
|
|
657
|
-
|
|
655
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
656
|
+
const deviceStatus: any = response.body
|
|
657
|
+
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
658
658
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
659
|
-
|
|
659
|
+
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
660
660
|
await this.updateHomeKitCharacteristics()
|
|
661
661
|
} else {
|
|
662
662
|
await this.statusCode(deviceStatus.statusCode)
|
|
663
663
|
}
|
|
664
664
|
} catch (e: any) {
|
|
665
665
|
await this.apiError(e)
|
|
666
|
-
|
|
666
|
+
this.errorLog(`failed pushHueSaturationChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`)
|
|
667
667
|
}
|
|
668
668
|
} else {
|
|
669
|
-
|
|
669
|
+
this.debugLog(`No changes (pushHueSaturationChanges), Hue: ${this.LightBulb.Hue}, HueCached: ${this.accessory.context.Hue}, Saturation: ${this.LightBulb.Saturation}, SaturationCached: ${this.accessory.context.Saturation}`)
|
|
670
670
|
}
|
|
671
671
|
}
|
|
672
672
|
|
|
673
673
|
async pushColorTemperatureChanges(): Promise<void> {
|
|
674
|
-
|
|
674
|
+
this.debugLog('pushColorTemperatureChanges')
|
|
675
675
|
if (this.LightBulb.ColorTemperature !== this.accessory.context.ColorTemperature) {
|
|
676
676
|
const kelvin = Math.round(1000000 / Number(this.LightBulb.ColorTemperature))
|
|
677
677
|
this.accessory.context.kelvin = kelvin
|
|
@@ -680,51 +680,51 @@ export class ColorBulb extends deviceBase {
|
|
|
680
680
|
parameter: `${kelvin}`,
|
|
681
681
|
commandType: 'command',
|
|
682
682
|
}
|
|
683
|
-
|
|
683
|
+
this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
684
684
|
try {
|
|
685
|
-
const
|
|
686
|
-
const deviceStatus: any =
|
|
687
|
-
|
|
685
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
686
|
+
const deviceStatus: any = response.body
|
|
687
|
+
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
688
688
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
689
|
-
|
|
689
|
+
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
690
690
|
await this.updateHomeKitCharacteristics()
|
|
691
691
|
} else {
|
|
692
692
|
await this.statusCode(deviceStatus.statusCode)
|
|
693
693
|
}
|
|
694
694
|
} catch (e: any) {
|
|
695
695
|
await this.apiError(e)
|
|
696
|
-
|
|
696
|
+
this.errorLog(`failed pushColorTemperatureChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`)
|
|
697
697
|
}
|
|
698
698
|
} else {
|
|
699
|
-
|
|
699
|
+
this.debugLog(`No changes (pushColorTemperatureChanges), ColorTemperature: ${this.LightBulb.ColorTemperature}, ColorTemperatureCached: ${this.accessory.context.ColorTemperature}`)
|
|
700
700
|
}
|
|
701
701
|
}
|
|
702
702
|
|
|
703
703
|
async pushBrightnessChanges(): Promise<void> {
|
|
704
|
-
|
|
704
|
+
this.debugLog('pushBrightnessChanges')
|
|
705
705
|
if (this.LightBulb.Brightness !== this.accessory.context.Brightness) {
|
|
706
706
|
const bodyChange: bodyChange = {
|
|
707
707
|
command: 'setBrightness',
|
|
708
708
|
parameter: `${this.LightBulb.Brightness}`,
|
|
709
709
|
commandType: 'command',
|
|
710
710
|
}
|
|
711
|
-
|
|
711
|
+
this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
712
712
|
try {
|
|
713
|
-
const
|
|
714
|
-
const deviceStatus: any =
|
|
715
|
-
|
|
713
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
714
|
+
const deviceStatus: any = response.body
|
|
715
|
+
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
716
716
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
717
|
-
|
|
717
|
+
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
718
718
|
await this.updateHomeKitCharacteristics()
|
|
719
719
|
} else {
|
|
720
720
|
await this.statusCode(deviceStatus.statusCode)
|
|
721
721
|
}
|
|
722
722
|
} catch (e: any) {
|
|
723
723
|
await this.apiError(e)
|
|
724
|
-
|
|
724
|
+
this.errorLog(`failed pushBrightnessChanges with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`)
|
|
725
725
|
}
|
|
726
726
|
} else {
|
|
727
|
-
|
|
727
|
+
this.debugLog(`No changes (pushBrightnessChanges), Brightness: ${this.LightBulb.Brightness}, BrightnessCached: ${this.accessory.context.Brightness}`)
|
|
728
728
|
}
|
|
729
729
|
}
|
|
730
730
|
|
|
@@ -733,9 +733,9 @@ export class ColorBulb extends deviceBase {
|
|
|
733
733
|
*/
|
|
734
734
|
async OnSet(value: CharacteristicValue): Promise<void> {
|
|
735
735
|
if (this.LightBulb.On !== this.accessory.context.On) {
|
|
736
|
-
|
|
736
|
+
this.infoLog(`Set On: ${value}`)
|
|
737
737
|
} else {
|
|
738
|
-
|
|
738
|
+
this.debugLog(`No Changes, On: ${value}`)
|
|
739
739
|
}
|
|
740
740
|
|
|
741
741
|
this.LightBulb.On = value
|
|
@@ -747,7 +747,7 @@ export class ColorBulb extends deviceBase {
|
|
|
747
747
|
*/
|
|
748
748
|
async BrightnessSet(value: CharacteristicValue): Promise<void> {
|
|
749
749
|
if (this.LightBulb.On && (this.LightBulb.Brightness !== this.accessory.context.Brightness)) {
|
|
750
|
-
|
|
750
|
+
this.infoLog(`Set Brightness: ${value}`)
|
|
751
751
|
} else {
|
|
752
752
|
if (this.LightBulb.On) {
|
|
753
753
|
this.debugLog(`No Changes, Brightness: ${value}`)
|
|
@@ -851,7 +851,7 @@ export class ColorBulb extends deviceBase {
|
|
|
851
851
|
async getAdaptiveLightingSettings(accessory: PlatformAccessory, device: device & devicesConfig): Promise<void> {
|
|
852
852
|
// Adaptive Lighting
|
|
853
853
|
this.adaptiveLighting = accessory.context.adaptiveLighting ?? true
|
|
854
|
-
|
|
854
|
+
this.debugLog(`adaptiveLighting: ${this.adaptiveLighting}`)
|
|
855
855
|
// Adaptive Lighting Shift
|
|
856
856
|
this.adaptiveLightingShift = (device as colorBulbConfig).adaptiveLightingShift ?? 0
|
|
857
857
|
this.debugLog(`adaptiveLightingShift: ${this.adaptiveLightingShift}`)
|
|
@@ -859,15 +859,15 @@ export class ColorBulb extends deviceBase {
|
|
|
859
859
|
|
|
860
860
|
async BLEPushConnection() {
|
|
861
861
|
if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
|
|
862
|
-
|
|
862
|
+
this.warnLog('Using OpenAPI Connection to Push Changes')
|
|
863
863
|
await this.openAPIpushChanges()
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
866
|
|
|
867
867
|
async BLERefreshConnection(switchbot: any): Promise<void> {
|
|
868
|
-
|
|
868
|
+
this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`)
|
|
869
869
|
if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
|
|
870
|
-
|
|
870
|
+
this.warnLog('Using OpenAPI Connection to Refresh Status')
|
|
871
871
|
await this.openAPIRefreshStatus()
|
|
872
872
|
}
|
|
873
873
|
}
|