[OBSOLETE] ASUSWRT Wifi Presence

@diodorus yes, that is the mode i run my routers in and this works well

1 Like

Has anyone figured out a working solution to either run this on the main router and any access points (assuming all are asuswrt) or run on just the main but handle connections to the AP’s?
Played around with writing a windows service but couldn’t find a responsive way to check (arp was too delayed).

I did get this working but the only way to do it was connect via ssh to the master and touch the file etc and delete. But you need to set up authorised keys etc on the routers. It was far too convoluted to document the process as the certificate and private key creation for the asus routers took me forever to figure out. It’s not the same cert format as usual for either Linux or Windows :frowning:

Gotcha.
Wish their was a way to share a mapped drive between different routers. Have three r7000 (1 main, 2 ap’s). As you know, your script works excellent if I just leave it on one.

@kramttocs Maybe another simpler option to.program for you would be to have 3 virtual presence sensors for one person one for each router/AP running the script and a master presence sensor and use webcore to program so that if the master presence sensor is away that as soon as one of the 3 presence sensor arrives home then set the master presence sensor as home. Likewise only set the master presence sensor back as away only when all three presence sensors have been set to away for more than say 60 seconds (this just had to be longer than the times it takes your device to reconnect to a new router/AP when roaming around the house)

This would work too give you presence across all ap’s it just slows down the time before you are shown as away by a minute or two.

1 Like

so if someone has an iPhone, this wifi presence is not a good solution because after sleeping for awhile, the iPhone no longer responds to wifi pings?

Yes from what I am aware the power saving features of IOS disconnects from the wifi when the phone is switched off for a while and then wakes up periodically and reconnect to check for new notifications etc… And this setting cannot be modified

A modified version could still work but you would need to delay the away notification to be longer than the wifi wakeup timeframe on IOS ( but I have no idea what things timeframe is on IOS)

@ranova scrub that. Having a read it seems that if connected to cellular data. The wifi will never wake up periodically and all notifications are received by cellular which triggers the phone to wake up. And if not connected to cellular data the phone will wake up with the configurable email schedule time. Also the phone does not disconnect from wifi when in charge.

There used to be I believe a tweak called insomnia in the cydia app store for my jailbroken phones. But I know the jailbreak scene is currently dead on new ios versions

So yes that effectively means it cannot work for you. This lack of control made my last iphone the iPhone 4S and I have never looked back as I love tasker on android

Thank you for this! I was fumbling through now I might get this Asus stuff to work on my system with some Ubuntu servers and Ubiquiti APs, USG, etc. I’d tried tweaking some things but happened upon your code. It’s working perfectly for me; I’m running it from a ubuntu server (that had just been running pi-hole) and it’s connecting to my unifi-ubuntu vm and finding the mobile devices there to set presence. The ability to do all the edits in a conf file is fantastic!

I’ve been using 2 iphones (and even apple watches) using this for 6 months or so, and it has been pretty seemless for me. I definitely don’t drop off Wi-Fi. Once in a while it takes a little longer than I’d like to connect to Wi-Fi, but that’s it. I use the Wi-Fi presense to unlock a door, and about once a week if I get home and walk up to the door, it’s not unlocked yet. Usually within 10 seconds door opens. My cron job runs every 10 seconds.

Did you ever get this working with Webcore? I’d be interested in your solution. My current solution has two people and it works well using virutual presence sensors, but I’d be interested in trying to get this to just run a piston directly. Might be a second or two faster.

so even overnight your wifi presence doesnt drop off for your iphones?

ahh bummer. I just got a new (well refurb) asus Tmo router and flashed it with the latest merlin AC68u firmware and couldnt get anything to execute via ssh, but after reading more into this thread, it may not work well enough. But maybe as a fall back presence detector in conjunction with Life360?

With execution, even after chmodding both files to 777, the terminal (using putty) keeps telling me “-sh: ./init-start: not found”

How do I fix that?

I’ve tried ./jffs/scripts/init-start as well

when I “ls” in /jffs/scripts/, I do see the folder I created and chickifhome and init-start

EDIT: Nevermind, I think its how notepad++ saved the file. I did a little editing of each file in winscp and saved them and it executes now!

Nope, it stays home 100% for me when I’m home. I will say I have it set to have to be disconnected for 2 minutes to register as AWAY. That solves any issues with router reboots or minor disconnect issues.

thanks for the info. I setup a simulated presence sensor and linked my life360, this wifi presence, and the simulated one to webcore and created a piston so that if any of the the life360 or wifi presence change to present, it changes the simulated to present. The otherside, if BOTH the life360 and wifi presence change to not present for 2 minutes, it changes the simulated one to not present.

Ill have to do more testing to see if this asus script works, since Im not at home. If it does, I can change my ST away/home routines to use the 2 simulated presence sensors instead. Hopefully, this creates a foolproof way for presence not to fail. Maybe Ill also add the Smartthings presence sensor back in as well

1 Like

Hmm,

I have two presensce sensors. One is the standard Smartthings based on GPS and the App, it has actually been pretty stable over the past 6 months. Usually when it does not work it after an update to the app or the hub, and I have not opened the app in a while. (Actually its my wife who rarely opens the app, haha).

My Wi-Fi presence used the simulated sensor.

I have several core apps based on presence. Some just use the wifi, such as unlocking the door. A couple use either one just in case there is an issue. I have one that I cannot remember that just uses the GPS sensor.

How do you detect Wi-Fi presence? ARP? Do you have access points. When I first started this I had an access point and tried to use ARP and found it to unstable for me with my IPhones. I ended up just scanning for MAC, not using Arp and getting rid of the access point. Lucy for me a good router was good enough to cover my house without the AP. Not everyone has that option.

sorry, when I said wifi presence, I just meant using the mac address scanning script in this thread.

So far, it works, but Im not sure how to code it to be a backup for one another because if Life360 fails to update, it will keep the presence as is and my current piston will only change when they BOTH change to one status - which defeats the purpose. Do you or anyone else have a good webcore piston that is more foolproof when using more than 1 presence detector?

Maybe after a few weeks of testing the MAC presence, I can make that a priority over life360

No I understood. I have a sensor that shows presence using the mac address and one using the app. In this thread there are several similar but not exactly the same approaches for detecting presence. I used ARP for a while because I had an access point as well as my router. That one did not work as well for my iPhone.

This is the one I’m using and its been solid. Of course this is for a single router with a 2.4ghz and a 5ghz dual band config

Can you explain what ARP is? Sorry, I literally just installed the script last night into my router and got it going. I used a modified code from someone that enabled both 5 and 2.4ghz and my gf’s iphone and my S8 both seemed to stay present last night while we were asleep, so I assume its ok