Skip to content

Commit

Permalink
Change scanning log level (#266)
Browse files Browse the repository at this point in the history
## ♻️ Current situation

Scanning logging now occurs every few minutes, which seems excessive.

## 💡 Proposed solution

Change the logging level so important logging messages are visible.

One could argue this could also be handled in the
https://github.com/OpenWonderLabs/homebridge-switchbot/ project.
  • Loading branch information
dnicolson authored Oct 24, 2024
1 parent 80db6d9 commit c1ffdf0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion BLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ In this code, you can get a [`WoHand`](#SwitchbotDeviceWoHand-object) object rep

### Logging

To be able to receive logging that this module is pushing out you will need to subscribt to the events.
To be able to receive logging that this module is pushing out you will need to subscribe to the events.

```typescript
this.switchBotBLE.on('log', (log) => {
Expand Down
6 changes: 3 additions & 3 deletions src/switchbot-ble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export class SwitchBotBLE extends EventEmitter {
this.noble.removeAllListeners('discover')
try {
await this.noble.stopScanningAsync()
this.log('info', 'Stopped Scanning for SwitchBot BLE devices.')
this.log('debug', 'Stopped Scanning for SwitchBot BLE devices.')
} catch (e: any) {
this.log('error', `discover stopScanningAsync error: ${JSON.stringify(e.message ?? e)}`)
}
Expand Down Expand Up @@ -288,7 +288,7 @@ export class SwitchBotBLE extends EventEmitter {

try {
await this.noble.startScanningAsync(PRIMARY_SERVICE_UUID_LIST, true)
this.log('info', 'Started Scanning for SwitchBot BLE devices.')
this.log('debug', 'Started Scanning for SwitchBot BLE devices.')
} catch (e: any) {
this.log('error', `startScanningAsync error: ${JSON.stringify(e.message ?? e)}`)
}
Expand All @@ -307,7 +307,7 @@ export class SwitchBotBLE extends EventEmitter {
this.noble.removeAllListeners('discover')
try {
await this.noble.stopScanningAsync()
this.log('info', 'Stopped Scanning for SwitchBot BLE devices.')
this.log('debug', 'Stopped Scanning for SwitchBot BLE devices.')
} catch (e: any) {
this.log('error', `stopScanningAsync error: ${JSON.stringify(e.message ?? e)}`)
}
Expand Down

0 comments on commit c1ffdf0

Please sign in to comment.