Use OptionsFlowWithReload in hyperion (#149163)

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

View File

@ -266,16 +266,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: HyperionConfigEntry) ->
assert hyperion_client assert hyperion_client
if hyperion_client.instances is not None: if hyperion_client.instances is not None:
await async_instances_to_clients_raw(hyperion_client.instances) await async_instances_to_clients_raw(hyperion_client.instances)
entry.async_on_unload(entry.add_update_listener(_async_entry_updated))
return True return True
async def _async_entry_updated(hass: HomeAssistant, entry: HyperionConfigEntry) -> None:
"""Handle entry updates."""
await hass.config_entries.async_reload(entry.entry_id)
async def async_unload_entry(hass: HomeAssistant, entry: HyperionConfigEntry) -> bool: async def async_unload_entry(hass: HomeAssistant, entry: HyperionConfigEntry) -> bool:
"""Unload a config entry.""" """Unload a config entry."""
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

View File

@ -17,7 +17,7 @@ from homeassistant.config_entries import (
ConfigEntry, ConfigEntry,
ConfigFlow, ConfigFlow,
ConfigFlowResult, ConfigFlowResult,
OptionsFlow, OptionsFlowWithReload,
) )
from homeassistant.const import ( from homeassistant.const import (
CONF_BASE, CONF_BASE,
@ -431,7 +431,7 @@ class HyperionConfigFlow(ConfigFlow, domain=DOMAIN):
return HyperionOptionsFlow() return HyperionOptionsFlow()
class HyperionOptionsFlow(OptionsFlow): class HyperionOptionsFlow(OptionsFlowWithReload):
"""Hyperion options flow.""" """Hyperion options flow."""
def _create_client(self) -> client.HyperionClient: def _create_client(self) -> client.HyperionClient: