Skip to content

Commit

Permalink
Merge pull request #52 from ad-ha/ad-ha-0.7.0
Browse files Browse the repository at this point in the history
0.7.0
  • Loading branch information
ad-ha authored Dec 2, 2024
2 parents 0034fe2 + 851778d commit 5f336a6
Show file tree
Hide file tree
Showing 16 changed files with 1,192 additions and 871 deletions.
9 changes: 9 additions & 0 deletions custom_components/mg_saic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
hass.data[DOMAIN].setdefault("coordinators_by_vin", {})
hass.data[DOMAIN]["coordinators_by_vin"][vin] = coordinator

# Register an update listener to handle options updates
entry.async_on_unload(entry.add_update_listener(update_listener))

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

# Register Services
Expand All @@ -59,6 +62,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
return False


async def update_listener(hass: HomeAssistant, entry: ConfigEntry):
"""Handle options update."""
coordinator = hass.data[DOMAIN][f"{entry.entry_id}_coordinator"]
await coordinator.async_update_options(entry.options)


async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Unload a config entry."""
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
Expand Down
Loading

0 comments on commit 5f336a6

Please sign in to comment.