Skip to content
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

Use constants for translation keys and rename latency time to latency #97866

Conversation

elmurato
Copy link
Contributor

@elmurato elmurato commented Aug 5, 2023

Proposed change

Code cleanups as a preparation for PR #97837:

  • Use constants for translation keys.
  • Rename "latency time" to "latency".
  • Remove unused constant KEY_SERVERS.
  • Fix typo in a comment.

Note:
NAME_LATENCY is still defined as "Latency Time", and not "Latency". This will be fixed in PR #97837 as this affects the entitiy unique ID.

Once this PR is accepted and merged, PR #97837 will be rebased upon these changes and continued.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • 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

  • This PR fixes or closes issue: n.a.
  • This PR is related to issue: n.a.
  • Link to documentation pull request: n.a.

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.
    No changes in config flow. Remaining code has no tests.

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:

@joostlek
Copy link
Member

joostlek commented Aug 5, 2023

What do you think about moving all these sensors into SensorEntityDescriptions? Since you might be adding bedrock support, you will add more sensors, so that would make that easier and this code way cleaner

@elmurato
Copy link
Contributor Author

elmurato commented Aug 5, 2023

What do you think about moving all these sensors into SensorEntityDescriptions? Since you might be adding bedrock support, you will add more sensors, so that would make that easier and this code way cleaner

Interesting, didn't know about it before, thanks! With that the code will be cleaner, agreed. But would it be OK for you, if I implement it after this PR and PR #97837? After those PRs and before tackling Bedrock support I wanted to switch to the DataUpdateCoordinator. Looks like adding SensorEntityDescriptions before that would make sense.

Copy link
Member

@gjohansson-ST gjohansson-ST left a comment

Choose a reason for hiding this comment

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

Thanks @elmurato 👍

@gjohansson-ST gjohansson-ST merged commit 8195c9d into home-assistant:dev Aug 5, 2023
21 checks passed
@elmurato elmurato deleted the mcserver-consts-for-translation-keys branch August 5, 2023 21:51
@github-actions github-actions bot locked and limited conversation to collaborators Aug 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants