mirror of
https://github.com/home-assistant/core.git
synced 2025-08-30 01:42:21 +02:00
Use OptionsFlowWithReload in yalexs_ble (#151256)
This commit is contained in:
@@ -129,24 +129,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: YALEXSBLEConfigEntry) ->
|
||||
|
||||
entry.async_on_unload(push_lock.register_callback(_async_state_changed))
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
|
||||
entry.async_on_unload(
|
||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_shutdown)
|
||||
)
|
||||
return True
|
||||
|
||||
|
||||
async def _async_update_listener(
|
||||
hass: HomeAssistant, entry: YALEXSBLEConfigEntry
|
||||
) -> None:
|
||||
"""Handle options update."""
|
||||
data = entry.runtime_data
|
||||
if entry.title != data.title or data.always_connected != entry.options.get(
|
||||
CONF_ALWAYS_CONNECTED
|
||||
):
|
||||
await hass.config_entries.async_reload(entry.entry_id)
|
||||
|
||||
|
||||
async def async_unload_entry(hass: HomeAssistant, entry: YALEXSBLEConfigEntry) -> bool:
|
||||
"""Unload a config entry."""
|
||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||
|
@@ -26,7 +26,7 @@ from homeassistant.config_entries import (
|
||||
ConfigEntry,
|
||||
ConfigFlow,
|
||||
ConfigFlowResult,
|
||||
OptionsFlow,
|
||||
OptionsFlowWithReload,
|
||||
)
|
||||
from homeassistant.const import CONF_ADDRESS
|
||||
from homeassistant.core import callback
|
||||
@@ -315,7 +315,7 @@ class YalexsConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
return YaleXSBLEOptionsFlowHandler()
|
||||
|
||||
|
||||
class YaleXSBLEOptionsFlowHandler(OptionsFlow):
|
||||
class YaleXSBLEOptionsFlowHandler(OptionsFlowWithReload):
|
||||
"""Handle YaleXSBLE options."""
|
||||
|
||||
async def async_step_init(
|
||||
|
Reference in New Issue
Block a user