Bluetooth binding missing "present" channel?

Unless I’ve misunderstood something, it seems the Bluetooth binding only reports change in rssi. If two consecutive readings of rssi report the same value, only the first result would trigger a change or update rule. If this is true, you can’t reliably know the last detection of presence of a BLE beacon. You can’t tell the difference between a beacon reporting repeatedly the same rssi from a beacon that left the house.

Does this sound familiar to anyone? Did anyone create some kind of work around, perhaps some kind of Exec binding with a script doing some hcitool lescan for detecting presence of a ble beacon?


I created my own BLE device presence control, it’s been extremely reliable during the week I’ve been using it. It makes use of the Exec Binding and a linux script doing some hcitool lescan, leaving a Switch On or Off. Together with a Network binding that detects when my phone register on my local network I’ve got a flawless Home/Away setup.

This is the script /home/openhabian/

# Need: sudo setcap 'cap_net_raw,cap_net_admin+eip' `which hcitool`
hcitool lescan > /tmp/lescan.txt &
sleep 11
kill -INT $pid
wait $pid

if grep -q $1 /tmp/lescan.txt; then
    echo "1"
    echo "0"


Then just create the exec thing, an Item and a Rule and your good to go. For instance:

  1. Thing (insert your BLE device address):
Thing exec:command:lescan-tile [command="/home/openhabian/ AA:BB:CC:DD:EE:FF", interval=240, timeout=15, autorun=false] // Run every 4 minutes

  1. Items:
Switch AtHome "I'm home"
String LescanRaw "[%s]" {channel="exec:command:lescan-tile:output"}

  1. Rules:
var Number lastPresenceActivity = now.millis

// BLE Tile is scannable => I'm home
rule "PresenceActivityTileScan"
        Item LescanRaw received update "1"
        if (AtHome.state != ON) AtHome.sendCommand(ON)
        lastPresenceActivity = now.millis

// Check every 5 minutes for last AtHome event, 10 minutes with no activity sets away
rule "PresenceCheck"
        Time cron "0 0/5 * 1/1 * ? *"
        if (AtHome.state != OFF && now.millis - lastPresenceActivity > 600000) { // 10 minutes

The Network Binding makes sure the AtHome switch sets to ON when I’m in Wifi range and disarms the alarm before I open the door. The lescan script makes sure the switch stays ON even though the phone goes in sleep mode, is turned off, out of battery, etc. My BLE device is a “Tile Mate” on my keys.