Add iPhone presence detection to a Raspberry Pi 3

In the previous post I wireless installed a clean version of Raspbian on a Raspbian Pi 3.
Now it’s time to do something usefull with this clean install, like add iPhone presence detection to a Raspberry Pi 3.
In this post I will layout the steps needed to do this

Retrieve MAC adress (bluetooth)

Put your iPhone bluetooth into discovery mode (Settings -> Bluetooth)
Make sure your raspberry pi is rebooted after the last update / upgrade
Otherwise you may experience an error message saying:
Device is not available: No such device

Now run following command:

hcitool scan 

It should find your iPhone and show you the mac addres

Ping device

You can now “l2ping” that mac address to see if it is available:

sudo l2ping -c1 -s32 -t1 'XX:XX:XX:XX:XX:XX'

To make the output more readable you can extend the command into something like:

sudo l2ping -c1 -s32 -t1 'XX:XX:XX:XX:XX:XX' > /dev/null && echo 'On' || echo 'Off'
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s