Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use new restoreNVM API to restore NVM backups #2120

Merged
merged 1 commit into from
Dec 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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