Use OptionsFlowWithReload in denonavr (#149109)

This commit is contained in:
G Johansson 2025-07-20 11:12:51 +02:00 committed by GitHub
parent 1a6bfc0310
commit ead99c549f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 11 deletions

View File

@ -53,8 +53,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: DenonavrConfigEntry) ->
raise ConfigEntryNotReady from ex raise ConfigEntryNotReady from ex
receiver = connect_denonavr.receiver receiver = connect_denonavr.receiver
entry.async_on_unload(entry.add_update_listener(update_listener))
entry.runtime_data = receiver entry.runtime_data = receiver
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
@ -100,10 +98,3 @@ async def async_unload_entry(
_LOGGER.debug("Removing zone3 from DenonAvr") _LOGGER.debug("Removing zone3 from DenonAvr")
return unload_ok return unload_ok
async def update_listener(
hass: HomeAssistant, config_entry: DenonavrConfigEntry
) -> None:
"""Handle options update."""
await hass.config_entries.async_reload(config_entry.entry_id)

View File

@ -10,7 +10,11 @@ import denonavr
from denonavr.exceptions import AvrNetworkError, AvrTimoutError from denonavr.exceptions import AvrNetworkError, AvrTimoutError
import voluptuous as vol import voluptuous as vol
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow from homeassistant.config_entries import (
ConfigFlow,
ConfigFlowResult,
OptionsFlowWithReload,
)
from homeassistant.const import CONF_HOST, CONF_MODEL, CONF_TYPE from homeassistant.const import CONF_HOST, CONF_MODEL, CONF_TYPE
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.httpx_client import get_async_client from homeassistant.helpers.httpx_client import get_async_client
@ -51,7 +55,7 @@ DEFAULT_USE_TELNET_NEW_INSTALL = True
CONFIG_SCHEMA = vol.Schema({vol.Optional(CONF_HOST): str}) CONFIG_SCHEMA = vol.Schema({vol.Optional(CONF_HOST): str})
class OptionsFlowHandler(OptionsFlow): class OptionsFlowHandler(OptionsFlowWithReload):
"""Options for the component.""" """Options for the component."""
async def async_step_init( async def async_step_init(