Skip to content

Commit

Permalink
Fix save empty devices
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Mamontov committed Apr 20, 2022
1 parent c51a483 commit f950aa3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion custom_components/miwifi/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "miwifi",
"name": "MiWiFi",
"version": "2.4.3",
"version": "2.4.4",
"documentation": "https://github.com/dmamontov/hass-miwifi/blob/main/README.md",
"issue_tracker": "https://github.com/dmamontov/hass-miwifi/issues",
"config_flow": true,
Expand Down
6 changes: 5 additions & 1 deletion custom_components/miwifi/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,11 @@ async def _async_load_devices(self) -> dict | None:
async def _async_save_devices(self) -> None:
"""Async save devices to Store"""

if self._store is None or (self.is_repeater and not self.is_force_load):
if (
self._store is None
or (self.is_repeater and not self.is_force_load)
or len(self.devices) == 0
):
return

await self._store.async_save(self.devices)
Expand Down

0 comments on commit f950aa3

Please sign in to comment.