Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent partial custom component overlays #21070

Merged
merged 2 commits into from Feb 21, 2019
Merged

Conversation

balloob
Copy link
Member

@balloob balloob commented Feb 14, 2019

Description:

This will force platforms to be resolved based off the component path, if it exists.

Today, if you want, you can override the Hue light platform, but not the other parts of the Hue integration. If a future update evolves the Hue component, removing or changing internal methods that the custom platform relied upon, the custom platform will start failing (like this report).

To avoid this, we're going to no longer allow custom components to be partial overlays (just a platform). Instead, if you want to override a built-in platform, you will need to override the whole component.

This is enforced by first resolving the platform as a component, and if it exists, limiting the lookup path to the component path.

Example: if I look up the hue component, and it is provided by a custom component, then all platform lookups will also be looked up in the custom component dir. The same works the other way around, if a user would only try to override hue/light.py but not hue/__init__.py, the custom platform will be ignored.

Breaking change: Custom platforms that override a built-in platform that has a component, should now also include the component in the custom_components/ folder. So if you want to override hue/light.py with a custom version, you will also need to provide/copy over hue/__init__.py.

Related issue (if applicable): fixes home-assistant/architecture#141

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@balloob balloob requested a review from a team as a code owner February 14, 2019 19:38
@ghost ghost assigned balloob Feb 14, 2019
@ghost ghost added in progress and removed core labels Feb 14, 2019
@pvizeli pvizeli merged commit 2435456 into dev Feb 21, 2019
@ghost ghost removed the in progress label Feb 21, 2019
@delete-merged-branch delete-merged-branch bot deleted the prevent-partial-custom-overlays branch February 21, 2019 08:41
thibmaek added a commit to thibmaek/home-assistant that referenced this pull request Feb 21, 2019
* upstream/dev: (948 commits)
  Prevent partial custom component overlays (home-assistant#21070)
  Alarm trigger support for Point (home-assistant#21207)
  Upgrade opensensemap-api to 0.1.4 (home-assistant#21240)
  Remove constraint from regex (home-assistant#21239)
  Updated frontend to 20190220.0
  Support OpenWRT 18.06 in luci device tracker (home-assistant#21236)
  Bump zigpy (home-assistant#21203)
  Fix bug in ZHA and tweak non sensor channel logic (home-assistant#21234)
  Don't dispatch to components when there are no channels for ZHA sensors (home-assistant#21223)
  Add zone and reps for Xiaomi vacuum (home-assistant#19777)
  Fix an Ambient PWS exception when location info is missing (home-assistant#21220)
  Add self to integration sensor and utility_meter (home-assistant#21226)
  Prevent invalid context from crashing (home-assistant#21231)
  Update pyhomematic to 0.1.56 (home-assistant#21227)
  Fix the build (home-assistant#21229)
  Updated frontend to 20190219.0
  Add yeelight flow action support (home-assistant#21195)
  Refactor ZHA listeners into channels (home-assistant#21196)
  Fix Homematic IP Cloud configuration (home-assistant#21202)
  Push pyads to 3.0.7 (home-assistant#21216)
  ...
@balloob balloob mentioned this pull request Mar 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable partial custom component overlays
3 participants