Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Require service on fjaraskupan to detect it#170363

Open
elupus wants to merge 2 commits into
home-assistant:devfrom
elupus:fjaraskupan/junk_detect
Open

Require service on fjaraskupan to detect it#170363
elupus wants to merge 2 commits into
home-assistant:devfrom
elupus:fjaraskupan/junk_detect

Conversation

@elupus
Copy link
Copy Markdown
Contributor

@elupus elupus commented May 11, 2026

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

  • 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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • 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
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

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 diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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",
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants