Skip to content

Commit

Permalink
Update NbPlatform.js
Browse files Browse the repository at this point in the history
Bug fix: TypeError when Nuki portal returns bridge without local IP and port.
  • Loading branch information
ebaauw committed Dec 1, 2020
1 parent add8115 commit 449421d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/NbPlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,21 @@ class NbPlatform extends homebridgeLib.Platform {
const jobs = []
for (const bridge of bridges) {
jobs.push(this.foundBridge(beat, bridge))
for (const job of jobs) {
try {
await job
} catch (error) {
this.warn(error)
}
}
for (const job of jobs) {
try {
await job
} catch (error) {
this.warn(error)
}
}
}
}

async foundBridge (beat, bridge) {
if (bridge.ip == null || bridge.port == null) {
return
}
const id = bridge.bridgeId.toString(16).toUpperCase()
if (this.bridges[id] == null) {
const name = 'Bridge_' + id
Expand Down

1 comment on commit 449421d

@ebaauw
Copy link
Owner Author

@ebaauw ebaauw commented on 449421d Dec 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #4.

Please sign in to comment.