So I have had this up and working for some time now, and it has been solid. I am adding a new Access Point (AP) to the network though, and that introduces some challenges. I have read all of these posts, but still am not finding what I am after. My script looks like this:
macaddress() { wl -i eth2 assoclist && wl -i eth1 assoclist; }
if (macaddress | fgrep “XX:XX:XX:XX:XX:XX” >/dev/null)
then
Me=Home
fi
My first question is: outside of running something off-router, does anyone have presence working using your main Asus router, an AP and this method, and if so, how (exactly) are you accomplishing that? There were some references to something along the lines of “I tried Joe’s method, slightly modified, and it works for me”, but nothing I could find specific as a “this works” solution. (this could be me - 300 posts is a lot of reading…
My second question would be: Is there an issue running the above script on both the Main Router (referred to now as MR) & also the AP? If I am understanding the script correctly, every execution of it (both on the MR & also the AP) does a check & either adds or deletes the status file & calls the curl script to update status. I could see this causing an issue if the MR runs & says “away” and calls curl, but then AP runs and says “home” & calls curl. This may lead to flap (again, if I am understanding the execution correctly).
The issue with the current script is that the WL command does not list the devices connected to the AP, so they all list as “Away” when they are connected to the AP, but are in fact present on the network.
It looks like the ARP command may work to list all devices visible on the network, but I need to change my lines for Command() and also the fgrep. Particularly, I need to have fgrep look for the MAC address. I am not sure what format to use to pull out the mac being on that line. One thing to note is that the ARP table seems to be slower to update than the original method using WL, so I am not sure if it is going to be as quick, but wanted to explore the option.
My question here is mainly : Are there any linux scripting gurus that can help me re-format the above lines to incorporate the ARP command instead of WL, and also the fgrep line to filter out based on whether the MAC is there, please?
Thank you so much for your help - I appreciate it, and look forward to hearing what works for you all!