mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Use OptionsFlowWithReload in xiaomi_miio (#149051)
This commit is contained in:
parent
4a5e193ebb
commit
dba3d98a2b
@ -466,8 +466,6 @@ async def async_setup_gateway_entry(
|
|||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, GATEWAY_PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, GATEWAY_PLATFORMS)
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(update_listener))
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_device_entry(
|
async def async_setup_device_entry(
|
||||||
hass: HomeAssistant, entry: XiaomiMiioConfigEntry
|
hass: HomeAssistant, entry: XiaomiMiioConfigEntry
|
||||||
@ -481,8 +479,6 @@ async def async_setup_device_entry(
|
|||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, platforms)
|
await hass.config_entries.async_forward_entry_setups(entry, platforms)
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(update_listener))
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@ -493,10 +489,3 @@ async def async_unload_entry(
|
|||||||
platforms = get_platforms(config_entry)
|
platforms = get_platforms(config_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 update_listener(
|
|
||||||
hass: HomeAssistant, config_entry: XiaomiMiioConfigEntry
|
|
||||||
) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(config_entry.entry_id)
|
|
||||||
|
@ -11,7 +11,11 @@ from micloud import MiCloud
|
|||||||
from micloud.micloudexception import MiCloudAccessDenied
|
from micloud.micloudexception import MiCloudAccessDenied
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
|
from homeassistant.config_entries import (
|
||||||
|
ConfigFlow,
|
||||||
|
ConfigFlowResult,
|
||||||
|
OptionsFlowWithReload,
|
||||||
|
)
|
||||||
from homeassistant.const import CONF_DEVICE, CONF_HOST, CONF_MAC, CONF_MODEL, CONF_TOKEN
|
from homeassistant.const import CONF_DEVICE, CONF_HOST, CONF_MAC, CONF_MODEL, CONF_TOKEN
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.device_registry import format_mac
|
from homeassistant.helpers.device_registry import format_mac
|
||||||
@ -56,7 +60,7 @@ DEVICE_CLOUD_CONFIG = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class OptionsFlowHandler(OptionsFlow):
|
class OptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Options for the component."""
|
"""Options for the component."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user