[core] Auto-replace / in entity names with Unicode fraction slash during deprecation period - #13016
Conversation
…ing deprecation period
|
👋 Hi there! This PR modifies 1 file(s) with codeowners. @esphome/core - As codeowner(s) of the affected files, your review would be appreciated! 🙏 Note: Automatic review request may have failed, but you're still welcome to review. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #13016 +/- ##
=======================================
Coverage 73.47% 73.48%
=======================================
Files 53 53
Lines 11310 11313 +3
Branches 1535 1535
=======================================
+ Hits 8310 8313 +3
Misses 2602 2602
Partials 398 398 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR implements a graceful migration path for the breaking change introduced in PR #12627, which prohibited the use of / in entity, device, and area names. Instead of rejecting configurations with /, this change auto-replaces the character with the visually similar Unicode FRACTION SLASH (⁄ U+2044) and logs a deprecation warning instructing users to update their configuration before ESPHome 2026.7.0.
Key Changes:
- Auto-replacement of
/with⁄(Unicode fraction slash) in entity, device, and area names - Deprecation warning logged for each occurrence with clear migration instructions
- Comprehensive test coverage updated to verify the new behavior
Reviewed changes
Copilot 8000 reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| esphome/config_validation.py | Modified _validate_no_slash() to auto-replace / with fraction slash and log deprecation warning; ensured return value is properly captured in _validate_entity_name() |
| tests/unit_tests/test_config_validation.py | Updated tests to verify auto-replacement behavior and warning message content instead of expecting validation errors |
|
thanks |
What does this implement/fix?
Auto-replace
/with the visually-similar Unicode FRACTION SLASH (⁄U+2044) in entity, device, and area names, with a deprecation warning.PR #12627 introduced validation that rejects
/in names because it's now used as a URL path separator in web server URLs. This caused a breaking change for users with existing configs containing/in entity names (e.g., "Airflow Up/Down", "On/Off Toggle").This PR provides a smoother migration path by:
/with⁄(fraction slash) which is visually nearly identicalThe fraction slash character:
/in UIs (Home Assistant, web server, etc.)%E2%81%84)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:Warning output:
Checklist:
tests/folder).If user exposed functionality or configuration variables are added/changed: