Hi there,
Because my mobile Apple devices disconnect wifi every x minutes, I’ve been looking for other options to detect my presence and let pimatic turn on some lights.
I thought about using l2ping to bluetooth-ping for my device, but reversed lookup by MAC-address is much faster.
On my raspberry pi, I did the following:
- install
hcitool
(I think it’s part of the bluez package). - then
hcitool scan
to scan for usable bluetooth devices connected - and
hciconfig hci0 up
to get it running.
Probably not the most elegant option, but I have added a new device to my pimatic config.json:
{
"id": "bt_thuis_lex",
"name": "Lex home",
"class": "ShellSwitch",
"onCommand": "echo on",
"offCommand": "echo off",
"getStateCommand": "if hcitool name AA:BB:CC:DD:CC:BB |grep -q iPhone_lxz; then echo on; else echo off; fi",
"interval": 6000
}