Bluetooth LE remotes, buttons, beacons and sensors in Home Assistant
Plenty of cheap Bluetooth Low Energy gadgets never connect to anything: a 4-key remote, a thermometer, a button, a beacon. They simply broadcast a short packet, an advertisement, a few times per second, and the information is in the bytes of that packet. If Home Assistant has no integration for the device, you would otherwise need a custom component or an ESPHome lambda just to find out which byte means "key 2 was pressed".
BLE Adv Rules lets you do that from the UI. Nothing connects to the device and nothing is pushed to it: the integration only listens.
How it works
- Look at what the device sends: a scan, a capture, or a live "Last advertisement" sensor.
- Describe the bytes you care about with a hex pattern, an optional mask and, when needed, a small template.
- Get an
evententity for button presses andsensorentities for values such as temperature or battery.
In practice: add the integration, scan for nearby devices while you press the button, pick the device, then add an event rule (for a button) or a sensor rule (for a value). Rule setup can listen to the device while you press its buttons, show the captured payloads under a byte-offset ruler, suggest a pattern and preview which captured payloads your rule would match. You can add as many rules as you need to one device, for instance four event rules for a four-key remote.
Example: an event rule with a template
For a 4-key remote whose payload is obfuscated, a rule can check the stable header of the raw packet with a pattern and let a template do the arithmetic the pattern cannot. The values below are the README's synthetic example for "Key 1".
Source: raw
Pattern: 0201021b05ffffee1b
Match mode: Starts with
Offset: 0
Template:
{# 0x3b #}{{ raw | count > 22 and raw[20] | bitwise_xor(raw[22]) == 59 }}
The full documentation walks through this and other worked examples, including a button identified by a masked manufacturer byte and a thermometer in service data.
Features
- Device discovery: a short scan lists the devices Home Assistant hears, ordered by how many different payloads each one sent.
- Recognize a device by address, by fingerprint, or both.
- Event rules: a matching advertisement fires an event on the device's event entity, one event type per rule.
- Sensor rules: read a number from the bytes (offset, length, byte order, signed, scale, add, precision) or compute the value with a template, with unit, device class, state class and an expiry time.
- Flexible matching on the raw packet, on the manufacturer data of a company id, or on the service data of a UUID, with hex patterns, wildcard digits, masks, match modes, offsets and optional templates with bitwise filters.
- Listen first, then write the rule, with a preview of what the rule reads from the captured advertisements.
- Capture action:
ble_adv_rules.capturereturns the advertisements heard in a few seconds, as data you can read in Developer tools. - Duplicate suppression with a configurable repeat window, so repeated packets of one press, or the same press heard by several scanners, fire once.
- Diagnostics: a "Last advertisement" sensor (disabled by default) and downloadable diagnostics with the device address redacted.
- English and Spanish translations.
Requirements
- Home Assistant 2026.9.0 or newer.
- A Bluetooth adapter that Home Assistant can use, or an ESPHome Bluetooth proxy in range of the device.
- Raw advertisement bytes are available through ESPHome Bluetooth proxies and, in practice, with local adapters on Home Assistant OS. Where raw data is missing, use the manufacturer data or service data sources instead.
Installation
HACS (recommended)
- Open HACS, then the menu, then Custom repositories.
- Add
https://github.com/aikrana/ha-ble-adv-ruleswith category Integration. - Search for BLE Adv Rules, download it and restart Home Assistant.
Manual
- Download
ble_adv_rules.zipfrom the latest release and unpack it intoconfig/custom_components/ble_adv_rules/. - Restart Home Assistant.
Then go to Settings, Devices & services, Add integration, BLE Adv Rules.