Use OptionsFlowWithReload in Proximity (#149136)

This commit is contained in:
Michael 2025-07-21 07:26:29 +02:00 committed by GitHub
parent 27787e0679
commit bd7cef92c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 11 deletions

View File

@ -43,17 +43,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ProximityConfigEntry) ->
entry.runtime_data = coordinator
await hass.config_entries.async_forward_entry_setups(entry, [Platform.SENSOR])
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
return True
async def async_unload_entry(hass: HomeAssistant, entry: ProximityConfigEntry) -> bool:
"""Unload a config entry."""
return await hass.config_entries.async_unload_platforms(entry, [Platform.SENSOR])
async def _async_update_listener(
hass: HomeAssistant, entry: ProximityConfigEntry
) -> None:
"""Handle options update."""
await hass.config_entries.async_reload(entry.entry_id)

View File

@ -13,7 +13,7 @@ from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
OptionsFlowWithReload,
)
from homeassistant.const import CONF_ZONE, UnitOfLength
from homeassistant.core import State, callback
@ -87,7 +87,7 @@ class ProximityConfigFlow(ConfigFlow, domain=DOMAIN):
@staticmethod
@callback
def async_get_options_flow(config_entry: ConfigEntry) -> OptionsFlow:
def async_get_options_flow(config_entry: ConfigEntry) -> ProximityOptionsFlow:
"""Get the options flow for this handler."""
return ProximityOptionsFlow()
@ -118,7 +118,7 @@ class ProximityConfigFlow(ConfigFlow, domain=DOMAIN):
)
class ProximityOptionsFlow(OptionsFlow):
class ProximityOptionsFlow(OptionsFlowWithReload):
"""Handle a option flow."""
def _user_form_schema(self, user_input: dict[str, Any]) -> vol.Schema: