Project: ESP32 Bluetooth proxy and a PN532 NFC/RFID tag reader with ESPHome, scanning tags into Home Assistant

Discuss Bluetooth / RFID Readers with Phone App Support
Post Reply
User avatar
ZerOne
Site Admin
Posts: 216
Joined: Sun Dec 13, 2020 8:21 am

Two small ESPHome builds in one thread: a Bluetooth proxy that extends Home Assistant's BLE range, and an NFC/RFID reader that sends "tag scanned" events. It follows the ESPHome Bluetooth proxy and PN532 pages and the Home Assistant Tags and Bluetooth pages as at October 2026 (ESPHome 2026.10.0). I have not tested these exact configs on my hardware, so check pins and options against your board and post corrections.

Part 1: Bluetooth proxy

What it does: the proxy forwards BLE advertisements, and optionally active connections, from any room to Home Assistant, which aggregates all proxies with any local USB adapter. Only BLE is supported. The ESPHome docs describe the following recommended Wi-Fi configuration (add your own secrets). The esp-idf framework is recommended over Arduino because it uses less memory.

Code: Select all

substitutions:
  name: my-bluetooth-proxy

esphome:
  name: ${name}
  name_add_mac_suffix: true

esp32:
  variant: esp32
  framework:
    type: esp-idf

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

logger:

api:
  encryption:
    key: !secret my_bluetooth_proxy_api_key

ota:
  platform: esphome

esp32_ble_tracker:

bluetooth_proxy:
  active: true
I added the encryption block to the API for safety. The ESPHome security guide recommends it for every device. The rest follows the docs' "complete sample recommended configuration".

Tips from the docs:
  • Active connections default to on for ESP32, with 3 connection slots by default. Devices that stay connected all the time (some locks and thermostats) hold one slot permanently. Passive broadcast sensors, such as many BTHome ones, do not use slots.
  • More slots use RAM. The docs recommend no more than 5 on ESP32 for stability, and say Ethernet-connected proxies handle 4 reliably.
  • If your board overheats, try passive scanning (scan_parameters: active: false under esp32_ble_tracker) if your devices do not need active scans.
  • Keep it away from your router and switches, at least about 3 metres, and close to the BLE devices.
  • Not every BLE device works. Search the Home Assistant integration list for yours.
After flashing, the proxy appears as a discovered ESPHome device. Adopt it with the encryption key. Home Assistant's Bluetooth panel (Settings > Connectivity > Bluetooth) shows adapters and proxies and a map of how devices connect.

Part 2: PN532 NFC/RFID reader (I2C)

Parts: an ESP32 board and a PN532 module. These modules have DIP switches for SPI or I2C. The ESPHome page says I2C is usually switch 1 ON, switch 2 OFF, and SPI the reverse, and you should follow the table printed on your board. Wire power (check your module's voltage), GND, SDA and SCL.

Code: Select all

i2c:
  sda: GPIO21
  scl: GPIO22

pn532_i2c:
  update_interval: 1s
  on_tag:
    then:
      - homeassistant.tag_scanned: !lambda 'return x;'
(Confirm I2C pins for your board.) The on_tag trigger fires when a tag is read, and x is the tag UID in the form 74-10-37-94. homeassistant.tag_scanned sends the scan to Home Assistant's tag component. Add the same API encryption, Wi-Fi and OTA settings as Part 1.

In Home Assistant:
  1. Open the Tags panel and scan a tag. The tag appears and you can name it. A tag ID is also a trigger you can use in automations.
  2. Create an automation with a Tag trigger for that tag, then an action such as turning on a scene or starting a playlist.
  3. The Tags docs include an RFID jukebox example that maps tag IDs to media content. Copy that pattern for a kids' music player.
Safety and security
  • Use this for convenience tasks. As noted in the overview thread, UIDs are not strong credentials. Do not use this reader to unlock a door or disarm an alarm.
  • Mount the reader indoors, and give the ESP32 a unique API encryption key.
  • Put ESPHome devices on a network segment that can reach Home Assistant. Note that mDNS discovery does not cross VLANs.
  • Check that your PN532 module's voltage and logic levels match your ESP32 board's before connecting.
Links
Question for the group: where have you placed your Bluetooth proxies, and how many BLE devices does each one handle? Has anyone built a reliable NFC scan point (jukebox, scenes) with ESPHome?
Post Reply

Return to “Bluetooth / RFID Reader Discussion”