Skip to content

Commit 1a5a405

Browse files
committed
Rename backup and restore to just read and write.
1 parent 29b9c6f commit 1a5a405

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ custom_zha_radios:
2626
```
2727
2828
# Backup and restore
29-
A complete radio NVRAM backup can be performed to migrate between different radios **based on the same chip**. Anything else is untested.
29+
A complete NVRAM backup can be performed to migrate between different radios **based on the same chip**. Anything else is untested.
3030
3131
```shell
32-
(venv) $ python -m zigpy_znp.tools.nvram_backup /dev/serial/by-id/old_radio -o backup.json
33-
(venv) $ python -m zigpy_znp.tools.nvram_restore /dev/serial/by-id/new_radio -i backup.json
32+
(venv) $ python -m zigpy_znp.tools.nvram_read /dev/serial/by-id/old_radio -o backup.json
33+
(venv) $ python -m zigpy_znp.tools.nvram_write /dev/serial/by-id/new_radio -i backup.json
3434
```
3535

3636
Tested migrations:

tests/test_tools_nvram.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
from zigpy_znp.types.nvids import NwkNvIds, OsalExNvIds
1010

11-
from zigpy_znp.tools.nvram_backup import main as nvram_backup
12-
from zigpy_znp.tools.nvram_restore import main as nvram_restore
11+
from zigpy_znp.tools.nvram_read import main as nvram_read
12+
from zigpy_znp.tools.nvram_write import main as nvram_write
1313

1414

1515
from test_api import pytest_mark_asyncio_timeout # noqa: F401
@@ -135,7 +135,7 @@ def close(self):
135135

136136

137137
@pytest_mark_asyncio_timeout(seconds=5)
138-
async def test_nvram_backup(openable_serial_znp_server, tmp_path):
138+
async def test_nvram_read(openable_serial_znp_server, tmp_path):
139139
def osal_nv_read(req):
140140
nvid = NwkNvIds(req.Id).name
141141

@@ -178,14 +178,14 @@ def nv_read(req):
178178
)
179179

180180
backup_file = tmp_path / "backup.json"
181-
await nvram_backup([openable_serial_znp_server._port_path, "-o", str(backup_file)])
181+
await nvram_read([openable_serial_znp_server._port_path, "-o", str(backup_file)])
182182

183183
# The backup JSON written to disk should be an exact copy of our fake NVRAM
184184
assert json.loads(backup_file.read_text()) == REAL_BACKUP
185185

186186

187187
@pytest_mark_asyncio_timeout(seconds=5)
188-
async def test_nvram_restore(openable_serial_znp_server, tmp_path):
188+
async def test_nvram_write(openable_serial_znp_server, tmp_path):
189189
simulated_nvram = {"osal": {}, "nwk": {}}
190190

191191
def osal_nv_item_init(req):
@@ -264,7 +264,7 @@ def nv_write(req):
264264
backup_file = tmp_path / "backup.json"
265265
backup_file.write_text(json.dumps(backup_obj))
266266

267-
await nvram_restore([openable_serial_znp_server._port_path, "-i", str(backup_file)])
267+
await nvram_write([openable_serial_znp_server._port_path, "-i", str(backup_file)])
268268

269269
# Convert every value to its hex representation to match the backup format
270270
simulated_nvram_hex = {
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)