Automatic BT switch on

633 views
Skip to first unread message

Dario Piantanida

unread,
Jan 31, 2012, 5:11:12 AM1/31/12
to tas...@googlegroups.com
Hello!

I usually keep my BT off and always forget to turn it on when I use my BT equipped car.

Can you suggest how to make tasker test whether a particuarl BT device is in range (my car) and keep BT on, otherwise turn it off?
I think a test every 5 minutes could be good.

And I would like to add conditions such as "in week ends".

Thank you!!!

Dario

Pent

unread,
Jan 31, 2012, 5:49:56 AM1/31/12
to Tasker
> Can you suggest how to make tasker test whether a particuarl BT device is
> in range (my car) and keep BT on, otherwise turn it off?

Does Android auto-connect to the car when BT is on ?

Pent

Dario Piantanida

unread,
Jan 31, 2012, 6:16:08 AM1/31/12
to tas...@googlegroups.com
Yes: if the BT is on, it automatically connects to the car

Pent

unread,
Jan 31, 2012, 7:06:29 AM1/31/12
to Tasker
> Can you suggest how to make tasker test whether a particuarl BT device is
> in range (my car) and keep BT on, otherwise turn it off?
> I think a test every 5 minutes could be good.

Try:

Profile: Connected
State: BT Connected
Enter Task: Variable Set, %Connected, 1
Exit Task:
Variable Clear, %Connected
BT Off

Profile: ConnectionCheck
Time: From: 09:00 To: 17.00 Repeat: 5 Mins
Day: Saturday, Sunday
BT On
Wait 30 Seconds
BT Off If [ %Connected Isn't Set ]

Untested.

Pent

Dario Piantanida

unread,
Jan 31, 2012, 9:23:13 AM1/31/12
to tas...@googlegroups.com
 I see.

I'm going to try.

Thank you

Adamx

unread,
Jan 31, 2012, 10:57:39 AM1/31/12
to tas...@googlegroups.com
I went another approach which seems to work fine for me.

Profile: Display On
Event: Display On
Enter Task: 
  Bluetooth On
  Wait 3 minutes
  Bluetooth Off If %PACTIVE !~ *,Driving,*

Profile: Driving
State: Bluetooth Connected
State: Power Any
Enter Task: 
  Car Mode On
  etc, etc

Dario Piantanida

unread,
Jan 31, 2012, 11:05:20 AM1/31/12
to tas...@googlegroups.com
I'm not sure where the difference is.

You substituted variable evaluation with profile evaluation, right? Anything else?

Tnx

Adamx

unread,
Jan 31, 2012, 12:55:43 PM1/31/12
to tas...@googlegroups.com
That, and instead of turning bluetooth on periodically between certain times, I do it when I turn the screen on. That way it will connect no matter what time of day I'm driving. 

J.

unread,
Jan 31, 2012, 2:31:01 PM1/31/12
to Tasker
Both doing it Pent's way e.g. turning on BT every 5 minutes throughout
the day, or doing it this way e.g. turning it on every time the
display turns on, seem like HUGE battery draining methods either way
honestly. I don't think there is really an efficient way of doing
this. I have tons of complex profiles set up, but for this one, I
just use a BT toggle widget to turn on BT that can be activated from
my lock screen. It takes all of 2 seconds OTW to the car. Of course,
I have auto BT off set up via Tasker once I leave the car, but unless
we have something like a BT near, this is the best we have I think.
The caveat is that BT scanning or a device to connect to is extremely
power hungry......

Kevin Taylor

unread,
Jan 31, 2012, 3:54:26 PM1/31/12
to tas...@googlegroups.com
> unless we have something like a BT near

A bit difficult to do without actually turning BT on.

You can save the battery a bit by adding a time context for when you are likely to be near the car.

Kevin

Kevin Taylor

unread,
Jan 31, 2012, 4:45:32 PM1/31/12
to tas...@googlegroups.com
I find that BT is not that much of a drain.
I leave mine on all day, and today after 16 hours the battery level is still 85%.
WiFi on the other hand is worth disabling based on a Cell Near context.

Kevin

J.

unread,
Jan 31, 2012, 9:54:16 PM1/31/12
to Tasker
Yeah of course BT would have to toggle on for BT near to work. Man 16
hours?! I can't get 16 hours without charging and that's with pretty
aggressive power management via tasker and green power! What kind of
phone do you have?

Kevin Taylor

unread,
Feb 1, 2012, 2:42:33 AM2/1/12
to tas...@googlegroups.com
> What kind of phone do you have?

HTC Desire S.

Kevin

J.

unread,
Feb 1, 2012, 9:20:55 AM2/1/12
to Tasker
Man I was so sure you did NOT have a Sense device, since Sense is such
a resource hog. I have an HTC Incredible 2 so that blows my theory
out of the water. Battery life is pretty bad on mine; the wakelocks
are typically from Slacker, Cubed Music Player, or Tasker (to a lesser
degree)...

Adamx

unread,
Feb 1, 2012, 10:33:13 AM2/1/12
to tas...@googlegroups.com
> What kind of phone do you have?

HTC Desire S.

With a car battery attached to it? How are you getting  16 hours for just 15% of your battery? 

I've not had a smartphone battery last much longer than between when I wake up in the morning and go to bed at night, and often much less.

Kevin Taylor

unread,
Feb 1, 2012, 12:22:53 PM2/1/12
to tas...@googlegroups.com
> How are you getting  16 hours for just 15% of your battery?

Nothing special. These phones are supposed to give 390 hours on standby.
I turn off all automatic application updates and update only via WiFi.
I sync two Gmail accounts.
I'm using Launcher Pro, so HTC Sense sync can be turned off.
Most other syncs are set to "when application opened" only.
WiFi is turned on by Tasker only when Cell Near says I am at work or at home.
Bluetooth is on 24hrs, but as I said, BT is a low-power technology and doesn't take much when not connected.
Tasker turns off my display when the proximity sensor indicates the phone is in my pocket.
(This profile is enabled only when Launcher Pro is the foreground app, so it doesn't turn off during a call)
GPS is generally kept off.
If I'm using GPS (rare, so not counted in my 15% for 16 hrs) I'm usually in the car so I can use an external power source. (yes, the car battery!)

Kevin

Dario Piantanida

unread,
Feb 3, 2012, 3:41:04 AM2/3/12
to tas...@googlegroups.com
Here I am, sorry for delay...

The way you proposed assumes you remember to turn display on when you get in your car, right?
In this case I might also remember to turn BT on! :)

I was wondering: instead of creating an "empty" profile, isn't it possible to test on STATE on exit action conditions?
It could be: turn BT Off it NOT BT connected...

Dave Disser

unread,
Feb 6, 2012, 4:45:37 PM2/6/12
to Tasker
I dealt with this problem by turning on Bluetooth whenever I
disconnect from my home or work Wi-Fi networks (since I'm using
leaving one or the other in my car). I also turn on BT automatically
whenever a call comes in. In any case, I also use a timeout so that
BT will be turned off automatically in two minutes if I don't connect
to anything. The actual implementation is a little complicated
because I use some variables to interact with other profiles:

1. I have two variables, %NEARHOME and %NEARWORK, which I set based on
Cell Near (for lowest power usage).
2. On Variable Set event for either of those, I turn on Wi-Fi
3. When connected to my home or work access points, I set %ATHOME or
%ATWORK (cleared when not connected).
4. On Variable Cleared for %ATHOME or %ATWORK (ie. I disconnected from
the Wi-Fi), I turn on Bluetooth, because odds are that I'm leaving
home or work in my car.
5. My "turn on bluetooth" action sets %BTTIMEOUT = %TIMES + 120.
6. I have another "watchdog" action that checks if BT is not connected
and %BTTIMEOUT is set and %TIMES > %BTTIMEOUT, then turn off bluetooth
and clear %BTTIMEOUT. If BT is connected, then reset %BTTIMEOUT to
%TIMES + 120.

--Dave

On Jan 31, 2:11 am, Dario Piantanida <dario.piantan...@gmail.com>
wrote:

Dario Piantanida

unread,
Feb 7, 2012, 2:57:42 AM2/7/12
to tas...@googlegroups.com
Wow!! Are you sure there's no simpler way?

Anyway, I tried something based on location, too, but I ended up with my BT disconnecting upon arriving home, even during calls!

Kaz

unread,
Feb 6, 2012, 8:02:32 PM2/6/12
to Tasker
Correct me if I'm wrong, but I don't think leaving Bluetooth on drains
battery as much as you think it does. (I'm talking about when BT is
idle with no connection) I tried to solve this problem when I first
discovered tasker, and mucked around with a few solutions, but then
realized simply leaving BT on was much simpler and didn't come with
the battery hit I has anticipated. Try it out and monitor your battery
usage.

On Jan 31, 2:11 am, Dario Piantanida <dario.piantan...@gmail.com>
wrote:

Dario Piantanida

unread,
Feb 7, 2012, 4:00:29 AM2/7/12
to tas...@googlegroups.com
It may be, but I still don't want my BT to be reachable when not needed: I may be paranoid, but I fear BT attacks or similar...

Kevin Taylor

unread,
Feb 7, 2012, 7:18:31 AM2/7/12
to tas...@googlegroups.com
> I may be paranoid, but I fear BT attacks

Settings/Wireless & networks/Bluetooth settings/Discoverable : untick if ticked.

On my phone this defaults to off, and if I turn it on it turns itself off after 2 minutes.

Kevin

Dario Piantanida

unread,
Feb 7, 2012, 7:40:33 AM2/7/12
to tas...@googlegroups.com
Sure, but I think there could be some exploit for undiscoverable BT devices too.
Same as WiFi network that do not broadcast SSID

V Oz

unread,
Feb 7, 2012, 7:55:05 AM2/7/12
to tas...@googlegroups.com
I think You should more accurate analyze the way You get in the car. Step by step.
If You can get in anytime and randomly, then periodic BT toggle while You're walker is for You.
If You first get the parking and put the phone to the cradle - solution is obvious.

Dario Piantanida

unread,
Feb 7, 2012, 8:13:12 AM2/7/12
to tas...@googlegroups.com
I'm not sure I'm getting the "while You're walker" part... ;-)

I use the BT equipped car in weekends, so I put this "filter" in the profile and I don't have any cradle; sometimes I connect it to the USB port for charging, but not always.

V Oz

unread,
Feb 7, 2012, 8:38:48 AM2/7/12
to tas...@googlegroups.com
walker ... it's when You're going by walk :-D

Why much people doing things with Tasker like with AutomateIt? Tasker is much clever due variables. Using FSM (finite state machine) approach we can get any task to be solved.

While I'm home, I'm - "brownie".  So, if I going outdoor, then I'm walker. If I get the car - I'm driver and so on.
In my case leaving home wifi area is the sign to become walker (my wifi works on 0 dBm tx-power mode)
When I reach car parking I prepare to become driver. Usually, I driving with phone in cradle + power (video registration+mp3+navigation). If I leave the car for a minute, I waiting for back to the car. If I get destination and leave the car, I become walker again.

So, in Your case, while You're walker or near car parking, You can toggle BT periodically (Pent's suggestion)
About BT safety. BT dongle can establish more then one connection simultaneously. While You're connected to the car's BT, any spy can read Your e-mails, sms, erase pictures and make twits from Your name :-D Booo

Dario Piantanida

unread,
Feb 7, 2012, 9:02:33 AM2/7/12
to tas...@googlegroups.com
The problem is the conditions you use to set variables...

At the moment I haven't find the right combination that determines when I need BT on, so I'll keep time based rule for the moment.

I hope nobody can turn off my engine through BT! :)

V Oz

unread,
Feb 7, 2012, 9:14:13 AM2/7/12
to tas...@googlegroups.com
I hope nobody can turn off my engine through BT! :)
who knows how it works in Your car. Did You study Your car electric scheme? I did. But I haven't BT in my one. 

They can loudly ask You "How are You doing, Dario?" while You are drifting :)

OK. don't worry, be happy. look for the ONE right combination.

Dario Piantanida

unread,
Feb 7, 2012, 9:23:47 AM2/7/12
to tas...@googlegroups.com
I could send a nice video in reply... :)

Dave Disser

unread,
Feb 7, 2012, 10:15:14 AM2/7/12
to Tasker
I'm sure there's a simpler way, but like I said it's complicated
because I use those variables for other profiles as well.
Essentially, I'm just turning on BT when I disconnect from Wi-Fi.
Also, my "turn off bluetooth" action only turns off BT only when there
is not BT connection for a couple minutes, so I'm guaranteed not to
lose BT in mid-call.

--Dave

On Feb 6, 11:57 pm, Dario Piantanida <dario.piantan...@gmail.com>
wrote:

Dario Piantanida

unread,
Feb 7, 2012, 11:04:08 AM2/7/12
to tas...@googlegroups.com
Right, I could add a cell near check + BT not connected so I can turn BT on when I get far from home and don't turn it off during a call...

Kaz

unread,
Feb 7, 2012, 12:29:23 PM2/7/12
to Tasker
A little OT but what I think would be great is if we had super cheap
RFID or NFC "stickers" that we could tag and place everywhere for
tasker to pickup as a context. (the car being a great example) The
hardware would have to support it of course but the new nexus has NFC
already. Anyone have any idea when we can expect to start playing with
something like this?

On Feb 7, 5:13 am, Dario Piantanida <dario.piantan...@gmail.com>
wrote:

Max Hodgson

unread,
Feb 7, 2012, 12:36:16 PM2/7/12
to tas...@googlegroups.com
On 7 February 2012 17:29, Kaz <kaza...@gmail.com> wrote:
> A little OT but what I think would be great is if we had super cheap
> RFID or NFC "stickers" that we could tag and place everywhere for
> tasker to pickup as a context. (the car being a great example) The
> hardware would have to support it of course but the new nexus has NFC
> already. Anyone have any idea when we can expect to start playing with
> something like this?


What you mean like this:

http://forum.xda-developers.com/showthread.php?t=1359057

Kaz

unread,
Feb 7, 2012, 12:39:55 PM2/7/12
to Tasker
So to answer the actual question, I don't think battery consumption is
an issue, therefore Pent's solution should work for you.

On Feb 7, 5:13 am, Dario Piantanida <dario.piantan...@gmail.com>
wrote:

Kaz

unread,
Feb 7, 2012, 6:57:04 PM2/7/12
to Tasker
Nice! Yeah exactly what I was talking about. Only problem with NFC is
you have to be so close for activation.. Wouldn't quite work if I had
my phone in my pocket when I drive in the car. </first world problems>
Still, very cool technology.

On Feb 7, 9:36 am, Max Hodgson <m...@mjhodgson.com> wrote:

justsoso8

unread,
Feb 7, 2012, 8:25:54 PM2/7/12
to Tasker
I have the similar solution with yours.

my issue is:
1. the wifi will sleep itself when screen turns off. It means every
time when I turn my screen on, it starts from wifi-disconnected, turns
the BT on, and then moves to wifi-connected, turns BT off again. It's
not big problme if the action is only BT toggling. But I need to do
many settings according to wifi status, it takes much time to get the
right wifi-connected setting each time when I turn on the screen.

2. More serious, I'm not sure if it happens at your side. When screen
is off, tasker is idle too, means it can not detect wifi disconnect
event. So even if I leave my home, the phone can not start the wifi-
disconnected task immeditally, until I turn on the scrren, or maybe
leave the cell area. but it has been long time since i start the car,
and the BT scan of car has been stopped then, so I lost the chance to
connect with my car.

Dave Disser

unread,
Feb 8, 2012, 10:45:55 AM2/8/12
to tas...@googlegroups.com
The default on my phone (and recommended for most phones) is disable wifi sleep to improve battery life.

My car's handsfree continuously scans for the phone.  My (separate) bluetooth stereo link does not, so I have a Tasker profile to bring up BT settings if handsfree is linked but stereo is not.

However, I am trying having BT on full time as an experiment, since some people suggested it doesn't drain the battery that much.

--Dave

Dario Piantanida

unread,
Feb 9, 2012, 2:38:41 AM2/9/12
to tas...@googlegroups.com
Disable wifi sleep to improve battery life??

Are you sure?

Dave Disser

unread,
Feb 9, 2012, 10:38:17 AM2/9/12
to tas...@googlegroups.com
Yes, I think the idea is that staying connected takes less power than repeatedly reconnecting.  My phone came that way, and I use the least amount of battery on days when I'm home connected to wifi for long periods of time.

Dario Piantanida

unread,
Feb 9, 2012, 10:46:00 AM2/9/12
to tas...@googlegroups.com
I think it heavily depends on how many reconnections you do every day: if you leave the phone sleeping most time, the wifi switched off should help the battery, IMHO

V Oz

unread,
Feb 10, 2012, 1:27:51 AM2/10/12
to tas...@googlegroups.com
Additionally using Run Shell action with root: iwconfig <iface> -txpower 0(1,4,...,32) may very decrease power consumption of wifi chip.
You can check it with iwlist <iface> -txpower
Message has been deleted

Chiraagt

unread,
Jul 28, 2012, 7:30:09 PM7/28/12
to tas...@googlegroups.com

That's absolutely ace that's exactly what I want and need. However me being a newbie and unable to make these profiles and tasks/commands I would request you to kindly upload your profiles to us on here so we to could enjoy the benefit of your creation. Also please do not forget to mention here and what information we have to manually enter like the cell neartower locations. The Wi-Fi's' ssid. Etc. Would be highly appreciative of you do manage to share this beauty with us too
Reply all
Reply to author
Forward
0 new messages