[OBSOLETE] ASUSWRT Wifi Presence

Aaand… I solved it.

@gosmittyca sorry didn’t get back to you as ive been on a Christmas party. Anyway glad you resolved it. For the benefit of the people on here what was the issue?

Wow, exactly what I was looking for, since the presence radius of android device in the ST app is way too large.
I’m running Merlin FW on my AC87U but I’m afraid my skills to implement this are not there. I would be able to edit the users and mac in your code but to set it up on the router is above my skills :frowning:
I wish it would be possible to do it the other way a round, in the ST app . If user connects to desired AP it would trigger the location presence.

Great job Fuzzyligic !

Theres not much to do to set it up, just copy the modified scripts with your names and mac’s into the jffs/scripts folder on the router and it just works once you edit the cron file as stated int he instructions.

if you are using an android phone you could also use tasker to do the same in sending the web request which could be a simpler solution

1 Like

Wow, that was quick reply - THANKS!
I’ll try for sure, I presume I can use notepad to edit it ?
Will backup the router config and jffs before my handy work :slight_smile:
Do I need to use something like putty to do this or is there more friendly program that would look like windows file explorer?

Using tasker, will this affect greatly battery life?

Yes putty is best. You can just use a text editor like vi to create the file and then copy and paste the
Text into the file and save it.

Otherwise you can use pscp to copy the file over. If all that doesn’t work out then you can use tasker. It has very little effect on battery life in my experience

1 Like

I’m complete newbie so plese bare with me (also English not my first language)
Questions:

  1. Editing the mac address do I keep * at the beginning and end of the mac?
  2. Did I understand well that since I’m located in Canada I have to change these lines in the CheckIfHome file curl "https://graph-eu01-euwest1.api.smartthings.com/api/smartapps/
    to
    curl "https://graph.api.smartthings.com/api/smartapps/

3 Those virtual presence sensors, I presume those are created under My device handlers, From code (copy/paste your code) named by each family member, but there is so many other options, do I just select Presence Sensor, then Enable oAuth … and Create? Then Save, Publish for Me

Similar with the App - right ?

Thanks for your patience!

Answer is yes to questions 1 & 2, for question 3 you need to just copy in the code in the device handler once. Don’t rename

Then click on my devices and then click new device and name this after each family member and select the virtual presence sensor as the handler.

You only need to enable oauth when copying in the smartapp code. The install a copy of the smartass for each presence sensor and get the URL

1 Like

Thank you!
When creating device for each family member it’s asking for Device Network ID
Is that the mac for each device?

That can be absolutely anythinganything. Just has to be unique across all your devices

1 Like

Hmmm, when I try to get the Application ID and Access Token everything is blank
I guess I screwed up somewhere.

I’ll try start again from scratch

EDIT: That worked, no longer blank however the App ID location looks tifferent in the pic you posted (RED)


I hope there will be no more hiccups

One (I hope last) problem
When I followed this:

“and now either reboot your router or just run the command ./init-start which will schedule your wifi check to be performed every 15 seconds.”

Running the ./init-start command I got response CheckIfHome not found

But running ls -als /jffs/scripts/CheckUser I see the GeorgeHome file got created.

EDIT: After rebooting the router the GeorgeHome file disappeared and never showed up again :frowning:

One more thing I noticed, when I log in to my hub the URL starts
https://graph-na02-useast1.api.smartthings.com

Should I use this link instead of https://graph.api.smartthings.com in the script?

EDIT2: Looks like my init-start script doesn’t work properly
I just copy/pasted the code posted, or should I replace those 5 * in each line with something else?

Thanks

sorry been out for the day.

your URL’s should all use https://graph-na02-useast1.api.smartthings.com as this is your shard.

the init-start script should work if you have enabled execute permissions using chmod as per the instructions. you should only execute the init-start once as it enables the CheckHome to run every 15 mins. but unless you have the correct URL in the CheckUser Script you wont see anything happening.

but as for the token and app id, the screen has changed slightly but those values are correct.

1 Like

I’m a bit confused now …I know you can see that :slight_smile:

I replaced all URLs in the CheckIfHome file
left this script as is without any editing
#!/bin/sh
cru a CheckIfHome "* * * * * /jffs/scripts/CheckIfHome"
cru a CheckIfHome15 "* * * * * sleep 15; /jffs/scripts/CheckIfHome"
cru a CheckIfHome30 "* * * * * sleep 30; /jffs/scripts/CheckIfHome"
cru a CheckIfHome45 “* * * * * sleep 45; /jffs/scripts/CheckIfHome”

enabled execute permissions using chmod as per the instructions
and I still get the error ./init-start Line 1 CheckIfHome not found

Once again the GeorgeHome file is there but if I disable wifi on the phone it doesn’t get deleted (waited several minutes)

ok what do you get when you type

cru l

and also

cru --help

the only thing i can think is maybe the double quotes are not copying in as the correct quotes. make sure you copy from the github raw page

1 Like

Did it Raw when copy/paste your code

sorry can you repeat the command

cru l

that is not a pipe symbol in the command but a lower case L

1 Like

oops, sorry, will do

ok strange because you have the all the entries with exception of the first. so try just the following command by itself

cru a CheckIfHome “* * * * * /jffs/scripts/CheckIfHome”

1 Like

Nothing happened, just got cursor back