mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Adjusted proposal
This commit is contained in:
parent
495bd1d5c8
commit
6d83b48448
@ -1120,7 +1120,13 @@ class ConfigEntry[_DataT = Any]:
|
|||||||
Returns function to unlisten.
|
Returns function to unlisten.
|
||||||
"""
|
"""
|
||||||
self.update_listeners.append(listener)
|
self.update_listeners.append(listener)
|
||||||
return lambda: self.update_listeners.remove(listener)
|
|
||||||
|
def remove_listener() -> None:
|
||||||
|
"""Remove listener."""
|
||||||
|
if listener in self.update_listeners:
|
||||||
|
self.update_listeners.remove(listener)
|
||||||
|
|
||||||
|
return remove_listener
|
||||||
|
|
||||||
def as_dict(self) -> dict[str, Any]:
|
def as_dict(self) -> dict[str, Any]:
|
||||||
"""Return dictionary version of this entry."""
|
"""Return dictionary version of this entry."""
|
||||||
@ -3243,7 +3249,7 @@ class ConfigFlow(ConfigEntryBaseFlow):
|
|||||||
if data is not UNDEFINED:
|
if data is not UNDEFINED:
|
||||||
raise ValueError("Cannot set both data and data_updates")
|
raise ValueError("Cannot set both data and data_updates")
|
||||||
data = entry.data | data_updates
|
data = entry.data | data_updates
|
||||||
update_listener_exist = bool(entry.update_listeners)
|
entry.update_listeners = []
|
||||||
result = self.hass.config_entries.async_update_entry(
|
result = self.hass.config_entries.async_update_entry(
|
||||||
entry=entry,
|
entry=entry,
|
||||||
unique_id=unique_id,
|
unique_id=unique_id,
|
||||||
@ -3251,9 +3257,7 @@ class ConfigFlow(ConfigEntryBaseFlow):
|
|||||||
data=data,
|
data=data,
|
||||||
options=options,
|
options=options,
|
||||||
)
|
)
|
||||||
if reload_even_if_entry_is_unchanged or (
|
if reload_even_if_entry_is_unchanged or result:
|
||||||
update_listener_exist is False and result is True
|
|
||||||
):
|
|
||||||
self.hass.config_entries.async_schedule_reload(entry.entry_id)
|
self.hass.config_entries.async_schedule_reload(entry.entry_id)
|
||||||
if reason is UNDEFINED:
|
if reason is UNDEFINED:
|
||||||
reason = "reauth_successful"
|
reason = "reauth_successful"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user