Conversation
houndci-bot
reviewed
Apr 8, 2018
| self.platform_name, wait_time) | ||
| async_track_point_in_time( | ||
| hass, self.async_setup(platform_config, discovery_info, tries), | ||
| hass, self._async_setup_platform(async_create_setup_task, tries), |
balloob
commented
Apr 8, 2018
| await async_setup_component( | ||
| self.hass, entry.domain, self._hass_config) | ||
|
|
||
| async def delegate_entry(self, entry, component): |
Member
Author
There was a problem hiding this comment.
I am not happy with the name "delegate_entry". As delegation means to "entrust (a task or responsibility) to another person" (per Google). In this case, the main component will setup the entry and then want other components to handle the entry too.
Merged
Adminiuga
pushed a commit
to Adminiuga/home-assistant
that referenced
this pull request
Jun 25, 2018
* Use config entry to setup platforms * Rename to async_forward_entry * Add tests * Catch if platform not exists for entry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Architecture diagram
The config entries journey continues 😎 Have been very happy with the architecture thus far. Have not needed a refactor yet.
In this PR, remove the use of "discovery" in favor of being able to delegate a config entry to another component. By default a config entry is passed to the component the entry belongs to. The owning component can choose to delegate it to another component to set it up too (using
hass.config_entries.delegate_entry(entry, component)). This will only work if the other component is capable of this, which will be the case of all Entity Components. In this case I have only added it to the light component.The EntityComponent has been updated to create a new EntityPlatform to manage the entities of the config entry and set up the config entry.
This change also paves the way for the following future functionality:
CC @Kane610 because you've been playing with config entries too
Checklist:
tox. Your PR cannot be merged unless tests passIf the code does not interact with devices: