kinda depends on the scan interval of the bluetooth component. I’m not using it in “production” right-now due to some problems with my zwave setup. My RPI is right at the entrance of my (small) studio, so I’m willing to bet it will detect my tag even before I have unlocked the door.
Its about 2x2 cm and 5 mm tick. Not the largest item on my keyring. Battery is a single cr3032.
I think the key with presence detection is to use multiple methods at ones, and to assign a separate device in you known_devices.yaml for each method. I have great results using nmap, gps logger, and owntracks on android 7.
(Owntracks is used only because I am not sure if HA can calculate proximity values from anything else.)
I have three separate devices in my known_devices.yaml for my phone and only trigger automations to off when all report ‘not home’, but trigger on when any of the three devices reports ‘home’. (Actually setting a binary sensor to off and on)
Here is how to configure the tracker. Note: for Iphone, I had to go into the bluetooth settings and leave that open while restarting home assistant. Iphones seem to only broadcast while in the bluetooth settings and for me, home assistant seemed to only add Iphones on startup.
If after configuring the device tracker you get an error similar to …
INFO:homeassistant.util.package:Attempting install of pybluez==0.22
Command "/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/private/var/folders/f1/x1cbc0q53sjc8w8sbvyzw4n40000gn/T/pip-build-p5f2np6x/pybluez/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/f1/x1cbc0q53sjc8w8sbvyzw4n40000gn/T/pip-fqesz8r4-record/install-record.txt --single-version-externally-managed --compile --home=/var/folders/f1/x1cbc0q53sjc8w8sbvyzw4n40000gn/T/tmpzg2q0qx6" failed with error code 1 in /private/var/folders/f1/x1cbc0q53sjc8w8sbvyzw4n40000gn/T/pip-build-p5f2np6x/pybluez/
ERROR:homeassistant.bootstrap:Not initializing device_tracker.bluetooth_tracker because could not install dependency pybluez==0.22
Run these commands to install the missing dependency.
I know this could be an “old” post since nobody writes on it since 1 month ago, but I’m running some tests on my RPi3 to detect all my diferent devices (ios, android 5 &6 and win-pc systems) trough “arp” instead of nmap and right know the success rate is good enough for me as every time, i perform an arp request (around 5 times a day) my andorid 6 is detected as well as my win pc and Ipad.
In the past, I wrote about the possiblity to use arp instead of nmap for presence detection (link below), but someone point out that it could be possible that arp deosn’t detect some devices, as in order to work, the device running the arp command (in my case the RPi3) should have a connection with all the devices to detect, which yes, that’s the theory but in my case even if a new device is registered in my LAN, inmeaiatley can be found through the arp command and I’m not running Pi-hole or something that forces the communication between new devices connected to my network and the Pi.
Before i used HA, i had a script that worked very good with iOS devices.
Since last weekend i activated it again to use with HA as “command_line device tracker”
The script runs as root on a ubuntu 14.04 server every minute and publishes the states to mqtt.
First install hping3 and mosquitto-clients. apt-get install hping3 mosquitto-clients
For example, the script is saved as nscan.sh in folder /root/scripts/nscan/.
You have to edit the DEVS and the MQTT IP (127.0.0.1 if mqtt runs on the same server) to your needs.
Now there is a cronjob that calls it every minute. * * * * * cd /root/scripts/nscan; ./nscan.sh
The script publishes the state of the devices to mqtt.