Skip to content

Commit

Permalink
⚙ Remove cache upon integration uninstallation
Browse files Browse the repository at this point in the history
This should help people having issues and trying to solve it by
uninstall/reinstall (like #82)
  • Loading branch information
kamaradclimber committed Jan 27, 2024
1 parent e63b5fd commit 0616d88
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion custom_components/rte_ecowatt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
entry, [Platform.SENSOR, Platform.CALENDAR]
)
if unload_ok:
hass.data[DOMAIN].pop(entry.entry_id)
config = hass.data[DOMAIN].pop(entry.entry_id)
if "rte_coordinator" in config:
await config["rte_coordinator"].clean()
return unload_ok


Expand Down Expand Up @@ -123,6 +125,9 @@ def __init__(self, hass, config: ConfigType):

self._custom_store = Store(hass, 1, "rte_ecowatt")

async def clean(self):
await self._custom_store.async_remove()

async def async_oauth_client(self):
client = await self.oauth_client.client()
self.token = client.token
Expand Down

0 comments on commit 0616d88

Please sign in to comment.