Tasker & SharpTools on Samsung S22 w/ Screen Locked

I’m having a problem where my Tasker tasks will not successfully trigger SharpTools commands while the phone is locked. I’ve seen other complaints about Android doze, but in my case I’ve disabled doze for Tasker and SmartTools (set battery to not optimized for these apps) and I don’t think that’s the problem.

I have a Tasker task that sets a SmartThings presence sensor on/off based on my distance from home. It hasn’t worked reliably and thought it was Tasker not triggering the task. So I added a beep to the task, so after it triggers SharpTools to set my presence it beeps. It then waits 10s and if the presence is still not set then it runs the task again.

I’ve found if my screen is locked the task runs over and over, beeping each time, so clearly Tasker is triggering the task properly. However, the presence sensor is not getting updated so it keeps re-running. But once I unlock the screen, viola, the task succeeds and my presence is updated in SmarThings. Turning on the screen does not solve the problem, I have to unlock the phone for it to work. It clearly seems to be a problem with SharpTools, or at least the interface between SharpTools and Tasker.

Any ideas how to overcome this? Very frustrating!

Interesting. Can you export the projects and give me a link so I can test it on my s21?

I recently got a S22 as well and ever since I got it, my Flic button to trigger an Alexa routine, to trigger a virtual switch, to trigger my Smartthings garage doors… Is intermittently not working.
Sometimes I press the button and it reacts instantly, sometimes it doesn’t untill I unlock the phone and open the Flic app.

I’ll be trying to add the button again, see if that’s the problem. Or it could be related to your issue, since I don’t think it could be a Sharptools issue. My reasoning would be, Tasker is not sending out the actual request. I assume the beep is on your device, generated by Tasker, so it’s local. If the beep would be over a cloud system, it might not work either?

That could also be my issue, might need to check something like data useage permissions in background.

I suspect this could be the issue too. Some devices have become really aggressive with their battery management and even restrict network access when the phone is not actively being used. You might check to see if there are any power/network type settings that would let you bypass this.

I’ve made sure that tasker and SharpTools both are excluded from battery optimization and can use background data, even while data saver is on (which it never is). I’ll try adding another network call to my tasker task to see if it’s successful. I assumed the Tasker/SharpTools integration uses local communication and is not done over the internet.

SmartThings doesn’t offer a local REST API. Even their own mobile app goes through the cloud. Here’s a diagram from one of their presentations:

In my Tasker task I’ve tried replacing the call to SharpTools with an HTTP Request to IFTTT. We’ll see if it works without unlocking my phone.

BTW, I knew that SharpTools had to go out to the internet to trigger SmartThings. The question was whether Tasker has to go through the internet to trigger things in SharpTools or if it triggers them locally.

My new HTTP call to an IFTTT webhook bypasses SharpTools, so it will be interesting to see if it’s more reliable without unlocking the phone.

That process happens within the phone. Android has a concept called Intents which allow apps to talk to each other. Tasker sends an Intent to SharpTools to tell it to run the action.

After testing for over a week I’ve confirmed the following:

  1. Tasker has no problem making HTTP calls while the phone is locked. Since changing it to call IFTTT it’s worked flawlessly with the phone locked.

  2. SharpTools clearly has a problem when the phone is locked. I currently repeat my task every 30s until my SmartThings presence sensor is updated. It is clearly getting updated because I can see via the SmartThings or SharpTools websites. However, it doesn’t notify Tasker that the presence has changed until I unlock the phone. I don’t know if the problem is SharpTools communicating with SmartThings or with Tasker. But as soon as I unlock my phone it updates immediately.

I’ve tried adding to my Tasker task to open SharpTools. However, it does not help. I know it opened because when I unlock my phone SharpTools is in the foreground. This seems to suggest it is not a problem with doze since it’s running in the foreground. There’s something on the Samsung S22 that’s preventing SharpTools from communicating, either with SmartThings or Tasker, while the phone is locked.

My issue seems to have been solved by removing the bluetooth connections for my buttons on the phone and adding them back. Guess auto migration from an old phone doesn’t work for all things. So my issue was not related to yours.

Still interested in seeing what the problem might be.

On a side note, what are you using for present sensor? The built in Smartthings sensor for the phone doesn’t do anything for me.

I searched the issue a bit and came up with this you could check, apparantly it’s a common issue:

https://tasker.joaoapps.com/userguide/en/faqs/faq-problem.html#00

I am using the AutoLocation Tasker plug-in for determining presence. That works well and so does Tasker when my phone is locked. Only thing that’s not working is SharpTools is not updating the status of devices in Tasker when the phone is locked.

With the SharpTools Tasker plugins being sunset when SmartThings shuts down Groovy in September, you might consider switching to HTTP Actions in Tasker.

You could either do it directly with the SmartThings REST API or using HTTP Triggers with SharpTools.io Rule Engine.

I use the pushover plug in.

I took the plunge and completely switched over to Hubitat. The biggest reason is I heavily use WebCore and once ST turns off Groovy, WebCore will no longer work. I’m now using the HE Maker app to trigger things from Tasker doing HTTP actions. I’m also using the AutoRemote Tasker plug-in so HE can send messages directly to Tasker when events happen, like my garage opens/closes and my front door locks/unlocks. I’m finding the setup is much more responsive and works great with my phone locked.

I like that I can still use the SharpTools dashboard with HE. I have it bookmarked in my Tesla browser so I can control automation from my car and check to make sure my garage is closed and doors are locked.

Thanks for the help!