8000 [config] Deprecate more ``*_SCHEMA`` constants by jesserockz · Pull Request #8763 · esphome/esphome · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[config] Deprecate more *_SCHEMA constants #8763

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

Merged
merged 2 commits into from
May 13, 2025
Merged

Conversation

jesserockz
Copy link
Member

What does this implement/fix?

Followup to #8747 and #8748

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code quality improvements to existing code or addition of tests
  • Other

Related issue or feature (if applicable):

  • fixes

Pull request in esphome-docs with documentation (if applicable):

  • esphome/esphome-docs#

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx

Example entry for config.yaml:

# Example config.yaml

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

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

@probot-esphome
Copy link

Hey there @grahambrown11, @hwstar, mind taking a look at this pull request as it has been labeled with an integration (alarm_control_panel) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-esphome
Copy link

Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration (cover) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-esphome
Copy link

Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration (climate) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-esphome
Copy link

Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration (light) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR deprecates legacy *_SCHEMA constants and introduces new helper functions for creating and registering components for light, fan, cover, climate, and alarm control panel components.

  • Refactored schema definitions in multiple components by renaming the internal *_SCHEMA constants.
  • Added new helper functions (e.g., new_light, new_fan, etc.) to replace legacy creation methods.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
esphome/components/light/init.py Added LightType enum, updated light schema, and new_light helper function.
esphome/components/fan/init.py Renamed FAN_SCHEMA, updated fan schema, and added new_fan helper function replacing create_fan_state.
esphome/components/cover/init.py Renamed COVER_SCHEMA, updated cover schema, and added new_cover helper function.
esphome/components/climate/init.py Renamed CLIMATE_SCHEMA, updated climate schema, and added new_climate helper function.
esphome/components/alarm_control_panel/init.py Renamed ALARM_CONTROL_PANEL_SCHEMA, updated schema, and added new_alarm_control_panel helper function.
Comments suppressed due to low confidence (5)

esphome/components/light/init.py:278

  • [nitpick] The function name 'new_light' may be ambiguous regarding its purpose of both creating and registering a light instance. Consider renaming it to 'create_light' or 'create_and_register_light' for improved clarity.
async def new_light(config, *args):

esphome/components/fan/init.py:302

  • [nitpick] The function name 'new_fan' might not clearly convey its intent of instantiating and registering a fan. Consider renaming it to 'create_fan' or a similar descriptive name.
async def new_fan(config, *args):

esphome/components/cover/init.py:195

  • [nitpick] The use of 'new_cover' could be clarified to indicate that it creates and registers a cover component. A name like 'create_cover' might improve readability.
async def new_cover(config, *args):

esphome/components/climate/init.py:449

  • [nitpick] The naming of 'new_climate' may be ambiguous; consider renaming it to 'create_climate' or 'create_and_register_climate' to clearly reflect its responsibilities.
async def new_climate(config, *args):

esphome/components/alarm_control_panel/init.py:241

  • [nitpick] The function 'new_alarm_control_panel' might benefit from a more descriptive name that indicates it creates and registers an alarm control panel instance. Renaming it to 'create_alarm_control_panel' could enhance clarity.
async def new_alarm_control_panel(config, *args):

@jesserockz jesserockz merged commit bc09560 into dev May 13, 2025
94 checks passed
@jesserockz jesserockz deleted the jesserockz-2025-133 branch May 13, 2025 01:24
@jesserockz jesserockz changed the title [config] Deprecate more *_SCHEMA constants [config] Deprecate more *_SCHEMA constants May 13, 2025
@jesserockz jesserockz mentioned this pull request May 13, 2025
@jesserockz jesserockz mentioned this pull request May 21, 2025
sa-crespo pushed a commit to sa-crespo/esphome that referenced this pull request May 26, 2025
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.

2 participants
0