Use OptionsFlowWithReload in speedtest (#149111)

This commit is contained in:
G Johansson 2025-07-20 13:08:42 +02:00 committed by GitHub
parent b31e17f1f9
commit 302b6f03ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 10 deletions

View File

@ -42,7 +42,6 @@ async def async_setup_entry(
async_at_started(hass, _async_finish_startup)
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
config_entry.async_on_unload(config_entry.add_update_listener(update_listener))
return True
@ -52,10 +51,3 @@ async def async_unload_entry(
) -> bool:
"""Unload SpeedTest Entry from config_entry."""
return await hass.config_entries.async_unload_platforms(config_entry, PLATFORMS)
async def update_listener(
hass: HomeAssistant, config_entry: SpeedTestConfigEntry
) -> None:
"""Handle options update."""
await hass.config_entries.async_reload(config_entry.entry_id)

View File

@ -6,7 +6,11 @@ from typing import Any
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
from homeassistant.config_entries import (
ConfigFlow,
ConfigFlowResult,
OptionsFlowWithReload,
)
from homeassistant.core import callback
from .const import (
@ -45,7 +49,7 @@ class SpeedTestFlowHandler(ConfigFlow, domain=DOMAIN):
return self.async_create_entry(title=DEFAULT_NAME, data=user_input)
class SpeedTestOptionsFlowHandler(OptionsFlow):
class SpeedTestOptionsFlowHandler(OptionsFlowWithReload):
"""Handle SpeedTest options."""
def __init__(self) -> None: