Smartthings and Tasker


(Rick Johnson) #1

I have Tasker and SharpTools on my android phone. Im having trouble figuring out how to turn on a light in smartthings when I connect to my WiFi
I have registered ST in SharpTools so I see all my things (switches)
In Tasker I have gone to Event - Plugin - Sharp Tools - Thing State
Then in Configuration under Optional Filters I have typed in the name of my lock in ST
Then Im lost
Rick


(Joshua Lyon (SharpTools.io Dashboard)) #3

Rick-
Did I understand correctly that when your mobile phone connects to your WiFi then you want to have a light turn on?

If so, you’ll want to setup a Tasker profile with State → Net → WiFi Connected as the trigger and then in the Task you’ll create an action with Plugin → SharpTools → A Thing to control your light.

The following article might be helpful in describing how to setup a WiFi based trigger. The article also includes steps on how to setup a Simulated Presence sensor which isn’t relevant in your case, so you can skip that part. Focus on the part that starts with “Create a context for entering/leaving your defined area” then in the next section for setting up the Task, choose to control your light instead of the Simulated Presence device as noted in the article.


PS. The Thing State plugin is used when you want to react to state changes of your SmartThings devices - for example, you might want to display a notification on your phone anytime the front door is unlocked.


#4

Why not do this and core and keep it all within smart things?


#5

to add to this, you can long press on the action you’ve created and create an exit task so that you can shut the light off when disconnected from wifi. Just keep in mind if your phone shuts off its wifi when not in use you might get some unintended triggers, in that case using “WiFi near” in place of “WiFi Connected” should fix that.


(Rick Johnson) #6

Thanks guys for the reply. Joshua I used the link you provided and got it working great. Actually it was a Lock so now when I drive in the driveway my lock unlocks. Thanks
I don’t suppose there is an easy way to get notifications when the Smartthings lock is unlocked
Rick


(Jason) #7

I use Sharptools, Tasker, and AutoNotification by joaoapps to get notifications when my garage door opens and closes. You don’t have to use AutoNotification but I like to be able to have more control over it than the built in notification from Tasker.


#8

You could create a custom monitoring rule in SHM, it keeps it simple and wont require any 3rd party services.


(Joshua Lyon (SharpTools.io Dashboard)) #9

The link from the PS part of my original message has you covered. In the main SharpTools UI long press on the lock and subscribe to the lock attribute. Then in Tasker create a new profile with Event > Plugin > SharpTools > Thing State and enter your lock name as the name and ‘lock’ (without the quotes) as the attribute name. Then in the Task for the profile you can use Alert > Notify to creat a notification with the desired variables (eg. %st_attr_value).

Or as others have mentioned, you can use alternative approaches like the native monitoring in SHM, but the notification will be limited to what you get out of the box.

For example, one of the benefits of the Tasker approach is you can add action buttons - for example quick actions to lock or unlock the door.


(Rick Johnson) #10

Thanks for all your suggestions
I have set up tasker so when its near my WiFi my lock will unlock
It works for the most part but I find when I wake my phone the lock/unlocks
Any way around this. Im afraid that if It rings in the middle of the night and i pick it up my lock will unlock
Rick


(Charles) #11

I put ST in a “Sleep” mode when I go to bed. If you do something similar, Tasker could make the mode a condition of executing the task. Or… just a simple time check based on whatever normal bounds make sense to not be acted upon.


#12

You could use your phone’s presence as a condition


(Rick Johnson) #13

David thanks
Can you elaborate on that a little


(Joshua Lyon (SharpTools.io Dashboard)) #14

There’s a really good community profile which uses phone presence (geolocation) to trigger events.

Using WiFi Connected can cause unexpected triggers as the phone disconnects and reconnects to the WiFi. Using WiFi Near is a step in the right direction as it just depends on being in the proximity of the WiFi, but it’s still subject to the phone losing visibility of the WiFi for a blip of time and causing a retrigger.

Geofences take that a step further and check to see if you are in a particular area before being triggered. Quality geofences use a fused location provider which combines WiFi, Cellular Towers, and GPS to balance accuracy with battery life.

The profile that @destructure00 put together takes it a step further with concentric geofences that fine tune accuracy and battery life for a really effective presence solution. The beauty of this is he has done the heavy lifting, so you just need to follow his instructions to create the profiles.


#15

Josh’s solution will be more robust, that’s actually very similar to how I handle presence sensing and it works great. Another option would be to set a variable in tasker based on the status of your phones presence in ST. You would need to make another profile to control the variable --> event > plugin > sharptools > thing state (or mode change if thats what you want your condition to be) > for the name enter the name of your phone as it appears in sharptools > create a task > variables > set var > for the name use something like %Mypresence, set it to %st_attr_value. Next if you disable beginner mode in tasker you should be able to see your variable listed and its value should be the last event state of your phone (you might have to leave/arrive before a value is set)

Now go back to your task that you are using to unlock the lock and add the if condition %Mypresence ~ Not Present


(Rick Johnson) #16

Guys Thanks for your suggestions but Im lost (sorry) Im trying with Josh’s suggestion but the link with the instructions leaves alot of info out
I have gotten to 3-b Action 2: Sharptools - Thing: YourPresenceSensorName, Command: departed, If %PACTIVE !~
I take it Im suppose to create before hand a pressence sensor in Sharptools


(Joshua Lyon (SharpTools.io Dashboard)) #17

The first section called Configuration is more like a short-hand version of the steps.

The section a bit further below titled Detailed setup steps walks through the details starting with creating the virtual presence sensor, installing the apps, authorizing SharpTools, Setting up AutoLocation, etc. etc.

To be fair, it is a large number of steps and can be a bit daunting. Feel free to post in either thread if you need help.


(Rick Johnson) #18

Thanks
I didnt scroll down far enough


(Rick Johnson) #19

Im having a little problem with AutoLocation.
I open "Tasker to find Home not on
When I open AutoLocation and check Manage Geofences sometimes all 3 will be outside (even though Im home) I have to click on a couple before they will change to inside then in Tasker Home will turn green. Most of the time its the first fence I created the little blue dot will be over a mile from where I actually am
Whats going on
Thanks
Rick
P.S. I have noticed that if I leave AutoLocation open to the map of the first fence it will eventually adjust but sometimes up to a min. But even that will not last Ill then open up Tasker and soon after the Home will go Black again because the fence has gone to outside againj


AutoMagic Premium
(Scott H) #20

I like the idea of multiple entry/exit borders, but I hate paying for apps that are no longer being developed. AutoLocation hasn’t been updated since 2014. I think I can do the same with Automagic (also saving me the cost of buying Tasker, since I’ve owned/used Automagic for a few years). I’ll see if I can use the concepts here to come up with a solid Automagic solution to share.


(Nick_S) #21

Hi guys, a little off topic but wasnt sure where else to post.

For some reason I seem to have lost my connection between tasker and smartthings…from within sharptools I can access everything alright, but as soon as I try to create routines turning lights on/off or start modes in ST, nothing happens.

Anyone else have siilar problems?