core
core copied to clipboard
RuuviTag BLE sensor support
Proposed change
This PR adds HA native BLE support for RuuviTag sensors.
It's cold around here:
Type of change
- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [x] 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
The code for the component is mostly copy-pasted from the tilt_ble
component (it would seem that the various *_ble
components could use some deduplication...). Similarly, the ruuvitag-ble
parser component has been adapted from https://github.com/Bluetooth-Devices/xiaomi-ble; the code from which ruuvitag-ble==0.1.0rc1 has been built from is https://github.com/akx/ruuvitag-ble/tree/initial-dev.
This is my first real HA contribution, so hand-holding would be welcome. I suspect @bdraco might be the person best suited to look at this BLE stuff...
Checklist
- [x] The code change is tested and works locally.
- I've tested that the RuuviTags around my house and garden are detected by HA; see screenshot above.
- [x] Local tests pass. Your PR cannot be merged unless tests pass
- [x] There is no commented out code in this PR.
- [x] I have followed the development checklist
- Communication code is encapsulated into
ruuvitag-ble
. PR to merge it into the Bluetooth-Devices repo: https://github.com/Bluetooth-Devices/ruuvitag-ble/pull/2
- Communication code is encapsulated into
- [x] The code has been formatted using Black (
black --fast homeassistant tests
) - [x] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [x] Documentation added/updated for www.home-assistant.io
- https://github.com/home-assistant/home-assistant.io/pull/24767
If the code communicates with devices, web services, or third-party tools:
- [x] The manifest file has all fields filled out correctly.
Updated and included derived files by running:python3 -m script.hassfest
. - [x] New or updated dependencies have been added to
requirements_all.txt
.
Updated by runningpython3 -m script.gen_requirements_all
. - [x] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
- See above.
- [ ] Untested files have been added to
.coveragerc
.
To help with the load of incoming pull requests:
- [x] I have reviewed two other open pull requests in this repository.
Hi akx
It seems you haven't yet signed a CLA. Please do so here.
Once you do that we will be able to review and accept this pull request.
Thanks!
I’m traveling this week but I can try to give you some initial feedback when I’m making connections.
If I don’t get back to this by Saturday feel free to ping me
@bdraco Hope your travels went fine! Post-Saturday ping :)
CI started
We do need 100% coverage on the config flow before we can merge this.
We do need 100% coverage on the config flow before we can merge this.
@bdraco I copied a config flow test from tilt_ble (since the config flow itself was copied from there) and just adapted the constants. I'm not going to pretend I understand how the config flow system works in depth, so I hope that's okay.
Looks like the tests are failing because the conftest.py
file was removed
@bdraco Bleh, right. Didn't notice the implicit autouse fixture there. Funnily, tests pass just fine on my macOS machine without it.
Fixed...
@bdraco Unrelated test seems to segfault 😞
Oh hey @bdraco, one more question – I realized that the movement_counter
wasn't visible because I had set native_unit_of_measurement
to None
... what would be the correct native_unit_of_measurement
for a dimensionless quantity like that?