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()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@ -46,10 +44,3 @@ async def async_unload_entry(hass: HomeAssistant, entry: FeedReaderConfigEntry)
|
|||||||
if len(entries) == 1:
|
if len(entries) == 1:
|
||||||
hass.data.pop(MY_KEY)
|
hass.data.pop(MY_KEY)
|
||||||
return await hass.config_entries.async_unload_platforms(entry, [Platform.EVENT])
|
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,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_URL
|
from homeassistant.const import CONF_URL
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
@ -44,7 +44,7 @@ class FeedReaderConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
@callback
|
@callback
|
||||||
def async_get_options_flow(
|
def async_get_options_flow(
|
||||||
config_entry: ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
) -> OptionsFlow:
|
) -> FeedReaderOptionsFlowHandler:
|
||||||
"""Get the options flow for this handler."""
|
"""Get the options flow for this handler."""
|
||||||
return FeedReaderOptionsFlowHandler()
|
return FeedReaderOptionsFlowHandler()
|
||||||
|
|
||||||
@ -119,11 +119,10 @@ class FeedReaderConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
errors={"base": "url_error"},
|
errors={"base": "url_error"},
|
||||||
)
|
)
|
||||||
|
|
||||||
self.hass.config_entries.async_update_entry(reconfigure_entry, data=user_input)
|
return self.async_update_reload_and_abort(reconfigure_entry, data=user_input)
|
||||||
return self.async_abort(reason="reconfigure_successful")
|
|
||||||
|
|
||||||
|
|
||||||
class FeedReaderOptionsFlowHandler(OptionsFlow):
|
class FeedReaderOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle an options flow."""
|
"""Handle an options flow."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user