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

Ruuvi Gateway integration #84853

Merged
merged 9 commits into from
Jan 3, 2023
Merged

Ruuvi Gateway integration #84853

merged 9 commits into from
Jan 3, 2023

Conversation

akx
Copy link
Contributor

@akx akx commented Dec 30, 2022

Proposed change

This PR adds a new ruuvi_gateway integration that supports reading BLE advertisements from a Ruuvi Gateway on the local network, acting as a Remote Bluetooth Scanner (like ESPhome and Shelly).

By default, the Ruuvi Gateway is configured to only relay advertisements with the RuuviTag manufacturer identifier, but it can be configured to relay all the things. (This is documented.)

Communication with the gateway is handled by https://github.com/akx/aioruuvigateway.

Screenshots

DHCP Autodiscovery!

Screen Shot 2022-12-31 at 17 02 09

... with a pre-filled IP (wow!)

Screen Shot 2022-12-31 at 17 02 06

Open questions

  • Should there be some sort of test for the bluetooth/coordinator bits here? They empirically work, and e.g. esphome doesn't seem to have explicit tests for that either..?

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

Checklist

  • The code change is tested and works locally.
    • Setting up a Ruuvi Gateway in the UI spawns BLE sensors from around my house even if no other BT adapter is set up.
  • 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][dev-checklist]
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.
    • Partially.

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][manifest-docs] 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:

  • I have reviewed two other PRs

@aapris
Copy link

aapris commented Dec 30, 2022

I could test this. Are there any instructions how to do it, assuming I'm a regular software developer?

@akx
Copy link
Contributor Author

akx commented Dec 30, 2022

@aapris Hey, familiar face 😁

Assuming you want to test this in a dev setup, pull my fork of the repo, switch to this branch, install requirements, python -m homeassistant, log in, go to Integrations and Devices and add a new Ruuvi Gateway integration with your gateway's host and the bearer token you may have set up during gateway setup.

If you have a non-dev setup (eg your home HA) it'd depend on the installation method.

@akx
Copy link
Contributor Author

akx commented Dec 31, 2022

Python 3.9 compatibility (oopsy in aioruuvigateway) will be taken care of once I'm at a terminal again, but this is otherwise reviewable. Would @bdraco want to take a look, being the resident Bluetooth sorcerer? 😁

@bdraco
Copy link
Member

bdraco commented Dec 31, 2022

I did a first pass review, if you need more detail, feel free to ask

Co-authored-by: J. Nick Koston <nick@koston.org>
@akx akx requested a review from bdraco January 3, 2023 19:39
@bdraco
Copy link
Member

bdraco commented Jan 3, 2023

You'll probably have to adjust the config flow tests for the formatted mac as well

@akx akx requested a review from bdraco January 3, 2023 19:51
@akx
Copy link
Contributor Author

akx commented Jan 3, 2023

Thanks for the handholding, @bdraco! 😁 I appreciate the help.

@bdraco bdraco merged commit 38f183a into home-assistant:dev Jan 3, 2023
@akx akx deleted the ruuvi-gateway branch January 4, 2023 06:27
@github-actions github-actions bot locked and limited conversation to collaborators Jan 5, 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