mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +00:00
Use OptionsFlowWithReload in nmap_tracker (#149067)
This commit is contained in:
parent
360da43868
commit
676a931c48
@ -88,16 +88,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
devices = domain_data.setdefault(NMAP_TRACKED_DEVICES, NmapTrackedDevices())
|
devices = domain_data.setdefault(NMAP_TRACKED_DEVICES, NmapTrackedDevices())
|
||||||
scanner = domain_data[entry.entry_id] = NmapDeviceScanner(hass, entry, devices)
|
scanner = domain_data[entry.entry_id] = NmapDeviceScanner(hass, entry, devices)
|
||||||
await scanner.async_setup()
|
await scanner.async_setup()
|
||||||
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
@ -18,7 +18,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_EXCLUDE, CONF_HOSTS
|
from homeassistant.const import CONF_EXCLUDE, CONF_HOSTS
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
@ -138,7 +138,7 @@ async def _async_build_schema_with_user_input(
|
|||||||
return vol.Schema(schema)
|
return vol.Schema(schema)
|
||||||
|
|
||||||
|
|
||||||
class OptionsFlowHandler(OptionsFlow):
|
class OptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle a option flow for homekit."""
|
"""Handle a option flow for homekit."""
|
||||||
|
|
||||||
def __init__(self, config_entry: ConfigEntry) -> None:
|
def __init__(self, config_entry: ConfigEntry) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user