Skip to content

Commit

Permalink
fix: inclusion with name and location not working sometimes (#2247)
Browse files Browse the repository at this point in the history
Fixes #2210
  • Loading branch information
robertsLando committed Feb 8, 2022
1 parent b684ba9 commit e2071fe
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/ZwaveClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1900,8 +1900,12 @@ class ZwaveClient extends TypedEventEmitter<ZwaveClientEventCallbacks> {
name: options.name || '',
loc: options.location || '',
}
} else {
this.tmpNode = undefined
}

this.isReplacing = false

return this._driver.controller.beginInclusion(inclusionOptions)
}

Expand Down Expand Up @@ -2582,11 +2586,6 @@ class ZwaveClient extends TypedEventEmitter<ZwaveClientEventCallbacks> {

private _onInclusionStopped() {
const message = 'Inclusion stopped'
// this could happen before node is added/removed so delay the reset
setTimeout(() => {
this.isReplacing = false
this.tmpNode = undefined
}, 2000)

this._updateControllerStatus(message)
this.emit('event', EventSource.CONTROLLER, 'inclusion stopped')
Expand All @@ -2600,6 +2599,8 @@ class ZwaveClient extends TypedEventEmitter<ZwaveClientEventCallbacks> {

private _onInclusionFailed() {
const message = 'Inclusion failed'
this.isReplacing = false
this.tmpNode = undefined
this._updateControllerStatus(message)
this.emit('event', EventSource.CONTROLLER, 'inclusion failed')
}
Expand Down

0 comments on commit e2071fe

Please sign in to comment.