Use OptionsFlowWithReload in xiaomi_miio (#149051)

This commit is contained in:
G Johansson
2025-07-19 16:50:13 +02:00
committed by GitHub
parent 4a5e193ebb
commit dba3d98a2b
2 changed files with 6 additions and 13 deletions

View File

@ -466,8 +466,6 @@ async def async_setup_gateway_entry(
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(
hass: HomeAssistant, entry: XiaomiMiioConfigEntry
@ -481,8 +479,6 @@ async def async_setup_device_entry(
await hass.config_entries.async_forward_entry_setups(entry, platforms)
entry.async_on_unload(entry.add_update_listener(update_listener))
return True
@ -493,10 +489,3 @@ async def async_unload_entry(
platforms = get_platforms(config_entry)
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)

View File

@ -11,7 +11,11 @@ from micloud import MiCloud
from micloud.micloudexception import MiCloudAccessDenied
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.core import callback
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."""
async def async_step_init(