You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice if it can set the status to away if certain devices are absent in the network. I don't like geofencing because it drains the battery.
Following code is an example if 2 devices are present or not:
# Function to check for the presence of two MAC addresses in the network
check_mac_addresses() {
# Arguments: Two MAC addresses to check
local mac1="$1"
local mac2="$2"
# Run arp-scan to detect all MAC addresses in the network
# Adjust the network range as per your configuration
local mac_addresses
mac_addresses=$(arp-scan --localnet | awk '{print $2}')
# Check if both MAC addresses are in the output
if echo "$mac_addresses" | grep -iq "$mac1" && echo "$mac_addresses" | grep -iq "$mac2"; then
return 0 # True: Both MAC addresses found
else
return 1 # False: At least one MAC address not found
fi
}
# Example usage
if check_mac_addresses "aa:bb:cc:dd:ee:ff" "11:22:33:44:55:66"; then
echo "Both MAC addresses are present."
else
echo "One or both MAC addresses are missing."
fi
Is that something that fits the project?
The text was updated successfully, but these errors were encountered:
@vincentcox, since the only device I have running 24/7 is my router (running openwrt) I adapted Silviu's amazing script to run there and implemented your phone presence idea.
I used a built-in tool instead of arp-scan but it works really well.
Hi guys,
Unfortunately, the last period was a little busy for me. @vincentcox thanks for the idea and for the 🍕 :) I will try to analyze and find the time to implement that. @tbilou sounds interesting, maybe you can contribute to a separate branch with your implementation if not to the main with a cross-platform solution
Best,
Silviu
It would be nice if it can set the status to away if certain devices are absent in the network. I don't like geofencing because it drains the battery.
Following code is an example if 2 devices are present or not:
Is that something that fits the project?
The text was updated successfully, but these errors were encountered: