Mopeka_pro_check with esp32_ble_tracker isn't reliably tracking multiple BLE devices

Hi. I’m currently running the mopeka_pro_check with esp32_ble_tracker to track a couple of BLE propane tank sensors. The logic seems to favor one of the sensors and will report the readings from it quite regularly - while only displaying data from the other sensor once every 10 - 20+ hours. Both sensors have fresh batteries and the manufacturer’s app - which uses BLE - gets updates from both sensors every few minutes. I’ve included my configuration (minus the wifi stuff). Any suggestions?

captive_portal:
esp32_ble_tracker:
  scan_parameters:
    interval: 200ms
    duration: 10min
    window: 160ms   

sensor:
  - platform: mopeka_pro_check
    mac_address: F6:7A:C7:BA:19:2A
    tank_type: 30LB_V
    temperature:
        name: "Propane - Driver Side - Temp"
    level:
        name: "Propane - Driver Side - Level"
    distance:
        name: "Propane - Driver Side - Distance"
    battery_level:
        name: "Propane - Driver Side - Battery"
  - platform: mopeka_pro_check
    mac_address: FD:C5:2E:22:B0:9E
    tank_type: 30LB_V
    temperature:
        name: "Propane - Passenger Side - Temp"
    level:
        name: "Propane - Passenger Side - Level"
    distance:
        name: "Propane - Passenger Side - Distance"
    battery_level:
        name: "Propane - Passenger Side - Battery"

It might not suit your use case, but as of like… just now, Mopeka has its own direct integration in the latest HA release 2023.2. I never had any luck with reliability for my esp32 / ESPHome (would always go offline randomly), so it will be a huge relief to toss out my esp and uninstall ESPHome :slight_smile:

If it helps, I never defined scan_parameters in my ble_tracker, but my sensors were defined exactly as you have them. Usually only one of them would be available at a time, but today both were reading, except one had a temp of 478*F, so I sprinted out to make sure my van wasn’t on fire…

Nice to see a fellow Vehicle Assistant member on here!

Agreed!

I actually went for an in-between solution, I turned my esp32 into a bluetooth proxy for HA, and then used the native mopeka integration in home assistant. It works a lot better and the mopeka device was discovered by HA automatically almost instantly.

ESP Home config for the bluetooth proxy is as follows:

esphome:
  name: "device-name"

esp32:
  board: wemos_d1_mini32
  framework:
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

# Enable Bluetooth Proxy Components
esp32_ble_tracker:
  scan_parameters:
    interval: 320ms
    window: 120ms
    duration: 60s
    active: true

bluetooth_proxy:
  active: true

# Wifi Setup
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

Note this did take awhile to compile with the esp-idf framework vs. Arduino

1 Like

I followed this conversation with interest, and must say removing the Mopeka from ESPHom (on a ESP32Dev) into HA, was actually quite a good piece of advice. Having said that the reason I was reading all of this up, was because on ESPHome, once I press the SYNC button on the Mopeka, I get data, and then it stops. I thought, great let me try the HA route with the ESP32 just a BLE proxy. Immediate data, and then nothing again. So there is clearly not an issue with either HA or ESPHome I think, but rather something else. Why would the data stop? The ESPHome is behind a room wall, about 2m from the Mopeka. Any advice would be welcome.