Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

Android phone key work around with Tasker?

This site may earn commission on affiliate links.
I'm a big Tasker fan & I've been using it for years. I already set up your idea on my phone to see about battery impact & make sure that I don't have any other issues. So far so good but I'm still waiting for a VIN. I'll definitely check back when I get my car. Thanks for posting this.
 
I'm a big Tasker fan & I've been using it for years. I already set up your idea on my phone to see about battery impact & make sure that I don't have any other issues. So far so good but I'm still waiting for a VIN. I'll definitely check back when I get my car. Thanks for posting this.

I hope it works. You have much more experience with Tasker than I do if you've been using it for years. Maybe you can help refine it as well as there are still a few glitches.
 
I'll keep you posted on how this works for me...as soon as I get my 3 back..been at the SC for a week now, getting the computer replaced. They told me it should be ready by the end of the day today.

The Tasker profile is running perfectly, so I have high hopes that this works for us .. I owe you a beer or 6 if this works
 
I hope it works. You have much more experience with Tasker than I do if you've been using it for years. Maybe you can help refine it as well as there are still a few glitches.
I'd be happy to. I've never done it but I think you can save profiles and copy them to other phones. Maybe we can refine it and upload the result so everyone can just download it. The only problem is that then we'll have to provide technical support & there's a good chance that our solution won't work on every phone.

By the way, the best ones that I've done in the past evolved exactly how you've been working on this one... lotsof ttrial and error. You're certainly on the right track IMO.
 
Interesting thread....

Something on note that my friend found as part of his issue with the Pixel 2 XL....

He has an Android Wear watch and it connects via Bluetooth LE....

Anyway.... Whenever he wears the watch, he has issues with the car connect as the watch appears to block the connection with the car...

When he doesn't wear the watch, he doesn't have an issue... Strange...
 
I'll keep you posted on how this works for me...as soon as I get my 3 back..been at the SC for a week now, getting the computer replaced. They told me it should be ready by the end of the day today.

The Tasker profile is running perfectly, so I have high hopes that this works for us .. I owe you a beer or 6 if this works

I sure hope it does. The phone key is much more reliable now compared to without running Tasker. I went from around a 25-30% failure rate to 5% or less with every refinement improving success.
 
Interesting thread....

Something on note that my friend found as part of his issue with the Pixel 2 XL....

He has an Android Wear watch and it connects via Bluetooth LE....

Anyway.... Whenever he wears the watch, he has issues with the car connect as the watch appears to block the connection with the car...

When he doesn't wear the watch, he doesn't have an issue... Strange...

The phone connects to the car as a key through Bluetooth LE. The regular connection for phone calls and to stream media is standard Bluetooth, like headphones or a speaker. I'm not at all familiar with how any Bluetooth protocols work, but I'd bet there's a conflict that only allows this Pixel 2 XL to connect to one BLE device at a time and if the watch is already occupying the connection, the phone won't try to connect to the car as well.
 
I'd be happy to. I've never done it but I think you can save profiles and copy them to other phones. Maybe we can refine it and upload the result so everyone can just download it. The only problem is that then we'll have to provide technical support & there's a good chance that our solution won't work on every phone.

By the way, the best ones that I've done in the past evolved exactly how you've been working on this one... lotsof ttrial and error. You're certainly on the right track IMO.

Yeah...I'm definitely not providing any support for this. It's difficult enough to get the basic working on my own phone, much less that dozens of Android variations out there. I'm happy with the way it's working but it's taken a lot of hours to get it that way. I already made tweaks to the second profile I posted recently. It's simpler to run the action as an Exit Task when Bluetooth becomes disconnected from the car instead of trying to tie it into power state and use Invert commands.
 
Yeah...I'm definitely not providing any support for this. It's difficult enough to get the basic working on my own phone, much less that dozens of Android variations out there. I'm happy with the way it's working but it's taken a lot of hours to get it that way. I already made tweaks to the second profile I posted recently. It's simpler to run the action as an Exit Task when Bluetooth becomes disconnected from the car instead of trying to tie it into power state and use Invert commands.
Agreed. Exit Tasks are the way to go. I just got my VIN today so I might be able to work on this in the next week or two... unless I'm just out driving all the time. You might have to give me a few days after I get it.:D

I'm happy to test and assist but I think what you've done is really good. Other than minor tweaks (like the Exit Task that you mentioned), I bet I won't be able to improve much on what you've done. Everyone will have to see what repeat interval will be the best for their phone but that's probably the only customization that will need to be done (if even that).
 
Another update: Since implementing the second Tasker profile to toggle Bluetooth off/on after it disconnects from the car, I have had no further failures to unlock the car in any of the situations that were troublesome for me before. I've not needed to tinker with Tasker or had to manually toggle my Bluetooth off/on to get it to connect. I've not had to reboot my phone, put it in airplane mode, restart the Tesla app, mess around with batter optimization settings, or perform any of the other suggested troubleshooting steps. Literally nothing. It just works now and I'm much happier.

To summarize:

Profile 1: Toggles Bluetooth off/on automatically every hour:
  • Purpose: Refreshes the phone's Bluetooth so that it is prepared to connect to the car at all times
  • Will not toggle Bluetooth if already connected to another device (keeps it from disconnecting when already connected to the car or using any other Bluetooth device)
  • Will only run when Bluetooth is already on (keeps it from turning Bluetooth on if I've manually turned it off)
  • Will not run if phone plugged in and charging (not a necessary condition, but I find no need to toggle Bluetooth off/on if my phone is plugged in overnight)
  • Every hour may be too often, but there's no noticeable effect on battery life, so I'm not inclined to test out what the minimum interval is because it's working.
Profile 2: Toggles Bluetooth off/on after disconnecting from the car after a delay of 10 seconds
  • Purpose: Squashes the bug where when using walk-away lock, going back to the car after barely walking out of Bluetooth range does not allow the phone to reconnect as the key.
  • After the car's Bluetooth is disconnected from the phone, Tasker waits 10 seconds, then toggles Bluetooth off/on, refreshing the phone's ability to reconnect to the car. The delay is needed because without it, Bluetooth will toggle as soon as the Bluetooth connection is dropped, then try reconnect to the car instantly. Sometimes it's successful, which put the phone in a weird state where it shows it's connected, but it's not.
Instructions are in the posts above. No guarantees it will work with your specific phone, but on my Pixel 1, it's been flawless. I'll update again any new situations that arise that need troubleshooting.
 
I've been running the first profile on my Pixel XL for a week or so. It's been doing pretty well, but I've had to pull my phone out a couple of times and had to toggle Airplane mode this morning. It has been better, but I'm not having the same luck as you. I also have a Moto 360 paired with my phone, so who knows if that somehow causes issues or not.
 
I've been running the first profile on my Pixel XL for a week or so. It's been doing pretty well, but I've had to pull my phone out a couple of times and had to toggle Airplane mode this morning. It has been better, but I'm not having the same luck as you. I also have a Moto 360 paired with my phone, so who knows if that somehow causes issues or not.

I think someone replied in one of the other threads that the phone key in general isn't as reliable when a smartwatch is constantly paired to the phone. On the other hand, I also remember someone saying they had no issues at all when a smartwatch is paired because it constantly pings the Bluetooth connection, so who knows. All part of trying to get a finicky system to work.
 
Since I got my car, my phone (also a pixel) has not been working as a key. I tried turning off battery optimization for the Tesla app and running the tasker profiles as SDKoala suggested with some success but most of the time, it still did not work. For the past few days I have had to manually unlock it using the app.

I noticed that if use a bluetooth LE scanner to trigger the bluetooth radio then go to my car, it works. However, this is not a practical solution and almost takes as long as opening up the app.

Last night I was watching a clip about google I/O and discovered that android P beta is available. I opted in, installed the beta and so far the key works as long as the screen is on (even if it is unlocked). I also turned battery optimization back on for the Tesla app, disabled the tasker profiles and rebooted my phone and it seems to still work just as well.

I am guessing (hoping) they have resolved some issues relating to background task scheduling/management and with the bluetooth LE stack. Hope this helps others who are still dealing with this issue.
 
Since I got my car, my phone (also a pixel) has not been working as a key. I tried turning off battery optimization for the Tesla app and running the tasker profiles as SDKoala suggested with some success but most of the time, it still did not work. For the past few days I have had to manually unlock it using the app.

I noticed that if use a bluetooth LE scanner to trigger the bluetooth radio then go to my car, it works. However, this is not a practical solution and almost takes as long as opening up the app.

Last night I was watching a clip about google I/O and discovered that android P beta is available. I opted in, installed the beta and so far the key works as long as the screen is on (even if it is unlocked). I also turned battery optimization back on for the Tesla app, disabled the tasker profiles and rebooted my phone and it seems to still work just as well.

I am guessing (hoping) they have resolved some issues relating to background task scheduling/management and with the bluetooth LE stack. Hope this helps others who are still dealing with this issue.
This is very encouraging. I have the app not optimized for battery and SDKoala's first profile in, but still have the occasional key failure, may be once every few days. Is Android P a good daily driver yet on the Pixel 2? In the past the developer previews have had Bluetooth issues so I avoided getting on the beta.
 
@SDKoala I tried messaging you directly but you seem to have blocked that off. Maybe better that way so others can chime in. Here's my message:

Hey,

I'm starting to see failures with phone key. Not a lot, but not 100% success, so I'm now onto the "next bottleneck." Decided to mess with tasker and re-read your original thread on how you did it.

I noticed that there is a profile condition called "Bluetooth Near." And it has an option to look for nearby BLE devices. Unfortunately you have to specify the MAC address for the device it's near, and the phone only provides the regular BT MAC, not the BLE MACs in the car.

I've seen screenshots where iPhone users can see all the MAC addresses of connected devices, including BLE. I'm wondering if there's a way to get that info in Android, or if I have to resort to setting up my wife's iPhone as a phone key.

If I have those BLE MAC addresses, seems like I can have tasker do a BT toggle as soon as it detects proximity to any of the car's 3 or 4 BLE radios. This assumes of course that the phone can even see those radios when it's not working as a phone key. I think it's worth trying.

In the BT Connected state, there's an option to enter MAC addresses as well. Perhaps it's enough to just build the profile you made but make the detection on the BLE MAC instead of the regular MAC. For example:

Profile = BT Connected [Inverted] [BLE MAC] + [Time Interval]
Task = [BT Toggle]

This would toggle the BT radio any time it detects there is no BLE connection with the car, at the time interval you specified. It would obviate the need for your secondary profile that prevents the toggle when you are standing outside your car. Now to see if I can get those BLE MAC addresses.
 
@SDKoala I tried messaging you directly but you seem to have blocked that off. Maybe better that way so others can chime in.

As far as I can tell, there's no native way to see the MAC addresses for BLE devices. There's an app in the Play Store that will do it: BLE Scanner. I already had the thought to tie the Tasker actions to the BLE MAC addresses but didn't pursue it when I stopped having trouble.

I read there are inconsistent results using the BT Near state in Tasker so I never tried it. I'm actually having better luck without the second profile to toggle BT when disconnecting and stopped using it.

It's actually since revisiting the battery optimization at your suggestion plus the recent update which has really stabilized the phone key.
 
SDK,

I finally have my car and the phone as key is working great so far 4 days in. My only failure so far was when I had intentionally disabled bluetooth earlier and then forgot that I had done so when I walked up to the car. Once I figured it out and turned bluetooth back on, the car let me in within a few seconds.

I preemptively disabled power saving on the app and used your Tasker profile for the periodic reset. I mentioned that I have a lot of experience with Tasker and you said that I might be able to help you improve it but I don't think I would change anything that you've done. There's always things to tinker with the length of time for the reset (i.e. longer than 1 hour, etc.). But, if there's no noticeable impact on battery life then it's probably not worth putting much effort into that. I have not added the profile to reset bluetooth after disconnecting from the car yet. BTW, I have a Nexus 6p.

So, in short, good job and thanks for posting this solution. Hopefully it's helping people who have been struggling. I would recommend giving this a try to anyone who is having problems with an Android. Also, don't forget to disable power saving for the app. It makes a lot of sense that this would make a difference.
 
  • Like
Reactions: SDKoala
@SDKoalaI noticed that there is a profile condition called "Bluetooth Near."

One of the problems with the * Near profile conditions is they work on a scanning/polling interval. By default, the BT Near condition scans every 2 minutes while your phone is awake and every 10 minutes while asleep. Neither of those windows is good for something that would need to be instantaneous.
 
  • Informative
Reactions: SDKoala
It seems Tasker is a bit deficient when it comes to BLE. It wouldn't need to poll if it allowed you to specify a MAC to look for. Right now, when you do that, it will say that the specified device is not paired therefore the profile will never activate. That's stupid, particularly with BLE devices. Instead Tasker makes you specified that this is an unpaired device, and it has to do a full scan. Maybe this is an Android limitation.

Anyway, this weekend, I got the BT Near profile working. It's not ideal, meaning I can't just walk up to the car and Tasker will realize it. But it basically does the same thing as @SDKoala's - check hourly if it's near, and if not, toggle BT. It's working pretty reliably. I'm checking for the 4 iBeacon radios. Originally just looking at a single one, but lots of false negatives there due to intermittent signal strength. Overall though, I wouldn't recommend anyone else doing it this way. No advantage and more complicated.

I'm unable to set up a secondary profile to check for BT disconnection from car. Every single time, my phone fake reconnects to the car as soon as the toggle is complete. Doesn't matter the Wait I set. I think this behavior is what's working in my favor without the profile. I haven't seen the situation where phone key dies due to me hanging out at the threshold of signal loss.