diff --git a/lib/ZwaveClient.ts b/lib/ZwaveClient.ts index 26db1f3a06..5844279830 100644 --- a/lib/ZwaveClient.ts +++ b/lib/ZwaveClient.ts @@ -3187,12 +3187,22 @@ class ZwaveClient extends TypedEventEmitter { async rebuildNodeRoutes(nodeId: number): Promise { if (this.driverReady) { let status: RebuildRoutesStatus = 'pending' + + const node = this.nodes.get(nodeId) + + if (!node) { + throw Error(`Node ${nodeId} not found`) + } + + node.rebuildRoutesProgress = status this.sendToSocket(socketEvents.rebuildRoutesProgress, [ [nodeId, status], ]) const result = await this._driver.controller.rebuildNodeRoutes(nodeId) status = result ? 'done' : 'failed' + + node.rebuildRoutesProgress = status this.sendToSocket(socketEvents.rebuildRoutesProgress, [ [nodeId, status], ])