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

Deprecate hass.components and log warning if used inside custom component #111508

Merged
merged 5 commits into from
Feb 29, 2024

Conversation

jpbede
Copy link
Member

@jpbede jpbede commented Feb 26, 2024

Proposed change

Deprecate the use of @bind_hass decorator (isn't used that much in custom integrations),

Deprecate the use of hass.components. The use within a custom component will issue a warning to the log.

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 Ruff (ruff format 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:

@jpbede jpbede changed the title Deprecate @bind_hass and log warning if used inside custom component Deprecate @bind_hass and log warning if used inside custom component Feb 26, 2024
homeassistant/loader.py Outdated Show resolved Hide resolved
@home-assistant home-assistant bot added cla-signed core deprecation Indicates a breaking change to happen in the future labels Feb 26, 2024
@jpbede jpbede changed the title Deprecate @bind_hass and log warning if used inside custom component Deprecate hass.components and log warning if used inside custom component Feb 27, 2024
@jpbede jpbede marked this pull request as ready for review February 27, 2024 20:33
@jpbede jpbede requested a review from a team as a code owner February 27, 2024 20:33
report(
(
f"accesses hass.components.{comp_name}."
" This is deprecated and will stop working in Home Assistant 2024.6, it"
Copy link
Member Author

Choose a reason for hiding this comment

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

Lets make it 6 months (home-assistant/developers.home-assistant#2093 (review))

Suggested change
" This is deprecated and will stop working in Home Assistant 2024.6, it"
" This is deprecated and will stop working in Home Assistant 2024.9, it"

Copy link
Member

Choose a reason for hiding this comment

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

Was this forgotten?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yikes, yes, thought I've hit "Commit suggestion". Will create a PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in #111903. Thanks for noticing it.

@jpbede jpbede added this to the 2024.3.0 milestone Feb 28, 2024
homeassistant/helpers/frame.py Outdated Show resolved Hide resolved
homeassistant/loader.py Show resolved Hide resolved
@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 February 29, 2024 00:52
@jpbede jpbede force-pushed the bind-hass-log-on-use branch from dc54011 to ad82e69 Compare February 29, 2024 06:20
@jpbede jpbede marked this pull request as ready for review February 29, 2024 06:28
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Thanks!

@MartinHjelmare MartinHjelmare merged commit bc6b4d0 into home-assistant:dev Feb 29, 2024
53 checks passed
balloob pushed a commit that referenced this pull request Feb 29, 2024
…ponent (#111508)

* Deprecate @bind_hass and log error if used inside custom component

* Log also when accessing `hass.components`

* Log warning only when `hass.components` is used

* Change version

* Process code review
@jpbede jpbede deleted the bind-hass-log-on-use branch February 29, 2024 16:01
@cdce8p cdce8p mentioned this pull request Mar 1, 2024
20 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cherry-picked cla-signed core deprecation Indicates a breaking change to happen in the future
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants