Skip to content

Commit

Permalink
update config options properly
Browse files Browse the repository at this point in the history
  • Loading branch information
firstof9 committed Mar 19, 2023
1 parent 40e6d54 commit 80f5ba6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion custom_components/nws_alerts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,17 @@ async def async_unload_entry(hass, config_entry):

async def update_listener(hass, entry):
"""Update listener."""
entry.data = entry.options
if not entry.options:
return

new_data = entry.options.copy()
hass.config_entries.async_update_entry(
entry=entry,
unique_id=entry.options[CONF_NAME],
data=new_data,
options={},
)

await hass.config_entries.async_forward_entry_unload(entry, "sensor")
hass.async_add_job(hass.config_entries.async_forward_entry_setup(entry, "sensor"))

Expand Down

0 comments on commit 80f5ba6

Please sign in to comment.