Use config entry to setup platforms (#13752)

* Use config entry to setup platforms

* Rename to async_forward_entry

* Add tests

* Catch if platform not exists for entry
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2018-04-09 10:09:08 -04:00
1 parent cb51553c2d
commit 73de749411
12 files changed
+271 -45

No files matched your search

+6 -1
View File
@@ -334,7 +334,7 @@ class SetIntentHandler(intent.IntentHandler):
async def async_setup(hass, config):
"""Expose light control via state machine and services."""
component = EntityComponent(
component = hass.data[DOMAIN] = EntityComponent(
_LOGGER, DOMAIN, hass, SCAN_INTERVAL, GROUP_NAME_ALL_LIGHTS)
await component.async_setup(config)
@@ -388,6 +388,11 @@ async def async_setup(hass, config):
return True
async def async_setup_entry(hass, entry):
"""Setup a config entry."""
return await hass.data[DOMAIN].async_setup_entry(entry)
class Profiles:
"""Representation of available color profiles."""