Issues with ble tracking on esp32 (esphome)

Hi

I created ble tracker using esp32 and esphome. I also have iBeacon called iNode. When I scan it using phone it is always available, but in home assistant the most of the time it is off.

In esphome logs I can see:

[21:06:41][D][binary_sensor:033]: 'ESP32 BLE Tracker iTag1': Sending state OFF
[21:06:41][D][binary_sensor:033]: 'iNode1': Sending state ON
[21:06:45][D][esp32_ble_tracker:470]: Found device 57:AC:98:FA:D5:CD RSSI=-88
[21:06:45][D][esp32_ble_tracker:491]:   Address Type: RANDOM
[21:06:52][D][esp32_ble_tracker:470]: Found device 58:80:3C:24:C0:BC RSSI=-50
[21:06:52][D][esp32_ble_tracker:491]:   Address Type: RANDOM
[21:07:01][D][esp32_ble_tracker:147]: Starting scan...
[21:07:06][D][esp32_ble_tracker:470]: Found device 57:AC:98:FA:D5:CD RSSI=-87
[21:07:06][D][esp32_ble_tracker:491]:   Address Type: RANDOM
[21:07:21][D][esp32_ble_tracker:147]: Starting scan...
[21:07:21][D][esp32_ble_tracker:470]: Found device 58:80:3C:24:C0:BC RSSI=-50
[21:07:21][D][esp32_ble_tracker:491]:   Address Type: RANDOM
[21:07:23][D][esp32_ble_tracker:470]: Found device 57:AC:98:FA:D5:CD RSSI=-90
[21:07:23][D][esp32_ble_tracker:491]:   Address Type: RANDOM
[21:07:41][D][esp32_ble_tracker:147]: Starting scan...
[21:07:41][D][binary_sensor:033]: 'iNode1': Sending state OFF
[21:07:46][D][esp32_ble_tracker:470]: Found device 57:AC:98:FA:D5:CD RSSI=-89
[21:07:46][D][esp32_ble_tracker:491]:   Address Type: RANDOM

Looks like the beacon is detected and after 20s seconds it is changed to off. And it is not detected for another 2 minutes at least.

My espconfig:

esphome:
  name: esp32
  platform: ESP32
  board: nodemcu-32s

wifi:
  ssid: "..."
  password: "...."

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "...."

ota:
  password: "....."

esp32_ble_tracker:
  scan_interval: 20s

binary_sensor:
  - platform: ble_presence
    mac_address: FF:FF:40:01:22:8C
    name: "ESP32 BLE Tracker iTag1"
  - platform: ble_presence
    mac_address: FC:58:FA:22:B1:7E
    name: "ESP32 BLE Tracker iTag2"
  - platform: ble_presence
    mac_address: FF:FF:00:03:EC:58
    name: "ESP32 BLE Tracker iTag3"
  - platform: ble_presence
    mac_address: D0:F0:18:43:EB:7A
    name: "iNode1"

sensor:
  - platform: xiaomi_miflora
    mac_address: 'C4:7C:8D:6A:DC:3B'
    temperature:
      name: "Xiaomi MiFlora Fikus benjamin Temperature"
    moisture:
      name: "Xiaomi MiFlora Fikus benjamin Moisture"
    illuminance:
      name: "Xiaomi MiFlora Fikus benjamin Illuminance"
    conductivity:
      name: "Xiaomi MiFlora Fikus benjamin Soil Conductivity"

Am I missing something? I wanted to check presence using this BLE beacons.

MiFlora is working fine all the time…

I’ve been seeing the same behavior with a Nut tracker I had kicking around.

It’s almost as if the tracker broadcast is falling outside the window of the BLE scan. I’ve set my scan at 30 seconds for testing and I’m still constantly missing the tracker broadcast.