Skip to content

Commit

Permalink
feat: use new restoreNVM API to restore NVM backups (#2120)
Browse files Browse the repository at this point in the history
Fixes #2119
  • Loading branch information
robertsLando authored Dec 30, 2021
1 parent fb59d33 commit 18b49ea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/guide/mqtt.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ This are the available APIs:
- `args`: array of arguments to pass to the command
- `restart()`: restart client
- `backupNVMRaw()`: Backup the NVM raw data
- `restoreNVMRaw(data)`: Restore the NVM raw data
- `restoreNVM(data)`: Restore the NVM data. If the given buffer is in a different NVM format, it is converted automatically. If the conversion is not supported, the operation fails.
- `softReset`: Soft reset the controller (restart)
- `driverFunction(code)`: Execute a driver function. The function `this` allow to access `zwaveClient` instance and `require` (ex: `this.zwaveClient` and `this.require`). The only parameter of the function is `driver`. It's like execute this:

Expand Down
6 changes: 3 additions & 3 deletions lib/ZwaveClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const allowedApis = validateMethods([
'validateDSK',
'abortInclusion',
'backupNVMRaw',
'restoreNVMRaw',
'restoreNVM',
'getProvisioningEntries',
'getProvisioningEntry',
'unprovisionSmartStartNode',
Expand Down Expand Up @@ -2691,12 +2691,12 @@ class ZwaveClient extends TypedEventEmitter<ZwaveClientEventCallbacks> {
this._updateControllerStatus(`Backup NVM progress: ${progress}%`)
}

async restoreNVMRaw(data: Buffer) {
async restoreNVM(data: Buffer) {
if (!this.driverReady) {
throw new DriverNotReadyError()
}

await this.driver.controller.restoreNVMRaw(
await this.driver.controller.restoreNVM(
data,
this._onRestoreNVMProgress.bind(this)
)
Expand Down
6 changes: 3 additions & 3 deletions src/components/ControlPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export default {
text: 'NVM Management',
options: [
{ name: 'Backup', action: 'backupNVMRaw' },
{ name: 'Restore', action: 'restoreNVMRaw' },
{ name: 'Restore', action: 'restoreNVM' },
],
icon: 'update',
desc: "Backup/Restore controller's NVM (Non Volatile Memory)",
Expand Down Expand Up @@ -455,7 +455,7 @@ export default {
if (!confirm) {
return
}
} else if (action === 'restoreNVMRaw') {
} else if (action === 'restoreNVM') {
const confirm = await this.$listeners.showConfirm(
'NVM Restore',
'While doing the restore the Z-Wave radio will be turned on/off.\n<strong>A failure during this process may brick your controller. Use at your own risk!</strong>',
Expand Down Expand Up @@ -553,7 +553,7 @@ export default {
)
}
break
case 'restoreNVMRaw':
case 'restoreNVM':
this.showSnackbar('NVM restore DONE')
break
default:
Expand Down

0 comments on commit 18b49ea

Please sign in to comment.