Skip to content

Commit

Permalink
listen for logs emitted
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker committed Sep 30, 2024
1 parent a3fb8cb commit 9dac9af
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
22 changes: 4 additions & 18 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.8",
"node-switchbot": "2.5.0-beta.19",
"node-switchbot": "2.5.0-beta.21",
"rxjs": "^7.8.1"
},
"devDependencies": {
Expand Down
6 changes: 4 additions & 2 deletions src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {

// SwitchBot OpenAPI
this.switchBotAPI = new SwitchBotOpenAPI(this.config.credentials?.token, this.config.credentials?.secret)
// Set the log level
this.switchBotAPI.setLogLevel(LogLevel.DEBUG)
// Listen for log events
this.switchBotAPI.on('log', (log) => {
this.debugLog(`[${log.level.toUpperCase()}] ${log.message}`)
})
// import fakegato-history module and EVE characteristics
this.fakegatoAPI = fakegato(api)
this.eve = new EveHomeKitTypes(api)
Expand Down

0 comments on commit 9dac9af

Please sign in to comment.