Good Evening everyone!
I hope this day finds you well. I’m here to introduce a new project that I and another developer (Ethan Seth) are working on. This project utilizes a few components that are very specific, so I would like to first apologize to the large portion of you for whom this will not work for sad face is sad.
Wifi Routers IN YOUR AREA, they do not have to be your own.
This will require some hands on, but I’ll try to be as specific as humanly as possible. Those of you who are much better at developing, please, feel free to pitch in. This is more a community project than it is a personal one.
PURPOSE: The purpose of this project has been a long time dream of mine. I have always wanted to have the ability to ask my smart house, “Where is [item name]?” and it could say, “At the living room couch, of course.” I’d love for this particular system to become much more granular, but so far I haven’t been able to get it more granular than being able to find accurately a certain side of a certain room, and sometimes that’s a bit flaky. Either way, this is still way more accurate than any other system I’ve found out there. what’s more, it’s expandable.
Let’s get started.
STEP 1: Go ahead and grab the mobile app. You can find that here: https://play.google.com/store/apps/details?id=com.hcp.find
STEP 2: Go through the process of creating your locations. NOTICE: Ensure you already have as many Access Points you want setup as possible. This system uses wireless routers to triangulate your position. This includes other people’s routers, and it doesn’t have to be on any router in specific, or any at all, but wifi on your device DOES have to be turned on.
To do this, go to your location, and click “Learn”, name your location. Let your phone sit there for about five minutes. Then click “Stop Learning”. THEN and only after you’ve “stopped learning”, move to your next location. Repeat this for every location you want, then move to step three.
STEP 3: Create Virtual Switches for every location you’ve made. This can get quite numerous depending on all the locations you have, but bear with me. If you don’t know how to create a virtual switch, please go to https://graph.api.smartthings.com/ and click on “my devices”. Here you can create a new device, scroll down until you find “Simulated Switch”.
STEP 4: Grab the Smart App. Because this is so hands on and not automatic, it’s not just “install” and move on, you have to edit this smart app to your specific settings. https://github.com/lozaning/SmartApps
In order to install this, again go to the graph.api page, and click “My SmartApps”, then click “New SmartApp”. Copy and paste the smart app code. Here is where you’ll need to make changes: EVERYWHERE. Hopefully you don’t have as many locations as I did (I had over 30).
-In the top section starting at line 14, you’ll see preferences. Each of these “sections” needs to be reflective of your simulated switches you created in step three. You can name the input section anything you like (i.e.: upstairsCabinetSwitch can also be usCbSwitch)
-In the def whatRoom section (starting at line 49, you’ll want to input your group and username. These can be found in the FIND ANDROID APP.
IMPORTANT NOTE: This api seems to be somewhat quirky. I don’t know why, but as I was getting assistance with some developers, we found that the api flipped the username from all caps to lowercase and back again. Not sure why, but if you get “null” errors in your logs, this may be why. This change should occur at line 65, NOT line 53.
-Next is the “fun” part. If you’ve got a lot of locations like me, this is going to take you a little while. Best of luck. Starting at line 81, you have a series of if, else statements. Each IF and ELSE statement needs to include ALL of your switch handlers that you identified earlier. Every “ELSE” statement needs to have ALL the switches as off except the switch the else statement is about, that one should be “on”. You should repeat all this for every location you have. If you ever add a location, you’ll have to come back to the app and make all these changes again. It’s a hassel, I know.
When you’re done with that, click “Save” and carry on to “Publish > For Me”. If you didn’t change the name of the app in line 2, it will be Location Tracker IIII.
STEP 5: Open your mobile app (android or iphone works for this portion, but the tracker only works for android), go to “Automations”, then “Smart Apps”, then “My Apps” all the way at the bottom, search for the app you just made, and select it. Here, you’re going to choose all the Switches you created in Step Three. Make sure the switch corresponds with the item you’re selecting it for. Name your app and click save until you’re back at the home screen.
TEST: If everything is done right, when you open the tracker app and click “track”, it should turn one whichever simulated switch you’ve corresponded to your area. Well, this is fun and dandy, and if this is as far as you wanted to go, then that works fine. keep in mind you’ll probably have to create a new app setup AND simulated switches for each individual and item you want to track. (ugh, there’s gotta be a better way to do this!)
If you want to do MORE with this, then let’s carry over to step six!
STEP 6: Head on over to https://wiki.webcore.co/ and follow the instructions they’ve laid out to have webCoRE installed. If you already have it installed, head over to step seven.
STEP 7: Open up the mobile app, go to automations, then to SmartApps, then MyApps, and install the webCoRE apps. Then go back to the automations>SmartApps section, and click “webCoRE”. here you’re going to install a new piston. Select all of the simulated switches you created in Step Three. Once you’re done, head over to dashboard.webcore.co and click “Add a new piston”, then select “</> Create a blank piston”. The defaults should be fine unless you want to change the name of it. Doesn’t matter unless you intend to come back here again.
STEP 8: Create an If, Then, Else statement. The initial if condition should be:
Physical Devices: Select all of your simulated switches
Which interaction: Any Interaction
What kind of comparison? Change to
Compare to: Value | on
Next you should see “with”, and you should choose under devices:
Then under do, I’m going to be sending an IFTTT maker request. So let’s pause a second and make sure we have that setup (if you don’t already). You can save your piston and come back to it if you haven’t already set this up.
STEP 8a: Configure IFTTT
Go back to dashboard.webcore.co and then go to ‘settings’ on the left hand side. Click interactions, and then click in the IFTTT webhooks url section. You can get this URL from here: http://www.ifttt.com/maker. That url is your url, do not share it with anyone else.
Click apply and carry on.
Back to STEP 8:
Do: location Send an IFTTT Maker Event…
Event: Value | EricLocation (This is what your maker event will be, make sure you have this saved, you’ll need it later)
Value 1: Value | device $currentEventDevice
For values 2 and three leave as nothing selected.
Choose whatever mode you want to use this for, if any.
So you’re done with webCoRE for now, you can save it and go over to look at it’s logs as everything else happens.
STEP 9: Configure IFTTT’s applet
go to www.ifttt.com and create a new applet. Search for “Webhook”, and make sure the event name is what you created a few minutes ago. Mine was EricLocation…
Then, do whatever you want with that information. If you want to send another webook out to a server or app you’re working on or whatever, you can do that, whatever you want. Me personally, I’m just testing it so I’m sending myself a text with it. That’s pretty much it. Hopefully everything works out alright with you guys and we can get this working for you.
I hope over time we can make this much more dynamic and acceptable, and maybe get a live tracking map, and maybe fix this so we don’t need to make a ton of virtual switches. From what I’ve seen, this setup is accurate at least up to which room you’re in. I’ll still be testing to see if I can get it more granular, but we’ll see.
Anyways, good luck, let me know if you guys want to participate any