Require service on fjaraskupan to detect it#170363
Open
elupus wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Fjäråskupan Bluetooth discovery/matching so devices are only added after the expected service UUID is seen, reducing false-positive devices created from partial manufacturer data.
Changes:
- Switches Fjäråskupan Bluetooth matcher from manufacturer prefix matching to a specific service UUID (manifest + generated matcher data).
- Splits runtime Bluetooth handling into: (1) “detect” on service UUID to create the coordinator/device and (2) “update” on manufacturer data only for already-detected addresses.
- Updates existing tests/fixtures to include the required service UUID in advertised data.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/components/fjaraskupan/test_init.py | Updates mock advertisement to include the service UUID required for detection. |
| tests/components/fjaraskupan/init.py | Updates shared BLE test fixture to include the service UUID. |
| homeassistant/generated/bluetooth.py | Regenerates Bluetooth matcher data to use service_uuid for this domain. |
| homeassistant/components/fjaraskupan/manifest.json | Changes discovery matcher from manufacturer prefix to the service UUID. |
| homeassistant/components/fjaraskupan/init.py | Requires service UUID before creating coordinators/devices; manufacturer data updates only apply after detection. |
Comments suppressed due to low confidence (1)
tests/components/fjaraskupan/test_init.py:26
- Add a regression test that verifies manufacturer-data-only advertisements (no matching service UUID) do not create a device/coordinator, and that the device is only created after an advertisement including the required service UUID is seen.
MOCK_SERVICE_INFO = BluetoothServiceInfo(
address="11:11:11:11:11:11",
name=DEVICE_NAME,
service_uuids=["77a2bd49-1e5a-4961-bba1-21f34fa4bc7b"],
rssi=-60,
manufacturer_data={ANNOUNCE_MANUFACTURER: b"ODFJAR\x01\x02\x00\x00\x00\x30\x04"},
service_data={},
source="local",
)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change
Proposed change
Only add new fans when we see the advertisement service in the data.
Some interaction between these fans and multiple bluetooth proxies
causes random addresses with partial manufacture data to be seen.
To avoid these being added as devices, require a service id to be
seen before adding the device.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: