I would like to let the PI know that I am home so that it starts a set of scripts to turn on my projector (I could loop it, but that would be expensive).
Clearly, I have my phone with me all the time, so I could check whether my phone is close by.
What is the best way to do so?
One way I found is using arp-scan
#!/bin/bash
# Checks if the phone is connected to the wifi network
# Loops until the phone is found
MAC_ADDRESS="XX:XX:XX:XX:XX:XX"
arp-scan --interface=wlp2s0 --localnet | grep $MAC_ADDRESS
while [ $? != 0 ]; do
sleep 60
arp-scan --interface=wlp2s0 --localnet | grep $MAC_ADDRESS
done
then if this script return, another one will take care of doing things with the PI.
One thing I am not too happy about, is that this thing will not be robust to e.g. lag in connecting to the wifi and disconnection. So maybe checking for my phone coordinates would be better, but I have no idea how to do implement it. I have an Android phone, if relevant.