BLE Adv Rules – turn Bluetooth LE advertisements into events and sensors from the UI

Hi everyone,

I’ve released BLE Adv Rules, a custom integration (HACS) for Bluetooth LE gadgets that Home Assistant has no integration for and that never connect to anything: they just broadcast advertisements. Think cheap remotes, buttons, beacons or thermometers.

Why

It started with the 4-key BLE remote (Sonoff RC14) that came in a pack of Sonoff S61 plugs. Home Assistant’s Bluetooth could hear it, but nothing understood the packets, and the key number is hidden behind an XOR. Rather than write a custom component or an ESPHome lambda for every gadget like that, I made a generic integration where you describe the bytes in the UI.

What it does

  • Add a device by scanning while you press its button, or enter it manually; it is recognized by address, by a fingerprint of its advertisements, or both.
  • Event rules: a matching advertisement fires an event on the device’s event entity (one event type per rule, e.g. key_1 … key_4), ready to use in automations.
  • Sensor rules: read a number from the bytes (offset, length, byte order, signed, scale, precision) or compute it with a template, with unit, device class and an expiry time.
  • Matching on the raw packet, manufacturer data or service data, with hex patterns, ? wildcards, masks, offsets and optional templates (bitwise_xor and friends) for obfuscated payloads.
  • Listen first, then write the rule: while you set up a rule it captures what the device sends, shows the payloads under a byte ruler and previews which ones your rule would match.
  • Duplicate suppression, so one press heard by several adapters or ESPHome Bluetooth proxies fires once.
  • A ble_adv_rules.capture action and a “Last advertisement” diagnostic sensor to investigate unknown devices.

It only listens: nothing connects to the device or sends anything to it. It works with local adapters and ESPHome Bluetooth proxies (raw packet bytes come through ESPHome proxies and local adapters on Home Assistant OS; elsewhere, use the manufacturer or service data sources).

Install

HACS → ⋮ → Custom repositories → add https://github.com/aikrana/ha-ble-adv-rules as an Integration, download it, restart, then add BLE Adv Rules from Settings → Devices & services. Requires Home Assistant 2026.9 or newer.

The README has worked examples (a 4-key remote, a button identified by a masked manufacturer byte, a thermometer in service data). Project page: BLE Adv Rules: Bluetooth LE to Home Assistant events & sensors

This is the first release (v0.1.0, UI in English and Spanish). Feedback and issues are very welcome on GitHub. If you have an RC14 or another advertisement-only gadget, I’d love to hear whether it works for you; captures from other RC14 units would also confirm whether they all encode the keys the same way.

Disclosure: this integration was developed with the assistance of AI tools, primarily for my own use. I run it on my own setup; it is provided as-is, with no warranty.

2 Likes