• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Getting Tasker to recognize when I am approaching the car

defaria

Newbie
Aug 4, 2014
15
3
I have a very annoying problem with handing off the Bluetooth from my headset (LG HBS730) to my car's Bluetooth (2013 Camaro) and I was hoping that Tasker could fix this for me and it does... sometimes... Other times it fails to recognize when I am in proximity of my car. I'm using the BT Near option of Tasker.

My problem defined: If I get in the car and start it up but I forget that my LG HBS730 headset is currently connected to Bluetooth on my phone (Galaxy Note 3) then the car will connect the phone profile but will fail to set the media profile as connected. At this point I'm hosed. I cannot connect my phone's media output to the car's Bluetooth. Nothing helps. I can try to say "Connect the media profile to the car" from the Bluetooth settings on the phone - it will try for a second and fail. I can power off my LG. Doesn't help. Hell I can reboot the phone but that doesn't work either (IIRC - I really don't want to have to reboot my phone just to have it connect the Bluetooth to my car).

I've found that I can turn off the car and it's not until I open the door that the car relinquishes it's grip on the phone. I can watch my Bluetooth connections on the phone, turn off the car and sit there. It doesn't disconnect. Open the door - poof, Bluetooth connection disconnects. After that I have to wait for up to a minute or two before powering on the car again or the radio, and thus the Bluetooth too, or the car radio will come on immediately and the lock on the Media Bluetooth profile has not been disconnected. It's only after sufficient time that when I power on the car and my radio I see MyLink (Chevy's radio software) initialize as it displays it's splash screen. Then I know the Bluetooth media will connect.

So that's the problem. My solution has been to use Tasker. The task I set up when I'm in the car is:

1. Secure Settings - Headset (LB HBS730) - Disconnect
2. Secure Settings - Driving Mode - Enabled
3. Car Mode - On
4. Secure Settings - Camaro (Chevy Camaro) Connect/Auto BT

This task is triggered by "Approach Car" Tasker profile which uses BT Near based on my car's Bluetooth address. My observation is that as the MyLink software in the care boots, at some time a call is made to connect to any paired Bluetooth phones around. The car seems to desperately want to make sure the user can answer his phone. I think it attempts to connect the media profile only after the phone gets connected. I can sit in my car, listening to stuff on my LG headset, turn the car on and watch the boot sequence. Some time after the car is started, like 2-7 seconds, if my tasker task works correctly, my LG headset turns off and the car's Bluetooth connection gets established correctly. This is wonderful - when it works. Other times the LG headset never gets disconnected and I'm stuck as described above. The BT Near profile in tasker appears to be iffy to start with but I can think of no other way to program Tasker to say I'm near my car.

Now as I said often this works. But sometimes it doesn't. How can I configure Tasker so that it works all the time?
 
Hi defaria, and welcome to AF :)

That's quite an interesting problem. I haven't played much with the "Bluetooth Near" context - most of my in-car profiles make use of "Bluetooth Connected" instead. I'm assuming that in your case, it's already too late by the time your phone establishes the connection to your car - that is, it's already locked itself into the no-media Bluetooth connection state.

The BT Near context uses the scanning period defined at Menu / Preferences / Monitor / BT Scan Time. It could be that the period is adequate for most attempts, but sometimes the scan is too slow to catch your car's BT before the connection is established. You could try adjusting that Scan Time settings to see if a faster scan would work better - just keep in mind that more frequent scans will use more battery.

Another option may be to store the GPS location when you disconnect from your car so that Tasker will know where it is, and then use a Location context to trigger your BT profile instead of the BT Near state. Let me know if you need more information on how to make that work. :)

Good luck! :thumbup:
 
Upvote 0
Hi defaria, and welcome to AF :)

That's quite an interesting problem. I haven't played much with the "Bluetooth Near" context - most of my in-car profiles make use of "Bluetooth Connected" instead. I'm assuming that in your case, it's already too late by the time your phone establishes the connection to your car - that is, it's already locked itself into the no-media Bluetooth connection state.

Exactly. In general it's a bug in the Bluetooth implementation in the car for sure. THAT should be fixed but I have little hope of that happening.

I have another problem with this setup that tasker actually helped me verify. If I enter the car and leave my headset on and connected and think "I'm only going to the store - no need to connect the phone to the car - I'll just listen on my headset" and turn off the car radio I used to get a thing were every 30 seconds to a minute (it was never an exact amount of seconds) my playback would pause. I would hit the play button and playback would resume on my headset and then 30-60 seconds later it would pause again. Now mind you the car radio is off! But apparently the Bluetooth driver would periodically poll for Bluetooth connection and the result would be a blip in the spec somewhere such that a pause Bluetooth command would go out or something like that.

I contacted the dealer and asked if there were any updates to MyLink's software and to my surprise there was! I scheduled an appointment and they updated the software. This is a while back. What I got for my troubles is this new problem! (UGH).

I thought the old problem was not there but I had a tasker task that when I disconnected from the car's Bluetooth it would do some things, wait for 15 seconds then say "Have you locked the car". One day I was in my car and decided not to connect the phone to the car and just listen on the headset. Then ever 30-60 seconds or more I'd hear "Have you locked the car". Damn car's Bluetooth is still periodically attempting to connect to my phone! Now I ask you, if the car radio is powered off, what's the purpose of attempting to connect the phone?!? I mean you might think "Well so that if a call comes in you can answer it" but remember - the radio is off. If a call came in you wouldn't even hear it!

The BT Near context uses the scanning period defined at Menu / Preferences / Monitor / BT Scan Time. It could be that the period is adequate for most attempts, but sometimes the scan is too slow to catch your car's BT before the connection is established. You could try adjusting that Scan Time settings to see if a faster scan would work better - just keep in mind that more frequent scans will use more battery.

Alas, BTDT already. I have it set to the lowest number - 25. The behavior I described happens even at 25.

Another option may be to store the GPS location when you disconnect from your car so that Tasker will know where it is, and then use a Location context to trigger your BT profile instead of the BT Near state. Let me know if you need more information on how to make that work. :)

This would require that I store the GPS location of where I disconnect from the car at every place that I park. I don't want this "Bluetooth handoff" as I think of it, to happen only when I approach the car from home or work, but where ever I parked. If I could remember to mark the location of where I parked every time then surely I could remember to simply turn off my headset whenever I approach the car.

I could possibly add to my Leave Car task to set the location of where I parked however I don't think that Tasker offers that option - does it?

According to http://androidforums.com/tasker/141304-tasker-save-gps-location.html this seems to be problematic at best. For one, I would need to change the profile to say "activate this profile when you get near this new GPS location" and I don't think that Tasker allows you to activate on a dynamically changing GPS setting.
 
Upvote 0
I'm afraid I can't help with the core Bluetooth issues - different car, different head unit, no headset to test with, etc. But I think I can help with this:

I could possibly add to my Leave Car task to set the location of where I parked however I don't think that Tasker offers that option - does it?

According to http://androidforums.com/tasker/141304-tasker-save-gps-location.html this seems to be problematic at best. For one, I would need to change the profile to say "activate this profile when you get near this new GPS location" and I don't think that Tasker allows you to activate on a dynamically changing GPS setting.

You should be able to extract some useful bits from this profile example: http://tasker.wikidot.com/car-parking-timer-and-find-car

Particularly these bits:

4 Clear variable %PARKED (which will hold the car's parked location)
5 Get GPS location with 240 second timeout
6 Set variable %PARKED to %LOC (GPS location)
7 Set variable %PARKED to %LOCN (Network location) if variable %PARKED is not set (i.e. GPS did not get a fix)

I'd add those steps into an Exit Task for when your phone disconnects from your car's Bluetooth, which will then store that location. I think you should then be able to use a Location-based context against the %PARKED variable.

I think. It's been a while since I've played with that :D
 
Upvote 0
AFAICT this won't work. When creating a new profile Tasker shows me a map and tells me to select a location. There is no place to put in %PARKED as the location.

Whoops, you are absolutely correct! Sorry about that - that's what I get for trying to go from memory. :D

I'm going to do some testing and tinkering and see if I can come up with a solution. My gut says that I've come across a way to do it (possibly with a plugin), I just need to fumble around a bit to remember it.



I think it should be possible using this plugin: https://play.google.com/store/apps/details?id=com.joaomgcd.autolocation

Still tinkering... I'll let you know if I come up with any brilliant ideas.
 
Upvote 0
I'd really appreciate it.

I think the problem lies in the fact that Tasker's polling every 25 seconds and my car seems to be sending out a beacon ever 30 - 60 seconds (at some indeterminate time. I tried timing it and came up with 32 secs, 45 secs, 65 secs, 30 secs, etc. IOW there was no pattern really). The two polling times do not intersect often. That coupled with when the car actually attempts to connect the media to the phone. If that happens before the 25 second BT near poll of Tasker then I'm hosed.

I've noticed that I seem to have less problems if my headset does not connect to the phone audio Bluetooth profile but only the media audio Bluetooth profile. Of course this means when I'm out and about listening to the headset and a phone call comes in that I cannot answer it with my headset.

BTW, why is there no "Bluetooth connect <this profile>" task in tasker? Actually Secure Settings is what I use to do BT Connection. But BT Connection seems to be all Bluetooth profiles or none of them. I cannot, for example, say "connect my headset's Bluetooth media audio to the phone and connect my car's Bluetooth to the phone's audio profile".
 
Upvote 0
I'm afraid I'm striking out - probably just because I've never played enough with AutoLocation. Maybe one of our other Tasker gurus will pop in and be able to provide some help with either the location bit or the Bluetooth stuff. It's just sadly beyond my realm of expertise. :thumbup:

I did find this thread on the Tasker support board, but I don't know if it will actually be at all helpful.
 
Upvote 0
So far I've been using A2DP Volume from the play store (https://play.google.com/store/apps/details?id=a2dp.Vol) and it seems to be working! Note there's another version of this that is a Tasker plugin but the app itself has several nice options. I have it set for the car as:

. Capture location on disconnect
. DIconnect WIFI when bluetooth connects
. Enable Reading Text Messages
. Delay for 3 seconds before reading text through music stream
. Set media volume on connect (to full on)
. Automatically remember last used media volume on disconnect
. Set in-call phone volume on connect (to full on).
. Launch car mode
 
  • Like
Reactions: codesplice
Upvote 0
So far I've been using A2DP Volume from the play store (https://play.google.com/store/apps/details?id=a2dp.Vol) and it seems to be working! Note there's another version of this that is a Tasker plugin but the app itself has several nice options. I have it set for the car as:

. Capture location on disconnect
. DIconnect WIFI when bluetooth connects
. Enable Reading Text Messages
. Delay for 3 seconds before reading text through music stream
. Set media volume on connect (to full on)
. Automatically remember last used media volume on disconnect
. Set in-call phone volume on connect (to full on).
. Launch car mode

Does the reading of texts play over the car speakers? I have Agent installed (https://play.google.com/store/apps/details?id=com.tryagent) but when it read a text for me on the drive home today it was via the phone speakers. This was even though the music and navigation was steaming the audio to the car speakers
 
Upvote 0
I used to use Agent. Now other things do what Agent used to do. IIRC texts are read aloud through my car speakers but quite frankly 1) I don't get many texts and 2) I have several apps and OSes that all say they will read texts aloud. I'm on a Galaxy Note 3 and they have some settings under Hands Free Mode. I also have BT Reader+ as well as A2DP Volume. Sometimes I hear things read multiple times. I haven't totally straightened this out yet but I do believe that it's actually A2DP Volume that is reading out texts to my car stereo speakers (if I'm connected to the car's bluetooth that is).

If you are using A2DP Volume, check that your car's bluetooth has Music Stream toggled on as a path for the text message sound to travel.
 
  • Like
Reactions: codesplice
Upvote 0
I don't have a solution but I do have a question. A little history, I just bought Tasker and Secure settings, I'm not a programmer but have some time on my hands. I think this whole idea is fascinating but after reading some of the tutorials I believe I'm in for a world of hurt. But what the heck..
My wish is to have my BT turn on when I turn my car on. I have a Uconnect system, rather new, and if my BT is on on the phone then it will auto connect to the car system. I set up a little profile, not quite sure how I did it but I tinkered, where when the phone doesn't see an active connection then it will turn off BT on the phone after a minute. But now when I turn the car back on I have to manually go to settings and turn BT back on for it to connect again. I guess I could make the timeout greater, say an hour or so, but that kind of defeats the purpose. I'm not asking or wishing for anyone to make a profile but to lead me in the direction of learning how to do this. The current tutorials are very sparse atm and they assume you know wtf you're doing with variables and extents. Anyway thanks for reading and any help is appreciated.
 
Upvote 0
I don't have a solution but I do have a question. A little history, I just bought Tasker and Secure settings, I'm not a programmer but have some time on my hands. I think this whole idea is fascinating but after reading some of the tutorials I believe I'm in for a world of hurt. But what the heck..
My wish is to have my BT turn on when I turn my car on. I have a Uconnect system, rather new, and if my BT is on on the phone then it will auto connect to the car system. I set up a little profile, not quite sure how I did it but I tinkered, where when the phone doesn't see an active connection then it will turn off BT on the phone after a minute. But now when I turn the car back on I have to manually go to settings and turn BT back on for it to connect again. I guess I could make the timeout greater, say an hour or so, but that kind of defeats the purpose. I'm not asking or wishing for anyone to make a profile but to lead me in the direction of learning how to do this. The current tutorials are very sparse atm and they assume you know wtf you're doing with variables and extents. Anyway thanks for reading and any help is appreciated.

Automatically turning on BT so that your phone will connect to the BT in your car is going to be a pretty trick. To be entirely honest, you'll probably end up better off just leaving BT enabled all of the time - the battery drain while it's idle really won't be that much at all, and it would definitely be less drain than having to frequently poll your location to see if you're near where you parked your car last.
 
  • Like
Reactions: bjanow
Upvote 0
Automatically turning on BT so that your phone will connect to the BT in your car is going to be a pretty trick. To be entirely honest, you'll probably end up better off just leaving BT enabled all of the time - the battery drain while it's idle really won't be that much at all, and it would definitely be less drain than having to frequently poll your location to see if you're near where you parked your car last.
Lol, thanks. I had a feeling that might be the correct answer. So back to the drawing board to figure out how to do something else. But curiosity has me here. I wouldn't want to poll GPS for my car. However, when the car radio/BT turns on it looks for a paired device and seeing none it simply says, "no phone connected, hands free system available" I thought there might be a way for the phone to see that this paired device was now active and waiting and turn on BT without me having to go into settings and turn it on manually. I do understand the battery drain is minimal leaving it on and I do turn it off at night to save a percent or two, but I'm just playing to learn. Thanks for the input. I'm determined to figure out this program..
 
Upvote 0
But how will your phone see a BT device if your phone's BT radio isn't turned on? :D
Now that is a point I never thought about. (sometimes I wonder about myself) So, been reading through some stuff, it seems like something needs to trigger BT turning on in the phone. An event I think it's called or event context. So lets say when I leave my home wifi then BT turns on. (yes and stays on. :) Then when I connect to my home wifi BT would turn off. Would that be an exit task? I'm sorry, I understand this is not the noob channel but I'm a little intimidated in asking on some other forums. So I do thank you for your replies. Maybe one day I'll be here helping others as remote as that seems right now.
 
  • Like
Reactions: codesplice
Upvote 0
Now that is a point I never thought about. (sometimes I wonder about myself) So, been reading through some stuff, it seems like something needs to trigger BT turning on in the phone. An event I think it's called or event context. So lets say when I leave my home wifi then BT turns on. (yes and stays on. :) Then when I connect to my home wifi BT would turn off. Would that be an exit task? I'm sorry, I understand this is not the noob channel but I'm a little intimidated in asking on some other forums. So I do thank you for your replies. Maybe one day I'll be here helping others as remote as that seems right now.

Yep, you've got it! In Tasker-speak, a context is a condition tested to see if a Task should run. That context can be an Event (a one-time thing, like "SMS Received"), a State (an on-going condition, like "Bluetooth Connected"), a Time/Date, a running Application, etc. Events can't have an exit task, since they just fire once anyway. A State, though, can. So you could have a profile with a State context for "Wifi Connected: HomeSSID", with an Exit Task that would turn on Bluetooth once you leave. :thumbsupdroid:
 
  • Like
Reactions: bjanow
Upvote 0
Yep, you've got it! In Tasker-speak, a context is a condition tested to see if a Task should run. That context can be an Event (a one-time thing, like "SMS Received"), a State (an on-going condition, like "Bluetooth Connected"), a Time/Date, a running Application, etc. Events can't have an exit task, since they just fire once anyway. A State, though, can. So you could have a profile with a State context for "Wifi Connected: HomeSSID", with an Exit Task that would turn on Bluetooth once you leave. :thumbsupdroid:
Excellent, thank you so much. That makes it clearer. Now off to play some more. I'll get it figured out, I do like doing this on my own rather than simply copying a script and importing it. Great start, thanks again.

edit: Haha, I got it. So when I connect to home wifi BT turns off and when it disconnects BT on. Amazing. On my way now. Oh, btw I found a series of tutorials on Youtube I'm going to try out now too. In case anyone wants to check it out here is lesson 1. I think they have a dozen or so. (how do I disable the embedded video? Only want the link if someone clicks it if they want)
 
Last edited:
  • Like
Reactions: codesplice
Upvote 0
Excellent, thank you so much. That makes it clearer. Now off to play some more. I'll get it figured out, I do like doing this on my own rather than simply copying a script and importing it. Great start, thanks again.

edit: Haha, I got it. So when I connect to home wifi BT turns off and when it disconnects BT on. Amazing. On my way now. Oh, btw I found a series of tutorials on Youtube I'm going to try out now too. In case anyone wants to check it out here is lesson 1. I think they have a dozen or so. (how do I disable the embedded video? Only want the link if someone clicks it if they want)
Can we return to my problem, which still hasn't been solved.

Thanks.
 
Upvote 0
I'm sorry, what piece of your problem are you still looking to resolve? I thought you mentioned getting it to with using A2DP Volume.
A2DP Volume is sorta working and sorta not. I also had to do a factory reset after getting locked out of my phone.

Basic problem still remains: Sometimes my Tasker Task for BT Near (or A2DPVolume) fails to notice I am near my car's BT and does not turn off the BT on my headset. When this happens I'm screwed. I think it's basically that the polling time of BT Near (whether used by Tasker or A2DPVolume) cycles in a different amount to the polling time of the car's BT. So when I turn on the car the chances that my phones BT Near scan will happen before my car's BT Scan is iffy at best.

I don't know of a better solution. It'd be wonderful if the ****ing people over at Chevy would fix their bug in the BT driver they are using - then I wouldn't have a problem at all. But the chances of auto mechanics at a dealership knowing what do to about a BT software driver is next to nil!

I have other problems with this too in that often something in Tasker triggers the exit task I have for In Car (i.e. when the car's BT is near) and my phone thinks it's just left the car. Of course it didn't as I'm still in the car, it's still in the car and we're still driving. When this happens the car's BT disconnects and I have to go through a number of contortions to get the car's BT connected again (Let's see, toggle off BT, toggle it back on, tell it to connect to the car. Then the Location Settings for Google Maps gets set to Power Savings and Maps stops working so I have to go into that, toggle on High Accuracy (which for some reason always required two taps) get back to the Navigation screen then press play to get the audio going again. Often the audio just does not want to go through the BT connection and I have to disconnect and reconnect the BT yet again! All of this while driving! This automation is *SUPPOSED* to make driving less distracted but as you can see above it is way *MORE* distracting.

And Tasker constantly screws up with other things too. For example, I have a profile "At Work". It's keyed off of a map. So theoretically when I leave work the Leave Work task is performed which helps me clock out of work (I'm a contractor and get paid by the hour). Sometimes this profile does not fire until I get home - MILES AWAY! Now why does that happen?

Tasker seems very flakey when it comes to BT Near and even Map location profiles and the like. I have a few profiles that execute tasks that turn off my password like when I'm at home or in my car. I experience many times when the In Car profile is activated and the task is run, but the turning off of the password never happens (my Safe Place task). I have no idea why it didn't work.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones