mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 16:17:20 +00:00
Use OptionsFlowWithReload in lastfm (#149113)
This commit is contained in:
parent
ead99c549f
commit
b262a5c9b6
@ -16,7 +16,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: LastFMConfigEntry) -> bo
|
|||||||
entry.runtime_data = coordinator
|
entry.runtime_data = coordinator
|
||||||
|
|
||||||
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(update_listener))
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -24,8 +23,3 @@ async def async_setup_entry(hass: HomeAssistant, entry: LastFMConfigEntry) -> bo
|
|||||||
async def async_unload_entry(hass: HomeAssistant, entry: LastFMConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: LastFMConfigEntry) -> bool:
|
||||||
"""Unload lastfm config entry."""
|
"""Unload lastfm config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(hass: HomeAssistant, entry: LastFMConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
@ -8,7 +8,11 @@ from typing import Any
|
|||||||
from pylast import LastFMNetwork, PyLastError, User, WSError
|
from pylast import LastFMNetwork, PyLastError, User, WSError
|
||||||
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_API_KEY
|
from homeassistant.const import CONF_API_KEY
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.selector import (
|
from homeassistant.helpers.selector import (
|
||||||
@ -155,7 +159,7 @@ class LastFmConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class LastFmOptionsFlowHandler(OptionsFlow):
|
class LastFmOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""LastFm Options flow handler."""
|
"""LastFm Options flow handler."""
|
||||||
|
|
||||||
config_entry: LastFMConfigEntry
|
config_entry: LastFMConfigEntry
|
||||||
|
Loading…
x
Reference in New Issue
Block a user