Skip to content

Commit

Permalink
0 if RotationSpeed is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker committed Oct 5, 2024
1 parent ab3f544 commit 408bcd1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"async-mqtt": "^2.6.3",
"fakegato-history": "^0.6.5",
"homebridge-lib": "^7.0.9",
"node-switchbot": "2.5.0-beta.38",
"node-switchbot": "2.5.0-beta.39",
"rxjs": "^7.8.1"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions src/device/fan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export class Fan extends deviceBase {

// RotationSpeed
this.Fan.RotationSpeed = this.serviceData.fanSpeed // ?? 0
await this.debugLog(`BLEparseStatus RotationSpeed: ${this.Fan.RotationSpeed}`)
await this.debugLog(`RotationSpeed: ${this.Fan.RotationSpeed}`)
}

async openAPIparseStatus() {
Expand All @@ -220,8 +220,8 @@ export class Fan extends deviceBase {
await this.debugLog(`SwingMode: ${this.Fan.SwingMode}`)

// RotationSpeed
this.Fan.RotationSpeed = this.deviceStatus.fanSpeed // ?? 0
await this.debugLog(`openAPIparseStatus RotationSpeed: ${this.Fan.RotationSpeed}`)
this.Fan.RotationSpeed = this.deviceStatus.fanSpeed ?? 0
await this.debugLog(`RotationSpeed: ${this.Fan.RotationSpeed}`)

// ChargingState
this.Battery.ChargingState = this.deviceStatus.chargingStatus === 'charging'
Expand Down Expand Up @@ -270,7 +270,7 @@ export class Fan extends deviceBase {

// RotationSpeed
this.Fan.RotationSpeed = this.webhookContext.fanSpeed // ?? 0
await this.debugLog(`parseStatusWebhook RotationSpeed: ${this.Fan.RotationSpeed}`)
await this.debugLog(`RotationSpeed: ${this.Fan.RotationSpeed}`)

// BatteryLevel
this.Battery.BatteryLevel = this.webhookContext.battery
Expand Down

0 comments on commit 408bcd1

Please sign in to comment.