Presence tom-foolery


#1

Hi everyone,
This is one of those things that I keep trying to address and keep falling back to mobile (but eats battery)- and then work gets in the way lol.

So i’d Love to hear your presence options? If you use the following, how - if not what do you use reliably?

As far as i’m Aware:

  1. Smartthings presence sensor (fairly big and variable delay)
  2. Phone and GPS (eats battery)
  3. Ibeacons (RAD beacons show promise with an iPhone app - but app development seems to have stopped) - would be cool to do room presence by BLE.
  4. WiFi (just started looking at a way to trigger presence of a MAC address is on the network).

Really keen to hear your thoughts as this community seem to be always pushing to find the best solution.


#2

theres webcore ios and android app coming from @ady624 which will fix presence detection for ST. its in early closed beta now but should be available for a wider beta within the next month or so.

see more here:

https://community.webcore.co/t/webcore-mobile-app-ios/273

and here:

https://community.webcore.co/t/webcore-mobile-app-android/274


#3

I use Wifi + Bluetooth (Wifi is a script that runs on the router and Bluetooth runs on rpi)

So I have a a RPI zero at the closest point to my parking spot (http://www.instructables.com/id/Raspberry-Pi-Bluetooth-InOut-Board-or-Whos-Hom/) adapted to send a webrequest to WebCore) as my cellphone (which i set to hotspot mode in my car) takes too long to shut off the hotspot + connect to wifi to have a good entry routine.

The wifi at home is pretty good but the bluetooth detection range is not (15 to 30 feet depending in which room i’m in) so the router also sends webrequest to WebCore using this: (https://community.smartthings.com/t/release-asuswrt-wifi-presence/37802/2)

Both webrequests activate the same variable, which requires being false 2 minutes to put the presence sensor at AWAY and instantly put it at present if it becomes true. Its been 100% reliable for me once I trained my wife to not put her phone in airplane mode at night


#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?