Skip to content

Commit

Permalink
Merge pull request #212 from mikey0000/fix-luba-data
Browse files Browse the repository at this point in the history
remove device from saved data if it ends up there
  • Loading branch information
mikey0000 authored Nov 28, 2024
2 parents e4224b6 + 42d42e7 commit 614368e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions custom_components/mammotion/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,10 @@ async def async_restore_data(self) -> None:
restored_data = await store.async_load()
try:
if restored_data:
device_dict = LubaMsg().to_dict(casing=betterproto.Casing.SNAKE)
if restored_data.get("device"):
del restored_data["device"]
mower_state = MowingDevice().from_dict(restored_data)
device_dict = LubaMsg().to_dict(casing=betterproto.Casing.SNAKE)
mower_state.update_raw(device_dict)
self.manager.get_device_by_name(
self.device_name
Expand All @@ -354,7 +356,7 @@ async def async_save_data(self, data: MowingDevice) -> None:
"""Get map data from the device."""
store = Store(self.hass, version=1, key=self.device_name)
stored_data = asdict(data)
stored_data["device"] = None
del stored_data["device"]
await store.async_save(stored_data)


Expand Down

0 comments on commit 614368e

Please sign in to comment.