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:
Paulus Schoutsen 2019-02-13 20:36:06 -08:00 committed by GitHub
parent 161c368c9d
commit 882f5ed079
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 54 additions and 169 deletions

View file

@ -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):