Expose config_entry and options as properties (#82691)

Expose config_entry and options as a property
This commit is contained in:
epenet 2022-11-25 11:13:44 +01:00 committed by GitHub
parent ea1868b7b9
commit e7d4f745ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1683,9 +1683,19 @@ class OptionsFlowWithConfigEntry(OptionsFlow):
def __init__(self, config_entry: ConfigEntry) -> None:
"""Initialize options flow."""
self.config_entry = config_entry
self._config_entry = config_entry
self._options = deepcopy(dict(config_entry.options))
@property
def config_entry(self) -> ConfigEntry:
"""Return the config entry."""
return self._config_entry
@property
def options(self) -> dict[str, Any]:
"""Return a mutable copy of the config entry options."""
return self._options
class EntityRegistryDisabledHandler:
"""Handler to handle when entities related to config entries updating disabled_by."""