mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Cleanup deprecated OptionsFlowWithConfigEntry (part 3) (#129756)
This commit is contained in:
parent
8870b657d1
commit
d180ff417d
@ -3127,6 +3127,10 @@ class OptionsFlow(ConfigEntryBaseFlow):
|
||||
)
|
||||
self._config_entry = value
|
||||
|
||||
def initialize_options(self, config_entry: ConfigEntry) -> None:
|
||||
"""Initialize the options to a mutable copy of the config entry options."""
|
||||
self._options = deepcopy(dict(config_entry.options))
|
||||
|
||||
@property
|
||||
def options(self) -> dict[str, Any]:
|
||||
"""Return a mutable copy of the config entry options.
|
||||
@ -3135,7 +3139,7 @@ class OptionsFlow(ConfigEntryBaseFlow):
|
||||
can only be referenced after initialisation.
|
||||
"""
|
||||
if not hasattr(self, "_options"):
|
||||
self._options = deepcopy(dict(self.config_entry.options))
|
||||
self.initialize_options(self.config_entry)
|
||||
return self._options
|
||||
|
||||
@options.setter
|
||||
@ -3161,7 +3165,7 @@ class OptionsFlowWithConfigEntry(OptionsFlow):
|
||||
"inherits from OptionsFlowWithConfigEntry, which is deprecated "
|
||||
"and will stop working in 2025.12",
|
||||
error_if_integration=False,
|
||||
error_if_core=False,
|
||||
error_if_core=True,
|
||||
)
|
||||
|
||||
|
||||
|
@ -16,7 +16,6 @@ from homeassistant.config_entries import (
|
||||
ConfigFlow,
|
||||
ConfigFlowResult,
|
||||
OptionsFlow,
|
||||
OptionsFlowWithConfigEntry,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback, split_entity_id
|
||||
from homeassistant.data_entry_flow import UnknownHandler
|
||||
@ -403,7 +402,7 @@ class SchemaConfigFlowHandler(ConfigFlow, ABC):
|
||||
)
|
||||
|
||||
|
||||
class SchemaOptionsFlowHandler(OptionsFlowWithConfigEntry):
|
||||
class SchemaOptionsFlowHandler(OptionsFlow):
|
||||
"""Handle a schema based options flow."""
|
||||
|
||||
def __init__(
|
||||
@ -422,10 +421,8 @@ class SchemaOptionsFlowHandler(OptionsFlowWithConfigEntry):
|
||||
options, which is the union of stored options and user input from the options
|
||||
flow steps.
|
||||
"""
|
||||
super().__init__(config_entry)
|
||||
self._common_handler = SchemaCommonFlowHandler(
|
||||
self, options_flow, self._options
|
||||
)
|
||||
self.initialize_options(config_entry)
|
||||
self._common_handler = SchemaCommonFlowHandler(self, options_flow, self.options)
|
||||
self._async_options_flow_finished = async_options_flow_finished
|
||||
|
||||
for step in options_flow:
|
||||
|
Loading…
x
Reference in New Issue
Block a user