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

Use value_fn for bmw_connected_drive binary_sensor #57540

Merged
merged 5 commits into from Oct 22, 2021

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Oct 12, 2021

Proposed change

Refactor bmw_connected_drive binary_sensor to use value_fn as attribute on the EntityDescription. By doing so we can remove almost all logic from the update method itself.

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)
  • 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: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

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, @rikroe, 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)

@cdce8p cdce8p added project-code_style PRs related to #53201 - pylint CodeStyle update smash Indicator this PR is close to finish for merging or closing labels Oct 12, 2021
@MartinHjelmare MartinHjelmare added this to Needs review in Dev Oct 15, 2021
Copy link
Contributor

@rikroe rikroe left a comment

Choose a reason for hiding this comment

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

While the diff looks very confusing I like the end result.

Unfortunately, cannot test this on my car, but at least no errors/warning are raised (i.e. it still ignores sensors your car doesn't have).

Thanks!

@cdce8p
Copy link
Member Author

cdce8p commented Oct 15, 2021

@gerard33 Would you be able to test this change, too?

@gerard33
Copy link
Contributor

Sure will also test this change.

Copy link
Contributor

@gerard33 gerard33 left a comment

Choose a reason for hiding this comment

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

All binary sensors work fine for my car with combustion engine (so can't test the EV binary sensors 馃槈).

@cdce8p cdce8p force-pushed the cs_bmw_connected_drive_value_fn branch 4 times, most recently from 04bccc4 to 360e3bb Compare October 17, 2021 23:27
@rytilahti
Copy link
Member

Please rebase on top of the current dev branch.

@cdce8p cdce8p force-pushed the cs_bmw_connected_drive_value_fn branch from 360e3bb to ba1a6c7 Compare October 19, 2021 09:11
@cdce8p
Copy link
Member Author

cdce8p commented Oct 19, 2021

Please rebase on top of the current dev branch.

馃憤馃徎 Did the rebase. As it has been tested already, I would argue this PR is almost done and could be merged as is.

@cdce8p cdce8p force-pushed the cs_bmw_connected_drive_value_fn branch from ba1a6c7 to c85e301 Compare October 21, 2021 13:50
Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks @cdce8p 馃憤

Dev automation moved this from Needs review to Reviewer approved Oct 22, 2021
@frenck frenck merged commit fa56be7 into home-assistant:dev Oct 22, 2021
Dev automation moved this from Reviewer approved to Done Oct 22, 2021
@cdce8p cdce8p deleted the cs_bmw_connected_drive_value_fn branch October 22, 2021 17:01
Chen-IL pushed a commit to Chen-IL/homeassistant-core that referenced this pull request Oct 23, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed code-quality Hacktoberfest integration: bmw_connected_drive project-code_style PRs related to #53201 - pylint CodeStyle update smash Indicator this PR is close to finish for merging or closing
Projects
Dev
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants