mirror of
https://github.com/home-assistant/core.git
synced 2025-08-30 09:51:37 +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))
|
entry.async_on_unload(push_lock.register_callback(_async_state_changed))
|
||||||
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(_async_update_listener))
|
|
||||||
entry.async_on_unload(
|
entry.async_on_unload(
|
||||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_shutdown)
|
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_shutdown)
|
||||||
)
|
)
|
||||||
return True
|
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:
|
async def async_unload_entry(hass: HomeAssistant, entry: YALEXSBLEConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
@@ -26,7 +26,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_ADDRESS
|
from homeassistant.const import CONF_ADDRESS
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@@ -315,7 +315,7 @@ class YalexsConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
return YaleXSBLEOptionsFlowHandler()
|
return YaleXSBLEOptionsFlowHandler()
|
||||||
|
|
||||||
|
|
||||||
class YaleXSBLEOptionsFlowHandler(OptionsFlow):
|
class YaleXSBLEOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle YaleXSBLE options."""
|
"""Handle YaleXSBLE options."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
Reference in New Issue
Block a user