[OBSOLETE] ASUSWRT Wifi Presence

This is what i’ve entered in ssh via putty

curl “https://graph-na02-useast1.api.smartthings.com/api/smartapps/installations/xxxx/Phone/home?access_token=xxxx” -k

I masked the token and app id for this post.

This is the result:

curl: (3) Illegal characters found in URL

Try this

curl -H "Authorization: Bearer <Access Token>" -X POST "https://graph-na02-useast1.api.smartthings.com/api/smartapps/installations/<AppID>/away"

curl: (3) Illegal characters found in URL

I think you have a typo in your appID. it should all be a single command, not broken up like yours shows.

Also I’m sure it does not make a difference, but I’d set the time on your router to the correct time. Maybe a sync issue? Either way, cant hurt to set the right time

Paul! It’s the extra lines that went in when I copied and paste from notepad which I have format to word wrap… duhhhh! Stupid me. I’ve cleaned out the code and it worked as it should be along with smartthings app. I guess the firmware version doesn’t matter. I’ll update to 380.65_4 and see if it stays ok. Good catch! You saved me a lot of head ache:sweat_smile:

1 Like

I’d like to thank the creator of this awesome smartapp/DH, Have it working flawlessly and I’m liking it. Just 1 question though. I have a dual band router running on 2.4 and 5ghz I’ve also added a guest network for the visitors to access. The 2.4 and 5 band is detected meaning the people who connects to that their mac address is displayed running wl -i eth1 assoclist wl -i eth2 assoclist. What about guest network? I tested this when I connected to the quest network and my mac doesn’t show up in the list though I can see it via the router’s gui. How do I achieve that like for example I have a pet sitter who only connects to the guest network and I like to deactivate SHM when his/her wifi presence is detected?

@Theo_Gardener

if you want to evaluate macs on guest networks you need to run the following

wl -i wl0.1 assoclist

on my router

wl0.1 - wl0.3 are the three guest networks on the 2.4ghz
wl1.1 - wl1.3 are the three guest network on the first 5ghz band
wl2.1 - wl2.3 are the three guest network on the second 5ghz band

the commands will only work if the guet network is enabled and active, otherwise they will produce an error as the interface is not defined.

to figure out which interface a particular ssid will be assigned to regardless of it is enabled or not you can run

nvram show | grep _ssid

hope this helps

You nailed it… I got it to work. This is perfect during our vacation. No need for me to use my mobile to deactivate SHM for when pet sitter comes in. Thank you for this!

Oh, and I’m trying out your smartapp for the virtual switch. Have been toying around with it lately. Yours is to monitor your TV is on or off. I also am trying to implement the same thing but to wireless desktop. Tried looking for the virtual switch device in IDE but can’t find it. The only thing I could find is the simulated switch. Is that the one you are using or you created a whole new device handler?

Allan

@Theo_Gardener Yes that’s the one. The simulated switch is the virtual switch

I get this error:

{“error”:true,“type”:“AccessDenied”,“message”:“This request is not authorized by the specified access token”}

Pls disregard error above. This is actual error that showed:

{“error”:true,“type”:“java.lang.IllegalArgumentException”,“message”:“An unexpected error occurred.”}

You are using my tv detection smartapp aren’t you? Not the user presence script? Take note of the mappings and ensure the url you are sending is correct.

Yes I am using the scripts from your asuswrt-tv-on-off-check.src. That’s the only error that I see right now. I’m using the simulated switch from the IDE’s drop down list.

@Theo_Gardener my next question is when do you recieve the error? Presumably you have installed and configured the smartapp with your simulated switch. Is that error in the IDE under the smartapp header off the log when you attempt to send the web request?

To be honest I don’t use this anymore myself. As i don’t use smartthings at all now. I will see if I get the chance I will set it up again and check to see if it still.works

@Theo_Gardener ok i tested and yes indeed the smartapp i uploaded to github was incorrect. i have updated the smartapp just get the code from below and replace your existing code. and then it will work ok, there is no need to uninstall and re-install the app

Stuart! Thanks for taking the time correcting the script. All things working now… awesome job!

If you use the arp command instead as others have on here. That would I believe work for wired clients. However I had never done so and can’t attest to its reliability

Hi Guys, Just wanted to post here that I have blatently stolen your idea to get this working using PowerShell for my BT SmartHub/HomeHub 6.

2 Likes