Allow translations for enum values in EnumSensor and ZHAEnumSelectEntity entities
Breaking Change
Unfortunately, the internal state will have to change from the current form (titles with spaces and the first letter, but sometimes multiple letters, being a capital; some are even CamelCase) to snake_case without any capitals or spaces. Automations that depend on this will seize to function, unless we come up with some mitigation.
Proposed change
Convert enums to lowercase snake_case in Sensor and Select entities. Add translations for EnumSensor and EnumSelectEntity entities in zigpy/zha.
Type of change
- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [x] 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
Some _attr_translation_keys in zigpy/zha needed to be changed, because of overlap.
Some enum value names were CamelCase (for compatibility, these haven't been changed). Some enum values had multiple capitals (for compatibility, these haven't been changed).
- This PR fixes or closes issue: fixes #
- This PR is related to issue:
- Link to documentation pull request:
- Depends on PR: https://github.com/zigpy/zha/pull/86
Checklist
- [ ] The code change is tested and works locally.
- [x] Local tests pass. Your PR cannot be merged unless tests pass
- [x] There is no commented out code in this PR.
- [x] I have followed the development checklist
- [x] I have followed the perfect PR recommendations
- [x] 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:
- [ ] Documentation added/updated for www.home-assistant.io
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 runningpython3 -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:
- [ ] I have reviewed two other open pull requests in this repository.
Hey there @dmulcahey, @adminiuga, @puddly, @thejulianjes, mind taking a look at this pull request as it has been labeled with an integration (zha) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of zha can trigger bot actions by commenting:
-
@home-assistant closeCloses the pull request. -
@home-assistant rename Awesome new titleRenames the pull request. -
@home-assistant reopenReopen the pull request. -
@home-assistant unassign zhaRemoves the current integration label and assignees on the pull request, add the integration domain after the command. -
@home-assistant add-label needs-more-informationAdd a label (needs-more-information, problem in dependency, problem in custom component) to the pull request. -
@home-assistant remove-label needs-more-informationRemove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks :+1:
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes. Thank you for your contribution!
Because of limited time, I decided to pursue only one PR at a time. I will look into this later.
We have recently migrated the core of ZHA to its own library: https://github.com/zigpy/zha. This is going to have to be reworked to an extent. Sorry for the inconvenience and Thanks!
Thanks for the heads-up. I reworked it and made a complementary PR in zigpy/zha.
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes. Thank you for your contribution!
If there is still interest in this getting merged, I am willing to continue to work on it.
@Caius-Bonus I think the zigpy/zha PR needs to be accepted and merged before this PR can move forward?
That is correct. But I haven't heard back yet from @puddly, so I don't know how to move forward yet.
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes. Thank you for your contribution!
I still want to work on it, but I have been busy.
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes. Thank you for your contribution!