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

Reverse component path #104087

Merged
merged 6 commits into from Dec 5, 2023
Merged

Reverse component path #104087

merged 6 commits into from Dec 5, 2023

Conversation

emontnemery
Copy link
Contributor

@emontnemery emontnemery commented Nov 16, 2023

Proposed change

Reverse the keys in hass.config.components from light.hue to the modern hue.light in some remaining cases.

Most cases already use hue.light, but some legacy code still used the old path.

Rationale

This is better aligned with how platforms are actually located after home-assistant/architecture#124 / #19948

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (notify) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of notify can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign notify Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@home-assistant
Copy link

Hey there @robbiet480, mind taking a look at this pull request as it has been labeled with an integration (ios) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of ios can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign ios Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@home-assistant
Copy link

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (device_tracker) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of device_tracker can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign device_tracker Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@home-assistant
Copy link

Hey there @home-assistant/core, @pvizeli, mind taking a look at this pull request as it has been labeled with an integration (tts) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of tts can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign tts Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@emontnemery
Copy link
Contributor Author

emontnemery commented Nov 19, 2023

Some custom integrations published on HACS reference hass.config.components, mainly tests:

bash-5.1# grep -ril --include \*.py "hass.config.components"
frenck/spook/custom_components/spook/ectoplasms/cloud/switch.py
frenck/spook/custom_components/spook/services.py
jcwillox/hass-auto-backup/custom_components/auto_backup/__init__.py
KartoffelToby/better_thermostat/custom_components/better_thermostat/utils/weather.py
PiotrMachowski/Home-Assistant-custom-components-Custom-Templates/custom_components/custom_templates/__init__.py
toreamun/amshan-homeassistant/custom_components/amshan/config_flow.py

bramstroker/homeassistant-powercalc/tests/group_include/test_include.py
danobot/entity-controller/tests/common.py
finity69x2/nws_alerts/tests/test_sensor.py
futuretense/keymaster/tests/test_binary_sensor.py
futuretense/keymaster/tests/test_helpers.py
futuretense/keymaster/tests/test_init.py
futuretense/keymaster/tests/test_services.py
moralmunky/Home-Assistant-Mail-And-Packages/tests/test_sensor.py
rgc99/irrigation_unlimited/tests/iu_test_support.py
sopelj/hass-ember-mug-component/tests/conftest.py
syssi/homeassistant-goecharger-mqtt/tests/conftest.py
vasqued2/ha-teamtracker/tests/test_sensor.py
werthdavid/homeassistant-pulsatrix-local-mqtt/tests/conftest.py

A quick review of the references suggest none of the custom integrations will be affected by this change however.

@emontnemery emontnemery marked this pull request as ready for review November 19, 2023 09:41
@@ -16,7 +16,7 @@
REQUIRED_NEXT_PYTHON_HA_RELEASE: Final = ""

# Format for platform files
PLATFORM_FORMAT: Final = "{platform}.{domain}"
PLATFORM_FORMAT: Final = "{domain}.{platform}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's confusing that this is inverted now. When we talk about platforms, the domain means the domain that entities of the platform are grouped by. Eg an entity_id sensor.test_id has the domain sensor and belongs to a platform that has the domain sensor by an integration test_integration. We should stay consistent with those semantics here too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks incorrect:

self.hass.config.components.add(
PLATFORM_FORMAT.format(domain=engine, platform=DOMAIN)
)

The domain parameter should be the "tts" domain.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should remove the PLATFORM_FORMAT constant? It's only used in two places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on discord, we should probably use PLATFORM_FORMAT in more places instead. Let's do that in a follow-up 👍

@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft November 24, 2023 09:47
@emontnemery emontnemery marked this pull request as ready for review December 4, 2023 14:52
@emontnemery emontnemery closed this Dec 4, 2023
@emontnemery emontnemery reopened this Dec 4, 2023
@MartinHjelmare MartinHjelmare merged commit 84e74e4 into dev Dec 5, 2023
98 of 99 checks passed
@MartinHjelmare MartinHjelmare deleted the reverse_component_path branch December 5, 2023 07:44
@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants