Use OptionsFlowWithReload in google_cloud (#151259)

This commit is contained in:
G Johansson
2025-08-28 07:19:44 +02:00
committed by GitHub
parent a7cb66c592
commit e23d3c8ab4
2 changed files with 2 additions and 8 deletions

View File

@@ -12,15 +12,9 @@ PLATFORMS = [Platform.STT, Platform.TTS]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up a config entry.""" """Set up a config 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(async_update_options))
return True return True
async def async_update_options(hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Handle options update."""
await hass.config_entries.async_reload(entry.entry_id)
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry.""" """Unload a config entry."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS) return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

View File

@@ -15,7 +15,7 @@ from homeassistant.config_entries import (
ConfigEntry, ConfigEntry,
ConfigFlow, ConfigFlow,
ConfigFlowResult, ConfigFlowResult,
OptionsFlow, OptionsFlowWithReload,
) )
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.selector import ( from homeassistant.helpers.selector import (
@@ -138,7 +138,7 @@ class GoogleCloudConfigFlow(ConfigFlow, domain=DOMAIN):
return GoogleCloudOptionsFlowHandler() return GoogleCloudOptionsFlowHandler()
class GoogleCloudOptionsFlowHandler(OptionsFlow): class GoogleCloudOptionsFlowHandler(OptionsFlowWithReload):
"""Google Cloud options flow.""" """Google Cloud options flow."""
async def async_step_init( async def async_step_init(