-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
[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
Conversation
Hey there @grahambrown11, @hwstar, mind taking a look at this pull request as it has been labeled with an integration ( |
Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration ( |
Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration ( |
Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration ( |
There was a problem hiding this 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):
*_SCHEMA
constants
What does this implement/fix?
Followup to #8747 and #8748
Types of changes
Related issue or feature (if applicable):
Pull request in esphome-docs with documentation (if applicable):
Test Environment
Example entry for
config.yaml
:# Example config.yaml
Checklist:
tests/
folder).If user exposed functionality or configuration variables are added/changed: