core icon indicating copy to clipboard operation
core copied to clipboard

Allow translations for enum values in EnumSensor and ZHAEnumSelectEntity entities

Open Caius-Bonus opened this issue 1 year ago • 8 comments

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:

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:

Caius-Bonus avatar Feb 01 '24 14:02 Caius-Bonus

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 close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign zha Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

home-assistant[bot] avatar Feb 01 '24 14:02 home-assistant[bot]

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks :+1:

Learn more about our pull request process.

home-assistant[bot] avatar Mar 18 '24 03:03 home-assistant[bot]

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!

github-actions[bot] avatar May 17 '24 04:05 github-actions[bot]

Because of limited time, I decided to pursue only one PR at a time. I will look into this later.

Caius-Bonus avatar May 17 '24 08:05 Caius-Bonus

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!

dmulcahey avatar Jul 10 '24 12:07 dmulcahey

Thanks for the heads-up. I reworked it and made a complementary PR in zigpy/zha.

Caius-Bonus avatar Jul 15 '24 15:07 Caius-Bonus

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!

github-actions[bot] avatar Sep 16 '24 11:09 github-actions[bot]

If there is still interest in this getting merged, I am willing to continue to work on it.

Caius-Bonus avatar Sep 22 '24 10:09 Caius-Bonus

@Caius-Bonus I think the zigpy/zha PR needs to be accepted and merged before this PR can move forward?

emontnemery avatar Oct 16 '24 08:10 emontnemery

That is correct. But I haven't heard back yet from @puddly, so I don't know how to move forward yet.

Caius-Bonus avatar Oct 16 '24 12:10 Caius-Bonus

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!

github-actions[bot] avatar Dec 15 '24 16:12 github-actions[bot]

I still want to work on it, but I have been busy.

Caius-Bonus avatar Dec 17 '24 11:12 Caius-Bonus

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!

github-actions[bot] avatar Feb 15 '25 17:02 github-actions[bot]