Use OptionsFlowWithReload in Trafikverket Train (#149042)

This commit is contained in:
G Johansson 2025-07-19 14:09:54 +02:00 committed by GitHub
parent 3a6f23b95f
commit b3bd882a80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 8 deletions

View File

@ -42,7 +42,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: TVTrainConfigEntry) -> b
)
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
entry.async_on_unload(entry.add_update_listener(update_listener))
return True
@ -53,11 +52,6 @@ async def async_unload_entry(hass: HomeAssistant, entry: TVTrainConfigEntry) ->
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
async def update_listener(hass: HomeAssistant, entry: TVTrainConfigEntry) -> None:
"""Handle options update."""
await hass.config_entries.async_reload(entry.entry_id)
async def async_migrate_entry(hass: HomeAssistant, entry: TVTrainConfigEntry) -> bool:
"""Migrate config entry."""
_LOGGER.debug("Migrating from version %s", entry.version)

View File

@ -20,7 +20,7 @@ from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
OptionsFlowWithReload,
)
from homeassistant.const import CONF_API_KEY, CONF_NAME, CONF_WEEKDAY, WEEKDAYS
from homeassistant.core import HomeAssistant, callback
@ -329,7 +329,7 @@ class TVTrainConfigFlow(ConfigFlow, domain=DOMAIN):
)
class TVTrainOptionsFlowHandler(OptionsFlow):
class TVTrainOptionsFlowHandler(OptionsFlowWithReload):
"""Handle Trafikverket Train options."""
async def async_step_init(