@switchbot/homebridge-switchbot 4.1.6-beta.3 → 4.1.6-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.
@@ -438,8 +438,7 @@ export class Humidifier extends deviceBase {
438
438
  switchBotBLE
439
439
  .discover({ model: this.device.bleModel, quick: true, id: this.device.bleMac })
440
440
  .then(async (device_list: SwitchbotDevice[]) => {
441
- const deviceList = device_list as WoHumi[]
442
- return await deviceList[0].percentage(this.HumidifierDehumidifier.RelativeHumidityHumidifierThreshold)
441
+ return await (device_list[0] as WoHumi).percentage(Number(this.HumidifierDehumidifier.RelativeHumidityHumidifierThreshold))
443
442
  })
444
443
  .then(async () => {
445
444
  this.successLog(`RelativeHumidityHumidifierThreshold: ${this.HumidifierDehumidifier.RelativeHumidityHumidifierThreshold} sent over BLE, sent successfully`)
@@ -512,7 +512,7 @@ export class StripLight extends deviceBase {
512
512
  .discover({ model: this.device.bleModel, id: this.device.bleMac })
513
513
  .then(async (device_list: SwitchbotDevice[]) => {
514
514
  this.infoLog(`Brightness: ${this.LightBulb.Brightness}`)
515
- return await device_list[0].setBrightness(this.LightBulb.Brightness)
515
+ return await (device_list[0] as WoStrip).setBrightness(Number(this.LightBulb.Brightness))
516
516
  })
517
517
  .then(async () => {
518
518
  this.successLog(`Brightness: ${this.LightBulb.Brightness} sent over SwitchBot BLE, sent successfully`)
@@ -551,7 +551,7 @@ export class StripLight extends deviceBase {
551
551
  .discover({ model: this.device.bleModel, id: this.device.bleMac })
552
552
  .then(async (device_list: SwitchbotDevice[]) => {
553
553
  this.infoLog(`RGB: ${(this.LightBulb.Brightness, red, green, blue)}`)
554
- return await device_list[0].setRGB(this.LightBulb.Brightness, red, green, blue)
554
+ return await (device_list[0] as WoStrip).setRGB(Number(this.LightBulb.Brightness), red, green, blue)
555
555
  })
556
556
  .then(async () => {
557
557
  this.successLog(`RGB: ${(this.LightBulb.Brightness, red, green, blue)} sent over SwitchBot BLE, sent successfully`)
@@ -3,7 +3,7 @@
3
3
  * lock.ts: @switchbot/homebridge-switchbot.
4
4
  */
5
5
  import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
6
- import type { bodyChange, device, lockProServiceData, lockProStatus, lockProWebhookContext, lockServiceData, lockStatus, lockWebhookContext, SwitchbotDevice } from 'node-switchbot'
6
+ import type { bodyChange, device, lockProServiceData, lockProStatus, lockProWebhookContext, lockServiceData, lockStatus, lockWebhookContext, SwitchbotDevice, WoSmartLock } from 'node-switchbot'
7
7
 
8
8
  import type { SwitchBotPlatform } from '../platform.js'
9
9
  import type { devicesConfig, lockConfig } from '../settings.js'
@@ -451,9 +451,9 @@ export class Lock extends deviceBase {
451
451
  max: this.maxRetryBLE(),
452
452
  fn: async () => {
453
453
  if (this.LockMechanism.LockTargetState === this.hap.Characteristic.LockTargetState.SECURED) {
454
- return await device_list[0].lock({ id: this.device.bleMac })
454
+ return await (device_list[0] as WoSmartLock).lock()
455
455
  } else {
456
- return await device_list[0].unlock({ id: this.device.bleMac })
456
+ return await (device_list[0] as WoSmartLock).unlock()
457
457
  }
458
458
  },
459
459
  })
@@ -392,15 +392,14 @@ export class RobotVacuumCleaner extends deviceBase {
392
392
  switchBotBLE
393
393
  .discover({ model: this.device.bleModel, id: this.device.bleMac })
394
394
  .then(async (device_list: SwitchbotDevice[]) => {
395
- const deviceList = device_list as SwitchbotDevice[]
396
395
  this.infoLog(`On: ${this.LightBulb.On}`)
397
396
  return await this.retryBLE({
398
397
  max: this.maxRetryBLE(),
399
398
  fn: async () => {
400
399
  if (this.LightBulb.On) {
401
- return await deviceList[0].turnOn()
400
+ return await (device_list[0] as any).turnOn()
402
401
  } else {
403
- return await deviceList[0].turnOff()
402
+ return await (device_list[0] as any).turnOff()
404
403
  }
405
404
  },
406
405
  })