FORUMS
Remove All Ads from XDA

Set Bluetooth off if no device connected (after an interval)

60 posts
Thanks Meter: 6
 
By g0d0fmischief, Member on 8th September 2017, 01:05 AM
Post Reply Email Thread
This would seem to have been an extremely simple thing and i've even found a place on the wiki where it had a downloadable profile that would do this. The newer versions of Tasker don't allow for import of those profiles it doesn't seem, if it doesn't I am not doing it right. I've made some profiles and tasks to this point, simple stuff, like turn wifi on at home or work, and set display to auto rotate (orientation) for certain apps. I'm still way n00b with tasker. I would like to use tasker to turn off my bluetooth if it goes a period of time without a device connected. Can someone do a noob walk through of how to do this?

Thanks in advance.
The Following User Says Thank You to g0d0fmischief For This Useful Post: [ View ] Gift g0d0fmischief Ad-Free
8th September 2017, 03:20 AM |#2  
ktmom's Avatar
Senior Member
Thanks Meter: 2,344
 
More
Create a profile -> State -> BT Connected (leave everything alone except tic invert)


Create enter task
Task -> Wait (set the delay you want)
Net -> Bluetooth -> Set [Off]


------ edit --------

The above is literally what you asked for. However, assuming the delay is to ensure nothing has connected to BT before shutting it off, you might want to add an IF statement to the final action. Such as:

"%PACTIVE ~ *[Profile name]*

[Profile name] should be replaced with the actual name of this profile. Leave the * in place though.

A final thought is by adding a second context to the profile:

State -> net -> BT status (on)

This profile will be active only when BT is on.
The Following 5 Users Say Thank You to ktmom For This Useful Post: [ View ] Gift ktmom Ad-Free
8th September 2017, 10:33 PM |#3  
niyonsv's Avatar
Senior Member
Thanks Meter: 89
 
More
Hi, I think I did the same thing but it didn't work. The Bluetooth just stays On and doesn't disconnect after 20 seconds. The profile in the Tasker app shows green color after turning on the Blutooth.

Pasting the profile from xml. Can you please check if there's any error?

PHP Code:
<TaskerData sr="" dvi="1" tv="5.0u5m">
    <
Profile sr="prof41" ve="2">
        <
cdate>1504900913492</cdate>
        <
edate>1504902100965</edate>
        <
id>41</id>
        <
mid0>42</mid0>
        <
nme>Bluetooth Auto Off</nme>
        <
State sr="con0" ve="2">
            <
code>3</code>
            <
pin>true</pin>
            <
Str sr="arg0" ve="3"/>
            <
Str sr="arg1" ve="3"/>
        </
State>
        <
State sr="con1" ve="2">
            <
code>2</code>
            <
Int sr="arg0" val="1"/>
        </
State>
    </
Profile>
    <
Task sr="task42">
        <
cdate>1504900934895</cdate>
        <
edate>1504902039267</edate>
        <
id>42</id>
        <
nme>BT Disconnected</nme>
        <
Action sr="act0" ve="7">
            <
code>30</code>
            <
Int sr="arg0" val="0"/>
            <
Int sr="arg1" val="20"/>
            <
Int sr="arg2" val="0"/>
            <
Int sr="arg3" val="0"/>
            <
Int sr="arg4" val="0"/>
        </
Action>
        <
Action sr="act1" ve="7">
            <
code>294</code>
            <
Int sr="arg0" val="0"/>
            <
ConditionList sr="if">
                <
Condition sr="c0" ve="3">
                    <
lhs>%PACTIVE</lhs>
                    <
op>2</op>
                    <
rhs>Bluetooth Auto Off</rhs>
                </
Condition>
            </
ConditionList>
        </
Action>
    </
Task>
</
TaskerData
9th September 2017, 02:04 AM |#4  
ktmom's Avatar
Senior Member
Thanks Meter: 2,344
 
More
How about selecting the profile with a long press, "exporting -> description to clipboard" then pasting that here.
The Following 2 Users Say Thank You to ktmom For This Useful Post: [ View ] Gift ktmom Ad-Free
9th September 2017, 02:44 AM |#5  
g0d0fmischief's Avatar
OP Member
Thanks Meter: 6
 
More
Quote:
Originally Posted by ktmom

Create a profile -> State -> BT Connected (leave everything alone except tic invert)


Create enter task
Task -> Wait (set the delay you want)
Net -> Bluetooth -> Set [Off]


------ edit --------

The above is literally what you asked for. However, assuming the delay is to ensure nothing has connected to BT before shutting it off, you might want to add an IF statement to the final action. Such as:

"%PACTIVE ~ *[Profile name]*

[Profile name] should be replaced with the actual name of this profile. Leave the * in place though.

A final thought is by adding a second context to the profile:

State -> net -> BT status (on)

This profile will be active only when BT is on.

Awesome, I'll give this a shot in just a bit thank you
The Following User Says Thank You to g0d0fmischief For This Useful Post: [ View ] Gift g0d0fmischief Ad-Free
9th September 2017, 05:37 AM |#6  
niyonsv's Avatar
Senior Member
Thanks Meter: 89
 
More
Quote:
Originally Posted by ktmom

How about selecting the profile with a long press, "exporting -> description to clipboard" then pasting that here.

Profile: Bluetooth Auto Off (41)
State: Not BT Connected [ Name:* Address:* ]
State: BT Status [ Statusn ]
Enter: BT Disconnected (42)
A1: Wait [ MS:0 Seconds:20 Minutes:0 Hours:0 Days:0 ]
A2: Bluetooth [ Setff ] If [ %PACTIVE ~ Bluetooth Auto Off ]

Oops, sorry, some texts are converted to emojis.

-----Edit------
Something more; if I manually 'turn off' the Bluetooth, the Tasker automatically 'turns on' it.
The Following 2 Users Say Thank You to niyonsv For This Useful Post: [ View ] Gift niyonsv Ad-Free
9th September 2017, 06:51 AM |#7  
g0d0fmischief's Avatar
OP Member
Thanks Meter: 6
 
More
Quote:
Originally Posted by ktmom

Create a profile -> State -> BT Connected (leave everything alone except tic invert)


Create enter task
Task -> Wait (set the delay you want)
Net -> Bluetooth -> Set [Off]


------ edit --------

The above is literally what you asked for. However, assuming the delay is to ensure nothing has connected to BT before shutting it off, you might want to add an IF statement to the final action. Such as:

"%PACTIVE ~ *[Profile name]*

[Profile name] should be replaced with the actual name of this profile. Leave the * in place though.

A final thought is by adding a second context to the profile:

State -> net -> BT status (on)

This profile will be active only when BT is on.

Without the added contexts you mentioned it just turned the Bluetooth off on a timer, even while it was connected and I was talking on the phone. With the two added contexts it seems to work perfect

Correction, it doesn't work at all now it would seem. Hmm. I'll try to make it again tomorrow.

Edit; yeah I've went through it and tried over and over neither seems to work. Even having ticed invert, it basically just turns it off on a timer. No matter what else. Hmm so close. I can post screen shots of how I've done it if you want to see
The Following User Says Thank You to g0d0fmischief For This Useful Post: [ View ] Gift g0d0fmischief Ad-Free
12th September 2017, 04:32 AM |#8  
letmedanz's Avatar
Senior Member
Flag Bangalore
Thanks Meter: 4,143
 
More
I agree for some reason this seems to have stopped working.
Had this simple profile that would turn off after a few minutes of disconnecting from my car blue tooth.
Was using a variable once connected to specific bt
Perhaps after the update something changed? Weird
The Following User Says Thank You to letmedanz For This Useful Post: [ View ] Gift letmedanz Ad-Free
15th September 2017, 05:44 PM |#9  
Crepusculi's Avatar
Member
Thanks Meter: 5
 
More
From what I can tell, it is the check for the variable %BLUE ~ "on" is what is causing bluetooth to turn back on. FWIW, I tried making a similar profile that would do the same with WiFi, and that's how I discovered the bug. I'm trying to find a way to trigger a different profile based on an event of bluetooth turning on, and then that would turn on the "Main" profile we had before. I'll update if I figure it out.
The Following User Says Thank You to Crepusculi For This Useful Post: [ View ] Gift Crepusculi Ad-Free
15th September 2017, 10:02 PM |#10  
ktmom's Avatar
Senior Member
Thanks Meter: 2,344
 
More
Long press on the profile name then hit the gear icon then deselect "restore settings"
The Following 5 Users Say Thank You to ktmom For This Useful Post: [ View ] Gift ktmom Ad-Free
16th September 2017, 03:24 AM |#11  
Crepusculi's Avatar
Member
Thanks Meter: 5
 
More
Quote:
Originally Posted by ktmom

Long press on the profile name then hit the gear icon then deselect "restore settings"

This worked like a charm!
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes