mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 08:07:45 +00:00
Use OptionsFlowWithReload in met (#149115)
This commit is contained in:
parent
1b8f3348b0
commit
b31e17f1f9
@ -47,7 +47,6 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
config_entry.runtime_data = coordinator
|
config_entry.runtime_data = coordinator
|
||||||
|
|
||||||
config_entry.async_on_unload(config_entry.add_update_listener(async_update_entry))
|
|
||||||
config_entry.async_on_unload(coordinator.untrack_home)
|
config_entry.async_on_unload(coordinator.untrack_home)
|
||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
||||||
@ -64,11 +63,6 @@ async def async_unload_entry(
|
|||||||
return await hass.config_entries.async_unload_platforms(config_entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(config_entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def async_update_entry(hass: HomeAssistant, config_entry: MetWeatherConfigEntry):
|
|
||||||
"""Reload Met component when options changed."""
|
|
||||||
await hass.config_entries.async_reload(config_entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def cleanup_old_device(hass: HomeAssistant) -> None:
|
async def cleanup_old_device(hass: HomeAssistant) -> None:
|
||||||
"""Cleanup device without proper device identifier."""
|
"""Cleanup device without proper device identifier."""
|
||||||
device_reg = dr.async_get(hass)
|
device_reg = dr.async_get(hass)
|
||||||
|
@ -10,7 +10,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_ELEVATION,
|
CONF_ELEVATION,
|
||||||
@ -147,7 +147,7 @@ class MetConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
return MetOptionsFlowHandler()
|
return MetOptionsFlowHandler()
|
||||||
|
|
||||||
|
|
||||||
class MetOptionsFlowHandler(OptionsFlow):
|
class MetOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Options flow for Met component."""
|
"""Options flow for Met component."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user