Hi @pillock, hope this finds you well. Did you notice any side effect on turning off this option other than preventing iphones from sleeping the connection? Higher battery usage or something else?


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)

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… :slight_smile:

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!

So I found the answer to my 3rd question (how to use ARP) - it’s just as fast for detecting when I come ON the network, but slower to detect leaving the network. (takes up to 2 minutes, depending on where I hit the ARP refresh TTL, is what I am thinking, and that is configurable, but not sure I want the “extras” that come with changing that (i.e. more broadcast traffic)) But, coming home & things happening then is the most important to me, so I think I can live with the leaving delay. Here is what I ended up using (note that you have to convert the MAC addresses to all lower case for the fgrep as ARP puts them out in lower and fgrep is case sensitive)


macaddress() { arp; }

if (macaddress | fgrep “38:xx:xx:b5:x2:d3” >/dev/null)
if [ “$Me” = Home ]
if [ ! -f /tmp/CheckUser/_MeHome ]
touch /tmp/CheckUser/_MeHome
curl “https://graph-na04-useast2.api.smartthings.com/api/smartapps/installations/ACCESSKEY/Phone/home?access_token=ACCESSTOKEN” -k
if [ -f /tmp/CheckUser/_MeHome ]
rm -f /tmp/CheckUser/_MeHome
curl "https://graph-na04-useast2.api.smartthings.com/api/smartapps/installations/ACCESSKEY/Phone/away?access_token=ACCESSTOKEN -k

Anyway - I hope that helps someone else - so far, it seems to be doing well.

Still interested to see if there is a better way! :slight_smile:

I added an access point and did exactly the same - swapped wl for arp and had exactly the same experience; it detects just as fast, but waits another minute or so before things fall off the network. Not a problem, but matches your experience :slight_smile:

Look at the second post by “wompah” - link. I’ve been using this code and its been great. The monitordevices.cfg file stores all your MAC IDs to be tracked together with its statuses. Just replace the mosquitto_pub with your curl.

anyone enable AIMesh on their AsusWRT routers? I did and now when my phone connects to the node (not the main router with the presence script) it doesnt show presence. Any fix to this?


So this ARP setup ideal for me because my Asus AC3100 supports neither wl or qcsapi_sockrpc for client lookup (it has some different wifi chipset)

Thanks for this.

One problem however. The if statements don’t run for me, for some reason (I tested by putting in an echo “test” within them).

I have confirmed that “arp” on my router outputs a matching MAC address in lowercase.

I believe the issue is with this line:
macaddress() { arp; }

I don’t think it is storing it into the variable macaddress.

echo “$macaddress” does not print anything

EDIT: O.M.G. Such a stupid thing. I fixed it.

if (macaddress | fgrep “38:xx:xx:b5:x2:d3” >/dev/null)

no double quotes on the MAC address. must be single quotes. at least on my AC3100 for whatever reason, I’m not sure why rrands1 version and everyone else’s seems to work fine.

I’m having the exact same problem. Ever since I enabled AIMesh on Merlin firmware 384.13, I’ve been having the same issue as you. Every time my cell connects to the node, my presence changes to Not Present.

I think there’s a way to execute jffs script if you connect it to a USB stick on the node. I just need to look more into it.

If worse comes to worse, I may have to just use my T-Mobile AC1900 converted AC68U as a repeater and hope Wifi Presence works better. I’ll post here if I find out anything useful and let ya know. Please do the same if you get anywhere with this.

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.