mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Use OptionsFlowWithReload in Feedreader (#149134)
This commit is contained in:
parent
bd7cef92c7
commit
eca80a1645
@ -32,8 +32,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: FeedReaderConfigEntry) -
|
||||
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
|
||||
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@ -46,10 +44,3 @@ async def async_unload_entry(hass: HomeAssistant, entry: FeedReaderConfigEntry)
|
||||
if len(entries) == 1:
|
||||
hass.data.pop(MY_KEY)
|
||||
return await hass.config_entries.async_unload_platforms(entry, [Platform.EVENT])
|
||||
|
||||
|
||||
async def _async_update_listener(
|
||||
hass: HomeAssistant, entry: FeedReaderConfigEntry
|
||||
) -> None:
|
||||
"""Handle reconfiguration."""
|
||||
await hass.config_entries.async_reload(entry.entry_id)
|
||||
|
@ -14,7 +14,7 @@ from homeassistant.config_entries import (
|
||||
ConfigEntry,
|
||||
ConfigFlow,
|
||||
ConfigFlowResult,
|
||||
OptionsFlow,
|
||||
OptionsFlowWithReload,
|
||||
)
|
||||
from homeassistant.const import CONF_URL
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
@ -44,7 +44,7 @@ class FeedReaderConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
@callback
|
||||
def async_get_options_flow(
|
||||
config_entry: ConfigEntry,
|
||||
) -> OptionsFlow:
|
||||
) -> FeedReaderOptionsFlowHandler:
|
||||
"""Get the options flow for this handler."""
|
||||
return FeedReaderOptionsFlowHandler()
|
||||
|
||||
@ -119,11 +119,10 @@ class FeedReaderConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
errors={"base": "url_error"},
|
||||
)
|
||||
|
||||
self.hass.config_entries.async_update_entry(reconfigure_entry, data=user_input)
|
||||
return self.async_abort(reason="reconfigure_successful")
|
||||
return self.async_update_reload_and_abort(reconfigure_entry, data=user_input)
|
||||
|
||||
|
||||
class FeedReaderOptionsFlowHandler(OptionsFlow):
|
||||
class FeedReaderOptionsFlowHandler(OptionsFlowWithReload):
|
||||
"""Handle an options flow."""
|
||||
|
||||
async def async_step_init(
|
||||
|
Loading…
x
Reference in New Issue
Block a user