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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix displayed units for BMW Connected Drive #76613

Merged
merged 5 commits into from
Aug 16, 2022

Conversation

rikroe
Copy link
Contributor

@rikroe rikroe commented Aug 11, 2022

Proposed change

Fixes the displayed sensor units (_attr_native_unit_of_measurement) depending on the HA unit system, which was broken due to #75225 (value conversion worked, but unit was wrong for imperial).

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

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
  • The code has been formatted using Black (black --fast 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.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 馃 Silver
  • 馃 Gold
  • 馃弳 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link

Hey there @gerard33, mind taking a look at this pull request as it has been labeled with an integration (bmw_connected_drive) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@davet2001
Copy link
Contributor

Could you add a test to verify the new behaviour especially showing metric/imperial units now working correctly?

@rikroe
Copy link
Contributor Author

rikroe commented Aug 13, 2022

Adding "a test" was more effort as I had to setup a test base. However thanks for the hint, being able to test in HA surely makes sense!

tests/components/bmw_connected_drive/__init__.py Outdated Show resolved Hide resolved
tests/components/bmw_connected_drive/__init__.py Outdated Show resolved Hide resolved
tests/components/bmw_connected_drive/test_sensor.py Outdated Show resolved Hide resolved
@rikroe
Copy link
Contributor Author

rikroe commented Aug 16, 2022

Just refactored the test to use a pytest fixture and streamlined it to use the same vehicle as #74871.
If this gets merged before, I'll update the other PR accordingly.

Unfortunately this was quite a lot of code change in the tests again, but I hope I included everything you need and it will be much easier to write tests in the future.

Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Looks good!

@MartinHjelmare MartinHjelmare added this to the 2022.8.6 milestone Aug 16, 2022
@MartinHjelmare MartinHjelmare merged commit cb2799b into home-assistant:dev Aug 16, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Aug 17, 2022
@rikroe rikroe deleted the bmw-force-metric-units branch December 21, 2023 14:19
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.

Numbers are in imperial units but until labels are metric 20220716.1 Forces metric units?
5 participants