Skip to content

Commit 857a813

Browse files
committed
Fix restore file read routines
1 parent 55ae69f commit 857a813

File tree

1 file changed

+3
-3
lines changed
  • custom_components/zha_toolkit

1 file changed

+3
-3
lines changed

custom_components/zha_toolkit/znp.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ async def znp_restore(
104104
event_data["restore_file"] = fname
105105

106106
# Read backup file
107-
with open(fname, encoding="utf_8") as f:
108-
backup = json.load(f)
107+
async with aiofiles.open(fname, encoding="utf_8") as f:
108+
backup = json.loads(await f.read())
109109

110110
# validate the backup file
111111
LOGGER.info("Validating backup contents")
@@ -203,7 +203,7 @@ async def znp_nvram_restore(
203203

204204
LOGGER.info("Restoring NVRAM from '%s'", fname)
205205
async with aiofiles.open(fname, "r", encoding="utf_8") as f:
206-
nvram_obj = json.load(await f.read())
206+
nvram_obj = json.loads(await f.read())
207207

208208
await nvram_write(app._znp, nvram_obj)
209209
LOGGER.info("Restored NVRAM from '%s'", fname)

0 commit comments

Comments
 (0)