mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Use OptionsFlowWithReload in keenetic_ndms2 (#149173)
This commit is contained in:
parent
8c964e64db
commit
0dba32dbcd
@ -33,8 +33,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: KeeneticConfigEntry) ->
|
|||||||
router = KeeneticRouter(hass, entry)
|
router = KeeneticRouter(hass, entry)
|
||||||
await router.async_setup()
|
await router.async_setup()
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(update_listener))
|
|
||||||
|
|
||||||
entry.runtime_data = router
|
entry.runtime_data = router
|
||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
@ -87,11 +85,6 @@ async def async_unload_entry(
|
|||||||
return unload_ok
|
return unload_ok
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(hass: HomeAssistant, entry: KeeneticConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
def async_add_defaults(hass: HomeAssistant, entry: KeeneticConfigEntry):
|
def async_add_defaults(hass: HomeAssistant, entry: KeeneticConfigEntry):
|
||||||
"""Populate default options."""
|
"""Populate default options."""
|
||||||
host: str = entry.data[CONF_HOST]
|
host: str = entry.data[CONF_HOST]
|
||||||
|
@ -12,7 +12,7 @@ from homeassistant.config_entries import (
|
|||||||
SOURCE_RECONFIGURE,
|
SOURCE_RECONFIGURE,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
@ -153,7 +153,7 @@ class KeeneticFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
return await self.async_step_user()
|
return await self.async_step_user()
|
||||||
|
|
||||||
|
|
||||||
class KeeneticOptionsFlowHandler(OptionsFlow):
|
class KeeneticOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle options."""
|
"""Handle options."""
|
||||||
|
|
||||||
config_entry: KeeneticConfigEntry
|
config_entry: KeeneticConfigEntry
|
||||||
|
Loading…
x
Reference in New Issue
Block a user