Skip to content

allow_ibeacon: scope rules by uuid - #3

Merged
davidcoulson merged 1 commit into
mainfrom
ibeacon-uuid
Sep 19, 2026
Merged

davidcoulson merged 1 commit into
mainfrom
ibeacon-uuid

Conversation

@davidcoulson

Copy link
Copy Markdown
Owner

allow_ibeacon rules could name a major/minor but not a uuid — the matcher never read the UUID bytes. major: 1 is the commonest vendor default, so the fleet's major: 1, rssi: -95 rule (deliberately below the floor, for probe calibration) forwarded anybody's major-1 beacon at −95 dBm.

allow_ibeacon:
  - uuid: fde3b150-2f64-43ba-aee9-867f75ee4a6f
    major: 1
    rssi: -95
  • uuid is optional — existing rules are unchanged. Needs a uuid, a major, or both; minor still needs a major; uuid-only covers every major/minor of that UUID.
  • One rule list, most-specific-first, so the winner no longer depends on config order.
  • An unparseable uuid drops the rule — never widens to "any".

Tests: 14 new checks against the real source under ASan/UBSan; gate property test extended (204,800 comparisons). Built: 2026.9.0 (fork, rrn00 C3, fleet config) and 2026.10.0-dev (hook). Same change in both repos; parity check green.

🤖 Generated with Claude Code

A rule could name a major and a minor but not a uuid - the matcher never
read the 16 uuid bytes. major/minor are small integers every vendor
starts counting from 1, so "major: 1" admitted anybody's beacon that was
left on its defaults, at that rule's own RSSI limit. On the fleet that
limit is -95, deliberately below the -90 floor so that probe-to-probe
calibration gets its weak cross-room readings; the same privilege went
to every foreign major-1 beacon in range. The config comment claiming
"every other iBeacon in range stays blocked" was true of other majors
and false of other uuids.

  allow_ibeacon:
    - uuid: fde3b150-2f64-43ba-aee9-867f75ee4a6f
      major: 1
      rssi: -95

- uuid is optional, so existing rules behave exactly as before. A rule
  needs a uuid, a major, or both; a minor still needs a major. A
  uuid-only rule covers every major/minor of that uuid.
- The two rule lists become one, kept most-specific-first (minor over
  major over uuid-only, uuid-scoped over unscoped), so the winner no
  longer depends on config order.
- A uuid that fails to parse drops the rule. It never widens to "any".
- The iBeacon uuid is transmitted in canonical order (checked against
  esp32_ble_beacon), so it is a straight compare.

Tests (real source, ASan/UBSan): 14 new checks; the gate property test
now covers uuid-scoped rules (204,800 comparisons). Compiled on ESPHome
2026.9.0 (fork, esp32c3 rrn00, fleet config) and 2026.10.0-dev (hook
component); generated call verified:
add_ibeacon_rule("fde3b1502f6443baaee9867f75ee4a6f", 1, -1, -95).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@davidcoulson
davidcoulson merged commit 4e94c75 into main Sep 19, 2026
2 checks passed
@davidcoulson
davidcoulson deleted the ibeacon-uuid branch September 19, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant