Conversation
|
Looks good, so far. |
|
I realized I should first migrate Hue from using phue to aiophue till I can finish this work so put this on hold. |
1a0358d to
5e46444
Compare
5e46444 to
3c8586f
Compare
| ) | ||
| except AuthenticationRequired: | ||
| # usernames can become invalid if hub is reset or user removed | ||
| # TODO: Remove self.config_entry (which we're setting up!). Start config flow. |
There was a problem hiding this comment.
line too long (90 > 79 characters)
|
So now that Hue has been refactored to use aiohue, I've picked up this PR again. Functionality wise it is 95% complete. 2 edge cases need to be handled and tests need to be written. Coolest of all: backwards compatible 😎 I think that building out a real config flow including discovery and import has been helpful in validating the API. It seems good so far, haven't discovered any major flaws. |
| allow_hue_groups) | ||
| await bridge.async_setup() | ||
| bridge = HueBridge(hass, entry, allow_unreachable, allow_groups) | ||
| hass.data[DOMAIN][host] = bridge |
There was a problem hiding this comment.
Is it intended to overwrite the bridge config in hass.data[host] with the bridge instance?
There was a problem hiding this comment.
Yeah. The setup will store the config for the entries and then bridge instance is set via config entry. If there is no auth, setup will initiate config flow to configure entry and once finished, the created config entry will pick up the config
|
Looks very clean 👍! I think one flaw of the current config entry API is that AFAIK it only allows components to register flow handlers, not platforms. Once #13275 is ready I'll also have a look at doing config entries for the cast integration (which is a platform). Not too related to this PR (can also extend this discussion in #devs): would the solution be to a) convert cast to a component b) have EntityComponent do some routing magic or c) something else? Also regarding this PR: Do I understand correctly that you use |
Discovery is used as normal: it will discover hubs using UPNP. It used to be that those hubs would have a file generated once authenticated and would depend on the discovery componet to remain active to load the hub in the future. With config entries, we will store auth and host and thus one can disable the discovery component after the hub has been discovered. |
aac707a to
976b5db
Compare
|
The refactor is done 👍 |
6eb67b2 to
7c8a6ff
Compare
7c8a6ff to
0e5ee63
Compare
|
I'm going to merge this so we can have it be on the dev branch of 0.66 for a week and find bugs. |
Description:
Migrate Hue to store all auth as config entries. Backwards compatible change 🎉 .
To make it backwards compatible:
To do:
Notify user if a new config entry is available?(future PR)I probably don't want to aim this PR for 0.66 because merging this PR means config entries have to go live for everyone. Rather give it 2 extra weeks to polish the UI.
Fun fact about bridge ID:
<host>/description.xmlcontains the ID in lowercase but misses the middle 4 characters 🤔Example entry for
configuration.yaml(if applicable):discovery:Checklist:
tox. Your PR cannot be merged unless tests passIf the code does not interact with devices: