mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Use OptionsFlowWithReload in denonavr (#149109)
This commit is contained in:
parent
1a6bfc0310
commit
ead99c549f
@ -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)
|
|
||||||
|
@ -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(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user