Automatically disable bluetooth

cska133

Member
Hi,

because the Samung devices does not show bluetooth icon when bluetooth is enabled, i often forget to turn it off. Thats why i was thinking of how to automate the disabling the bluetooth when there is no connected device.
I made this macro, see attached screenshot.

The macro works but i have the problem , that if the bluetooth transfer takes longer than the defined wait time then the macro action executes and bluetooth gets disabled alltough the bluetooth transfer is still running, so the transfer interrupts.
Is there any option to add in the macro so that the bluetooth does not disable untill the transfer is still running and disable only when no connection?

Thanks
 

Attachments

  • Screenshot_20240326-224917_MacroDroid.jpg
    Screenshot_20240326-224917_MacroDroid.jpg
    232.1 KB · Views: 9

Dm114

Well-known member
Hi,

because the Samung devices does not show bluetooth icon when bluetooth is enabled, i often forget to turn it off. Thats why i was thinking of how to automate the disabling the bluetooth when there is no connected device.
I made this macro, see attached screenshot.

The macro works but i have the problem , that if the bluetooth transfer takes longer than the defined wait time then the macro action executes and bluetooth gets disabled alltough the bluetooth transfer is still running, so the transfer interrupts.
Is there any option to add in the macro so that the bluetooth does not disable untill the transfer is still running and disable only when no connection?

Thanks
When trigger Device Disconnected fires there is no more BT connexion with this device so, no more transfer. You even shouldn't need a Wait action.

What kind of transfer are you speaking about?
 

dhj49er

Well-known member
Hi,

because the Samung devices does not show bluetooth icon when bluetooth is enabled, i often forget to turn it off. Thats why i was thinking of how to automate the disabling the bluetooth when there is no connected device.
I made this macro, see attached screenshot.

The macro works but i have the problem , that if the bluetooth transfer takes longer than the defined wait time then the macro action executes and bluetooth gets disabled alltough the bluetooth transfer is still running, so the transfer interrupts.
Is there any option to add in the macro so that the bluetooth does not disable untill the transfer is still running and disable only when no connection?

Thanks
You say the macro works....so what is disconnecting the device in order to generate the trigger?

I agree with @Dm114 that when the trigger fires, any data transfer between the device and your phone is terminated.

So how is the Bluetooth data transfer continuing? Is it to another device?
 

cska133

Member
With bluetooth transfer i mean data trasnfer, i usually transfer fotos/videos or apk files from/to my device.
I also was thinking/hoping that Device disconneted (every bluetooth device) trigger will fire when the bluetooth data transfer finish. But many times it happened that bluetooth gets disabled exactly after the set Wait time, when the data transfer is not finished because it takes longer than the Wait time (I can see this in the log)

My idea with the macro was: i enable bluetooth on my device and the phone. Then i start the data transfer. When finished i disabled the bluetooth on the phone. At this point my device does not have bluetooth connection any more (this is the trigger) , so now the bluetooth on my device disconnect (this is the action). I added the Wait time exactely because of the fact that in some situations the bluetooth gets disabled although the data transfer is still established. So by doing this it is as a time buffer.

@dhj49er
Sorry i dont understand your questions? Please clarify if I have not answered them
 

Dm114

Well-known member
With bluetooth transfer i mean data trasnfer, i usually transfer fotos/videos or apk files from/to my device.
I also was thinking/hoping that Device disconneted (every bluetooth device) trigger will fire when the bluetooth data transfer finish. But many times it happened that bluetooth gets disabled exactly after the set Wait time, when the data transfer is not finished because it takes longer than the Wait time (I can see this in the log)

My idea with the macro was: i enable bluetooth on my device and the phone. Then i start the data transfer. When finished i disabled the bluetooth on the phone. At this point my device does not have bluetooth connection any more (this is the trigger) , so now the bluetooth on my device disconnect (this is the action). I added the Wait time exactely because of the fact that in some situations the bluetooth gets disabled although the data transfer is still established. So by doing this it is as a time buffer.

@dhj49er
Sorry i dont understand your questions? Please clarify if I have not answered them
Sorry but when Device Disconnected trigger fires, it mean that your BT device is not physically connected anymore. So no additional transfer can be done (maybe except a few bytes in the transfer buffer).

The delay you are speaking about could be the delay the transfer app keeps on trying to reconnect before giving up.
 

dhj49er

Well-known member
With bluetooth transfer i mean data trasnfer, i usually transfer fotos/videos or apk files from/to my device.
I also was thinking/hoping that Device disconneted (every bluetooth device) trigger will fire when the bluetooth data transfer finish. But many times it happened that bluetooth gets disabled exactly after the set Wait time, when the data transfer is not finished because it takes longer than the Wait time (I can see this in the log)

My idea with the macro was: i enable bluetooth on my device and the phone. Then i start the data transfer. When finished i disabled the bluetooth on the phone. At this point my device does not have bluetooth connection any more (this is the trigger) , so now the bluetooth on my device disconnect (this is the action). I added the Wait time exactely because of the fact that in some situations the bluetooth gets disabled although the data transfer is still established. So by doing this it is as a time buffer.

@dhj49er
Sorry i dont understand your questions? Please clarify if I have not answered them
Your idea will not work.
It appears that you are
Manually enabling Bluetooth on your phone and device.
Manually starting the Bluetooth data transfer.
Manually disabling Bluetooth on the device.
Using a macro to disable bluetooth.

My suggestion is for you to wait until the data transfer is complete before disabling Bluetooth on the device. In you macro remove the wait action as it's not necessary.
 

cska133

Member
Sorry but when Device Disconnected trigger fires, it mean that your BT device is not physically connected anymore. So no additional transfer can be don
No need for sorry. But still... my Wait time as action is set to 7 min, why BT gets disabled exactely after 7min when i start the BT transfer of a big file ,which takes longer then 7min?


The delay you are speaking about could be the delay the transfer app keeps on trying to reconnect before giving up.
Which delay you mean? The 7min as action? This is set by me.


It appears that you are
Manually enabling Bluetooth on your phone and device.
Manually starting the Bluetooth data transfer.
Manually disabling Bluetooth on the device.
Using a macro to disable bluetooth.
It seems you have not understood me. I try clarifying.
My device is a tablet, where i try disableng BT via Macrodroid. So yes, I do manually enable BT on (1) my tablet and (2) my phone. Yes, manually start BT transfer between. But i manually disable BT only on the phone, and this only after the BT transfer is finished. Now my tablets is coming in the "game". On my tablet i would like to automytically disable BT via MD macro.
My suggestion is for you to wait until the data transfer is complete before disabling Bluetooth on the device
As you can see I manually disable BT after transfer has finished -> this on the second device (phone). On my device (tablet) this should happen automatically via MD macro.

I hope now is more clear
 

dhj49er

Well-known member
To me, it hardly seems worth having the macro on the tablet, as you do everything else manually.

You already manually disable Bluetooth on the phone after the data transfer has ended. Just manually disable Bluetooth on the tablet, to avoid the issue you are having.
 

cska133

Member
You already manually disable Bluetooth on the phone after the data transfer has ended. Just manually disable Bluetooth on the tablet, to avoid the issue you are having
And here is the problem, my wafe always forget to dissble the bluetooth on the tablet and soon the battery is empty again. Because samsung tablet is not showing the BT symbol I also dont notice that BT is on. Thatsway i need the macro. Thank you for your help.

Maybe constrains can help in my case?
 

dhj49er

Well-known member
The following macro should work on your tablet. It includes a fail safe in case you forget to turn off your phones Bluetooth.

Your phone is the specified device and needs to be selected from the drop-down list when creating the macro.

T Bluetooth device connected - your phone
T Bluetooth device disconnected - your phone

A If Trigger fired Bluetooth device connected - your phone
A Wait "X" minutes
A Disable Bluetooth
A Else if Trigger fired Bluetooth device disconnected - your phone
A Disable Bluetooth
A Cancel Macro Actions - this macro

"X" is set to be greater than the longest that data transfer can take eg longest data transfer is 20 minutes, set X to 30 or even 60 to be sure.
 
Last edited:

cska133

Member
Thank you, this might be the missing puzzle part.
In general the trigger connected/disconnected should refer to all bluetooth devices, not only to my phone. So i will change/adapt this in your macro suggestion. Or will this not work for "all devices"?
Further, the action condition ELSE IF is very interesting and important to interupt the X delay and disable the bluetooth ealier and immediately.
I will give a try of it. Thank you

T Bluetooth connected - your phone
T Bluetooth disconnected - your phone
PS
I think you should change here to "Bluetooth device connected/disconnected" because Bluetooth connected/disconnected is refered to the BT on/off toggle on the actual device in use. With "BT device connected/disconnected" you can define to which paired Bluetooth device the trigger is refered (or to all devices in general).
 
Last edited:

cska133

Member
A Else if Trigger fired Bluetooth disconnected - your phone
I can not find "else if" or do you mean simply another IF condition?

Further question:
I had situations that BT was enabled by me or by another app but I had not connected BT to another device. So in this case BT is just enabled but without connection. I would like to add in the macro that if BT is on and no BT device connected, then BT should set to off after 3 min delay. Should this work with the other actions in the macro?
I suppose the trigger must be:
T: bluetooth enabled AND all bluetooth devices disconnected (=no BT device connected).
Right?
What should be the IF-action in this case?
 

dhj49er

Well-known member
I can not find "else if" or do you mean simply another IF condition?

Further question:
I had situations that BT was enabled by me or by another app but I had not connected BT to another device. So in this case BT is just enabled but without connection. I would like to add in the macro that if BT is on and no BT device connected, then BT should set to off after 3 min delay. Should this work with the other actions in the macro?
I suppose the trigger must be:
T: bluetooth enabled AND all bluetooth devices disconnected (=no BT device connected).
Right?
What should be the IF-action in this case?
Get the first macro working before adding a new requirement.

Then you can try adding the new requirement yourself

This is one of the best ways to learn how to use Macrodroid.

Given the number of different questions you have asked, have you purchased or going to purchase the pro version?
 
Top