mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +00:00
Use OptionsFlowWithReload in AVM Fritz!Box Tools (#149085)
This commit is contained in:
parent
dbdc666a92
commit
d266b6f6ab
@ -75,8 +75,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: FritzConfigEntry) -> boo
|
|||||||
if FRITZ_DATA_KEY not in hass.data:
|
if FRITZ_DATA_KEY not in hass.data:
|
||||||
hass.data[FRITZ_DATA_KEY] = FritzData()
|
hass.data[FRITZ_DATA_KEY] = FritzData()
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(update_listener))
|
|
||||||
|
|
||||||
# Load the other platforms like switch
|
# Load the other platforms like switch
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
|
|
||||||
@ -94,9 +92,3 @@ async def async_unload_entry(hass: HomeAssistant, entry: FritzConfigEntry) -> bo
|
|||||||
hass.data.pop(FRITZ_DATA_KEY)
|
hass.data.pop(FRITZ_DATA_KEY)
|
||||||
|
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(hass: HomeAssistant, entry: FritzConfigEntry) -> None:
|
|
||||||
"""Update when config_entry options update."""
|
|
||||||
if entry.options:
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
@ -17,7 +17,11 @@ from homeassistant.components.device_tracker import (
|
|||||||
CONF_CONSIDER_HOME,
|
CONF_CONSIDER_HOME,
|
||||||
DEFAULT_CONSIDER_HOME,
|
DEFAULT_CONSIDER_HOME,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
|
from homeassistant.config_entries import (
|
||||||
|
ConfigFlow,
|
||||||
|
ConfigFlowResult,
|
||||||
|
OptionsFlowWithReload,
|
||||||
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
@ -409,7 +413,7 @@ class FritzBoxToolsFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class FritzBoxToolsOptionsFlowHandler(OptionsFlow):
|
class FritzBoxToolsOptionsFlowHandler(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