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

Add EufyLife Bluetooth integration #85907

Merged
merged 16 commits into from
Jan 17, 2023
Merged

Conversation

bdr99
Copy link
Contributor

@bdr99 bdr99 commented Jan 15, 2023

Proposed change

Add a new integration for EufyLife Bluetooth smart scale devices.

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.

To help with the load of incoming pull requests:

@bdraco
Copy link
Member

bdraco commented Jan 15, 2023

I'll try to give this a second pass tomorrow after some sleep. I still need to look through the lib as well

@bdr99
Copy link
Contributor Author

bdr99 commented Jan 15, 2023

@bdraco Sounds good, thanks for all of your feedback so far!

@bdraco bdraco self-requested a review January 15, 2023 04:44
@bdr99
Copy link
Contributor Author

bdr99 commented Jan 16, 2023

Updated this PR to add a brand for eufy, as suggested in home-assistant/brands#4039 (comment).

@bdraco
Copy link
Member

bdraco commented Jan 16, 2023

I think this is just about ready to merge. I found a few small presentation issues that need to be sorted out first

@bdraco
Copy link
Member

bdraco commented Jan 16, 2023

Thanks @bdr99

@bdraco
Copy link
Member

bdraco commented Jan 17, 2023

History stats tests are failing with

DEBUG:homeassistant.util.executor:Calling executor with function: <bound method async_periodic_statistics of <Recorder(Recorder, started 6166867968)>>, args: (datetime.datetime(2023, 1, 17, 0, 33, 9, 455126, tzinfo=datetime.timezone.utc),), kwargs: {}
DEBUG:homeassistant.util.executor:Calling executor with function: <bound method async_periodic_statistics of <Recorder(Recorder, started 6166867968)>>, args: (datetime.datetime(2023, 1, 17, 0, 33, 9, 455321, tzinfo=datetime.timezone.utc),), kwargs: {}
DEBUG:homeassistant.util.executor:Calling executor with function: <bound method async_periodic_statistics of <Recorder(Recorder, started 6166867968)>>, args: (datetime.datetime(2023, 1, 17, 0, 33, 9, 455577, tzinfo=datetime.timezone.utc),), kwargs: {}
DEBUG:homeassistant.util.executor:Calling executor with function: <bound method async_periodic_statistics of <Recorder(Recorder, started 6166867968)>>, args: (datetime.datetime(2023, 1, 17, 0, 33, 9, 455805, tzinfo=datetime.timezone.utc),), kwargs: {}
DEBUG:homeassistant.util.executor:Calling executor with function: <bound method async_periodic_statistics of <Recorder(Recorder, started 6166867968)>>, args: (datetime.datetime(2023, 1, 17, 0, 33, 9, 455989, tzinfo=datetime.timezone.utc),), kwargs: {}
DEBUG:homeassistant.util.executor:Calling executor with function: <bound method async_periodic_statistics of <Recorder(Recorder, started 6166867968)>>, args: (datetime.datetime(2023, 1, 17, 0, 33, 9, 456271, tzinfo=datetime.timezone.utc),), kwargs: {}
DEBUG:homeassistant.util.executor:Calling executor with function: <bound method async_periodic_statistics of <Recorder(Recorder, started 6166867968)>>, args: (datetime.datetime(2023, 1, 17, 0, 33, 9, 456422, tzinfo=datetime.timezone.utc),), kwargs: {}
DEBUG:homeassistant.util.executor:Calling executor with function: <bound method async_periodic_statistics of <Recorder(Recorder, started 6166867968)>>, args: (datetime.datetime(2023, 1, 17, 0, 33, 9, 456621, tzinfo=datetime.timezone.utc),), kwargs: {}
DEBUG:homeassistant.util.executor:Calling executor with function: <bound method async_periodic_statistics of <Recorder(Recorder, started 6166867968)>>, args: (datetime.datetime(2023, 1, 17, 0, 33, 9, 456813, tzinfo=datetime.timezone.utc),), kwargs: {}
DEBUG:homeassistant.util.executor:Calling executor with function: <bound method async_periodic_statistics of <Recorder(Recorder, started 6166867968)>>, args: (datetime.datetime(2023, 1, 17, 0, 33, 9, 457092, tzinfo=datetime.timezone.utc),), kwargs: {}
DEBUG:homeassistant.util.executor:Calling executor with function: <bound method async_periodic_statistics of <Recorder(Recorder, started 6166867968)>>, args: (datetime.datetime(2023, 1, 17, 0, 33, 9, 457334, tzinfo=datetime.timezone.utc),), kwargs: {}
DEBUG:homeassistant.util.executor:Calling executor with function: <bound method async_periodic_statistics of <Recorder(Recorder, started 6166867968)>>, args: (datetime.datetime(2023, 1, 17, 0, 33, 9, 457433, tzinfo=datetime.timezone.utc),), kwargs: {}
DEBUG:homeassistant.util.executor:Calling executor with function: <bound method async_periodic_statistics of <Recorder(Recorder, started 6166867968)>>, args: (datetime.datetime(2023, 1, 17, 0, 33, 9, 457676, tzinfo=datetime.timezone.utc),), kwargs: {}
DEBUG:homeassistant.util.executor:Calling executor with function: <bound method async_periodic_statistics of <Recorder(Recorder, started 6166867968)>>, args: (datetime.datetime(2023, 1, 17, 0, 33, 9, 457868, tzinfo=datetime.timezone.utc),), kwargs: {}
DEBUG:homeassistant.util.executor:Calling executor with function: <bound method async_periodic_statistics of <Recorder(Recorder, started 6166867968)>>, args: (datetime.datetime(2023, 1, 17, 0, 33, 9, 458009, tzinfo=datetime.timezone.utc),), kwargs: {}
DEBUG:homeassistant.util.executor:Calling executor with function: <bound method async_periodic_statistics of <Recorder(Recorder, started 6166867968)>>, args: (datetime.datetime(2023, 1, 17, 0, 33, 9, 458241, tzinfo=datetime.timezone.utc),), kwargs: {}
DEBUG:homeassistant.util.executor:Calling executor with function:

@bdr99
Copy link
Contributor Author

bdr99 commented Jan 17, 2023

@bdraco Do you think the test failures are related to this PR?

bdraco added a commit to bdraco/home-assistant that referenced this pull request Jan 17, 2023
bdraco added a commit to bdraco/home-assistant that referenced this pull request Jan 17, 2023
@bdraco bdraco merged commit 2ed6df9 into home-assistant:dev Jan 17, 2023
@bdr99 bdr99 mentioned this pull request Jan 17, 2023
19 tasks
rlippmann pushed a commit to rlippmann/core that referenced this pull request Jan 18, 2023
Co-authored-by: J. Nick Koston <nick@koston.org>
@github-actions github-actions bot locked and limited conversation to collaborators Jan 18, 2023
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.

Please address the comments in a new PR. Thanks!

discovery_info = self._discovery_info

model_name = MODEL_TO_NAME.get(discovery_info.name)
assert model_name is not None
Copy link
Member

Choose a reason for hiding this comment

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

Why are we using dict.get on line 50 if we know that they key is not missing?

return True

@property
def native_value(self) -> float | None:
Copy link
Member

Choose a reason for hiding this comment

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

We could use self._attr_native_value instead in _handle_state_update and async_added_to_hass to set the native value.

@home-assistant home-assistant unlocked this conversation Jan 25, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 26, 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.

3 participants