Presence tom-foolery


#4

Interesting and thanks for sharing!
Seems all roads to wifi presence lead to needed an Asus Router - anyone tried anything on a Netgear?

Also seems beacons are faster but the range is often variable (for example last night i was woken up to my phone alerting me that I had suddenly entered the study - left voice on for testing lol)

What do people use to connect beacons to smartthings? I have found IFTTT web hook delay a good 15 mins. Beaconthings development seems to have stopped and I can no longer configure the app on iOS 11.


#5

Im on a netgear router, you basiclly need anything that can run dd-wrt, asus-wrt or tomato. I have the blackhawk(R7000) for reference. Just check your routers compatibility with any of these.

Bluetooth gets me noticed in 15 seconds worst case scenario and wifi in 30secounds once i’m connected.

When i had my ISP’s provided router, i had 4 rpi zeros doing bluetooth detection and they covered my house pretty well with no blindspots. When i got my R7000 router i decided the rpi’s could be used for something better and had to buy a router anyways.


#6

nice - i’ve got an R8500 - i’ll have a look in more detail - the DD-WRT looked a little on the scary side initially.

I’m assuming you just need to be able to ssh, pull down a specific app and call a web request when a mac address is present?


#7

ok so DD-wrt is installed, and is a little daunting at first, as there is at least 90% of settings on each page i don’t understand.

That said, enabled SSH and now managed to SSH to the router.

Did you write anything custom, did you use some existing code?
Also do you send web requests? is there a way to trigger smarttings locally without having to hit the web? in what i’ve read so far it seems cloud only

EDIT: https://community.smartthings.com/t/release-asuswrt-wifi-presence/37802
but uses a smartApp - i’m thinking it would be quicker to trigger a piston directly in WebCoRE?


#8

How familiar are you with linux? like are you familiar with Nano?


#9

errrm i can get by (barely :wink: )
my thought was create the file using nano, but in the asus-wrt its located /jffs/scripts/ so need to do a little checking as to what other changes to the code is needed.


#10

does the command “wl -i eth1 assoclist” bring up the connected devices?


#11

if it does I can send you my version (anonymised) for reference, you would just need to get the right HTTP trigger from WebCore and your mac addresses for it to work


#12

i get a list of mac addresses indeed, however my phone is not one of them

It is however on eth3
(this router has a 2.4Ghz and 2x 5GHz) - for simplicity up to this point i’ve been using the same SSID and WPA2 key for all, so i imagine i’d need to check all 3.


#13

yes please, that would be VERY helpful -thank you!


#14

Yup I only have 2 but its good news. Did you enable JFFS in the dd-wrt setting?


#15

i did. i think i’m ready to rock…


#16
#!/bin/sh

Person1=Away

macaddress="wl -i eth1 assoclist wl -i eth2 assoclist"

case “$macaddress” in XX:XX:XX:XX:XX:XX)
Person1=Home
;;
esac

case “$macaddress” in XX:XX:XX:XX:XX:XX)
Person2=Home
;;
esac

if [ “$Person1” = Home ]
then
if [ ! -f /jffs/scripts/users/Person1 ]
then
touch /jffs/scripts/users/Person1
curl -X POST https://graph.api.smartthings.com/xxxx(Trigger Arrived)
fi
else
if [ -f /jffs/scripts/users/Person1 ]
then
rm -f /jffs/scripts/users/Person1
curl -X POST https://graph.api.smartthings.com/xxxx(Trigger Left)
fi
fi

if [ “$Person2” = Home ]
then
if [ ! -f /jffs/scripts/users/Person2 ]
then
touch /jffs/scripts/users/Person2
curl -X POST (Trigger Arrived)
fi
else
if [ -f /jffs/scripts/users/Person12 ]
then
rm -f /jffs/scripts/users/Person2
curl -X POST (Trigger Left)
fi
fi


#17

Sorry this sucks, i’ll pull the file directly


#18

cool, thanks! - my thinking right now is you can only hit a URL per piston (unlike sending a GET with a header or variable)
so do you create a piston per action, so 4 pistons
Person 1 arrives [sets presence for person 1 present]
Person 1 left [sets presence for person 2 not present]
Person 2 arrives
Person 2 left


#19

Nope, as a condition set IFTTT as the device (Virtual Device) and you have a URL at the bottom. you just put a Value, Example Person1Left and it give you a URL. You can put them all in 1 piston.


#20

EDIT; used VI

i’m assuming with the direct POST to the webcore piston you havent used the SmartApp.
How do you get the script to poll/run every few seconds, or when mac addresses change?


#21

I have also been using


For presense detection. It has been rock solid for months. Smartthings actually has been pretty good as well. I actually have two presense sensors for myself the Wi-Fi and the Smartthings. I have a couple pistons that only run based on wifi. Like unlocking my door when I get home. That way I have to be right at the house, vs 500 ft away for the door to unlock.

Here was the final script that I came up with based on several of the comments in the thread for my router.


#22

I have an Ubiquity setup in my house consisting of a USG Pro 4, Unifi 16-150w, 4 UAP AC Pro and a AP Mesh Pro. I have a ruby script running on a local server that uses the Unifi API to poll my network for mac addresses. This was actually quite a pain because devices don’t always tell the network they left and such, but after a lot of tinkering I managed to get something working.

I’ve linked a gist here with my script, but I’d highly recommend you use it for inspiration since I wrote it with my custom needs in mind. It uses a YAML file to load the MAC addresses and users and I use the ASUSWRT Wifi Presence Smart App / Device to make it all work.

The YAML format is like this

johndoe:
  mac: xx:00:xx:00:xx:00
  app_id: xxxxxxxxxxxxxxxxxxx
  access_token: xxxxxxxxxxxxxxxxxxx

#23

Spent quite some time trying to make this work, three reasons, firstly my ST presence sensor gave up on me, secondly I found the ST app mobile presence functionality unreliable, and finally I wanted to detect presence of other family members without them having to have the ST mobile app installed, and access to mess up my settings etc.

So after some trial and error with a few options i have ended up as follows

An Automate flow - http://llamalab.com/automate/ - (i created the flow) running on everyone’s android devices (no IOS) which based on a change in Wi-FI and a short delay will detect the current location and if inside/outside the defined area will call a webcore piston via the execute endpoint which then sets a custom presence device handler (Virtual Presence Plus by Austin Pritchett with a few updates). Each family member has their own presence device created in ST. For a more accurate arrival I have set the Automate flow to bypass the location detection if connected to the home Wi-Fi.
I’ve been running this for a few weeks, and it seems reliable. The implementation isnt entirely straight forward, but doesnt involve a huge amount of development.

Drawbacks here would be if a phone was left at home, or was switched off (my kids never switch their phone off/leave it behind!) when leaving/arriving, but would be corrected when the phone was powered again. And if all else fails the presence of the individuals can be overridden through the ST app presence device which i have complete control over.