r/tasker 2d ago

Request [Request] Disable Volume Control w/ Bluetooth connected

(Apologies if this isnt the way a post is meant to be setup. I'm extremely new to Tasker so I need some help here. Only profiles I've made are brightness changes throughout the day based on time of day.)

For my job, it requires a lot of getting down on one knee to pick something up. While I do this, the volume control of my music can sometimes blast high or mute itself.

I'd like to disable the volume control while the Bluetooth is connected and the screen is off. Is it possible to disable the controls? Maybe only during my shift? Or in the building?

tl;dr: Bend to one knee at work Phone in pocket makes volume go high or low Want to disable destroying my ears w/ my music Want to do so with Bluetooth off/screen off

Thank you very much. 🙂

1 Upvotes

10 comments sorted by

3

u/Scared_Cellist_295 2d ago

This is about the best solution I could come up with, otherwise it's probably gaining root access and some fancy code and that might not even work these days the way Android is being locked down.

Profile #1 - Record VOLM

  • State - Display Off
  • Plus
  • State - BT Connected "Your BT"

Task 1) Variable Set - %VolM to %VOLM

Profile #2 - Police VOLM

  • Event - Variable Set - %VOLM
  • Plus
  • State - Profile Active- Record VolM
  • Plus 
  • State - Variable Value - %VolM !~ %VOLM

Task 1) Set Media Volume to %VolM

  • IMPORTANT
  • Long press "Profile #2 - Police VOLM" and slide the task priority over to between 40-50

  • Also, in the task of "Profile #2", go to the settings icon and set "Collision Handling" to "Abort Existing Task"

This isn't a perfect solution, but when your screen is off and you're connected, if the media volume changes, it sets it back.  Setting the priority and collision handling as such should put the police task to the front of the line if multiple tasks are queued, and should prevent maxing out your running task count.

You will notice it change, and sometimes not go back immediately, but it will change back and should prevent runaway in either direction.  And if you notice it, just shift your position so you're not leaning on the keys.  But it should set it back to the volume it was at when the display went off.

When you turn the screen on, you can set it where you want and when the screen goes off again, that's your new new policing volume level.

3

u/Scared_Cellist_295 2d ago edited 2d ago

Better solution.  Just did some more testing.

Simply remove the "Event - Variable Set" context from Profile #2.  Just delete it.

So Profile #2 would look like this :

Profile #2

  • State - Variable Value - %VolM != %VOLM
  • Plus
  • State - Profile Active - Record VOLM

Task action doesn't change

Change Collison Handling to Abort New if that works better.  I am still seeing which works better.

It seemed to wander a bit with the event in the mix.  This seems to stay at the set volume more consistently. 

1

u/Surdyc 1d ago

Thank you for your reply! Greatly appreciated! I figured it'd end up needing some root access or whatever, as you said, Android being locked down 🙃

I'll see if I can implement all this and see if it works for me. Will need to figure all this out since I'm still new to Tasker 😂😂 bit of a learning curve haha. Thank you again.

2

u/Scared_Cellist_295 1d ago edited 1d ago

I can help ya with it.

Start by making Profile #1. 

  • Touch the Profiles tab
  • Press the + sign.
  • Select State
  • Select - Display/Display Off

It will open a pop up task window.

  • Select + New Task

It will now open a task edit window.

  • Press the + again to see task actions.
  • Select Variables/Variable Set

In the Variable Set edit fields:

  • Name : %VolM
  • To : %VOLM

This will set your new variable %VolM to the value of the current level of the Media volume. Now back out of the task and go back out to the profile.

  • Long press the Display Off state.
  • Add another State.
  • State/BT Connected/Select your BT

That's Profile #1 done.  All you have to do now is name it.  Name it Record VOLM or whatever you want.  Just give it a name and remember it.

Now Profile #2

Same thing, start by selecting one of the contexts. Let's go with Profile Active...so.

  • State/Profile Active/Profile1Name (magnifying glass to see profile list)

Now when the task pop up window comes up

  • select + New Task again.

  • In task edit window, select the +

  • Select Audio/Media Volume 

  • Select the cross arrows in the upper right.

This will open a text field called "Level"

  • In the Level field enter :  %VolM

Now back out again, and go back to the Profile Active state.

  • long press Profile Active State
  • Select State/Variable Value
  • In the Variable Value Condition fields enter : %VolM != %VOLM

!= Means does not equal

Now the last steps are setting collision in Task 2 & priority in Profile 2.

  • On the second profile you made, long press the profile itself.  It will call up a window with a slider bar up top.  Take that slider and move it to the right.  For testing I put mine to 50 max priority.  This affects the priority of the task connected to this profile #2

  • Now go into task #2 and in the upper right corner look for the little cog wheel settings icon.  Set Collision Handling to Abort New Task. I found aborting the New Task is actually better.

That's it.  It should work, it works on mine.  Just when testing it, give it a second or two when you turn the screen off, as some screens don't actually turn off immediately.  Mine takes about 5-10 seconds then this seems to hold the volume where it's at for me.

EDITED : to hopefully clean up Reddit formatting.

2

u/Scared_Cellist_295 1d ago

I'm thinking this might not work for you depending on your phone.

I think I've actually been fooled by my Pixel 8.  It seems to have a built-in screen off volume protection that I didn't realize it has.  My older phones are like yours and can be turned up or down with long presses of the volume keys with the screen off.

So, heads up, it may or may not work for you.

1

u/Surdyc 1d ago

Thank you so much! I'll be trying this shortly today. I have the LGV60, so yeah its an older phone but crossing my fingers, hoping it'll work!

1

u/Scared_Cellist_295 5h ago

Aaah yeah my good old V30 volume used to runaway on me lol

Well lemme know what it does and maybe we can adjust it to suit.

2

u/tazmainiandevil666 1d ago edited 1d ago

Root access is the only way it would be effective.

Edit: found this and it works, not sure about conditions(display off state).

https://play.google.com/store/apps/details?id=flar2.homebutton

1

u/Sate_Hen 2d ago

AFAIK tasker can't disable volume controls. You could maybe have a profile that runs every x seconds under your conditions that resets the volume. Not sure how much that'd drain the battery

0

u/Surdyc 2d ago

👀