Don't directly update config entries (#20877)
* Don't directly update config entries * Use ConfigEntryNotReady * Fix tests * Remove old test * Lint
This commit is contained in:
parent
161c368c9d
commit
882f5ed079
11 changed files with 54 additions and 169 deletions
|
@ -127,6 +127,7 @@ from homeassistant.util.decorator import Registry
|
|||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
_UNDEF = object()
|
||||
|
||||
SOURCE_USER = 'user'
|
||||
SOURCE_DISCOVERY = 'discovery'
|
||||
|
@ -441,9 +442,10 @@ class ConfigEntries:
|
|||
for entry in config['entries']]
|
||||
|
||||
@callback
|
||||
def async_update_entry(self, entry, *, data):
|
||||
def async_update_entry(self, entry, *, data=_UNDEF):
|
||||
"""Update a config entry."""
|
||||
entry.data = data
|
||||
if data is not _UNDEF:
|
||||
entry.data = data
|
||||
self._async_schedule_save()
|
||||
|
||||
async def async_forward_entry_setup(self, entry, component):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue