Search code examples
androidbluetoothtasker

Tasker Turn bluetooth off at time only if not connected


I've made a tasker profile which turns ON my Bluetooth at 0700 and off at 2230. It also turns Bluetooth OFF when Wifi is connected and back on when the wifi disconnects throughout this time period.

What I would now like to make happen is for the Bluetooth to remain ON if it is connected at and beyond 2230 and turn OFF when it disconnects after this time. (i.e if its connected to my car kit in the late evening, I don't want it to turn off at 2230, but turn off when I get out of the car).

My profile for the first paragraph is as follows, but I've no idea how to implement the second paragraph

    Profile > Bluetooth On/Off

    State > Time > From 07:00 Till 22:30
    + 
    State > Not Wifi Connected

    Enter Task > Bluetooth On
    Exit Task > Bluetooth Off

    Task > Bluetooth On > Bluetooth On
    Task > Bluetooth Off > Bluetooth Off

I don't know if this is possible with one profile, but any help would be awesome!

Cheers


Solution

  • Solution:

    A) Create a profile that toggles a variable on Bluetooth connect/ disconnect.

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

    B) Add an If to your task that skips to the end/ends the task if the variable is set.

    Enter Task > Bluetooth On *if %BTConnected is not set*
    

    Source: https://groups.google.com/forum/#!msg/tasker/Q36eZRmFbaE/x9XEwKPwuA4J