mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 19:15:30 +00:00
Use OptionsFlowWithReload in wled (#149046)
This commit is contained in:
@ -48,9 +48,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: WLEDConfigEntry) -> bool
|
||||
# Set up all platforms for this device/entry.
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
|
||||
# Reload entry when its updated.
|
||||
entry.async_on_unload(entry.add_update_listener(async_reload_entry))
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@ -65,8 +62,3 @@ async def async_unload_entry(hass: HomeAssistant, entry: WLEDConfigEntry) -> boo
|
||||
coordinator.unsub()
|
||||
|
||||
return unload_ok
|
||||
|
||||
|
||||
async def async_reload_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
"""Reload the config entry when it changed."""
|
||||
await hass.config_entries.async_reload(entry.entry_id)
|
||||
|
@ -12,7 +12,7 @@ from homeassistant.config_entries import (
|
||||
ConfigEntry,
|
||||
ConfigFlow,
|
||||
ConfigFlowResult,
|
||||
OptionsFlow,
|
||||
OptionsFlowWithReload,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, CONF_MAC
|
||||
from homeassistant.core import callback
|
||||
@ -120,7 +120,7 @@ class WLEDFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
return await wled.update()
|
||||
|
||||
|
||||
class WLEDOptionsFlowHandler(OptionsFlow):
|
||||
class WLEDOptionsFlowHandler(OptionsFlowWithReload):
|
||||
"""Handle WLED options."""
|
||||
|
||||
async def async_step_init(
|
||||
|
@ -373,6 +373,7 @@ async def test_single_segment_with_keep_main_light(
|
||||
hass.config_entries.async_update_entry(
|
||||
init_integration, options={CONF_KEEP_MAIN_LIGHT: True}
|
||||
)
|
||||
await hass.config_entries.async_reload(init_integration.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert (state := hass.states.get("light.wled_rgb_light_main"))
|
||||
|
Reference in New Issue
Block a user